Code: |
#============================================================================== # ■ Anuaire # Pokemon SoulDarkness DS - DragonStarX45 # 23/08/12 #------------------------------------------------------------------------------ class ANUAIRE< Window_Base include POKEMON_S def initialize super(0, 200, 480, 64) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize @commands = ["Personages principaux", "Personages secondaire", "Quitter"] @item_max = @commands.size @column_max = 3 refresh # Appelle de la méthode "refresh" self.index = 0 end # Fin de la méthode def refresh self.contents.clear # Boucle pour afficher chaque commande for i in 0...@item_max # Position X selon i x = 4 + i * 160 # Taille du texte text_size = self.contents.text_size(@commands[i]).width # Affichage du texte. self.contents.draw_text(x, 0, text_size, 32, @commands[i]) end end end |
Code: |
#============================================================================== # ■ Pokemon_Menu # Pokemon Script Project - Krosk # 18/07/07 # 22/02/10 - Palbolsky #----------------------------------------------------------------------------- # Scène modifiable #----------------------------------------------------------------------------- # Menu principal accessible par échap #----------------------------------------------------------------------------- module POKEMON_S class Pokemon_Menu < Window_Base #-------------------------------------------------------------------------- # #-------------------------------------------------------------------------- def initialize(menu_index = 0) @menu_index = menu_index super(0,0,640,480) self.contents = Bitmap.new(width - 32, height - 32) self.opacity = 0 self.z = 11 end #-------------------------------------------------------------------------- # #-------------------------------------------------------------------------- def main @spriteset = Spriteset_Map.new @interface = Interface_Echap.new if POKEMON_S::VIEWER_TEAM @pkmn_team = Pokemon_Equipe.new end s1 = "POKéDEX" s3 = "POKéMON" s5 = "SAC" s7 = "ANUAIRE" s2 = Player.name s4 = "SAUVER" s6 = "OPTIONS" s8 = "QUITTER" s9 = "Anuaire" @command_window = Window_Command.new(80, [s1, s2, s3, s4, s5, s6, s7, s9], $fontsizebig, 2, 14) @command_window.index = @menu_index @command_window.x = 480 - 169 - 123 + 200 @command_window.y = 28 - 20 @command_window.z = 10000 @command_window.visible = false @selecteur = Sprite.new @selecteur.z = 200 if $color_menu == 1 or $color_menu == nil # Vert @string = "_rouge" elsif $color_menu == 0 # Bleu @string = "_vert" elsif $color_menu == 2 # Rouge @string = "_bleu" end @selecteur.bitmap = RPG::Cache.picture("Menu Echap/selector_menu" + @string) if @command_window.index == 0 @selecteur.x = 37 @selecteur.y = 249 elsif @command_window.index == 2 @selecteur.x = 37 @selecteur.y = 289 elsif @command_window.index == 4 @selecteur.x = 37 @selecteur.y = 329 elsif @command_window.index == 6 @selecteur.x = 37 @selecteur.y = 369 end if @command_window.index == 1 @selecteur.x = 117 @selecteur.y = 249 elsif @command_window.index == 3 @selecteur.x = 117 @selecteur.y = 289 elsif @command_window.index == 5 @selecteur.x = 117 @selecteur.y = 329 elsif @command_window.index == 9 @selecteur.x = 117 @selecteur.y = 369 end if $pokemon_party.size == 0 # Enlève accès Equipe @command_window.disable_item(2) end if not($data_pokedex[0]) # Enlève accès Pokédex si non possédé @command_window.disable_item(0) end if $game_system.save_disabled @command_window.disable_item(5) end @command_window.disable_item(5) Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @command_window.dispose @spriteset.dispose @selecteur.dispose @interface.dispose @pkmn_team.dispose if not @pkmn_team.nil? Graphics.freeze end #-------------------------------------------------------------------------- # #-------------------------------------------------------------------------- def update if @command_window.index == 0 @selecteur.x = 37 @selecteur.y = 249 elsif @command_window.index == 2 @selecteur.x = 37 @selecteur.y = 289 elsif @command_window.index == 4 @selecteur.x = 37 @selecteur.y = 329 elsif @command_window.index == 6 @selecteur.x = 37 @selecteur.y = 369 elsif @command_window.index == 1 @selecteur.x = 117 @selecteur.y = 249 elsif @command_window.index == 3 @selecteur.x = 117 @selecteur.y = 289 elsif @command_window.index == 5 @selecteur.x = 117 @selecteur.y = 329 elsif @command_window.index == 9 @selecteur.x = 117 @selecteur.y = 369 end # ウィンドウを更新 @command_window.update @spriteset.update @selecteur.update @interface.update # コマンドウィンドウがアクティブの場合: update_command を呼ぶ if @command_window.active update_command return end end def dispose super end #-------------------------------------------------------------------------- # ● フレーム更新 (コマンドウィンドウがアクティブの場合) #-------------------------------------------------------------------------- def update_command # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # マップ画面に切り替え $scene = Scene_Map.new self.contents.clear 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 # Pokédex if not($data_pokedex[0]) $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) $scene = Pokemon_Pokedex.new self.contents.clear when 2 # Menu if $pokemon_party.size == 0 $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) $scene = Pokemon_Party_Menu.new when 4 # Sac $game_system.se_play($data_system.decision_se) $scene = Pokemon_Item_Bag.new when 6 # Pokématos if $game_switches[9] == false $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) $scene = Pokematos.new when 1 # Carte dresseur $game_system.se_play($data_system.decision_se) $game_temp.common_event_id = 19 $scene = Scene_Map.new when 3 # Sauvegarde if $game_system.save_disabled $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) $scene = Pokemon_Save.new self.contents.clear when 5 # OPTIONS $game_system.se_play($data_system.decision_se) $scene = OPTION.new end return when 9 # ANNUAIRE $game_system.se_play($data_system.decision_se) $scene = ANUAIRE.new end return end end end end |
Code: |
when 5 # OPTIONS $game_system.se_play($data_system.decision_se) $scene = OPTION.new return when 9 # ANNUAIRE $game_system.se_play($data_system.decision_se) $scene = ANUAIRE.new return end end end end end |
Opale a écrit: | ||
Pour ton deuxième problème, je pense que ton code devrais s'écrire comme ça à la fin :
|
Code: |
def initialize(index = 0) @index = index #... suite de ton script |
Code: |
def main Graphics.transition loop do Graphics.update Input.update update while $scene != self break end end Graphics.freeze dispose # Si tu as une def dispose après Graphics.freeze end |
Code: |
class ANUAIRE attr_accessor :index def initialize(index = 0) @index = index @fond = Sprite.new @fond.bitmap = RPG::Cache.picture("nom_de_limage.png") # Faut bien que ton annuaire ait un fond ! # Suite du script... Tu enlèves refresh. |
Code: |
def main Graphics.transition loop do Graphics.update Input.update update while $scene != self break end end Graphics.freeze dispose # Si tu as une def dispose après Graphics.freeze end |
Code: |
@command.update @item_max.update @column_max.update |
Code: |
def dispose @command.dispose @item_max.dispose @column_max.dispose end |
Code: |
$scene = ANUAIRE.new |