Class: UI::DexButton
- Inherits:
-
SpriteStack
- Object
- SpriteStack
- UI::DexButton
- Defined in:
- scripts/01450 Systems/00101 Dex/00002 UI/01400 Dex UIs.rb
Overview
Dex sprite that show the Pokemon infos
Constant Summary
Constants inherited from SpriteStack
Instance Attribute Summary
Attributes inherited from SpriteStack
#animated, #data, #moving, #stack, #viewport, #x, #y
Instance Method Summary collapse
-
#data=(pokemon)
Change the data.
-
#initialize(viewport, index) ⇒ DexButton
constructor
Create a new dex button.
-
#selected=(value)
Tell the button if it's selected or not : change the obfuscator visibility & x position.
Methods inherited from SpriteStack
#[], #add_background, #add_line, #add_text, #anime, #anime_delta_set, #dispose, #each, #execute_anime, #move, #move_to, #opacity, #opacity=, #push, #push_sprite, #set_origin, #set_position, #simple_mouse_in?, #size, #stop_animation, #translate_mouse_coords, #update, #update_animation, #update_position, #visible, #visible=, #with_cache, #with_font, #with_surface, #z, #z=
Constructor Details
#initialize(viewport, index) ⇒ DexButton
Create a new dex button
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'scripts/01450 Systems/00101 Dex/00002 UI/01400 Dex UIs.rb', line 94 def initialize(, index) # Create the sprite stack at coordinate 147, 62 using the RPG::Cache.pokedex as image source super(, 147, 62, default_cache: :pokedex) # Show the background image add_background('But_List') # Show the caught indicator @catch_icon = add_sprite(119, 9, 'Catch') # Show the Pokemon Icon Sprite add_sprite(17, 15, NO_INITIAL_IMAGE, type: PokemonIconSprite) # Show the Pokemon formated ID add_text(35, 1, 116, 16, :id_text3, type: SymText, color: 10) # Show the Pokemon name add_text(35, 16, 116, 16, :name, type: SymText, color: 10) # Show the obfuscator in forground when the Pokemon button is not @obfuscator = add_foreground('But_ListShadow') # Adjust the position according to the index set_position(index == 0 ? 147 : 163, y - 40 + index * 40) end |
Instance Method Details
#data=(pokemon)
Change the data
117 118 119 120 121 |
# File 'scripts/01450 Systems/00101 Dex/00002 UI/01400 Dex UIs.rb', line 117 def data=(pokemon) super(pokemon) # Change the catch visibility to the captured state of the Pokemon @catch_icon.visible = $pokedex.creature_caught?(pokemon.id) end |
#selected=(value)
Tell the button if it's selected or not : change the obfuscator visibility & x position
125 126 127 128 |
# File 'scripts/01450 Systems/00101 Dex/00002 UI/01400 Dex UIs.rb', line 125 def selected=(value) @obfuscator.visible = !value set_position(value ? 147 : 163, y) end |