#encoding:utf-8
#==============================================================================
# ■ Window_MenuStatus
#------------------------------------------------------------------------------
# 2015-3-18这段代码只有我和上帝看得懂
# 2015-3-20现在只有上帝看的懂了...
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :pending_index # 保留位置(整队用)
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, window_width, window_height)
@pending_index = -1
self.opacity=0
refresh
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
Graphics.width - 160
end
#--------------------------------------------------------------------------
# ● 获取窗口的高度
#--------------------------------------------------------------------------
def window_height
Graphics.height
end
#--------------------------------------------------------------------------
# ● 获取标准的边距尺寸
#--------------------------------------------------------------------------
def standard_padding
return 20
end
#--------------------------------------------------------------------------
# ● 获取项目数
#--------------------------------------------------------------------------
def item_max
$game_party.members.size
end
#--------------------------------------------------------------------------
# ● 获取项目的高度
#--------------------------------------------------------------------------
def item_height
(height - standard_padding * 2) / 4
end
#--------------------------------------------------------------------------
# ● 获取项目的绘制矩形
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new
rect.width = 300
rect.height = 100
rect.x = index % col_max * (item_width + spacing)
rect.y = index / col_max * item_height
rect
end
#------------------------------------------
# * 肖像对应
#-------------------------------------------
def set_face_respond(symbol,face)
@portrait[symbol]=face
end
#---------------------------------------------
# * 添加肖像对应!
#----------------------------------------------
def new_face_respond
set_face_respond($game_party.member[0],"face_mainhero")
set_face_respond($game_party.member[1],"face_nothero")
end
#---------------------------------------------------------------------------
# *角色肖像绘制
#----------------------------------------------------------------------------
def draw_portrait(x,y,enabled,portrait)
bitmap=Cache.picture(portrait)
rect=Rect.new(0,0,bitmap.width,bitmap.height)
contents.blt(x,y,bitmap,rect,enabled ? 255 : translucent_alpha)
end
#---------------------------------------------------------------------------
# * 原始-角色肖像绘制
#----------------------------------------------------------------------------
#def draw_portrait(x,y,enabled,portrait)
# bitmap=Cache.picture("face_mainhero")
# rect=Rect.new(0,0,bitmap.width,bitmap.height)
# contents.blt(x,y,bitmap,rect,enabled ? 255 : translucent_alpha)
#end
#--------------------------------------------------------------------------
# ● 绘制简单的状态
#--------------------------------------------------------------------------
def draw_actor_simple_status(actor, x, y)
draw_actor_name(actor,x+100,y-line_height)
#draw_actor_level(actor,x+70,y)
#draw_actor_icons(actor,x,y + line_height * 2)
#draw_actor_class(actor,x+150,y)
draw_actor_hp(actor,x, y + line_height * 1)
draw_actor_mp(actor,x ,y + line_height * 2)
end
#--------------------------------------------------------------------------
# ● 绘制项目
#--------------------------------------------------------------------------
def draw_item(index)
actor = $game_party.members[index]
enabled = $game_party.battle_members.include?(actor)
rect = item_rect(index)
draw_item_background(index)
draw_portrait(rect.x,rect.y,enabled,@portrait[$game_party.members[index]])
draw_actor_simple_status(actor, rect.x+100 , rect.y + 25 )
end
#--------------------------------------------------------------------------
# ● 绘制项目的背景
#--------------------------------------------------------------------------
def draw_item_background(index)
if index == @pending_index
contents.fill_rect(item_rect(index), pending_color)
end
end
#--------------------------------------------------------------------------
# ● 按下确定键时的处理
#--------------------------------------------------------------------------
def process_ok
super
$game_party.menu_actor = $game_party.members[index]
end
#--------------------------------------------------------------------------
# ● 返回上一个选择的位置
#--------------------------------------------------------------------------
def select_last
select($game_party.menu_actor.index || 0)
end
#--------------------------------------------------------------------------
# ● 设置保留位置(整队用)
#--------------------------------------------------------------------------
def pending_index=(index)
last_pending_index = @pending_index
@pending_index = index
redraw_item(@pending_index)
redraw_item(last_pending_index)
end
end