Auteur: Yukihiro matsumoto
#============================================
# ‘ Window_EquipItem
#----------------------------------------------
# @υζΚΕAυΟXΜσβΖΘιACeΜκπ¦·ιEBhEΕ·B
#============================================
class Window_EquipItem < Window_Selectable
#------------------------------------------
# IuWFNgϊ»
# actor : AN^[
# equip_type : υΚ (0`3)
#------------------------------------------
def initialize(actor, equip_type)
super(0, 256, 640, 224)
@actor = actor
@equip_type = equip_type
@column_max = 2
refresh
self.active = false
self.index = -1
end
#------------------------------------------
# ACeΜζΎ
#------------------------------------------
def item
return @data[self.index]
end
#------------------------------------------
# tbV
#------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# υΒΘνπΗΑ
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
@data.push($data_weapons[i])
end
end
end
# υΒΘhοπΗΑ
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1
@data.push($data_armors[i])
end
end
end
end
# σπΗΑ
@data.push(nil)
# rbg}bvπ쬡ASΪπ`ζ
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max-1
draw_item(i)
end
end
#------------------------------------------
# ΪΜ`ζ
# index : ΪΤ
#------------------------------------------
def draw_item(index)
item = @data[index]
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#------------------------------------------
# wveLXgXV
#------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end |
|