# # 冒険メモ(RGSS2) #  (C)2007,2010 TYPE74RX-T # # ★ カスタマイズポイント:27~30行目 #============================================================================== # ★ 再定義ポイント #------------------------------------------------------------------------------ # class Scene_Menu # def create_command_window # def update_command_selection # class Scene_File # def return_scene # class Scene_End # def return_scene #============================================================================== #============================================================================== # ★ RX_T #------------------------------------------------------------------------------ #  素材用汎用モジュールです。 #============================================================================== module RX_T RX_MemoOption = 1 # 1:新しく登録されたメモが一番上に来る # 2:新しく登録されたメモが一番下に来る RX_Delimitation = "◆" # 区切りの印。 RX_MemoCommand = "メモ" # メニュー上に表示するメモコマンド名 RX_MemoSwitch = 0 # 指定のゲームスイッチがオンの時に使用可能にするか # 0:常時使用可能 end #============================================================================== # ■ Game_Party #------------------------------------------------------------------------------ #  パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク # ラスのインスタンスは $game_party で参照されます。 #============================================================================== class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias rx_rgss2m1_initialize initialize def initialize # メソッドを呼び戻す rx_rgss2m1_initialize @rx_memo = "" end #-------------------------------------------------------------------------- # ★ メモ #-------------------------------------------------------------------------- def rx_memo return @rx_memo end #-------------------------------------------------------------------------- # ★ メモの取得 #-------------------------------------------------------------------------- def rx_memo=(memo) @rx_memo = memo end end #============================================================================== # ■ Interpreter #------------------------------------------------------------------------------ #  イベントコマンドを実行するインタプリタです。このクラスは Game_System クラ # スや Game_Event クラスの内部で使用されます。 #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # ★ 注釈 #-------------------------------------------------------------------------- alias rx_rgss2m1_command_108 command_108 def command_108 # メモに記入する if @parameters[0].include?("メモ記入:") # メモの内容を取得(コマンド名は排除) get_memo = @parameters[0].sub("メモ記入:", "") i = 1 loop do # 次の行に文字列がある場合 if @list[@index+i].code == 408 get_memo += "\n" + @list[@index+i].parameters[0] i += 1 else break end end case RX_T::RX_MemoOption when 1 # 既存のメモを待避 copy_memo = $game_party.rx_memo # 新しく登録したメモが一番上に来るようにする $game_party.rx_memo = get_memo + "\n" + copy_memo when 2 # 新しく登録したメモが一番下に来るようにする $game_party.rx_memo += get_memo + "\n" end # 継続(競合対策) return true end # メモに区切りをつける if @parameters[0].include?("メモ区切り") # メモに区切りをつける case RX_T::RX_MemoOption when 1 # 既存のメモを待避 copy_memo = $game_party.rx_memo # 新しく登録したメモが一番上に来るようにする $game_party.rx_memo = " " + "\n" + RX_T::RX_Delimitation + "\n" + " " + "\n" + copy_memo when 2 # 新しく登録したメモが一番下に来るようにする $game_party.rx_memo += " " + "\n" + RX_T::RX_Delimitation + "\n" + " " + "\n" end # 継続(競合対策) return true end # 指定のメモを消去する if @parameters[0].include?("メモ消去:") # メモの内容を取得(コマンド名は排除) get_memo = @parameters[0].sub("メモ消去:", "") i = 1 loop do # 次の行に文字列がある場合 if @list[@index+i].code == 408 get_memo += "\n" + @list[@index+i].parameters[0] i += 1 else break end end # 指定のメモを消去する $game_party.rx_memo = $game_party.rx_memo.sub(get_memo, "") return true end # メモを全消去する if @parameters[0].include?("メモ全消去") # メモを全消去する $game_party.rx_memo = "" # 継続(競合対策) return true end # メソッドを呼び戻す rx_rgss2m1_command_108 end end #============================================================================== # ■ Window_RX_Memo #------------------------------------------------------------------------------ #  メモ画面で表示する、メモウィンドウです。 #============================================================================== class Window_RX_Memo < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor : アクター #-------------------------------------------------------------------------- def initialize super(0, 0, Graphics.width, Graphics.height) @memo_index = 0 @draw_limit = false @lines = (Graphics.height - 32) / WLH # メモを配列化 @memo = $game_party.rx_memo.split(/\s*\n\s*/) refresh end #-------------------------------------------------------------------------- # ● メモのインデックス #-------------------------------------------------------------------------- def memo_index return @memo_index end #-------------------------------------------------------------------------- # ● メモのインデックスの取得 #-------------------------------------------------------------------------- def memo_index=(index) @memo_index = index end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear # メモの最終行が見えたら進めたインデックスを戻す if @memo_index + @lines - 1 > @memo.size @memo_index -= 1 end # メモの初期位置から更に上に行こうとしたらインデックスを戻す @memo_index = 0 if @memo_index < 0 draw_memo_info end #-------------------------------------------------------------------------- # ● メモ情報の描画 # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_memo_info x = 0 y = 0 y2 = 0 self.contents.font.color = normal_color # 一行ずつ出力(画面に出力できる範囲のみ) for i in @memo_index..@memo.size self.contents.draw_text(x, y + WLH * y2, Graphics.width - 32, WLH, @memo[i]) # 描画中の Y 座標を求める drawing_y_locate = WLH * y2 + WLH + 32 # 最終行まで描画したら(一画面分ギリギリの場合を除く) if drawing_y_locate >= Graphics.height - WLH and @memo.size > @lines - 1 # メモの最終位置まで描画したらリミットフラグを立てる @draw_limit = true if @lines + @memo_index - 1 >= @memo.size # ウインドウの最下段に上下の操作方法を表示 @draw_limit ? mes = "↑:戻る" : mes = "↓:進む" mes = "↑:戻る ↓:進む" if @memo_index > 0 and not @draw_limit self.contents.draw_text(x, y + WLH * (y2 + 1), Graphics.width - 32, WLH, mes) # リミットフラグを解除してループを抜ける @draw_limit = false if @draw_limit break end y2 += 1 end end end #============================================================================== # ■ Scene_Menu #------------------------------------------------------------------------------ #  メニュー画面の処理を行うクラスです。 #============================================================================== class Scene_Menu < Scene_Base #-------------------------------------------------------------------------- # ● コマンドウィンドウの作成 #-------------------------------------------------------------------------- def create_command_window s1 = Vocab::item s2 = Vocab::skill s3 = Vocab::equip s4 = Vocab::status s5 = Vocab::save s6 = Vocab::game_end s7 = RX_T::RX_MemoCommand @command_window = Window_Command.new(160, [s1, s2, s3, s4, s7, s5, s6]) @command_window.index = @menu_index if $game_party.members.size == 0 # パーティ人数が 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(5, false) # セーブを無効化(元は4) end # ★ 特定のスイッチがオフの場合 @rx_memo = true if RX_T::RX_MemoSwitch > 0 and not $game_switches[RX_T::RX_MemoSwitch] @rx_memo = false @command_window.draw_item(4, false) # 冒険メモを無効化 end end #-------------------------------------------------------------------------- # ● コマンド選択の更新 #-------------------------------------------------------------------------- def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif 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 == 5 # 元は4 Sound.play_buzzer return elsif not @rx_memo 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_RX_Memo.new when 5 # セーブ $scene = Scene_File.new(true, false, false) when 6 # ゲーム終了 $scene = Scene_End.new end end end end #============================================================================== # ■ Scene_File #------------------------------------------------------------------------------ #  ファイル画面の処理を行うクラスです。 #============================================================================== class Scene_File < Scene_Base #-------------------------------------------------------------------------- # ● 元の画面へ戻る #-------------------------------------------------------------------------- def return_scene if @from_title $scene = Scene_Title.new elsif @from_event $scene = Scene_Map.new else $scene = Scene_Menu.new(5) # 元は4 end end end #============================================================================== # ■ Scene_End #------------------------------------------------------------------------------ #  ゲーム終了画面の処理を行うクラスです。 #============================================================================== class Scene_End < Scene_Base #-------------------------------------------------------------------------- # ● 元の画面へ戻る #-------------------------------------------------------------------------- def return_scene $scene = Scene_Menu.new(6) # 元は5 end end #============================================================================== # ■ Scene_RX_Memo #------------------------------------------------------------------------------ #  メモ画面の処理を行うクラスです。 #============================================================================== class Scene_RX_Memo < Scene_Base #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super create_menu_background @status_window = Window_RX_Memo.new end #-------------------------------------------------------------------------- # ● 終了処理 #-------------------------------------------------------------------------- def terminate super dispose_menu_background @status_window.dispose end #-------------------------------------------------------------------------- # ● 元の画面へ戻る #-------------------------------------------------------------------------- def return_scene $scene = Scene_Menu.new(4) end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update update_menu_background @status_window.update if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.repeat?(Input::DOWN) Sound.play_cursor @status_window.memo_index += 1 @status_window.refresh elsif Input.repeat?(Input::UP) Sound.play_cursor @status_window.memo_index -= 1 @status_window.refresh end super end end