#encoding:utf-8
#==============================================================================
# ■ Window_MenuStatus
#------------------------------------------------------------------------------
# 菜单画面中,显示队伍成员状态的窗口
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :pending_index # 保留位置(整队用)
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, window_width, window_height)
@pending_index = -1
refresh
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
Graphics.width
end
#--------------------------------------------------------------------------
# ● 获取窗口的高度
#--------------------------------------------------------------------------
def window_height
Graphics.height - 96
end
#--------------------------------------------------------------------------
# ● 获取项目数
#--------------------------------------------------------------------------
def item_max
$game_party.members.size
end
#--------------------------------------------------------------------------
# ● 获取项目的高度
#--------------------------------------------------------------------------
def item_height
height - standard_padding * 2
end
#--------------------------------------------------------------------------
# ● 获取项目的宽度
#--------------------------------------------------------------------------
def item_width
(width - standard_padding * 2 + spacing) /col_max - spacing
end
#--------------------------------------------------------------------------
# ● 获取行间距的宽度
#--------------------------------------------------------------------------
def spacing
return 0
end
#--------------------------------------------------------------------------
# ● 绘制项目
#--------------------------------------------------------------------------
def show
# 方法体从这里开始
puts "draw_actor_HalfBody(actor, rect.x, rect.y, enabled)"
# 到这里结束
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
#--------------------------------------------------------------------------
# ● 获取列数
#--------------------------------------------------------------------------
def col_max
return 4 #跟据分辨率的不同可以改
end
#--------------------------------------------------------------------------
# ● 获取首列位置
#--------------------------------------------------------------------------
def top_col
ox / (item_width + spacing)
end
#--------------------------------------------------------------------------
# ● 设置首列位置
#--------------------------------------------------------------------------
def top_col=(col)
col = 0 if col < 0
#col = col_max - 1 if col > col_max
self.ox = col * (item_width + spacing)
end
#--------------------------------------------------------------------------
# ● 获取尾列位置
#--------------------------------------------------------------------------
def bottom_col
top_col + col_max - 1
end
#--------------------------------------------------------------------------
# ● 设置尾列位置
#--------------------------------------------------------------------------
def bottom_col=(col)
self.top_col = col - (col_max - 1)
end
#--------------------------------------------------------------------------
# ● 确保光标在画面范围内滚动
#--------------------------------------------------------------------------
def ensure_cursor_visible
self.top_col = index if index < top_col
self.bottom_col = index if index > bottom_col
end
#--------------------------------------------------------------------------
# ● 获取项目的绘制矩形
#--------------------------------------------------------------------------
def item_rect(index)
rect = super
rect.x = index * (item_width + spacing)
rect.y = 0
rect
end
#--------------------------------------------------------------------------
# ● 获取对齐方向
#--------------------------------------------------------------------------
def alignment
return 1
end
#--------------------------------------------------------------------------
# ● 光标向下移动
#--------------------------------------------------------------------------
def cursor_down(wrap = false)
end
#--------------------------------------------------------------------------
# ● 光标向上移动
#--------------------------------------------------------------------------
def cursor_up(wrap = false)
end
#--------------------------------------------------------------------------
# ● 光标移至下一页
#--------------------------------------------------------------------------
def cursor_pagedown
end
#--------------------------------------------------------------------------
# ● 光标移至上一页
#--------------------------------------------------------------------------
def cursor_pageup
end
#--------------------------------------------------------------------------
# ● 计算窗口内容的宽度
#--------------------------------------------------------------------------
def contents_width
(item_width + spacing) * item_max - spacing
end
#--------------------------------------------------------------------------
# ● 计算窗口内容的宽度
#--------------------------------------------------------------------------
def contents_height
item_height
end
end