#============================================================================== # ショップテンプレ [タイプA用 オプション (メッセージ追加)] ver1.00 (2007/9/6) #   by 水夜 Zenith Creation (http://zenith.ifdef.jp/) #============================================================================== module SHOP # ここはそのままにしておいてください SUB_MESSAGES = [] #============================================================================== # □ カスタマイズポイント #============================================================================== # メッセージ追加 SUB_MESSAGES[変数の値][状況] = "メッセージ" # #===================================================================== # ※ 「状況」 # 0:個数入力決定時, 1:個数入力キャンセル時 #===================================================================== # # ※ 必ずしも両方設定する必要はありません。 # (設定していない場合は通常通りアイテムの説明文が表示されます) # ↓ 店員 ID 0 SUB_MESSAGES[0] = [] # メッセージ設定の前に必ず左のように記述してください。 SUB_MESSAGES[0][0] = "ありがとうございます" SUB_MESSAGES[0][1] = "あれ、やめるんですか?" #============================================================================== # □ カスタマイズポイント終了 #============================================================================== end class Window_ShopHelp < Window_Base #-------------------------------------------------------------------------- # ● テキスト設定 #-------------------------------------------------------------------------- def set_text(text, align = 0) # テキストとアラインメントの少なくとも一方が前回と違っている場合 if text != @text or align != @align # テキストを再描画 self.contents.clear self.contents.font.color = SHOP::HELP_COLOR self.contents.draw_text(4, 0, self.width - 40, 32, text, align) @text = text @align = align @actor = nil end end end class Scene_Shop #-------------------------------------------------------------------------- # ● メイン処理 #-------------------------------------------------------------------------- alias option_main main def main @help_window2 = Window_ShopHelp.new @help_window2.visible = false option_main @help_window2.dispose end #-------------------------------------------------------------------------- # ● 店員ピクチャをセット #-------------------------------------------------------------------------- def set_picture(index = 0, forced = false) # 強制変更ではなくて、カウントが残っている場合 終了 if !forced and @picture_count != nil return end # 画像が無効なら終了 if @storekeeper_name == nil return end # 画像名取得 if @storekeeper_name.is_a?(Array) picture_name = @storekeeper_name[index] else picture_name = @storekeeper_name end # カウント・メッセージ設定 case index when 0, 1, 2 @picture_count = nil @help_window.visible = true @help_window2.visible = false text_set = false when 3 @picture_count = SHOP::DECIDE_TIME * 2 text_set = set_message(1) when 4 @picture_count = SHOP::CANCEL_TIME * 2 text_set = set_message(2) end # 画像を変える必要がなければ終了 if picture_name == @pre_keeper_name @picture_count = nil unless text_set return end # 画像変更 case SHOP::PICTURES_FOLDER when 1 @storekeeper.bitmap = RPG::Cache.picture(picture_name) when 2 @storekeeper.bitmap = RPG::Cache.battler(picture_name, 0) end @pre_keeper_name = picture_name end #-------------------------------------------------------------------------- # ● 店員メッセージをセット #-------------------------------------------------------------------------- alias option_set_message set_message def set_message(index = 0) if index == 0 option_set_message(index) if @picture_count == nil @help_window.visible = true @help_window2.visible = false end return true end texts = SHOP::SUB_MESSAGES[$game_variables[SHOP::VARIABLE_ID]] text = texts[index-1] if text == nil return false end @help_window2.set_text(text) @help_window.visible = false @help_window2.visible = true return true end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update # ピクチャ更新 if @picture_count != nil @picture_count -= 1 if @picture_count < 0 @picture_count = nil if @command_window.active set_picture(0) set_message(0) elsif @buy_window.active or @sell_window.active set_picture(1) elsif @number_window.active set_picture(2) end @help_window.visible = true @help_window2.visible = false end end # ウィンドウを更新 @help_window.update @command_window.update @gold_window.update @dummy_window.update @buy_window.update @sell_window.update @number_window.update @status_window.update # コマンドウィンドウがアクティブの場合: update_command を呼ぶ if @command_window.active update_command return end # 購入ウィンドウがアクティブの場合: update_buy を呼ぶ if @buy_window.active update_buy return end # 売却ウィンドウがアクティブの場合: update_sell を呼ぶ if @sell_window.active update_sell return end # 個数入力ウィンドウがアクティブの場合: update_number を呼ぶ if @number_window.active update_number return end end end