Al Maker Renard Moyen
Nombre de messages : 82 Age : 30 Localisation : A Marseille, est desfois dans le RMXP World Passion : Foot, ordi, jeux vidéos, sports... Date d'inscription : 12/06/2006
| Sujet: Confirmation de sauvegarde Mer 14 Juin - 23:02 | |
| Ce script permet de demander si on veut écraser une partie déjà sauvegardée. Allez dans "Scene_File" et ajoutez après la ligne 51, ceci : - Code:
-
if self.is_a?(Scene_Save) @confirm_window.dispose @yes_no_window.dispose end Ensuite, remplacez le script "Scene_Save" par celui-là : - Code:
-
class Scene_Save < Scene_File # ----------------------------- def initialize super("Save in which slot?") @confirm_window = Window_Base.new(120, 188, 400, 64) @confirm_window.contents = Bitmap.new(368, 32) string = "Really overwrite this file?" @confirm_window.contents.font.name = "Arial" @confirm_window.contents.font.size = 24 @confirm_window.contents.draw_text(4, 0, 368, 32, string) @yes_no_window = Window_Command.new(100, ["Yes", "No"]) @confirm_window.visible = false @confirm_window.z = 1500 @yes_no_window.visible = false @yes_no_window.active = false @yes_no_window.index = 1 @yes_no_window.x = 270 @yes_no_window.y = 252 @yes_no_window.z = 1500 @mode = 0 end # ----------------------------- def on_decision(filename) if FileTest.exist?(filename) @confirm_window.visible = true @yes_no_window.visible = true @yes_no_window.active = true @mode = 1 else .se_play(.save_se) file = File.open(filename, "wb") write_save_data(file) file.close if .save_calling .save_calling = false = Scene_Map.new return end = Scene_Menu.new(4) end end # ----------------------------- def update if @mode == 0 super else @help_window.update @yes_no_window.update if Input.trigger?(Input::C) .se_play(.decision_se) if @yes_no_window.index == 0 filename = make_filename(@file_index) .se_play(.save_se) file = File.open(filename, "wb") write_save_data(file) file.close if .save_calling .save_calling = false = Scene_Map.new else = Scene_Menu.new(4) end else @confirm_window.visible = false @yes_no_window.visible = false @yes_no_window.active = false @yes_no_window.index = 1 @mode = 0 end end if Input.trigger?(Input::B) @confirm_window.visible = false @yes_no_window.visible = false @yes_no_window.active = false @yes_no_window.index = 1 @mode = 0 return end end end # ----------------------------- def on_cancel .se_play(.cancel_se) if .save_calling .save_calling = false = Scene_Map.new return end = Scene_Menu.new(4) end # ----------------------------- def write_save_data(file) characters = [] for i in 0....actors.size actor = .actors[i] characters.push([actor.character_name, actor.character_hue]) end Marshal.dump(characters, file) Marshal.dump(Graphics.frame_count, file) .save_count += 1 .magic_number = .magic_number Marshal.dump(, file) Marshal.dump(, file) Marshal.dump(, file) Marshal.dump(, file) Marshal.dump(, file) Marshal.dump(, file) Marshal.dump(, file) Marshal.dump(, file) Marshal.dump(, file) Marshal.dump(, file) end end | |
|