Window_Command
#============================================
# ¡ Window_Command
#----------------------------------------------
# @ˆê”Ê“I‚ȃRƒ}ƒ“ƒh‘I‘ð‚ðs‚¤ƒEƒBƒ“ƒhƒE‚Å‚·B
#============================================
class Window_Command < Window_Selectable
#------------------------------------------
# œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
# width : ƒEƒBƒ“ƒhƒE‚Ì•
# commands : ƒRƒ}ƒ“ƒh•¶š—ñ‚Ì”z—ñ
#------------------------------------------
def initialize(width, commands)
# ƒRƒ}ƒ“ƒh‚̌”‚©‚çƒEƒBƒ“ƒhƒE‚Ì‚‚³‚ðZo
super(0, 0, width, commands.size * 32 + 32)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
self.index = 0
end
#------------------------------------------
# œ ƒŠƒtƒŒƒbƒVƒ…
#------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#------------------------------------------
# œ €–Ú‚Ì•`‰æ
# index : €–Ú”Ô†
# color : •¶šF
#------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end
#------------------------------------------
# œ €–Ú‚Ì–³Œø‰»
# index : €–Ú”Ô†
#------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
end
# ¡ Window_Command
#----------------------------------------------
# @ˆê”Ê“I‚ȃRƒ}ƒ“ƒh‘I‘ð‚ðs‚¤ƒEƒBƒ“ƒhƒE‚Å‚·B
#============================================
class Window_Command < Window_Selectable
#------------------------------------------
# œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
# width : ƒEƒBƒ“ƒhƒE‚Ì•
# commands : ƒRƒ}ƒ“ƒh•¶š—ñ‚Ì”z—ñ
#------------------------------------------
def initialize(width, commands)
# ƒRƒ}ƒ“ƒh‚̌”‚©‚çƒEƒBƒ“ƒhƒE‚Ì‚‚³‚ðZo
super(0, 0, width, commands.size * 32 + 32)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
self.index = 0
end
#------------------------------------------
# œ ƒŠƒtƒŒƒbƒVƒ…
#------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#------------------------------------------
# œ €–Ú‚Ì•`‰æ
# index : €–Ú”Ô†
# color : •¶šF
#------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end
#------------------------------------------
# œ €–Ú‚Ì–³Œø‰»
# index : €–Ú”Ô†
#------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
end
Publicité