#==============================================================================
# ■ Window_MenuCommand
#==============================================================================
class Window_MenuCommand < Window_Command
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
super(0, Graphics.height - 72)
select_last
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def make_command_list
add_main_commands
add_game_end_command
end
#--------------------------------------------------------------------------
# ● 向指令列表添加主要的指令
#--------------------------------------------------------------------------
def add_main_commands
add_command(Vocab::item, :item, main_commands_enabled)
end
end
#==============================================================================
# ■ Window_MenuStatus
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● 获取窗口的高度
#--------------------------------------------------------------------------
def window_height
Graphics.height / 3
end
#--------------------------------------------------------------------------
# ● 获取显示行数
#--------------------------------------------------------------------------
def visible_line_number
return 1
end
#--------------------------------------------------------------------------
# ● 获取显示列数
#--------------------------------------------------------------------------
def col_max
return 1
end
#--------------------------------------------------------------------------
# ● 获取项目的高度
#--------------------------------------------------------------------------
def item_height
height - standard_padding * 2
end
#--------------------------------------------------------------------------
# ● 获取项目的高度
#--------------------------------------------------------------------------
def item_height
height - standard_padding * 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_actor_name(actor, rect.x + 4, rect.y + 4, 180)
change_color(system_color)
draw_text(rect.x + 4, rect.y + 30, 72, line_height, "年龄")
change_color(normal_color)
# (↓)这里调整年龄数值的位置
aw = 72 # 宽度 字数太多被挤扁时改这里
ax = rect.x - aw + 126 # 位置X
# (↓)当角色99级时 年龄显示为:你猜 通常不会有人把99岁的长辈尊为主人公吧
if actor.level == 99
draw_text(ax, rect.y + 30, aw, line_height, "你猜", 2)
# (↓)当角色98级时 用2号(可更改)变量来表示年龄
# 如果你打算把99岁的长辈尊为主人公
# 或者你的主人公是个寿星啊精灵啊恶魔啊什么的 可以活到三位数年龄
elsif actor.level == 98 # (↓)变量号
draw_text(ax, rect.y + 30, aw, line_height, $game_variables[2], 2)
# (↓)不满足以上两种情况 以等级的数值表示年龄
else
draw_text(ax, rect.y + 30, aw, line_height, actor.level, 2)
end
end
end
#==============================================================================
# ■ Window_ActorPortrait
#==============================================================================
class Window_ActorPortrait < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize(x, y)
super(-12, -12, Graphics.width + 24, Graphics.height + 24)
self.opacity = 0
refresh
end
#--------------------------------------------------------------------------
# ● 角色
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
return unless @actor
draw_player
end
#--------------------------------------------------------------------------
# ● 绘制角色肖像画
#--------------------------------------------------------------------------
def draw_player
# (↓)这里未调整肖像画位置
px = 20 # 位置X
py = 0 # 位置Y
# (↓)肖像画路径 \Graphics\Pictures
# 文件名为: ActorPortrait + 角色ID 例如20号角色: ActorPortrait20
bitmap = Cache.picture("ActorPortrait" + @actor.id.to_s)
rect = Rect.new(0, 0, bitmap.width, bitmap.height)
contents.blt(contents_width - bitmap.width - px,
contents_height - bitmap.height - py, bitmap, rect)
bitmap.dispose
end
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_portrait_window
create_command_window
create_status_window
end
#--------------------------------------------------------------------------
# ● 生成肖像画窗口
#--------------------------------------------------------------------------
def create_portrait_window
@actorportrait_window = Window_ActorPortrait.new(0, 0)
@actorportrait_window.z = 999 # 优先级 需要肖像画遮住窗口就注释掉这一行
@actorportrait_window.viewport = @viewport
@actorportrait_window.actor = @actor
end
#--------------------------------------------------------------------------
# ● 生成状态窗口
#--------------------------------------------------------------------------
def create_status_window
wy = Graphics.height - Graphics.height / 3
@status_window = Window_MenuStatus.new(@command_window.width, wy)
@status_window.z = 1000 # 优先级 需要肖像画遮住窗口就注释掉这一行
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_MenuCommand.new
@command_window.z = 1000 # 优先级 需要肖像画遮住窗口就注释掉这一行
@command_window.set_handler(:item, method(:command_item))
@command_window.set_handler(:game_end, method(:command_game_end))
@command_window.set_handler(:cancel, method(:return_scene))
end
end