#==============================================================================
# ■ Window_Mapstatus
#------------------------------------------------------------------------------
# 地图上显示简单状态的窗口
#==============================================================================
class Window_Mapstatus < Window_Base
def initialize
width = 96 + 4 + 124 + standard_padding * 2 #头像宽度+4+HPMP宽度+2倍的间距
height = 96 + standard_padding * 2 #头像宽度+2倍的间距
super(0, Graphics.height - height, width, height)
@actor = $game_party.members #队员列表
@current = 0 #当前显示第一号角色的状态
@old_hp = @actor[@current].hp #记录当前该角色的hp
@old_mp = @actor[@current].mp #记录当前该角色的mp
self.opacity = 160 #透明度
refresh #刷新
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
begin #禁忌方法,解除Bug报错等问题。
contents.clear
actor = @actor[@current]
draw_actor_face(actor, 0, 0)
draw_actor_name(actor, 100, 0)
draw_actor_level(actor, 100, 24)
draw_actor_hp(actor, 100, 48)
draw_actor_mp(actor, 100, 72)
rescue #禁忌方法,解除Bug报错等问题。
end
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
def update
update_actor_status
end
#--------------------------------------------------------------------------
# ● 更新当前HPMP值
#--------------------------------------------------------------------------
def update_actor_status
if @old_hp != @actor[@current].hp || @old_mp != @actor[@current].mp
refresh
@old_hp = @actor[@current].hp #新的HP代入旧的HP
@old_mp = @actor[@current].mp #新的MP代入旧的MP
end
end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# 地图画面
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● 生成所有窗口
#--------------------------------------------------------------------------
alias map_create_all_windows create_all_windows
def create_all_windows
map_create_all_windows
@mapstatus_window = Window_Mapstatus.new
end
end