Class: UI::Storage::PartyStack
- Inherits:
-
UI::SpriteStack
- Object
- UI::SpriteStack
- UI::Storage::PartyStack
- Defined in:
- scripts/01450 Systems/00200 Storage/00002 UI_Storage/00202 PartyStack.rb
Overview
Stack responsive of showing a party
Constant Summary collapse
- SLOT_IMAGES =
List of images according to the mode
{ pokemon: 'pc/party_pkmn', item: 'pc/party_items', battle: 'pc/party_battle' }
- POKEMON_COORDINATES =
List of coordinate for Pokemon sprite
[ [224, 64], [272, 80], [224, 112], [272, 128], [224, 160], [272, 176] ]
Constants inherited from UI::SpriteStack
UI::SpriteStack::NO_INITIAL_IMAGE
Instance Attribute Summary collapse
-
#mode ⇒ Symbol
Get the current mode.
Attributes inherited from UI::SpriteStack
#animated, #data, #moving, #stack, #viewport, #x, #y
Instance Method Summary collapse
-
#data=(data)
Update the data.
-
#gray_pokemon {|pokemon| ... }
Make the pokemon gray depending on a criteria.
-
#hovering_left_arrow? ⇒ Boolean
Tell if the left arrow is hovered.
-
#hovering_right_arrow? ⇒ Boolean
Tell if the right arrow is hovered.
-
#initialize(viewport, mode_handler, selection_handler) ⇒ PartyStack
constructor
Create a new party stack.
-
#pokemon_sprites ⇒ Array<Sprite>
Get the Pokemon sprites.
-
#update_selection(selection)
Update the selection.
Methods inherited from UI::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, mode_handler, selection_handler) ⇒ PartyStack
Create a new party stack
20 21 22 23 24 25 26 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00202 PartyStack.rb', line 20 def initialize(, mode_handler, selection_handler) super() create_stack mode_handler.add_mode_ui(self) selection_handler.party_selection_display = self @selection = [] end |
Instance Attribute Details
#mode ⇒ Symbol
Get the current mode
7 8 9 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00202 PartyStack.rb', line 7 def mode @mode end |
Instance Method Details
#data=(data)
Update the data
40 41 42 43 44 45 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00202 PartyStack.rb', line 40 def data=(data) super update_selection(@selection) self.mode = @mode @box_name.visible = @mode == :battle end |
#gray_pokemon {|pokemon| ... }
Make the pokemon gray depending on a criteria
49 50 51 52 53 54 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00202 PartyStack.rb', line 49 def gray_pokemon @pokemon_icons.each_with_index do |icon, index| pokemon = @data.content[index] icon.shader = (pokemon && yield(pokemon) ? @gray_shader : nil) end end |
#hovering_left_arrow? ⇒ Boolean
Tell if the left arrow is hovered
74 75 76 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00202 PartyStack.rb', line 74 def hovering_left_arrow? @left_arrow.simple_mouse_in? end |
#hovering_right_arrow? ⇒ Boolean
Tell if the right arrow is hovered
80 81 82 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00202 PartyStack.rb', line 80 def hovering_right_arrow? @right_arrow.simple_mouse_in? end |
#pokemon_sprites ⇒ Array<Sprite>
Get the Pokemon sprites
68 69 70 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00202 PartyStack.rb', line 68 def pokemon_sprites @pokemon_shadows end |
#update_selection(selection)
Update the selection
30 31 32 33 34 35 36 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00202 PartyStack.rb', line 30 def update_selection(selection) @select_buttons.each_with_index do |, index| .visible = selected = selection.include?(index) @pokemon_icons[index].y = @pokemon_shadows[index].y - (selected ? 4 : 0) end @selection = selection end |