RPGVX Ace 스크립트
2016.01.10 09:03

Custom Icon Sheets (커스텀 아이콘 적용 스크립트)

조회 수 470 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
원문출처 :
http://himeworks.com/2013/03/custom-icon-sheets/

직접 만든 아이콘을 사용할 수 있게 해주는 스크립트 입니다.
아래 파란색 처리된 부분에서 사용할 아이템을 지정합니다.
그리고 주석에 를 쓰면 사용가능하죠.



#===============================================================================
Title: Custom Icon Sheets
Author: Hime
Date: Jun 1, 2016
--------------------------------------------------------------------------------
** Change log
Jun 1, 2015
- added patch for yanfly's ace item menu
May 27, 2015
- fixed bug with yanfly's shop options
Jun 13, 2013
- icon width and height is now specified for each sheet individually
Mar 31, 2013
- now correctly draws icons of non-default sizes
Mar 25, 2013
- Initial release
--------------------------------------------------------------------------------
** Terms of Use
* Free to use in non-commercial projects
* Contact me for commercial use
* No real support. The script is provided as-is
* Will do bug fixes, but no compatibility patches
* Features may be requested but no guarantees, especially if it is non-trivial
* Credits to Hime Works in your project
* Preserve this header
--------------------------------------------------------------------------------
** Description

This script allows you to designate which icon sheet you want to draw your
icon from. This allows you to organize your icons so that you don't need
to load one large iconset just to draw one icon.
--------------------------------------------------------------------------------
** Installation

Place this script below Materials and above Main

--------------------------------------------------------------------------------
** Usage

-- Installation --

Place this script below Materials and above Main.

-- Setting up custom icon sheets --

Place any custom icon sheets in your Graphics/System folder.
In the configuration below, add the filenames (without extensions) to the
`Icon_Sheets` array. You must also include the default icon sheet to use,
which is "Iconset"

-- Using custom icon indices --

Now that you have set up your icon sheets, you can begin using them.
In your database, note-tag objects with



Where
`name` is the exact filename of the icon index, without extensions
`index` is the index of the icon in the specified file.

--------------------------------------------------------------------------------
** Compatibility

This script overwrites the following methods:

Window_Base
draw_icon

#===============================================================================
=end
$imported = {} if $imported.nil?
$imported["TH_CustomIconSheets"] = true
#===============================================================================
# ** Configuration
#===============================================================================
module TH
module Custom_Icon_Sheets

# List of icon sheets to load. Case-insensitive.
# All icon sheets must be placed in the System folder
# You must provide the dimensions of the icons as well


Icon_Sheets = {
"Iconset" => [24, 24],
"Weapons_1" => [24, 24],
#"CustomIcons" => [24, 24],
#"LargeIcons" => [65, 65]
}


# The default sheet to use if none is specified
Default_Sheet = "Iconset"

# Note-tag format.
Regex = //i

#===============================================================================
# ** Rest of script
#===============================================================================

#---------------------------------------------------------------------------
# Each sheet starts at a specific icon index.
#---------------------------------------------------------------------------
def self.icon_offsets
@icon_offsets
end
#---------------------------------------------------------------------------
# Load all icon sheets. This script uses a look-up table to map icon
# indices to specific icon sheets.
#---------------------------------------------------------------------------
def self.load_sheets
@icon_offsets = {}
@icon_table = []
icon_count = 0
Icon_Sheets.each {|sheet, (width, height)|
sheet = sheet.downcase
bmp = Cache.system(sheet)

# update the "icon index offset" for the current icon sheet.
# This is used by the look-up table to determine how the icon index
# is offset
@icon_offsets[sheet] = icon_count
@icon_table.push([sheet, icon_count, width, height])

# number of icons per sheet is given by the number of icons per row
# times the number of icons per height, including empty spaces.
icon_count += (bmp.width / width) * (bmp.height / height)
}

# store the icon table in reverse order
@icon_table.reverse!
end

def self.load_icon_sheet(index)
@icon_table.each {|sheet, offset, width, height|
if index >= offset
index -= offset
return Cache.system(sheet), index, width, height
end
}
end
end
end

module RPG
class BaseItem
def icon_sheet
return @icon_sheet unless @icon_sheet.nil?
load_notetag_custom_icon_sheet
return @icon_sheet
end

def load_notetag_custom_icon_sheet
res = self.note.match(TH::Custom_Icon_Sheets::Regex)
if res
@icon_sheet = res[1].downcase
@custom_icon_index = res[2].to_i
else
@icon_sheet = TH::Custom_Icon_Sheets::Default_Sheet.downcase
@custom_icon_index = @icon_index
end
end

alias :th_custom_icon_sheets_icon_index :icon_index
def icon_index
parse_custom_icon_index unless @custom_icon_index_checked
th_custom_icon_sheets_icon_index
end

#---------------------------------------------------------------------------
# Automatically updates the icon index based on the appropriate icon sheet
# to use.
#---------------------------------------------------------------------------
def parse_custom_icon_index
# offset the index as necessary, using the icon sheet to look up the offset
self.icon_index = TH::Custom_Icon_Sheets.icon_offsets[self.icon_sheet] + @custom_icon_index
@custom_icon_index_checked = true
end
end
end

module DataManager

class << self
alias :th_custom_icon_sheets_load_database :load_database
end

#-----------------------------------------------------------------------------
# Prepare the custom icon database
#-----------------------------------------------------------------------------
def self.load_database
th_custom_icon_sheets_load_database
TH::Custom_Icon_Sheets.load_sheets
end
end

class Window_Base < Window

#-----------------------------------------------------------------------------
# Overwrite. Get the appropriate bitmap to draw from.
#-----------------------------------------------------------------------------
def draw_icon(icon_index, x, y, enabled = true)
bitmap, icon_index, icon_width, icon_height = TH::Custom_Icon_Sheets.load_icon_sheet(icon_index)
rect = Rect.new(icon_index % 16 * icon_width, icon_index / 16 * icon_height, icon_width, icon_height)
contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
end
end

#===============================================================================
# Compatibility patches. This script must be placed under the other scripts
#===============================================================================
class CSCA_Window_EncyclopediaInfo < Window_Base
def csca_draw_icon(item)
if item.csca_custom_picture == ""
bitmap, icon_index, icon_width, icon_height = TH::Custom_Icon_Sheets.load_icon_sheet(icon_index)
rect = Rect.new(icon_index % 16 * icon_width, icon_index / 16 * icon_height, icon_width, icon_height)
target = Rect.new(0,0,72,72)
contents.stretch_blt(target, bitmap, rect)
else
bitmap = Bitmap.new("Graphics/Pictures/"+item.csca_custom_picture+".png")
target = Rect.new(0,0,72,72)
contents.stretch_blt(target, bitmap, bitmap.rect, 255)
end
end
end if $imported["CSCA-Encyclopedia"]

#===============================================================================
# Compatibility with Yanfly Ace Shop Options: drawing custom icon in shop
#===============================================================================
class Window_ShopData < Window_Base
def draw_item_image
colour = Color.new(0, 0, 0, translucent_alpha/2)
rect = Rect.new(1, 1, 94, 94)
contents.fill_rect(rect, colour)
if @item.image.nil?

bitmap, icon_index, icon_width, icon_height = TH::Custom_Icon_Sheets.load_icon_sheet(@item.icon_index)
rect = Rect.new(icon_index % 16 * icon_width, icon_index / 16 * icon_height, icon_width, icon_height)
target = Rect.new(0, 0, 96, 96)
contents.stretch_blt(target, bitmap, rect)
else
bitmap = Cache.picture(@item.image)
contents.blt(0, 0, bitmap, bitmap.rect, 255)
end
end
end if $imported["YEA-ShopOptions"]

#===============================================================================
# Compatibility with Yanfly Ace Item Menu: drawing custom icon in item menu
#===============================================================================
class Window_ItemStatus < Window_Base
def draw_item_image
colour = Color.new(0, 0, 0, translucent_alpha/2)
rect = Rect.new(1, 1, 94, 94)
contents.fill_rect(rect, colour)
if @item.image.nil?

bitmap, icon_index, icon_width, icon_height = TH::Custom_Icon_Sheets.load_icon_sheet(@item.icon_index)
rect = Rect.new(icon_index % 16 * icon_width, icon_index / 16 * icon_height, icon_width, icon_height)
target = Rect.new(0, 0, 96, 96)
contents.stretch_blt(target, bitmap, rect)
else
bitmap = Cache.picture(@item.image)
contents.blt(0, 0, bitmap, bitmap.rect, 255)
end
end
end if $imported["YEA-ItemMenu"]

?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수 추천 수
168 RPGMV 플러그인 Kaus Ultimate Overlay v1.03 (강력레이아웃추가! 빛/포그/파노라마/맵) 2 file 파란별빛 2015.11.08 2024 0
167 RPGMV 플러그인 Menu Music MV (메뉴를 열때 음악을 콘트롤 하는 플러그인) 1 파란별빛 2015.11.09 964 0
166 RPGMV 플러그인 Hidden Shop Goods (못사는 물건은 아예 숨겨지게 하는 플러그인) 파란별빛 2015.11.09 1037 0
165 RPGVX Ace 스크립트 파티원 기차처럼 줄줄이 붙는 스크립트. 1 file 천무 2015.11.12 3088 0
164 RPGMV 플러그인 Drain Percentage​​ : Hp/Mp Drain 스킬 타입 백분율 계산 플러그인 2 file MKMV 2015.11.15 3017 0
163 RPGMV 플러그인 엔딩 후 타이틀과 BGM 변경 6 file 러닝은빛 2015.12.21 2302 0
162 RPGMV 플러그인 스크린샷 파일 만들기 2 file 러닝은빛 2015.12.23 2148 0
161 RPGMV 플러그인 발소리 재생 플러그인 6 file 러닝은빛 2015.12.28 1642 0
160 RPGMV 플러그인 Weather EX 날씨 확장 플러그인입니다. 2 BeeBee 2016.01.03 1108 0
159 유니티 스크립트 [C#] 보안 64비트 정수 맛난호빵 2016.01.04 382 0
158 RPGMV 플러그인 Action Sequence Pack 2 (전투모드 액션 플러그인) 2 plam 2016.01.05 1821 0
157 RPGMV 플러그인 MBS - Map Zoom plugin (맵을 확대,축소해주는 플러그인) HT9MAN 2016.01.06 895 0
156 RPGMV 플러그인 Advanced Game Time (게임에 시간개념을 적용해주는 플러그인) 2 plam 2016.01.06 1398 0
155 RPGMV 플러그인 Icon Inventory and Details Window (인벤토리 아이템을 아이콘으로 보이게) plam 2016.01.06 903 0
154 RPGMV 플러그인 Crafting System (아이템 조합 시스템) 3 plam 2016.01.06 1709 0
153 RPGVX Ace 스크립트 Damage Popup by Dargor (데미지 수치 팝업하는 스크립트) plam 2016.01.10 612 0
» RPGVX Ace 스크립트 Custom Icon Sheets (커스텀 아이콘 적용 스크립트) plam 2016.01.10 470 0
151 RPGMV 플러그인 Multiple HUD 6 file 러닝은빛 2016.01.12 2844 1
150 RPGMV 플러그인 전투 도중 멤버교체가 가능해지는 플러그인 2 file Wailer 2016.01.13 1298 0
149 RPGMV 플러그인 Wave Filter 1 러닝은빛 2016.01.14 961 0
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 ... 15 Next
/ 15






[개인정보취급방침] | [이용약관] | [제휴문의] | [후원창구] | [인디사이드연혁]

Copyright © 1999 - 2016 INdiSide.com/(주)씨엘쓰리디 All Rights Reserved.
인디사이드 운영자 : 천무(이지선) | kernys(김원배) | 사신지(김병국)