#==============================================================================
# ■ 仿轩辕剑式的菜单(美化&加强)--By whbm
#==============================================================================
# ■ 仿轩辕剑式的菜单--By 亿万星辰
#==============================================================================
#有问题,找蚂蚁 redant修改
# ■ Scene_Menu
#------------------------------------------------------------------------------
# 处理菜单画面的类。
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# ● 初始化对像
# menu_index : 命令光标的初期位置
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
@item_update = false
@skill_update = false
@equip_update = false
@status_update = false
@sys_update = false
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
#----------------------------- 主菜单 -----------------------------------
# 生成命令窗口
picture = "Graphics/System/menu/【菜单】菜单.jpg"
@sprite = Sprite.new
@sprite.bitmap = Bitmap.new(picture)
@command_window = Window_MenuCommand.new(@menu_index)
#........................................................................
# @command_window.contents = Bitmap.new("Graphics/System/menu/【菜单】菜单.jpg")
@command_window.width = 640
@command_window.height = 480
@command_window.x = -16
@command_window.y = -16
@command_window.z = 999
@command_window.opacity = 0
#whbm
#........................................................................
# 同伴人数为 0 的情况下
if $game_party.actors.size == 0
# 物品、特技、装备、状态无效化
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# 禁止存档的情况下
if $game_system.save_disabled
# 存档无效
@command_window.disable_item(5)
end
# 生成金钱窗口
@gold_window = Window_Gold_Menu.new
@gold_window.x = 155
@gold_window.y = 382
@gold_window.opacity = 0
# 生成状态窗口
@status_window = Window_MenuStatus.new
#........................................................................
@back_status = Window_Help.new
@back_status.height = 640
@back_status.width = 596
@back_status.opacity = 0
@back_status.z = 1
# @back_status.contents = Bitmap.new("Graphics/System/menu/【菜单】菜单.jpg")
#@back_status.x = -16
#@back_status.y = -16
#........................................................................
@status_window.x = 120
@status_window.y = 32
@status_window.z = 2
@status_window.opacity = 0
@status_window1 = Window_MenuEquip.new
@status_window1.x = 120
@status_window1.z = 2
@status_window1.opacity = 0
@status_window1.y = 32
@status_window1.visible = false
# 遮蔽窗口
#@dummy_window = Window_Base.new(0, 0, 640, 480)
#........................................................................
#@dummy_sprite = Sprite.new(Viewport.new(0,0,640 + 32,480 + 32))
#@dummy_sprite.x = 0
#@dummy_sprite.y = 0
# @dummy_window.opacity = 0 #BSY
#........................................................................
#@dummy_window.back_opacity = 0
@old_index = @menu_index
case @menu_index
when 1
# @pic_now = 0
@command_window.contents = Bitmap.new("Graphics/System/menu/【菜单】物品.png")
#@dummy_sprite.bitmap = Bitmap.new("Graphics/System/menu/底图_物品")
when 3
@command_window.contents = Bitmap.new("Graphics/System/menu/【菜单】武术.png")
#@dummy_sprite.bitmap = Bitmap.new("Graphics/System/menu/底图_奇术")
when 2
@command_window.contents = Bitmap.new("Graphics/System/menu/【菜单】装备.png")
#@dummy_sprite.bitmap = Bitmap.new("Graphics/System/menu/底图_装备")
when 4
@command_window.contents = Bitmap.new("Graphics/System/menu/【菜单】任务.png")
#@dummy_sprite.bitmap = Bitmap.new("Graphics/System/menu/底图_合成")
when 0
@pic_now = 0
@command_window.contents = Bitmap.new("Graphics/System/menu/【菜单】状态.png")
#@dummy_sprite.bitmap = Bitmap.new("Graphics/System/menu/底图_状态")
when 5
@command_window.contents = Bitmap.new("Graphics/System/menu/【菜单】系统.png")
# @dummy_sprite.bitmap = Bitmap.new("Graphics/System/menu/底图_天书")
end
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果切换画面就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@sprite.dispose
# @renwu_window.dispose
@command_window.dispose
@gold_window.dispose
@status_window.dispose
@status_window1.dispose
# @dummy_window.dispose
# @dummy_sprite.dispose
#........................................................................
@back_status.dispose
#........................................................................
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新窗口
#----------------------------- 主菜单 -----------------------------------
@command_window.update
@gold_window.update
# @renwu_window.update
if @command_window.index ==2
@status_window.visible = false
@status_window1.visible = true
@status_window1.update
else
@status_window.visible = true and @status_window1.visible = false if !@status_window.visible
@status_window.update
end
if @command_window.index != @old_index
case @command_window.index
when 1
if @pic_now != 1
@command_window.contents = Bitmap.new("Graphics/System/menu/【菜单】物品.png")
@pic_now = 1
#@dummy_sprite.bitmap = Bitmap.new("Graphics/System/menu/底图_物品")
end
when 3
if @pic_now != 3
@command_window.contents = Bitmap.new("Graphics/System/menu/【菜单】武术.png")
@pic_now = 3
#@dummy_sprite.bitmap = Bitmap.new("Graphics/System/menu/底图_奇术")
end
when 2
if @pic_now != 2
@command_window.contents = Bitmap.new("Graphics/System/menu/【菜单】装备.png")
@pic_now = 2
#@dummy_sprite.bitmap = Bitmap.new("Graphics/System/menu/底图_装备")
end
when 4
if @pic_now != 4
@command_window.contents = Bitmap.new("Graphics/System/menu/【菜单】任务.png")
@pic_now = 4
# @dummy_sprite.bitmap = Bitmap.new("Graphics/System/menu/底图_合成")
end
when 0
if @pic_now != 0
@command_window.contents = Bitmap.new("Graphics/System/menu/【菜单】状态.png")
@pic_now = 0
#@dummy_sprite.bitmap = Bitmap.new("Graphics/System/menu/底图_状态")
end
when 5
if @pic_now != 5
@command_window.contents = Bitmap.new("Graphics/System/menu/【菜单】系统.png")
@pic_now = 5
#@dummy_sprite.bitmap = Bitmap.new("Graphics/System/menu/底图_天书")
end
end
@old_index = @command_window.index
end
# 命令窗口被激活的情况下: 调用 update_command
if @command_window.active
update_command
return
end
# 状态窗口被激活的情况下: 调用 update_status
if @status_window.active
if @item_update
update_target#update_item_target
return
elsif @skill_update
update_skill_target
return
else
update_status
return
end
end
if @status_window1.active
update_status1
return
end
#----------------------------- 物品菜单 ---------------------------------
if @item_update
@itemcommand_window.update
# @help_window.update
# @equip_window.update
#@equip_window.refresh
@itemlist_window.update
@status_window.update# @target_window.update
# 物品窗口被激活的情况下: 调用 update_item
if @command_index != @itemcommand_window.index
@command_index = @itemcommand_window.index
@itemlist_window.set_item(@command_index)
end
# コマンドウィンドウがアクティブの場合: update_itemcommand を呼ぶ
if @itemcommand_window.active
@equip_window.refresh
@equip_window.set_item(@itemlist_window.item)#(nil)
update_itemcommand
return
end
# アイテムウィンドウがアクティブの場合: update_itemlist を呼ぶ
if @itemlist_window.active
@equip_window.refresh
@equip_window.set_item(@itemlist_window.item)#@item_window.item)
# @equip_window.refresh
update_itemlist
#........................................................................
# update_itemcommand
return
end
# ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
if @target_window.active
update_target
# @equip_window.refresh
return
end
#----------------------------- 奇术菜单 ---------------------------------
elsif @skill_update
# 刷新窗口
@skill_help_window.update
@skill_window.update
# 特技窗口被激活的情况下: 调用 update_skill
if @skill_window.active
#........................................................................
@skill_window_icon.set_skill(@skill_window.skill)
@skill_window_icon.refresh
#........................................................................
update_skill
return
end
#----------------------------- 装备菜单 ---------------------------------
elsif @equip_update
@equip_right_window.update
@equip_item_window.update
# 设置物品窗口的可视状态
@equip_item_window1.visible = (@equip_right_window.index == 0)
@equip_item_window2.visible = (@equip_right_window.index == 1)
@equip_item_window3.visible = (@equip_right_window.index == 2)
@equip_item_window4.visible = (@equip_right_window.index == 3)
@equip_item_window5.visible = (@equip_right_window.index == 4)
@equip_item_window6.visible = (@equip_right_window.index == 5)
@equip_item_window7.visible = (@equip_right_window.index == 6)
@equip_item_window8.visible = (@equip_right_window.index == 7)
# 获取当前装备中的物品
item1 = @equip_right_window.item
#........................................................................
@equip_window.set_item(item1)
#........................................................................
# 设置当前的物品窗口到 @item_window
case @equip_right_window.index
when 0
@equip_item_window = @equip_item_window1
when 1
@equip_item_window = @equip_item_window2
when 2
@equip_item_window = @equip_item_window3
when 3
@equip_item_window = @equip_item_window4
when 4
@equip_item_window = @equip_item_window5
when 5
@equip_item_window = @equip_item_window6
when 6
@equip_item_window = @equip_item_window7
when 7
@equip_item_window = @equip_item_window8
end
# 右窗口被激活的情况下
if @equip_right_window.active
# 删除变更装备后的能力
@status_window1.set_new_parameters(nil, nil, nil, @status_window1.index)
end
# 物品窗口被激活的情况下
if @equip_item_window.active
# 获取现在选中的物品
item2 = @equip_item_window.item
#........................................................................
@equip_window.set_item(item2)
#........................................................................
# 变更装备
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@equip_right_window.index, item2 == nil ? 0 : item2.id)
# 获取变更装备后的能力值
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
# 返回到装备
@actor.equip(@equip_right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# 描画左窗口
@status_window1.set_new_parameters(new_atk, new_pdef, new_mdef, @status_window1.index)
end
#........................................................................
@equip_window.refresh
#........................................................................
# 右侧窗口被激活的情况下: 调用 update_right
if @equip_right_window.active
update_right
return
end
# 物品窗口被激活的情况下: 调用 update_item
if @equip_item_window.active
update_equip_item
return
end
#----------------------------- 状态菜单 ---------------------------------
elsif @status_update
update_status_status
return
#----------------------------- 系统菜单 ---------------------------------
elsif @sys_update
if @end_window != nil and !@end_window.disposed?
update_end
elsif @bgm_window != nil and !@bgm_window.disposed? and @currentbgm_window != nil and !@currentbgm_window.disposed?
update_bgm
elsif @sfx_window != nil and !@sfx_window.disposed? and @currentsfx_window != nil and !@currentsfx_window.disposed?
update_sfx
elsif !@system_window.disposed?
update_system
end
return
end
end
def update_command
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换的地图画面
$scene = Scene_Map.new
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 同伴人数为 0、存档、游戏结束以外的场合
if $game_party.actors.size == 0 and @command_window.index < 4
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 命令窗口的光标位置分支
case @command_window.index
when 1 # 物品
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到物品画面
@item_update = true
@itemlist_update = true
@command_window.active = false
wupin
@command_window.active = true
when 3 # 特技
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活状态窗口
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2 # 装备
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活状态窗口
@command_window.active = false
@status_window1.active = true
@status_window1.index = 0
when 4 # 合成
#@stagg = -1
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活合成窗口
@command_window.active = false
#$scene = Scene_Mession.new
renwu
#loadcraft
@command_window.active = true
when 0 # 状态
@stagg = -1
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活状态窗口
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 5 # 存档
@status_update = false
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# if $game_system.save_disabled
# 演奏冻结 SE
# $game_system.se_play($data_system.buzzer_se)
# return
#end
@system_window = Window_SysCommand.new
@command_window.active = false
@sys_update = true
end
return
end
end
#--------------------------------------------------------------------------
def renwu
@scene = 100
@renwu_window = Window_renwu.new
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
@renwu_window.update
# 如果切换画面就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
@renwu_window.dispose
end
def wupin
# picture = "Graphics/Battlebacks/北惧.jpg"
#@sprite = Sprite.new
#@sprite.bitmap = Bitmap.new(picture)
# タイトルウィンドウを作成
#@itemtitle_window = Harts_Window_ItemTitle.new
#コマンドウィンドウを作成
@scene = 100
@itemcommand_window = Harts_Window_ItemCommand.new
@command_index = @itemcommand_window.index
#アイテムウィンドウを作成
@itemlist_window = Harts_Window_ItemList.new
@itemlist_window.active = false
#ヘルプウィンドウを作成
@help_window = Window_Help_New.new
@equip_window = Window_Equip.new
@equip_window.y = 405
@help_window.x =147
@help_window.y = 386
# ヘルプウィンドウを関連付け
@itemcommand_window.help_window = @help_window
@itemlist_window.help_window = @help_window
@help_window.x =147
@help_window.y = 386#384
# ターゲットウィンドウを作成 (不可視?非アクティブに設定)
# @target_window = Window_Target.new
# @target_window.visible = false
# @target_window.active = false
# アイテムウィンドウ内容表示
@itemlist_window.set_item(@command_index)
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
# @sprite.
# @sprite.bitmap.dispose unless @sprite.bitmap.disposed?
# @itemtitle_window.dispose
# @equip_icon.dispose
@equip_window.dispose
@itemcommand_window.dispose
@itemlist_window.dispose
@help_window.dispose
# @target_window.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
#def update
# ウィンドウを更新
# @itemtitle_window.update
# @itemcommand_window.update
# @itemlist_window.update
#@help_window.update
#@target_window.update
# if @command_index != @itemcommand_window.index
# @command_index = @itemcommand_window.index
# @itemlist_window.set_item(@command_index)
# end
# コマンドウィンドウがアクティブの場合: update_itemcommand を呼ぶ
# if @itemcommand_window.active
# update_itemcommand
# return
# end
# アイテムウィンドウがアクティブの場合: update_itemlist を呼ぶ
#if @itemlist_window.active
# update_itemlist
# return
#end
# ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
#if @target_window.active
# update_target
# return
#end
#end
#--------------------------------------------------------------------------
# ● フレーム更新 (コマンドウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_itemcommand
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# メニュー画面に切り替え
@equip_window.refresh
$scene = Scene_Menu.new(1)
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 選択中のコマンドのアイテムがない場合
if @itemlist_window.item_number == 0
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# アイテムウィンドウをアクティブにする
@itemcommand_window.active = false
@itemlist_window.active = true
@itemlist_window.index = 0
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アイテムウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_itemlist
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
@equip_window.refresh
# アイテムウィンドウをアクティブにする
@itemcommand_window.active = true
@itemlist_window.active = false
@itemlist_window.index = 0
@itemcommand_window.index = @command_index
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# アイテムウィンドウで現在選択されているデータを取得
@item = @itemlist_window.item
# 使用アイテムではない場合
unless @item.is_a?(RPG::Item)
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 使用できない場合
unless $game_party.item_can_use?(@item.id)
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# 効果範囲が味方の場合
if @item.scope >= 3
# ターゲットウィンドウをアクティブ化
@itemlist_window.active = false
#@target_window.x = 304
@status_window.visible=true#@target_window.visible = true
@status_window.active=true #@target_window.active = true
# 効果範囲 (単体/全体) に応じてカーソル位置を設定
if @item.scope == 4 || @item.scope == 6
@status_window.index = -1 #@target_window.index = -1
else
@status_window.index = 0 # @target_window.index = 0
end
# 効果範囲が味方以外の場合
else
# コモンイベント ID が有効の場合
if @item.common_event_id > 0
# コモンイベント呼び出し予約
$game_temp.common_event_id = @item.common_event_id
# アイテムの使用時 SE を演奏
$game_system.se_play(@item.menu_se)
# 消耗品の場合
if @item.consumable
# 使用したアイテムを 1 減らす
$game_party.lose_item(@item.id, 1)
# アイテムウィンドウの項目を再描画
@itemlist_window.draw_item(@itemlist_window.index)
end
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
end
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_target
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# アイテム切れなどで使用できなくなった場合
unless $game_party.item_can_use?(@item.id)
# アイテムウィンドウの内容を再作成
@itemlist_window.refresh
# @equip_window.dispose
end
# ターゲットウィンドウを消去
@itemlist_window.active = true
@status_window.visible = false # @target_window.visible = false
@status_window.active = false #@target_window.active = false
@itemlist_window.set_item(@command_index)
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# アイテムを使い切った場合
if $game_party.item_number(@item.id) == 0
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# ターゲットが全体の場合
if @status_window.index == -1 #@target_window.index == -1
# パーティ全体にアイテムの使用効果を適用
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# ターゲットが単体の場合
if @status_window.index >= 0# @target_window.index >= 0
# ターゲットのアクターにアイテムの使用効果を適用
target = $game_party.actors[@status_window.index]#@target_window.index]
used = target.item_effect(@item)
end
# アイテムを使った場合
if used
# アイテムの使用時 SE を演奏
$game_system.se_play(@item.menu_se)
# 消耗品の場合
if @item.consumable
# 使用したアイテムを 1 減らす
$game_party.lose_item(@item.id, 1)
# アイテムウィンドウの項目を再描画
@itemlist_window.draw_item(@itemlist_window.index)
@itemlist_window.set_item(@command_index)
end
# ターゲットウィンドウの内容を再作成
# @target_window.refresh
@status_window.refresh
@equip_window.refresh
# 全滅の場合
if $game_party.all_dead?
# ゲームオーバー画面に切り替え
$scene = Scene_Gameover.new
return
end
# コモンイベント ID が有効の場合
if @item.common_event_id > 0
# コモンイベント呼び出し予約
$game_temp.common_event_id = @item.common_event_id
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
end
# アイテムを使わなかった場合
unless used
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
def loadcraft(craft_index = 0)
@scene = 100
@craft_window = Window_Craft.new
@craft_window.windowskin = RPG::Cache.windowskin("../system/menu/windowskins/palskin")
@craft_window.index = craft_index
@craft_window.back_opacity = 180
@confirm_window = Window_Base.new(120, 188, 400, 64)
@confirm_window.contents = Bitmap.new(368, 32)
@confirm_window.contents.font.name = "黑体"
@confirm_window.contents.font.size = 20
@confirm_window.windowskin = RPG::Cache.windowskin("../system/menu/windowskins/palskin")
@confirm_window.back_opacity = 180
@help_window = Window_Help_New_Craft.new
#........................................................................
@equip_icon = Window_Equip_Craft.new
@equip_icon.set_item_id
#........................................................................
@craft_window.help_window = @help_window
@result_window = Window_CraftResult.new
@result_window.windowskin = RPG::Cache.windowskin("../system/menu/windowskins/palskin")
@result_window.back_opacity = 180
@ingredients_window = Window_CraftIngredients.new
@ingredients_window.windowskin = RPG::Cache.windowskin("../system/menu/windowskins/palskin")
@ingredients_window.back_opacity = 180
@yes_no_window = Window_Command.new(100, ["确定", "放弃"])
@yes_no_window.windowskin = RPG::Cache.windowskin("../system/menu/windowskins/palskin")
@yes_no_window.back_opacity = 180
@confirm_window.visible = false
@confirm_window.z = 1500
@yes_no_window.visible = false
@yes_no_window.active = false
@yes_no_window.index = 1
@yes_no_window.x = 270
@yes_no_window.y = 252
@yes_no_window.z = 1500
@label_window = Window_Base.new(450,200 - 32 + 5,190,52)
@label_window.windowskin = RPG::Cache.windowskin("../system/menu/windowskins/palskin")
@label_window.back_opacity = 100
@label_window.contents=Bitmap.new(@label_window.width - 32,@label_window.height - 32)
@label_window.contents.font.size=20
@label_window.contents.font.color = @label_window.normal_color
@label_window.contents.font.name = "黑体"
@label_window.contents.draw_text(0, 0, @label_window.contents.width, 20, " 现有 需要")
loop do
Graphics.update
Input.update
update_loadcraft
if @scene == 99
break
end
end
@help_window.dispose
@equip_icon.dispose
@craft_window.dispose
@result_window.dispose
@ingredients_window.dispose
@confirm_window.dispose
@yes_no_window.dispose
@label_window.dispose
end
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def update_loadcraft
@craft_window.update
@equip_icon.set_item(@craft_window.recipe)
@equip_icon.refresh
@ingredients_window.update
if $game_party.recipes.size > 0
@result_window.set_result(@craft_window.recipe.result, @craft_window.recipe.result_type)
@ingredients_window.set_ingredients(@craft_window.recipe.ingredients,
@craft_window.recipe.ingredient_types,
@craft_window.recipe.quantities)
end
if @craft_window.active
update_craft
return
end
if @yes_no_window.active
confirm_update
return
end
end
#--------------------------------------------------------------------------
def update_craft
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@scene = 99
return
end
if Input.trigger?(Input::C) and $game_party.recipes.size != 0
@recipe = @craft_window.recipe
if @recipe.have
$game_system.se_play($data_system.decision_se)
@yes_no_window.active = true
@craft_window.active = false
else
$game_system.se_play($data_system.buzzer_se)
return
end
end
end
#--------------------------------------------------------------------------
def confirm_update
@craft_index = @craft_window.index
@confirm_window.visible = true
@confirm_window.z = 1500
@yes_no_window.visible = true
@yes_no_window.active = true
@yes_no_window.z = 1500
@yes_no_window.update
string = "合成 " + @recipe.name + "?"
cw = @confirm_window.contents.text_size(string).width
center = @confirm_window.contents.width/2 - cw /2
unless @drawn
@confirm_window.contents.draw_text(center, 0, cw, 30, string)
@drawn = true
end
if Input.trigger?(Input::C)
if @yes_no_window.index == 0
$game_system.se_play($data_system.decision_se)
@recipe.make
$game_system.se_play($data_system.save_se)
@confirm_window.visible = false
@yes_no_window.active = false
@yes_no_window.visible = false
@craft_window.dispose
@craft_window = Window_Craft.new
@craft_window.windowskin = RPG::Cache.windowskin("../system/menu/windowskins/palskin")
@craft_window.index = @craft_index
@craft_window.back_opacity = 180
@craft_window.active = true
else
$game_system.se_play($data_system.cancel_se)
@confirm_window.visible = false
@yes_no_window.active = false
@yes_no_window.visible = false
@craft_window.dispose
@craft_window = Window_Craft.new
@craft_window.windowskin = RPG::Cache.windowskin("../system/menu/windowskins/palskin")
@craft_window.index = @craft_index
@craft_window.back_opacity = 180
@craft_window.active = true
end
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@confirm_window.visible = false
@yes_no_window.active = false
@yes_no_window.visible = false
@craft_window.dispose
@craft_window = Window_Craft.new
@craft_window.windowskin = RPG::Cache.windowskin("../system/menu/windowskins/palskin")
@craft_window.index = @craft_index
@craft_window.back_opacity = 180
@craft_window.active = true
end
end
#--------------------------------------------------------------------------
def update_status
if @command_window.index == 0 and @stagg != @status_window.index
# 演奏确定 SE
# 切换到状态画面
# 获取角色
@actor = $game_party.actors[@status_window.index]
# 生成状态窗口
if @stagg != -1
@status_status_window.dispose
end
@stagg = @status_window.index
@status_status_window = Window_Status_New.new(@actor)
@status_update = true
end
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
if @command_window.index == 0
@status_status_window.dispose
@stagg = -1
end
# 激活命令窗口
@command_window.active = true
@status_window.active = false
@status_window.index = -2
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口的光标位置分支
case @command_window.index
when 3 # 特技
# 本角色的行动限制在 2 以上的情况下
if $game_party.actors[@status_window.index].restriction >= 2
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
@window_index = @status_window.index
@actor = $game_party.actors[@status_window.index]
# 生成帮助窗口、状态窗口、特技窗口
@skill_help_window = Window_Help_New_Skill.new
@skill_window = Window_Skill_New.new(@actor)
#........................................................................
@skill_window_icon = Window_Skill_Icon.new
@skill_window_icon.y = 402
#........................................................................
# 关联帮助窗口
@skill_window.help_window = @skill_help_window
@status_window.active = false
@skill_update = true
end
return
end
end
#--------------------------------------------------------------------------
# ● 物品刷新
#--------------------------------------------------------------------------
def update_item
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
@item_help_window.dispose
@help_window.dispose
# @item_window.dispose
@itemlist_window.dispose
#........................................................................
@equip_window.dispose
#........................................................................
# @item_update = false
@itemlist_update = false
# @command_window.active = true
@itemcommand_window.active = true
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取物品窗口当前选中的物品数据
@item = @itemlist_window.item#@item_window.item
# 不使用物品的情况下
unless @item.is_a?(RPG::Item)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 不能使用的情况下
unless $game_party.item_can_use?(@item.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 效果范围是我方的情况下
if @item.scope >= 3
# 激活目标窗口
@itemlist_window.active = false
@status_window.active = true
# 设置效果范围 (单体/全体) 的对应光标位置
if @item.scope == 4 || @item.scope == 6
@status_window.index = -1
else
@status_window.index = 0
end
# 效果在我方以外的情况下
else
# 公共事件 ID 有效的情况下
if @item.common_event_id > 0
# 预约调用公共事件
$game_temp.common_event_id = @item.common_event_id
# 演奏物品使用时的 SE
$game_system.se_play(@item.menu_se)
# 消耗品的情况下
if @item.consumable
# 使用的物品数减 1
$game_party.lose_item(@item.id, 1)
# 再描绘物品窗口的项目
@itemlist_window.draw_item(@itemlist_window.index)
end
@item_help_window.dispose
@itemlist_window.dispose
@help_window.dispose
#........................................................................
@equip_window.dispose
#........................................................................
# 切换到地图画面
$scene = Scene_Map.new
return
end
end
return
end
end
def update_item_target
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 由于物品用完而不能使用的场合
unless $game_party.item_can_use?(@item.id)
# 再次生成物品窗口的内容
#@item_window.refresh
# @equip_window.dispose
@itemlist_window.refresh
end
# 删除目标窗口
@itemlist_window.active = true
@status_window.index = -2
@status_window.active = false
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 如果物品用完的情况下
if $game_party.item_number(@item.id) == 0
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 目标是全体的情况下
if @status_window.index == -1
# 对同伴全体应用物品使用效果
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# 目标是单体的情况下
if @status_window.index >= 0
# 对目标角色应用物品的使用效果
target = $game_party.actors[@status_window.index]
used = target.item_effect(@item)
end
# 使用物品的情况下
if used
# 演奏物品使用时的 SE
$game_system.se_play(@item.menu_se)
# 消耗品的情况下
if @item.consumable
# 使用的物品数减 1
$game_party.lose_item(@item.id, 1)
# 再描绘物品窗口的项目
@itemlist_window.draw_item(@itemlist_window.index)
# @item_window.draw_item(@itemlist_window.index)#item_window.index)
end
# 再生成目标窗口的内容
@status_window.refresh
# @equip_window.refresh
# @itemlist_window.refresh
# 全灭的情况下
if $game_party.all_dead?
# 切换到游戏结束画面
$scene = Scene_Gameover.new
return
end
# 公共事件 ID 有效的情况下
if @item.common_event_id > 0
# 预约调用公共事件
$game_temp.common_event_id = @item.common_event_id
@item_help_window.dispose
#@item_window.dispose
@help_window.dispose
@equip_window.dispose
@itemlist_window.dispose
# 切换到地图画面
$scene = Scene_Map.new
return
end
end
# 无法使用物品的情况下
unless used
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
#--------------------------------------------------------------------------
# ● 技能刷新
#--------------------------------------------------------------------------
def update_skill
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
@skill_help_window.dispose
@skill_window.dispose
@skill_window_icon.dispose
@skill_update = false
@status_window.active = true
@status_window.index = @window_index
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取特技窗口现在选择的特技的数据
@skill = @skill_window.skill
# 不能使用的情况下
if @skill == nil or not @actor.skill_can_use?(@skill.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 效果范围是我方的情况下
if @skill.scope >= 3
# 激活目标窗口
@skill_window.active = false
@status_window.active = true
# 设置效果范围 (单体/全体) 的对应光标位置
if @skill.scope == 4 || @skill.scope == 6
@status_window.index = -1
elsif @skill.scope == 7
@status_window.index = @actor_index - 10
else
@status_window.index = 0
end
# 效果在我方以外的情况下
else
# 公共事件 ID 有效的情况下
if @skill.common_event_id > 0
# 预约调用公共事件
$game_temp.common_event_id = @skill.common_event_id
# 演奏特技使用时的 SE
$game_system.se_play(@skill.menu_se)
# 消耗 SP
@actor.sp -= @skill.sp_cost
# 再生成各窗口的内容
@skill_window.refresh
@status_window.refresh
@skill_help_window.dispose
@skill_window.dispose
@skill_window_icon.dispose
# @back_skill.dispose
# 切换到地图画面
$scene = Scene_Map.new
return
end
end
return
end
end
def update_skill_target
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 删除目标窗口
@skill_window.active = true
@status_window.index = -2
@status_window.active = false
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 因为 SP 不足而无法使用的情况下
unless @actor.skill_can_use?(@skill.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 目标是全体的情况下
if @status_window.index == -1
# 对同伴全体应用特技使用效果
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
# 目标是使用者的情况下
if @status_window.index <= -2
# 对目标角色应用特技的使用效果
target = $game_party.actors[@status_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
# 目标是单体的情况下
if @status_window.index >= 0
# 对目标角色应用特技的使用效果
target = $game_party.actors[@status_window.index]
used = target.skill_effect(@actor, @skill)
end
# 使用特技的情况下
if used
# 演奏特技使用时的 SE
$game_system.se_play(@skill.menu_se)
#-----修正------------------------------------------------------
@actor.skill_sp_cost[@skill.id] = @skill.sp_cost if @actor.skill_sp_cost[@skill.id] == nil
# SP 消費
@actor.sp -= @actor.skill_sp_cost[@skill.id]
#---------------------------------------------------------------
# 再生成各窗口内容
@status_window.refresh
@skill_window.refresh
# 全灭的情况下
if $game_party.all_dead?
# 切换到游戏结束画面
$scene = Scene_Gameover.new
return
end
# 公共事件 ID 有效的情况下
if @skill.common_event_id > 0
# 预约调用公共事件
$game_temp.common_event_id = @skill.common_event_id
@skill_help_window.dispose
@skill_window.dispose
@back_skill.dispose
# 释放窗口
@item_window.dispose
# @back_item.dispose
@status_window.dispose
# 切换到地图画面
$scene = Scene_Map.new
return
end
end
# 无法使用特技的情况下
unless used
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
#--------------------------------------------------------------------------
# ● 装备刷新
#--------------------------------------------------------------------------
def update_right
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
@equip_help_window.dispose
@equip_right_window.dispose
@equip_item_window1.dispose
@equip_item_window2.dispose
@equip_item_window3.dispose
@equip_item_window4.dispose
@equip_item_window5.dispose
@equip_item_window6.dispose
@equip_item_window7.dispose
@equip_item_window8.dispose
#........................................................................
@equip_window.dispose
#........................................................................
@equip_update = false
@status_window1.active = true
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 固定装备的情况下
if @actor.equip_fix?(@equip_right_window.index)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活物品窗口
@equip_right_window.active = false
@equip_item_window.active = true
@equip_window.set_item_id
@equip_item_window.index = 0
return
end
end
def update_equip_item
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 激活右侧窗口
@equip_right_window.active = true
@equip_item_window.active = false
@equip_item_window.index = -1
@equip_window.set_item_id
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 演奏装备 SE
$game_system.se_play($data_system.equip_se)
# 获取物品窗口现在选择的装备数据
item = @equip_item_window.item
# 变更装备
@actor.equip(@equip_right_window.index, item == nil ? 0 : item.id)
# 激活右侧窗口
@equip_right_window.active = true
# @equip_right_window.visible = false#true
@equip_item_window.active = false
@equip_item_window.index = -1
@equip_window.set_item_id
# 再生成右侧窗口、物品窗口的内容
@equip_right_window.refresh
if @equip_right_window.index == 6 or @equip_right_window.index == 7
@equip_item_window7.refresh
@equip_item_window8.refresh
else
@equip_item_window.refresh
end
return
end
end
def update_status1
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 激活命令窗口
@command_window.active = true
@status_window1.active = false
@status_window1.index = -1
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口的光标位置分支
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
@equip_index = 0
@actor = $game_party.actors[@status_window1.index]
@equip_help_window = Window_Help_New.new
@equip_help_window.x = 147
@equip_help_window.y = 386# 480 - 64 - 32 - 8
@equip_right_window = Window_EquipRight_New.new(@actor)
@equip_item_window1 = Window_EquipItem_New.new(@actor, 0)
@equip_item_window2 = Window_EquipItem_New.new(@actor, 1)
@equip_item_window3 = Window_EquipItem_New.new(@actor, 2)
@equip_item_window4 = Window_EquipItem_New.new(@actor, 3)
@equip_item_window5 = Window_EquipItem_New.new(@actor, 4)
@equip_item_window6 = Window_EquipItem_New.new(@actor, 5)
@equip_item_window7 = Window_EquipItem_New.new(@actor, 6)
@equip_item_window8 = Window_EquipItem_New.new(@actor, 7)
#........................................................................
@equip_window = Window_Equip.new
@equip_window.y = 405
@equip_window.set_item_id
#........................................................................
# 关联帮助窗口
@equip_right_window.help_window = @equip_help_window
@equip_item_window1.help_window = @equip_help_window
@equip_item_window2.help_window = @equip_help_window
@equip_item_window3.help_window = @equip_help_window
@equip_item_window4.help_window = @equip_help_window
@equip_item_window5.help_window = @equip_help_window
@equip_item_window6.help_window = @equip_help_window
@equip_item_window7.help_window = @equip_help_window
@equip_item_window8.help_window = @equip_help_window
# 设置光标位置
@equip_right_window.index = @equip_index
@status_window1.active = false
@equip_update = true
# 设置物品窗口的可视状态
@equip_item_window1.visible = (@equip_right_window.index == 0)
@equip_item_window2.visible = (@equip_right_window.index == 1)
@equip_item_window3.visible = (@equip_right_window.index == 2)
@equip_item_window4.visible = (@equip_right_window.index == 3)
@equip_item_window5.visible = (@equip_right_window.index == 4)
@equip_item_window6.visible = (@equip_right_window.index == 5)
@equip_item_window7.visible = (@equip_right_window.index == 6)
@equip_item_window8.visible = (@equip_right_window.index == 7)
# 获取当前装备中的物品
item1 = @equip_right_window.item
# 设置当前的物品窗口到 @item_window
@equip_window.set_item_id
case @equip_right_window.index
when 0
@equip_item_window = @equip_item_window1
when 1
@equip_item_window = @equip_item_window2
when 2
@equip_item_window = @equip_item_window3
when 3
@equip_item_window = @equip_item_window4
when 4
@equip_item_window = @equip_item_window5
when 5
@equip_item_window = @equip_item_window6
when 6
@equip_item_window = @equip_item_window7
when 7
@equip_item_window = @equip_item_window8
end
# 右窗口被激活的情况下
if @equip_right_window.active
# 删除变更装备后的能力
@status_window1.set_new_parameters(nil, nil, nil)
end
# 物品窗口被激活的情况下
if @equip_item_window.active
# 获取现在选中的物品
item2 = @equip_item_window.item
# 变更装备
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@equip_right_window.index, item2 == nil ? 0 : item2.id)
# 获取变更装备后的能力值
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
# 返回到装备
@actor.equip(@equip_right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# 描画左窗口
@status_window1.set_new_parameters(new_atk, new_pdef, new_mdef)
#........................................................................
@equip_window.set_item(item2)
#........................................................................
end
end
end
#--------------------------------------------------------------------------
# ● 状态刷新
#--------------------------------------------------------------------------
def update_status_status
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
@status_status_window.dispose
# @bgstatus.dispose
@status_update = false
@status_window.active = true
return
end
end
def update_system
@system_window.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
@system_window.dispose
@sys_update = false
@command_window.active = true
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
case @system_window.index
when 0
@bgm_window = Window_BGM_Volume.new(80, ["0%", "17%", "34%", "50%", "67%", "84%", "100%"])
@currentbgm_window = Window_CurrentBGM_Volume.new
@system_window.active = false
when 1
@sfx_window = Window_SFX_Volume.new(80, ["0%", "17%", "34%", "50%", "67%", "84%", "100%"])
@currentsfx_window = Window_CurrentSFX_Volume.new
@system_window.active = false
when 2
@system_window.dispose
$scene = Scene_Save.new
when 3
@system_window.dispose
$scene = Scene_Load.new(true)
when 4
@end_window = Window_EndCommand.new
@system_window.active = false
when 5
@system_window.dispose
$scene = Chaochao_Scene_Party.new
when 6
@system_window.dispose
$scene = Scene_Lvup.new
end
return
end
end
def update_bgm
@bgm_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@system_window.active = true
@bgm_window.dispose
@currentbgm_window.dispose
return
end
if Input.trigger?(Input::C)
case @bgm_window.index
when 0
$game_system.bgm_volume = 0
$game_system.bgm_play($game_system.bgm_memorize)
@currentbgm_window.refresh
when 1
$game_system.bgm_volume = 17
$game_system.bgm_play($game_system.bgm_memorize)
@currentbgm_window.refresh
when 2
$game_system.bgm_volume = 34
$game_system.bgm_play($game_system.bgm_memorize)
@currentbgm_window.refresh
when 3
$game_system.bgm_volume = 50
$game_system.bgm_play($game_system.bgm_memorize)
@currentbgm_window.refresh
when 4
$game_system.bgm_volume = 67
$game_system.bgm_play($game_system.bgm_memorize)
@currentbgm_window.refresh
when 5
$game_system.bgm_volume = 84
$game_system.bgm_play($game_system.bgm_memorize)
@currentbgm_window.refresh
when 6
$game_system.bgm_volume = 100
$game_system.bgm_play($game_system.bgm_memorize)
@currentbgm_window.refresh
end
return
end
end
def update_sfx
@sfx_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@sfx_window.dispose
@currentsfx_window.dispose
@system_window.active = true
return
end
if Input.trigger?(Input::C)
case @sfx_window.index
when 0
$game_system.se_volume = 0
$game_system.se_play($data_system.decision_se)
@currentsfx_window.refresh
when 1
$game_system.se_volume = 17
$game_system.se_play($data_system.decision_se)
@currentsfx_window.refresh
when 2
$game_system.se_volume = 34
$game_system.se_play($data_system.decision_se)
@currentsfx_window.refresh
when 3
$game_system.se_volume = 50
$game_system.se_play($data_system.decision_se)
@currentsfx_window.refresh
when 4
$game_system.se_volume = 67
$game_system.se_play($data_system.decision_se)
@currentsfx_window.refresh
when 5
$game_system.se_volume = 84
$game_system.se_play($data_system.decision_se)
@currentsfx_window.refresh
when 6
$game_system.se_volume = 100
$game_system.se_play($data_system.decision_se)
@currentsfx_window.refresh
end
$game_map.autoplay
return
end
end
def update_end
@end_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@end_window.dispose
@system_window.active = true
return
end
if Input.trigger?(Input::C)
case @end_window.index
when 0
@end_window.dispose
@system_window.dispose
command_to_title
when 1
command_shutdown
end
return
end
end
def command_to_title
$game_system.se_play($data_system.decision_se)
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
$scene = Scene_Title.new
end
def command_shutdown
$game_system.se_play($data_system.decision_se)
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
$scene = nil
end
end