Code: |
#============================================================================== # ■ Système d'options - Pokémon Script Project DS # By Thomas' - (Thomas6497) & Palbolsky # 29/03/10 #------------------------------------------------------------------------------ # $options[0] : vitesse # $options[1] : couleur du menu # $options[2] : animation # $options[3] : choix combat #=============================================================================== class OPTIONS < Window_Base include POKEMON_S def initialize(z_level = 100, mode = "navigation", index = 0) @z_level = z_level @mode = mode @index = index @amount = $options[4] super(0, 0, 640, 480) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize self.z = @z_level + 24 self.opacity = 0 end def main Graphics.freeze @spriteset = Spriteset_Map.new @background = Sprite.new @background.bitmap = RPG::Cache.picture("Options/OPTIONS_FOND.png") @background.z = @z_level @background.x = 13 @background.y = 13 string = @amount + 1 draw_text(127, 336, 100, 32, "TYPE " + string.to_s, 1) @dummy = Sprite.new @dummy.bitmap = RPG::Cache.picture(POKEMON_S::MSG) @dummy.x = 15 @dummy.y = 158 @dummy.z = @z_level + 23 @dummy.visible = false Graphics.transition loop do if $scene != self break end Graphics.update Input.update update end Graphics.freeze @background.dispose @dummy.dispose @spriteset.dispose self.contents.clear end def update if @mode == "navigation" self.contents.clear string = @amount + 1 draw_text(127, 336, 100, 32, "TYPE " + string.to_s, 1) if Input.trigger?(Input::B) # Quitter $game_system.se_play($data_system.cancel_se) $scene = Pokemon_Menu.new(5) return end if @index == 0 # Vitesse défilement texte @background.bitmap = RPG::Cache.picture("Options/Vitesse.png") if Input.repeat?(Input::DOWN) $game_system.se_play($data_system.cursor_se) @index = 1 return end if Input.repeat?(Input::C) $game_system.se_play($data_system.decision_se) @mode = "vitesse" @index = $options[0] - 1 return end end if @index == 1 # Animations @background.bitmap = RPG::Cache.picture("Options/combat.png") if Input.repeat?(Input::DOWN) $game_system.se_play($data_system.cursor_se) @index = 2 return end if Input.repeat?(Input::UP) $game_system.se_play($data_system.cursor_se) @index = 0 return end if Input.repeat?(Input::C) $game_system.se_play($data_system.decision_se) @mode = "animations" if $options[2] == true @index = 0 elsif $options[2] == false @index = 1 end return end end if @index == 2 # Choix @background.bitmap = RPG::Cache.picture("Options/Style.png") if Input.repeat?(Input::UP) $game_system.se_play($data_system.cursor_se) @index = 1 return end if Input.repeat?(Input::DOWN) $game_system.se_play($data_system.cursor_se) @index = 3 return end if Input.repeat?(Input::C) $game_system.se_play($data_system.decision_se) @mode = "choix" if $options[3] == true @index = 0 elsif $options[3] == false @index = 1 end @curseur_E.visible = true return end end if @index == 3 # Messages @background.bitmap = RPG::Cache.picture("Options/Fenêtre.png") if Input.repeat?(Input::UP) $game_system.se_play($data_system.cursor_se) @index = 2 return end if Input.repeat?(Input::C) $game_system.se_play($data_system.decision_se) @mode = "message" @dummy.visible = true return end end if @mode == "vitesse" if Input.trigger?(Input::B) # Retour navigation $game_system.se_play($data_system.cancel_se) @mode = "navigation" @index = 0 return end if @index == 0 # Vitesse 1 @background.bitmap = RPG::Cache.picture("Options/Vitesse1.png") if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $options[0] = 1 return end if Input.repeat?(Input::RIGHT) $game_system.se_play($data_system.cursor_se) @index = 1 return end end if @index == 1 # Vitesse 2 @background.bitmap = RPG::Cache.picture("Options/Vitesse2.png") if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $options[0] = 2 return end if Input.repeat?(Input::LEFT) $game_system.se_play($data_system.cursor_se) @index = 0 return end if Input.repeat?(Input::RIGHT) $game_system.se_play($data_system.cursor_se) @index = 2 return end end if @index == 2 # Vitesse 3 @background.bitmap = RPG::Cache.picture("Options/vitesse3.png") if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $options[0] = 3 return end if Input.repeat?(Input::LEFT) $game_system.se_play($data_system.cursor_se) @index = 1 return end end end if @mode == "animations" if Input.trigger?(Input::B) # Retour navigation $game_system.se_play($data_system.cancel_se) @mode = "navigation" @curseur_C.visible = false @index = 1 return end if @index == 0 # Oui @background.bitmap = RPG::Cache.picture("Options/Combat1.png") if Input.repeat?(Input::RIGHT) $game_system.se_play($data_system.cursor_se) @index = 1 return end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $options[2] = true return end end if @index == 1 # Non @background.bitmap = RPG::Cache.picture("Options/Combat2.png") if Input.repeat?(Input::LEFT) $game_system.se_play($data_system.cursor_se) @index = 0 return end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $options[2] = false return end end end if @mode == "choix" if Input.trigger?(Input::B) # Retour navigation $game_system.se_play($data_system.cancel_se) @mode = "navigation" @curseur_E.visible = false @index = 3 return end if @index == 0 # Choix @background.bitmap = RPG::Cache.picture("Options/Style1.png") if Input.repeat?(Input::RIGHT) $game_system.se_play($data_system.cursor_se) @index = 1 return end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $options[3] = true return end end if @index == 1 # Defini @background.bitmap = RPG::Cache.picture("Options/Style2.png") if Input.repeat?(Input::LEFT) $game_system.se_play($data_system.cursor_se) @index = 0 return end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $options[3] = false return end end end if @mode == "message" self.contents.clear string = @amount + 1 draw_text(13, 140, 212, 32, "FENETRE TYPE " + string.to_s) draw_text(127, 336, 100, 32, "TYPE " + string.to_s, 1) @dummy.bitmap = RPG::Cache.picture("Messages/" + POKEMON_S::NAME_MSG.to_s + @amount.to_s) if Input.trigger?(Input::B) # Retour navigation $game_system.se_play($data_system.cancel_se) @mode = "navigation" @dummy.visible = false @index = 4 return end if Input.repeat?(Input::LEFT) $game_system.se_play($data_system.cursor_se) @amount -= 1 if @amount < 0 @amount = 0 end end if Input.repeat?(Input::RIGHT) $game_system.se_play($data_system.cursor_se) @amount += 1 if @amount > 16 @amount = 16 end end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $options[4] = @amount $options[5] = "Messages/" + POKEMON_S::NAME_MSG.to_s + $options[4].to_s + ".png" return end end end end end |