Class: UI::Storage::BoxStack
- Inherits:
-
UI::SpriteStack
- Object
- UI::SpriteStack
- UI::Storage::BoxStack
- Defined in:
- scripts/01450 Systems/00200 Storage/00002 UI_Storage/00200 BoxStack.rb
Overview
Stack responsive of showing a box
Constant Summary
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
-
#box_option_hovered? ⇒ Boolean
Tell if the name background is hovered in order to show the option menu.
-
#data=(data)
Update the data.
-
#gray_pokemon {|pokemon| ... }
Make the pokemon gray depending on a criteria.
-
#initialize(viewport, mode_handler, selection_handler) ⇒ BoxStack
constructor
Create a new box 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) ⇒ BoxStack
Create a new box stack
12 13 14 15 16 17 18 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00200 BoxStack.rb', line 12 def initialize(, mode_handler, selection_handler) super() @selection = [] create_stack mode_handler.add_mode_ui(self) selection_handler.box_selection_display = self end |
Instance Attribute Details
#mode ⇒ Symbol
Get the current mode
7 8 9 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00200 BoxStack.rb', line 7 def mode @mode end |
Instance Method Details
#box_option_hovered? ⇒ Boolean
Tell if the name background is hovered in order to show the option menu
22 23 24 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00200 BoxStack.rb', line 22 def box_option_hovered? return @name_background.simple_mouse_in? end |
#data=(data)
Update the data
38 39 40 41 42 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00200 BoxStack.rb', line 38 def data=(data) super self.mode = @mode update_selection(@selection) end |
#gray_pokemon {|pokemon| ... }
Make the pokemon gray depending on a criteria
46 47 48 49 50 51 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00200 BoxStack.rb', line 46 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 |
#pokemon_sprites ⇒ Array<Sprite>
Get the Pokemon sprites
62 63 64 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00200 BoxStack.rb', line 62 def pokemon_sprites @pokemon_shadows end |
#update_selection(selection)
Update the selection
28 29 30 31 32 33 34 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00200 BoxStack.rb', line 28 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 |