Project1
标题:
菜单选项窗口怎么样增加一个"下一页"?
[打印本页]
作者:
纳尔德
时间:
2011-9-28 17:17
标题:
菜单选项窗口怎么样增加一个"下一页"?
就是
物品
技能
……
下一页
按下 下一页 后
就转到另一个选项窗口。 dsu_plus_rewardpost_czw
作者:
fux2
时间:
2011-9-28 17:58
建立多个WINDOW_COMMAND切来切去啦.
作者:
纳尔德
时间:
2011-9-28 18:01
fux2 发表于 2011-9-28 17:58
建立多个WINDOW_COMMAND切来切去啦.
就是感觉好麻烦的说..有点繁杂了
作者:
各种压力的猫君
时间:
2011-9-28 18:02
丢个范例给你,新建个工程插到main上面
#==============================================================================
# ■ 2PMenu
#------------------------------------------------------------------------------
# 将RMVX默认的菜单扩展到两页的范例
#------------------------------------------------------------------------------
# 1.0 2011-9-28 初版 by 各种压力的猫君
#==============================================================================
module MPMenu_Config
#==============================================================================
# 【设定段】
#------------------------------------------------------------------------------
#第2页的选项文字
AMENU1 = "物品2"
AMENU2 = "技能2"
AMENU3 = "装备2"
AMENU4 = "状态2"
AMENU5 = "其它选项A"
AMENU6 = "其它选项B"
#==============================================================================
end
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# menu_index : 命令窗口光标初始位置
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
$menupage = 1 if $menupage == nil
create_menu_background
create_command_window
@gold_window = Window_Gold.new(0, 360)
@status_window = Window_MenuStatus.new(160, 0)
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@command_window.dispose
@gold_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# ● 翻页处理
#--------------------------------------------------------------------------
def turnpage
dispose_menu_background
@command_window.dispose
create_menu_background
create_command_window
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
update_menu_background
@command_window.update
@gold_window.update
@status_window.update
if @command_window.active
update_command_selection
elsif @status_window.active
update_actor_selection
end
end
#--------------------------------------------------------------------------
# ● 生成命令窗口
#--------------------------------------------------------------------------
def create_command_window
if $menupage == 1
s1 = Vocab::item
s2 = Vocab::skill
s3 = Vocab::equip
s4 = Vocab::status
s5 = Vocab::save
s6 = Vocab::game_end
s7 = "下一页"
elsif $menupage == 2
s1 = MPMenu_Config::AMENU1
s2 = MPMenu_Config::AMENU2
s3 = MPMenu_Config::AMENU3
s4 = MPMenu_Config::AMENU4
s5 = MPMenu_Config::AMENU5
s6 = MPMenu_Config::AMENU6
s7 = "上一页"
end
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
@command_window.index = @menu_index
if $game_party.members.size == 0 # 如果队伍为空
@command_window.draw_item(0, false) # 无效化物品选项
@command_window.draw_item(1, false) # 无效化技能选项
@command_window.draw_item(2, false) # 无效化装备选项
@command_window.draw_item(3, false) # 无效化状态选项
end
if $game_system.save_disabled # 如果禁止存档
@command_window.draw_item(4, false) # 无效化存档选项
end
end
#--------------------------------------------------------------------------
# ● 更新命令窗口
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
$menupage = nil
end
#------------------------------------------------------------------------------
if $menupage == 1 #【第1页的选项命令】
if Input.trigger?(Input::C)
if $game_party.members.size == 0 and @command_window.index < 4
Sound.play_buzzer
return
elsif $game_system.save_disabled and @command_window.index == 4
Sound.play_buzzer
return
end
Sound.play_decision
case @command_window.index
when 0 # 物品
$scene = Scene_Item.new
when 1,2,3 # 技能、装备、状态
start_actor_selection
when 4 # 存档
$scene = Scene_File.new(true, false, false)
when 5 # 结束游戏
$scene = Scene_End.new
when 6 # 翻页
$menupage = 2
turnpage
end
end
#------------------------------------------------------------------------------
elsif $menupage == 2 #【第2页的选项命令】
if Input.trigger?(Input::C)
if $game_party.members.size == 0 and @command_window.index < 4
Sound.play_buzzer
return
elsif $game_system.save_disabled and @command_window.index == 4
Sound.play_buzzer
return
end
Sound.play_decision
case @command_window.index
when 0 # 物品2
$scene = Scene_Item.new
when 1,2,3 # 技能2、装备2、状态2
start_actor_selection
when 4 # 其它选项A
print "这里可以自己扩展"
when 5 # 其它选项B
print "这里可以自己扩展"
when 6 # 翻页
$menupage = 1
turnpage
end
end
#------------------------------------------------------------------------------
end
end
#--------------------------------------------------------------------------
# ● 角色选择开始
#--------------------------------------------------------------------------
def start_actor_selection
@command_window.active = false
@status_window.active = true
if $game_party.last_actor_index < @status_window.item_max
@status_window.index = $game_party.last_actor_index
else
@status_window.index = 0
end
end
#--------------------------------------------------------------------------
# ● 角色选择结束
#--------------------------------------------------------------------------
def end_actor_selection
@command_window.active = true
@status_window.active = false
@status_window.index = -1
end
#--------------------------------------------------------------------------
# ● 角色选择更新
#--------------------------------------------------------------------------
def update_actor_selection
if Input.trigger?(Input::B)
Sound.play_cancel
end_actor_selection
elsif Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
case @command_window.index
when 1 # 技能
$scene = Scene_Skill.new(@status_window.index)
when 2 # 装备
$scene = Scene_Equip.new(@status_window.index)
when 3 # 状态
$scene = Scene_Status.new(@status_window.index)
end
end
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1