# ▼▲▼ XRXS26BX. +BUZZデザイン ▼▲▼ built 033109 # by 桜雅 在土 # by かーい # ▼▲▼ XRXS_MP17. ターゲットにメニューステータス ▼▲▼ # by 桜雅 在土 #============================================================================== # □ カスタマイズポイント #============================================================================== module XRXS26 # # 「能力値を表示しないアクター」IDの配列 # NO_PARAMETER_ACTORS = [] RECT_HEIGHT = 72 HEIGHT_DOWN = -8 end #============================================================================== # ■ Window_MenuStatus #============================================================================== class Window_MenuStatus < Selectable_Nomove #-------------------------------------------------------------------------- # ○ インクルード #-------------------------------------------------------------------------- include XRXS26 include XRXS_Cursor2 #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :newitem_window attr_reader :bottomkeyhelp_window attr_accessor :top_window attr_accessor :top_sprite #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(160, 36, 480, 372) self.contents = Bitmap.new(width - 32, RECT_HEIGHT * FRONT_MEMBER_LIMIT) refresh self.cursor_height = RECT_HEIGHT self.active = false self.index = -1 # ボトムキーヘルプウィンドウ @bottomkeyhelp_window = Window_BottomKeyHelp.new @bottomkeyhelp_window.visible = false # トップウィンドウ @top_window = Window_Base.new(160, 0, 480, 36) @top_window.visible = $scene.is_a?(Scene_Menu) @top_window.z = 105 @top_sprite = Sprite.new @top_sprite.x = 176 @top_sprite.y = 4 @top_sprite.z = 107 @top_sprite.visible = $scene.is_a?(Scene_Menu) @top_sprite.bitmap = Bitmap.new(480, 64) @top_sprite.bitmap.font.size = 16 @top_sprite.bitmap.font.color = system_color @top_sprite.bitmap.draw_text(4, 0, 92, 28, "戦闘メンバー") @top_sprite.bitmap.draw_text(224, 0, 92, 28, "待機メンバー") end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.size = 16 self.contents.font.color = system_color @item_max = $game_party.actors.size @column_max = 1 y = (FRONT_MEMBER_LIMIT + 1) / 2 * RECT_HEIGHT + 28 for i in 0...$game_party.actors.size y = i % FRONT_MEMBER_LIMIT * RECT_HEIGHT + HEIGHT_DOWN actor = $game_party.actors[i] if i >= FRONT_MEMBER_LIMIT x = 280 self.contents.font.color = disabled_color self.contents.draw_text(x, y, 120, 32, actor.name) else x = 64 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) if self.class.method_defined?("draw_actor_ssp") draw_actor_ssp(actor, x + 28, y + 32) draw_actor_sp(actor, x + 28, y + 48) draw_actor_state(actor, x + 28, y + 64) else draw_actor_sp(actor, x + 28, y + 32) draw_actor_state(actor, x + 28, y + 48) end end end end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update # ウィンドウを更新 @bottomkeyhelp_window.update super end #-------------------------------------------------------------------------- # ○ 解放 #-------------------------------------------------------------------------- def dispose @bottomkeyhelp_window.dispose @top_window.dispose @top_sprite.bitmap.dispose @top_sprite.dispose super end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super # カーソルの移動が可能な状態の場合 if self.active and @item_max > 0 and @index >= 0 if Input.repeat?(Input::DOWN) # 列数が 1 かつ 方向ボタンの下の押下状態がリピートでない場合か、 # またはカーソル位置が(項目数 - 列数)より前の場合 if (@column_max == 1 and Input.trigger?(Input::DOWN)) or @index < @item_max - @column_max # カーソルを下に移動 $game_system.se_play($data_system.cursor_se) @index = (@index + @column_max) % @item_max end end # 方向ボタンの上が押された場合 if Input.repeat?(Input::UP) # 列数が 1 かつ 方向ボタンの上の押下状態がリピートでない場合か、 # またはカーソル位置が列数より後ろの場合 if (@column_max == 1 and Input.trigger?(Input::UP)) or @index >= @column_max # カーソルを上に移動 $game_system.se_play($data_system.cursor_se) @index = (@index - @column_max + @item_max) % @item_max end end # 方向ボタンの右が押された場合 if Input.repeat?(Input::RIGHT) or Input.repeat?(Input::LEFT) if @index + FRONT_MEMBER_LIMIT < BACKWARD_MEMBER_LIMIT # カーソルを右に移動 $game_system.se_play($data_system.cursor_se) @index += FRONT_MEMBER_LIMIT elsif @index < FRONT_MEMBER_LIMIT * 2 and @index >= FRONT_MEMBER_LIMIT # カーソルを左に移動 $game_system.se_play($data_system.cursor_se) @index -= FRONT_MEMBER_LIMIT end end end # カーソルの矩形を更新 update_cursor_rect end #-------------------------------------------------------------------------- # ● 1 ページに表示できる行数の取得 #-------------------------------------------------------------------------- def page_row_max # ウィンドウの高さから、フレームの高さ 24 を引き、1 行の高さで割る return (self.height - 24) / @cursor_height end #-------------------------------------------------------------------------- # ● カーソルの矩形更新 #-------------------------------------------------------------------------- def update_cursor_rect if @index < 0 self.cursor_rect.empty else if(@index >= FRONT_MEMBER_LIMIT) # 現在の行を取得 row = @index - FRONT_MEMBER_LIMIT else # 現在の行を取得 row = @index end # 現在の行が、表示されている先頭の行より前の場合 if row < self.top_row # 現在の行が先頭になるようにスクロール self.top_row = row end # 現在の行が、表示されている最後尾の行より後ろの場合 if row > self.top_row + (self.page_row_max - 1) # 現在の行が最後尾になるようにスクロール self.top_row = row - (self.page_row_max - 1) end if @index >= FRONT_MEMBER_LIMIT y = (@index - self.top_row - FRONT_MEMBER_LIMIT) * RECT_HEIGHT + 4 + HEIGHT_DOWN self.cursor_rect.set(224, y, 224, RECT_HEIGHT) else y = (@index - self.top_row) * RECT_HEIGHT + 4 + HEIGHT_DOWN self.cursor_rect.set(0, y, 224, RECT_HEIGHT) end 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("X","入れ替え") end #-------------------------------------------------------------------------- # ○ キーヘルプを設定 2 #-------------------------------------------------------------------------- def set_keyhelp2 @bottomkeyhelp_window.clear @bottomkeyhelp_window.add("X,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(160, 416, 480, 64) self.contents = Bitmap.new(width - 32, height - 32) self.z = 105 self.opacity = 0 clear end #-------------------------------------------------------------------------- # ○ クリア #-------------------------------------------------------------------------- def clear self.contents.clear @now_x = 340 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 #============================================================================== # □ Window_MenuStatusTarget #============================================================================== class Window_MenuStatusTarget < Window_MenuStatus #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :column_max # 列数 attr_reader :item_max # アイテム数 #-------------------------------------------------------------------------- # ○ カーソルの矩形更新 #-------------------------------------------------------------------------- def update_cursor_rect # カーソル位置 -1 は全選択、-2 以下は単独選択 (使用者自身) if @index <= -2 @index += 10 super @index -= 10 elsif @index == -1 self.cursor_rect.set(0, 0, self.width - 32, self.height - 32) else super end end end #============================================================================== # ■ Window_Target #============================================================================== class Window_Target < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias xrxs_mp17_initialize initialize def initialize # 呼び戻す xrxs_mp17_initialize # メニューステータスウィンドウを完全寄生 @status_window = Window_MenuStatusTarget.new @status_window.refresh @column_max = @status_window.column_max @item_max = @status_window.item_max # 設定変更 self.opacity = 0 self.contents_opacity = 0 @status_window.visible = false @status_window.x = 640 - @status_window.width @status_window.z = 500 end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- alias xrxs_mp17_refresh refresh def refresh # 呼び戻す xrxs_mp17_refresh # @status_window.refresh unless @status_window.nil? end #-------------------------------------------------------------------------- # ○ アクティブ状態 #-------------------------------------------------------------------------- def active=(bool) super @status_window.active = bool end #-------------------------------------------------------------------------- # ○ 可視状態 #-------------------------------------------------------------------------- def visible=(bool) super @status_window.visible = bool @status_window.top_window.visible = bool @status_window.top_sprite.visible = bool end #-------------------------------------------------------------------------- # ○ カーソル位置 #-------------------------------------------------------------------------- def index=(i) super @index = i @status_window.index = i end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update # ウィンドウを更新 @status_window.update super end #-------------------------------------------------------------------------- # ○ 解放 #-------------------------------------------------------------------------- def dispose @status_window.dispose super end end #============================================================================== # ■ Scene_PartyChange #============================================================================== class Scene_PartyChange alias :xrxs26b_initialize :initialize #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize xrxs26b_initialize @status_window.top_window.x = 80 end end