# ▼▲▼ XRXS26AX. +入れ替えメニュー ver.2 ▼▲▼ built 081113 # ▼▲▼ XRXS26BX. +BUZZデザイン ▼▲▼ built 033109 # # Re-upload 2010/ 3/25 # #============================================================================== # □ カスタマイズポイント #============================================================================== module XRXS26 MENU_STATUS_STRETCH = true # 「メニューステータスをストレッチ」(3人以下の場合) end class Window_MenuStatus < Window_Selectable # # 「能力値を表示しないアクター」IDの配列 # NO_PARAMETER_ACTORS = [] end #------------------------------------------------------------------------------ # 「メニューステータスウィンドウ」に関する値の設定 #------------------------------------------------------------------------------ class Window_MenuStatus < Window_Selectable # 列数 COLUMN_MAX = 1 # カーソル:高さ CURSOR_HEIGHT = 96 # 一行の高さ LINE_HEIGHT = 116 end #------------------------------------------------------------------------------ # 「入れ替えメニュー」稼動部分のカスタマイズ #------------------------------------------------------------------------------ class Scene_Menu MENU_MEMBER_CHANGE_KEY_GO = Input::RIGHT # 「入れ替え」移行キー MENU_MEMBER_CHANGE_KEY_END = Input::LEFT # 「入れ替え」終了キー MENU_MEMBER_CHANGE_INDEX_MIN = 0 # 「入れ替え」に移行できるコマンド位置の最低値 FORCETOBATTLE_ACTORS = [] # 待機へ送れないアクターIDの配列 UMBATTLABLE_ACTORS = [] # 戦闘へ送れないアクターIDの配列 UNMOVABLE_ACTORS = [] # 場所すら固定なアクターIDの配列 end #============================================================================== # ■ Window_MenuStatus #============================================================================== class Window_MenuStatus < Window_Selectable #-------------------------------------------------------------------------- # ○ インクルード #-------------------------------------------------------------------------- include XRXS26 include XRXS_Cursor2 #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :column_max # 列数 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize h = 480 if MENU_STATUS_STRETCH h = FRONT_MEMBER_LIMIT * 116 + 16 end super(0, 0, 480, h) h = ($game_party.actors.size - 1) * LINE_HEIGHT + CURSOR_HEIGHT self.contents = Bitmap.new(width - 32, h) refresh self.active = false self.index = -1 end #-------------------------------------------------------------------------- # ○ 1 ページに表示できる行数の取得 #-------------------------------------------------------------------------- def page_row_max if MENU_STATUS_STRETCH return FRONT_MEMBER_LIMIT # 戦闘パーティ最大数 else return [FRONT_MEMBER_LIMIT, 4].max # 戦闘パーティ最大数(最低4) end end #-------------------------------------------------------------------------- # ○ 先頭の行の取得 #-------------------------------------------------------------------------- def top_row # ウィンドウ内容の転送元 Y 座標を、1 行の高さ LINE_HEIGHT で割る return self.oy / LINE_HEIGHT end #-------------------------------------------------------------------------- # ○ 先頭の行の設定 #-------------------------------------------------------------------------- def top_row=(row) super self.oy = self.oy/32 * LINE_HEIGHT end #-------------------------------------------------------------------------- # ● カーソルの矩形更新 #-------------------------------------------------------------------------- def update_cursor_rect super unless @index < 0 y = (self.cursor_rect.y + self.oy) * LINE_HEIGHT/32 - self.oy self.cursor_rect.set(0, y, self.cursor_rect.width, CURSOR_HEIGHT) end end end #============================================================================== # ■ Scene_Menu #============================================================================== class Scene_Menu #-------------------------------------------------------------------------- # ○ インクルード #-------------------------------------------------------------------------- include XRXS26 #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias xrxs26ax_update update def update # インデックスを保存 @status_index = @status_window.index # 呼び戻す xrxs26ax_update end #-------------------------------------------------------------------------- # ● フレーム更新 (コマンドウィンドウがアクティブの場合) #-------------------------------------------------------------------------- alias xrxs26ax_update_command update_command def update_command # 呼び戻す xrxs26ax_update_command # 入れ替え移行キーが押されたとき、@command_window.indexが設定値以上 if Input.trigger?(MENU_MEMBER_CHANGE_KEY_GO) and @command_window.index >= MENU_MEMBER_CHANGE_INDEX_MIN # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # カーソル位置を記憶 @command_index_before_menu_member_change = @command_window.index # 入れ替えウィンドウへ移行 @command_window.active = false @command_window.index = -1 @status_window.active = true @status_window.index = 0 end end #-------------------------------------------------------------------------- # ● フレーム更新 (ステータスウィンドウがアクティブの場合) #-------------------------------------------------------------------------- alias xrxs26ax_update_status update_status def update_status # 呼び戻す if @command_window.index != -1 xrxs26ax_update_status return end # B ボタンか入れ替え終了キーが押されたとき if ((Input.trigger?(Input::B) or Input.trigger?(MENU_MEMBER_CHANGE_KEY_END)) and @status_window.index2 == -1 and @status_index%@status_window.column_max == 0) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # コマンドウィンドウをアクティブにする @command_window.active = true @command_window.index = 0 @status_window.active = false @status_window.index = -1 return end # B ボタンが押されたとき if Input.trigger?(Input::B) and @status_window.index2 >= 0 @status_window.index = @status_window.index2 @status_window.index2 = -1 return end # 決定キーが押されたとき if Input.trigger?(Input::C) if @status_window.index2 == -1 if UNMOVABLE_ACTORS.include?($game_party.actors[@status_window.index].id) # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # メンバーの入れ替え一人目の決定 @status_window.index2 = @status_window.index else if UNMOVABLE_ACTORS.include?($game_party.actors[@status_window.index].id) # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # どちらかが戦闘メンバー かつ どちらかが戦闘禁止アクター の場合 if (@status_window.index < FRONT_MEMBER_LIMIT or @status_window.index2 < FRONT_MEMBER_LIMIT) and (UMBATTLABLE_ACTORS.include?($game_party.actors[@status_window.index].id) or UMBATTLABLE_ACTORS.include?($game_party.actors[@status_window.index2].id)) # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # どちらかが待機メンバー かつ どちらかが待機禁止アクター の場合 if (@status_window.index >= FRONT_MEMBER_LIMIT or @status_window.index2 >= FRONT_MEMBER_LIMIT) and (FORCETOBATTLE_ACTORS.include?($game_party.actors[@status_window.index].id) or FORCETOBATTLE_ACTORS.include?($game_party.actors[@status_window.index2].id)) # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # メンバーの入れ替え二人目の決定と入れ替えの実行 actor2 = $game_party.actors[@status_window.index] actor = $game_party.actors[@status_window.index2] $game_party.actors[@status_window.index2] = actor2 $game_party.actors[@status_window.index] = actor @status_window.index = @status_window.index2 @status_window.index2 = -1 # プレイヤーをリフレッシュ $game_player.refresh # ステータスウィンドウをリフレッシュ @status_window.refresh end return end end end #============================================================================== # ■ Window_MenuStatus #============================================================================== class Window_MenuStatus < Window_Selectable #-------------------------------------------------------------------------- # ○ インクルード #-------------------------------------------------------------------------- include XRXS26 #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :newitem_window attr_reader :bottomkeyhelp_window #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias xrxs26bx_initialize initialize def initialize # 呼び戻す xrxs26bx_initialize # 寄生してウィンドウを作成 # ボトルキーヘルプウィンドウ @bottomkeyhelp_window = Window_BottomKeyHelp.new @bottomkeyhelp_window.visible = false # 設定変更 self.height = 448 self.contents = Bitmap.new(width - 32, height - 32) refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear @item_max = $game_party.actors.size @column_max = 2 y = (FRONT_MEMBER_LIMIT+1)/2 * 72 + 28 self.contents.font.size = 16 self.contents.font.color = system_color self.contents.draw_text(4, 0, 92, 28, "戦闘メンバー") self.contents.draw_text(4, y, 92, 28, "待機メンバー") for i in 0...$game_party.actors.size x = 64 + i%2 * 224 y = i/2 * 72 + 24 actor = $game_party.actors[i] if i >= FRONT_MEMBER_LIMIT y += 32 self.contents.font.color = disabled_color self.contents.draw_text(x, y, 120, 32, actor.name) else draw_actor_name(actor , x , y ) end draw_actor_graphic(actor, x - 40, y + 64) unless NO_PARAMETER_ACTORS.include?(actor.id) draw_actor_level(actor , x + 94, y ) draw_actor_hp(actor , x + 28, y + 16) draw_actor_sp(actor , x + 28, y + 32) draw_actor_state(actor , x + 28, y + 48) end end end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update # ウィンドウを更新 @bottomkeyhelp_window.update super end #-------------------------------------------------------------------------- # ○ 解放 #-------------------------------------------------------------------------- def dispose @bottomkeyhelp_window.dispose super end #-------------------------------------------------------------------------- # ● カーソルの矩形更新 #-------------------------------------------------------------------------- def update_cursor_rect if @index < 0 self.cursor_rect.empty else y = @index/2 * 72 + 28 if @index >= FRONT_MEMBER_LIMIT y += 32 end self.cursor_rect.set(@index%2 * 224, y, 224, 72) end end end #============================================================================== # ■ Scene_Menu #============================================================================== class Scene_Menu #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias xrxs26bx_update update def update # 登録 if @bottomkeyhelp_window.nil? @bottomkeyhelp_window = @status_window.bottomkeyhelp_window @bottomkeyhelp_window.visible = true set_keyhelp1 end # 呼び戻す xrxs26bx_update end #-------------------------------------------------------------------------- # ● フレーム更新 (コマンドウィンドウがアクティブの場合) #-------------------------------------------------------------------------- alias xrxs26bx_update_command update_command def update_command # 呼び戻す xrxs26bx_update_command # 入れ替え移行キーが押されたとき if @command_window.index == -1 and @status_window.active set_keyhelp2 end end #-------------------------------------------------------------------------- # ● フレーム更新 (ステータスウィンドウがアクティブの場合) #-------------------------------------------------------------------------- alias xrxs26bx_update_status update_status def update_status # 保存 last_index = @status_window.index2 # 呼び戻す xrxs26bx_update_status # if last_index != @status_window.index2 # 一人目を選択した場合 if @status_window.index2 >= 0 set_keyhelp3 else set_keyhelp2 end end # 戻った場合 unless @status_window.active set_keyhelp1 end end #-------------------------------------------------------------------------- # ○ キーヘルプを設定 1 #-------------------------------------------------------------------------- def set_keyhelp1 @bottomkeyhelp_window.clear @bottomkeyhelp_window.add("B","メニューを閉じる") @bottomkeyhelp_window.add("C","選択") @bottomkeyhelp_window.add("→","入れ替え") end #-------------------------------------------------------------------------- # ○ キーヘルプを設定 2 #-------------------------------------------------------------------------- def set_keyhelp2 @bottomkeyhelp_window.clear @bottomkeyhelp_window.add("←,B","戻る") @bottomkeyhelp_window.add("C","一人目を選択") end #-------------------------------------------------------------------------- # ○ キーヘルプを設定 3 #-------------------------------------------------------------------------- def set_keyhelp3 @bottomkeyhelp_window.clear @bottomkeyhelp_window.add("B","戻る") @bottomkeyhelp_window.add("C","ニ人目を選択") end end #============================================================================== # □ Window_BottomKeyHelp #------------------------------------------------------------------------------ # 画面下で操作説明をする透明なウィンドウです。 #============================================================================== class Window_BottomKeyHelp < Window_Base #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 432, 640, 64) self.contents = Bitmap.new(width - 32, height - 32) self.opacity = 0 clear end #-------------------------------------------------------------------------- # ○ クリア #-------------------------------------------------------------------------- def clear self.contents.clear @now_x = 608 end #-------------------------------------------------------------------------- # ○ 追加 #-------------------------------------------------------------------------- def add(key, explanation) # 計算 self.contents.font.size = 20 x = self.contents.text_size(key).width self.contents.font.size = 16 x += self.contents.text_size(explanation).width + 8 @now_x -= x # 描写 self.contents.font.size = 20 self.contents.font.color = system_color self.contents.draw_text(@now_x, 0, x, 32, key, 0) self.contents.font.size = 16 self.contents.font.color = normal_color self.contents.draw_text(@now_x, 0, x, 32, explanation, 2) # 余白 @now_x -= 32 end end