Auteur: Yukihiro matsumoto
#============================================
# ‘ Window_Command
#----------------------------------------------
# @κΚIΘR}hIππs€EBhEΕ·B
#============================================
class Window_Command < Window_Selectable
#------------------------------------------
# IuWFNgϊ»
# width : EBhEΜ
# commands : R}hΆρΜzρ
#------------------------------------------
def initialize(width, commands)
# R}hΜΒ©ηEBhEΜ³π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
#------------------------------------------
# tbV
#------------------------------------------
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 |
|