# # 冒険メモ・イベント呼び出し型(RGSS2) #  (C)2008,2009 TYPE74RX-T # # ★ カスタマイズポイント:27行目~(module RX_T内) #============================================================================== # ★ 再定義ポイント #------------------------------------------------------------------------------ # 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_OtherScenes = [] RX_OtherScenes[0] = "test1" # オリジナルのシーンクラスを入力します(rx_ad_memoは除く)。 RX_OtherScenes[1] = "test2" # shift+ctrlを押しながら「f」キーで全セクション検索できます。 RX_OtherScenes[2] = "test3" # 「$game_temp.next_scene =」で引っかかるものを RX_OtherScenes[3] = "test4" # ここに登録していきましょう(設定値は一例です)。 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?("冒険メモ") # 次のシーン呼び出し $game_temp.next_scene = "rx_ad_memo" @index += 1 return false 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 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_Map #------------------------------------------------------------------------------ #  マップ画面の処理を行うクラスです。 #============================================================================== class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # ★ 配列で指定した要素のうちのいずれかに一致しているか #-------------------------------------------------------------------------- def rx_rgss2m1_eqaror(nx_scene, array) result = false for i in 0...array.size if nx_scene == array[i] result = true break end end return result end #-------------------------------------------------------------------------- # ● 画面切り替えの実行 #-------------------------------------------------------------------------- alias rx_rgss2m1_update_scene_change update_scene_change def update_scene_change return if $game_player.moving? # プレイヤーの移動中? # ★ デフォルトのシーン群を配列化 rx_defo_nex_sc = ["battle", "shop", "name", "menu", "save", "debug", "gameover", "title"] rx_defo_nex_sc.concat(RX_T::RX_OtherScenes) # ★ 次のシーンがデフォルトで呼ばれるシーンのいずれにも当てはまらない場合 unless rx_rgss2m1_eqaror($game_temp.next_scene, rx_defo_nex_sc) # 冒険メモ画面呼び出しなら冒険メモ画面を呼ぶ call_rx_ad_memo if $game_temp.next_scene == "rx_ad_memo" return end # メソッドを呼び戻す rx_rgss2m1_update_scene_change end #-------------------------------------------------------------------------- # ★ 冒険メモ画面への切り替え #-------------------------------------------------------------------------- def call_rx_ad_memo $game_temp.next_scene = nil $scene = Scene_RX_Memo.new 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_Map.new 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