Class: UI::TeamButton
- Inherits:
-
SpriteStack
- Object
- SpriteStack
- UI::TeamButton
- Defined in:
- scripts/01450 Systems/00102 Party/00002 UI/02000 UI__TeamButton.rb
Overview
Button that show basic information of a Pokemon
Constant Summary collapse
- CoordinatesY =
List of the Y coordinate of the button (index % 6), relative to the contents definition !
[0, 24, 64, 88, 128, 152]
- CoordinatesX =
List of the X coordinate of the button (index % 2), relative to the contents definition !
[0, 160]
- TextureBackgroundY =
List of the Y coordinate of the background textures
[0, 56, 112, 168]
- TextureBackgroundHeight =
Height of the background texture
56
Constants inherited from SpriteStack
Instance Attribute Summary collapse
-
#item_text ⇒ SymText
readonly
Get the Item text to perform specific operations.
-
#selected ⇒ Boolean
Get the selected state of the sprite.
Attributes inherited from SpriteStack
#animated, #data, #moving, #stack, #viewport, #x, #y
Instance Method Summary collapse
-
#data=(data)
Set the data of the SpriteStack.
-
#hide_item_name
Hide the item name.
-
#initialize(viewport, index) ⇒ TeamButton
constructor
Create a new Team button.
-
#refresh
Refresh the button.
-
#show_item_name
Show the item name.
-
#update_background
Update the background according to the selected state.
-
#update_graphics
Update the graphics.
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) ⇒ TeamButton
Create a new Team button
21 22 23 24 25 26 27 28 |
# File 'scripts/01450 Systems/00102 Party/00002 UI/02000 UI__TeamButton.rb', line 21 def initialize(, index) @index = index super(, *initial_coordinates) create_sprites @selected = false fix_initial_position_cause_dev_is_lazy end |
Instance Attribute Details
#item_text ⇒ SymText (readonly)
Get the Item text to perform specific operations
6 7 8 |
# File 'scripts/01450 Systems/00102 Party/00002 UI/02000 UI__TeamButton.rb', line 6 def item_text @item_text end |
#selected ⇒ Boolean
Get the selected state of the sprite
17 18 19 |
# File 'scripts/01450 Systems/00102 Party/00002 UI/02000 UI__TeamButton.rb', line 17 def selected @selected end |
Instance Method Details
#data=(data)
Set the data of the SpriteStack
32 33 34 35 36 |
# File 'scripts/01450 Systems/00102 Party/00002 UI/02000 UI__TeamButton.rb', line 32 def data=(data) super(data) update_item_text_visibility update_background end |
#hide_item_name
Hide the item name
62 63 64 |
# File 'scripts/01450 Systems/00102 Party/00002 UI/02000 UI__TeamButton.rb', line 62 def hide_item_name @item_sprite.visible = @item_text.visible = false end |
#refresh
Refresh the button
67 68 69 |
# File 'scripts/01450 Systems/00102 Party/00002 UI/02000 UI__TeamButton.rb', line 67 def refresh self.data = @data end |
#show_item_name
Show the item name
57 58 59 |
# File 'scripts/01450 Systems/00102 Party/00002 UI/02000 UI__TeamButton.rb', line 57 def show_item_name @item_sprite.visible = @item_text.visible = true end |
#update_background
Update the background according to the selected state
39 40 41 42 43 44 45 |
# File 'scripts/01450 Systems/00102 Party/00002 UI/02000 UI__TeamButton.rb', line 39 def update_background if @data.dead? @background.src_rect.y = TextureBackgroundY[@selected ? 3 : 2] else @background.src_rect.y = TextureBackgroundY[@selected ? 1 : 0] end end |
#update_graphics
Update the graphics
72 73 74 |
# File 'scripts/01450 Systems/00102 Party/00002 UI/02000 UI__TeamButton.rb', line 72 def update_graphics @icon.update end |