#encoding:utf-8
#==============================================================================
# ■ Window_Status
#------------------------------------------------------------------------------
# 状态画面中,显示角色基本信息的窗口。
#==============================================================================
class Window_Status < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, Graphics.width, Graphics.height)
@actor = actor
refresh
activate
@data = []
end
#--------------------------------------------------------------------------
# ● 设置角色
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# v1设置技能类型 ID
#--------------------------------------------------------------------------
def stype_id=(stype_id)
return if @stype_id == stype_id
@stype_id = stype_id
refresh
self.oy = 0
end
#--------------------------------------------------------------------------
# v1 获取技能
#--------------------------------------------------------------------------
def item
@data && index >= 0 ? @data[index] : nil
end
#--------------------------------------------------------------------------
# v1 获取选择项目的有效状态
#--------------------------------------------------------------------------
def current_item_enabled?
enable?(@data[index])
end
#--------------------------------------------------------------------------
# v1 查询列表中是否含有此技能
#--------------------------------------------------------------------------
def include?(item)
item && item.stype_id == @stype_id
end
#--------------------------------------------------------------------------
# v1 查询此技能是否可用
#--------------------------------------------------------------------------
def enable?(item)
@actor && @actor.usable?(item)
end
#--------------------------------------------------------------------------
# v1生成技能列表
#--------------------------------------------------------------------------
def make_item_list
@data = @actor ? @actor.skills.select {|skill| include?(skill) } : []
end
#--------------------------------------------------------------------------
# v1 返回上一个选择的位置
#--------------------------------------------------------------------------
def select_last
select(@data.index(@actor.last_skill.object) || 0)
end
#--------------------------------------------------------------------------
# v1绘制项目
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if skill
rect = item_rect(index)
rect.width -= 4
draw_item_name(skill, rect.x, rect.y, enable?(skill))
draw_skill_cost(rect, skill)
end
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_block1 (0)
make_item_list#
draw_all_items#
end