| Villageois (Nv 2) |
 |
Inscrit le: 02 Sep 2008, 00:00 Messages: 24 Niveau RPG Maker: Assez bon Logiciel(s) préféré(s): ♥ : RM2k3 Point(s) Fort(s): Scripts d'interfaces // EventMaking Sexe: Masculin Points d'aide: 0/60
Créations :
Voir ses créations
|
Puis le Scene_Menu par celui-là : - Code: Tout sélectionner
#============================================================================== # ■ Scene_Menu #------------------------------------------------------------------------------ # Modifié par Nono II # 10/11/08 11:40 #==============================================================================
class Scene_Menu #-------------------------------------------------------------------------- # ● オブジェクト初期化 # menu_index : コマンドのカーソル初期位置 #-------------------------------------------------------------------------- def initialize(menu_index = 0) @menu_index = menu_index end #-------------------------------------------------------------------------- # ● メイン処理 #-------------------------------------------------------------------------- def main # コマンドウィンドウを作成 s1 = $data_system.words.item s2 = $data_system.words.skill s3 = $data_system.words.equip s4 = "État" s5 = "Suspendre" s6 = "Sauvegarder" s7 = "Quitter" @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6,s7]) @command_window.index = @menu_index # パーティ人数が 0 人の場合 if $game_party.actors.size == 0 # アイテム、スキル、装備、ステータスを無効化 @command_window.disable_item(0) @command_window.disable_item(1) @command_window.disable_item(2) @command_window.disable_item(3) end # セーブ禁止の場合 if $game_system.save_disabled # セーブを無効にする @command_window.disable_item(5) end
# ステータスウィンドウを作成 @status_window = Window_MenuStatus.new @status_window.x = 160 @status_window.y = 0 # トランジション実行 Graphics.transition # メインループ loop do # ゲーム画面を更新 Graphics.update # 入力情報を更新 Input.update # フレーム更新 update # 画面が切り替わったらループを中断 if $scene != self break end end # トランジション準備 Graphics.freeze # ウィンドウを解放 @command_window.dispose
@status_window.dispose end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update # ウィンドウを更新 @command_window.update
@status_window.update # コマンドウィンドウがアクティブの場合: update_command を呼ぶ if @command_window.active update_command return end # ステータスウィンドウがアクティブの場合: update_status を呼ぶ if @status_window.active update_status return end end #-------------------------------------------------------------------------- # ● フレーム更新 (コマンドウィンドウがアクティブの場合) #-------------------------------------------------------------------------- def update_command # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # マップ画面に切り替え $scene = Scene_Map.new return end # C ボタンが押された場合 if Input.trigger?(Input::C) # パーティ人数が 0 人で、セーブ、ゲーム終了以外のコマンドの場合 if $game_party.actors.size == 0 and @command_window.index < 4 # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # コマンドウィンドウのカーソル位置で分岐 case @command_window.index when 0 # アイテム # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # アイテム画面に切り替え $scene = Scene_Item.new when 1 # スキル # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # ステータスウィンドウをアクティブにする @command_window.active = false @status_window.active = true @status_window.index = 0 when 2 # 装備 # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # ステータスウィンドウをアクティブにする @command_window.active = false @status_window.active = true @status_window.index = 0 when 3 # ステータス # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # ステータスウィンドウをアクティブにする @command_window.active = false @status_window.active = true @status_window.index = 0 when 5 # セーブ # セーブ禁止の場合 if $game_system.save_disabled # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # セーブ画面に切り替え $scene = Scene_Save.new when 6 # ゲーム終了 # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # ゲーム終了画面に切り替え $scene = Scene_End.new when 4 $game_system.se_play($data_system.decision_se) $scene = Scene_Suspendre.new end return end end #-------------------------------------------------------------------------- # ● フレーム更新 (ステータスウィンドウがアクティブの場合) #-------------------------------------------------------------------------- def update_status # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # コマンドウィンドウをアクティブにする @command_window.active = true @status_window.active = false @status_window.index = -1 return end # C ボタンが押された場合 if Input.trigger?(Input::C) # コマンドウィンドウのカーソル位置で分岐 case @command_window.index when 1 # スキル # このアクターの行動制限が 2 以上の場合 if $game_party.actors[@status_window.index].restriction >= 2 # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # スキル画面に切り替え $scene = Scene_Skill.new(@status_window.index) when 2 # 装備 # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # 装備画面に切り替え $scene = Scene_Equip.new(@status_window.index) when 3 # ステータス # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # ステータス画面に切り替え $scene = Scene_Status.new(@status_window.index) end return end end end
Et enfin ajoutez celui-ci au-dessus de Main : - Code: Tout sélectionner
#============================================================================== # ■ Scene_Title #------------------------------------------------------------------------------ # Fait par Nono II # 10/11/08 11:40 #==============================================================================
class Window_Suspendre < Window_Base def initialize super(150,120,340,64) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = 26 refresh end def refresh self.contents.clear self.contents.font.color = normal_color self.contents.draw_text(-16, -12, 320, 56, "Voulez-vous suspendre votre partie ?", 2) end end
class Window_Attention < Window_Base def initialize super(150,100,340,260) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = 24 self.windowskin = RPG::Cache.windowskin("") refresh end def refresh self.contents.clear self.contents.font.color = Color.new(220,30,50,240) self.contents.font.size = 36 self.contents.draw_text(-96, -12, 320, 56, "Attention !", 2) self.contents.font.color = normal_color self.contents.font.size = 24 self.contents.draw_text(-16, 32, 320, 56, "N'oubliez pas de faire ", 1) self.contents.draw_text(-16, 56, 320, 56, '"Reprendre" lorsque vous', 1) self.contents.draw_text(-16, 80, 320, 56, "relancerez le jeu sinon vos", 1) self.contents.draw_text(-16, 104, 320, 56, "données seront perdues !", 1) end end
class Scene_Suspendre def write_save_data(file) characters = [] for i in 0...$game_party.actors.size actor = $game_party.actors[i] characters.push([actor.character_name, actor.character_hue]) end Marshal.dump(characters, file) Marshal.dump(Graphics.frame_count, file) $game_system.save_count += 1 $game_system.magic_number = $data_system.magic_number Marshal.dump($game_system, file) Marshal.dump($game_switches, file) Marshal.dump($game_variables, file) Marshal.dump($game_self_switches, file) Marshal.dump($game_screen, file) Marshal.dump($game_actors, file) Marshal.dump($game_party, file) Marshal.dump($game_troop, file) Marshal.dump($game_map, file) Marshal.dump($game_player, file) Marshal.dump($game_temp, file) end def delai(seconds) for i in 0...(seconds) sleep 1 Graphics.update end end def main @message = Window_Suspendre.new @msg = Window_Attention.new @msg.visible = false s1 = "Oui" s2 = "Non" @command = Window_Command.new(96,[s1,s2]) @command.x = 150 @command.y = 184 Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self break end end
Graphics.freeze
@command.dispose @message.dispose @msg.dispose end def update @command.update if Input.trigger?(Input::C) case @command.index when 0 $game_system.se_play($data_system.save_se) file = File.open("Pause.rxdata", "wb") write_save_data(file) file.close @command.visible = false @message.visible = false @msg.visible = true delai(4) exit when 1 $game_system.se_play($data_system.buzzer_se) $scene = Scene_Menu.new(4) end end if Input.trigger?(Input::B) $game_system.se_play($data_system.buzzer_se) $scene = Scene_Menu.new(4) end end def exit if Input.trigger?(Input::C) Audio.bgm_fade(800) Audio.bgs_fade(800) Audio.me_fade(800) $scene = nil end if Input.trigger?(Input::B) Audio.bgm_fade(800) Audio.bgs_fade(800) Audio.me_fade(800) $scene = nil end end end
Et voilà. J'espère que ça vous plaira ^^
|
|