Project1
标题:
菜单档案
[打印本页]
作者:
子弹君
时间:
2014-9-23 20:57
标题:
菜单档案
#==============================================================================
# 菜单档案 by 子弹君
#==============================================================================
# 说明:
# 在菜单里添加一个档案的选项,将存档、读档、回到标题等选项整合到一个窗口
# (注:要使用此脚本需要将默认菜单里的存档、结束游戏这两项删掉
# 会脚本的人可以自己为档案添加选项。)
#==============================================================================
$BombScript ||= {};$BombScript["菜单档案"] = "菜单档案20140923"
#==============================================================================
# 设定部分
#==============================================================================
module BOMB
module DA
COMMAND = "档案"
# 设置选项的名字
WIDTH = 160
# 设置窗口的宽度
end
end
class Window_MenuCommand
#--------------------------------------------------------------------------
# ● 添加选项
#--------------------------------------------------------------------------
alias bomb20140921_add_original_commands add_original_commands
def add_original_commands
bomb20140921_add_original_commands
add_command(BOMB::DA::COMMAND, :story)
end
end
class Scene_Menu
alias bomb20140921_create_command_window create_command_window
def create_command_window
bomb20140921_create_command_window
@command_window.set_handler(:story, method(:command_story))
end
def command_story
SceneManager.call(Scene_Story)
end
end
class Bomb_Save < Window_Command
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
super(0, 0)
update_placement
self.openness = 0
open
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return BOMB::DA::WIDTH
end
#--------------------------------------------------------------------------
# ● 更新窗口的位置
#--------------------------------------------------------------------------
def update_placement
self.x = (Graphics.width - width) / 2
self.y = (Graphics.height - height) / 2
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def make_command_list
add_command("存档", :save)
add_command("读档", :continue)
add_command("回到标题", :to_title)
add_command("退出游戏", :shutdown)
end
end
class Scene_Story < Scene_End
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
@command_window = Bomb_Save.new
@command_window.set_handler(:save, method(:command_save))
@command_window.set_handler(:continue, method(:command_continue))
@command_window.set_handler(:to_title, method(:command_totitle))
@command_window.set_handler(:shutdown, method(:command_shutdown))
@command_window.set_handler(:cancel, method(:return_scene))
end
#--------------------------------------------------------------------------
# ● 指令“存档”
#--------------------------------------------------------------------------
def command_save
close_command_window
SceneManager.call(Scene_Save)
end
#--------------------------------------------------------------------------
# ● 指令“读取存档”
#--------------------------------------------------------------------------
def command_continue
close_command_window
SceneManager.call(Scene_Load)
end
#--------------------------------------------------------------------------
# ● 指令“回到标题”
#--------------------------------------------------------------------------
def command_totitle
close_command_window
fadeout_all
SceneManager.goto(Scene_Title)
end
#--------------------------------------------------------------------------
# ● 指令“退出”
#--------------------------------------------------------------------------
def command_shutdown
close_command_window
fadeout_all
SceneManager.exit
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1