#encoding:utf-8
#==============================================================================
# ■ Cache
#------------------------------------------------------------------------------
# 此模块加载所有图像,建立并储存 Bitmap 对象。为加快加载速度并节省内存,
# 此模块将以建立的 bitmap 对象储存在内定哈希表中,使得程序在需要已存在
# 的图像时能快速读取 bitmap 对象。
#==============================================================================
module Cache
#--------------------------------------------------------------------------
# ● 取得角色全身像图
#--------------------------------------------------------------------------
def self.body(filename)
load_bitmap("Graphics/Bodies/", filename)
end
end
#encoding:utf-8
#==============================================================================
# ■ Window_MenuStutasBody
#------------------------------------------------------------------------------
# 选单画面中,显示队伍成员全身像的窗口
#==============================================================================
class Window_MenuStutasBody < Window_Base
#--------------------------------------------------------------------------
# ● 初始化物件
#--------------------------------------------------------------------------
def initialize(actor)
super(x, y, windows_width, windows_height)
@actor = actor
@graphic = Sprite.new(self.viewport)
@graphic.x = 960
@graphic.y = 544
refresh
end
#--------------------------------------------------------------------------
# ● 取得窗口的坐标与大小
#--------------------------------------------------------------------------
def x
return 0 - standard_padding
end
def y
return 0 - standard_padding
end
def windows_width
return Graphics.width + standard_padding * 2
end
def windows_height
return Graphics.height + standard_padding * 2
end
#--------------------------------------------------------------------------
# ● 设定角色
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
@graphic.dispose
super
end
#--------------------------------------------------------------------------
# ● 显示
#--------------------------------------------------------------------------
def refresh
self.contents.clear
name = "Character" + @actor.id.to_s
begin
@graphic.bitmap = Cache.body(name)
@graphic.ox = @graphic.bitmap.width
@graphic.oy = @graphic.bitmap.height
rescue
end
end
end
#encoding:utf-8
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
# 选单画面
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_command_window
create_information_window
create_status_window
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_MenuCommand.new
@command_window.y = 2
@command_window.opacity = 0
@command_window.set_handler(:item, method(:command_item))
@command_window.set_handler(:skill, method(:command_personal))
@command_window.set_handler(:equip, method(:command_personal))
@command_window.set_handler(:status, method(:command_personal))
@command_window.set_handler(:formation, method(:command_formation))
@command_window.set_handler(:save, method(:command_save))
@command_window.set_handler(:game_end, method(:command_game_end))
@command_window.set_handler(:cancel, method(:return_scene))
end
#--------------------------------------------------------------------------
# ● 切换角色
#--------------------------------------------------------------------------
def on_actor_change
@menustutasbody_window.actor = @actor
@menustutasbody_window.activate
end
#--------------------------------------------------------------------------
# ● 生成游戏信息窗口
#--------------------------------------------------------------------------
def create_information_window #
@gold_window = Window_Information.new
@gold_window.x = 0
@gold_window.y = Graphics.height - @gold_window.height - 2
@gold_window.opacity = 0
end #
#--------------------------------------------------------------------------
# ● 生成状态窗口
#--------------------------------------------------------------------------
def create_status_window
@status_window = Window_MenuStatus.new(0, @command_window.height - 2 + 2)
@status_window.opacity = 0
end
#--------------------------------------------------------------------------
# ● 指令“物品”
#--------------------------------------------------------------------------
def command_item
SceneManager.call(Scene_Item)
end
#--------------------------------------------------------------------------
# ● 指令“技能”“装备”“状态”
#--------------------------------------------------------------------------
def command_personal
@status_window.select_last
@menustutasbody_window = Window_MenuStutasBody.new(@actor)
@menustutasbody_window.opacity = 0
@status_window.activate
@menustutasbody_window.activate
@status_window.set_handler(:ok, method(:on_personal_ok))
@status_window.set_handler(:cancel, method(:on_personal_cancel))
end
#--------------------------------------------------------------------------
# ● 指令“整队”
#--------------------------------------------------------------------------
def command_formation
@status_window.select_last
@status_window.activate
@status_window.set_handler(:ok, method(:on_formation_ok))
@status_window.set_handler(:cancel, method(:on_formation_cancel))
end
#--------------------------------------------------------------------------
# ● 指令“存盘”
#--------------------------------------------------------------------------
def command_save
SceneManager.call(Scene_Save)
end
#--------------------------------------------------------------------------
# ● 指令“结束游戏”
#--------------------------------------------------------------------------
def command_game_end
SceneManager.call(Scene_End)
end
#--------------------------------------------------------------------------
# ● 个人指令“确定”
#--------------------------------------------------------------------------
def on_personal_ok
case @command_window.current_symbol
when :skill
SceneManager.call(Scene_Skill)
when :equip
SceneManager.call(Scene_Equip)
when :status
SceneManager.call(Scene_Status)
end
end
#--------------------------------------------------------------------------
# ● 个人指令“取消”
#--------------------------------------------------------------------------
def on_personal_cancel
@status_window.unselect
@command_window.activate
end
#--------------------------------------------------------------------------
# ● 整队“确定”
#--------------------------------------------------------------------------
def on_formation_ok
if @status_window.pending_index >= 0
$game_party.swap_order(@status_window.index,
@status_window.pending_index)
@status_window.pending_index = -1
@status_window.redraw_item(@status_window.index)
else
@status_window.pending_index = @status_window.index
end
@status_window.activate
end
#--------------------------------------------------------------------------
# ● 整队“取消”
#--------------------------------------------------------------------------
def on_formation_cancel
if @status_window.pending_index >= 0
@status_window.pending_index = -1
@status_window.activate
else
@status_window.unselect
@command_window.activate
end
end
end