本帖最后由 魔法丶小肉包 于 2017-3-22 11:33 编辑
稍作修改,楼主可以参考一下
class Window_EquipStatus < Window_Base #-------------------------------------------------------------------------- # ● 初始化对象 #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, window_width, window_height) @actor = nil @temp_actor = nil @hurt = 0 refresh end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh contents.clear draw_actor_name(@actor, 4, 0) if @actor 6.times {|i| draw_item(0, line_height * (1 + i), 2 + i) } draw_current_param2(0,0) if @actor end #-------------------------------------------------------------------------- # ● 绘制總戰力 #-------------------------------------------------------------------------- def draw_current_param2(x, y) @hurt = 0 6.times{|n| @hurt + @actor.param(2 + n) } change_color(system_color) draw_text(x-25, y, self.width, line_height, @hurt.to_s, 2) end end
class Window_EquipStatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, window_width, window_height)
@actor = nil
@temp_actor = nil
@hurt = 0
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_actor_name(@actor, 4, 0) if @actor
6.times {|i| draw_item(0, line_height * (1 + i), 2 + i) }
draw_current_param2(0,0) if @actor
end
#--------------------------------------------------------------------------
# ● 绘制總戰力
#--------------------------------------------------------------------------
def draw_current_param2(x, y)
@hurt = 0
6.times{|n| @hurt + @actor.param(2 + n) }
change_color(system_color)
draw_text(x-25, y, self.width, line_height, @hurt.to_s, 2)
end
end
还有,应该是6.times{|n| @hurt += @actor.param(2 + n) }
6.times{|n| @hurt + @actor.param(2 + n) }的话@hurt永远是0 |