#============================================================================== # ○リストからコモンイベントを起動させます #作成者:riru/ガラス細工の夢幻 #http://garasuzaikunomugen.web.fc2.com/index.html #============================================================================== #再生する、コモンID RIRU_COMMON_LIST = [1,143,145,144,147] #ウィンドウ上の説明文 RIRU_COMMONSELECT_HELP = "再生したいコモンイベントを選んでください" #列数 RIRU_COMMONSELECT_COLUMN = 2 #ウィンドウの幅 RIRU_COMMONSELECT_WIDTH = 400 #------------------------------------------------------------------------------ #  コモンイベントの選択を行うクラスです。 #============================================================================== class Scene_Common_select < Scene_Base #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super create_menu_background @help_window = Window_Commonselecthelp.new((544-RIRU_COMMONSELECT_WIDTH)/2, 0) @commonselect_window = Window_Commonselect.new((544-RIRU_COMMONSELECT_WIDTH)/2) @commonselect_window.active = true end #-------------------------------------------------------------------------- # ● 終了処理 #-------------------------------------------------------------------------- def terminate super dispose_menu_background @help_window.dispose @commonselect_window.dispose end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super update_menu_background @commonselect_window.update if @commonselect_window.active decide_common_selection end end #-------------------------------------------------------------------------- # ● コモンイベントの決定 #-------------------------------------------------------------------------- def decide_common_selection if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) $game_temp.common_event_id = RIRU_COMMON_LIST[@commonselect_window.index] $scene = Scene_Map.new end end end #============================================================================== # ■ Window_commonselect #------------------------------------------------------------------------------ #  コモンイベントの一覧を表示するウィンドウです。 #============================================================================== class Window_Commonselect < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 #-------------------------------------------------------------------------- def initialize(x) super(x, WLH+32, RIRU_COMMONSELECT_WIDTH, 416-(WLH+32)) @column_max = RIRU_COMMONSELECT_COLUMN refresh self.index = 0 end #-------------------------------------------------------------------------- # ● アイテムの取得 #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # ● アイテムの取得 #-------------------------------------------------------------------------- def enabled return @enabled end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh @item_max = RIRU_COMMON_LIST.size create_contents for i in 0...@item_max next if RIRU_COMMON_LIST[index] == nil draw_item(i,RIRU_COMMON_LIST[i]) end end #-------------------------------------------------------------------------- # ● 項目の描画 # index : 項目番号 #-------------------------------------------------------------------------- def draw_item(index,id) name = $data_common_events[id].name rect = item_rect(index) self.contents.clear_rect(rect) self.contents.draw_text(rect, name,1) end end #============================================================================== # ■ Window_Commonselecthelp #------------------------------------------------------------------------------ #  説明を表示するウィンドウです。 #============================================================================== class Window_Commonselecthelp < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y) @width = RIRU_COMMONSELECT_WIDTH super(x, y, @width, WLH+32) refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.draw_text(0, y, @width - 32, WLH, RIRU_COMMONSELECT_HELP,1) end def update super refresh end end