Class: UI::Storage::Composition
- Inherits:
-
UI::SpriteStack
- Object
- UI::SpriteStack
- UI::Storage::Composition
- Defined in:
- scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb
Overview
Stack responsive of showing the full PC UI
Constant Summary
Constants inherited from UI::SpriteStack
UI::SpriteStack::NO_INITIAL_IMAGE
Instance Attribute Summary collapse
-
#box_index ⇒ Integer
readonly
Get the current box index.
-
#cursor_handler ⇒ CursorHandler
readonly
Get the cursor object.
-
#mode_handler ⇒ ModeHandler
readonly
Get the mode handler.
-
#party ⇒ Array<PFM::Pokemon>
Get the party.
-
#selection_handler ⇒ SelectionHandler
readonly
Get the selection handler.
-
#storage ⇒ PFM::Storage
Get the storage object.
-
#summary ⇒ Summary
readonly
Get the summary object.
Attributes inherited from UI::SpriteStack
#animated, #data, #moving, #stack, #viewport, #x, #y
Instance Method Summary collapse
-
#animate_left_arrow(middle_animation = nil)
Start animation for left arrow.
-
#animate_right_arrow(middle_animation = nil)
Start animation for right arrow.
-
#done? ⇒ boolean
Tell if the animation is done.
-
#hovering_box_option? ⇒ Boolean
Tell if the box option is hovered.
-
#hovering_left_arrow? ⇒ Boolean
Tell if the left arrow is hovered.
-
#hovering_mode_indicator? ⇒ Boolean
Tell if the mouse hover the mode indicator.
-
#hovering_party_left_arrow? ⇒ Boolean
Tell if the left arrow of party stack is hovered.
-
#hovering_party_right_arrow? ⇒ Boolean
Tell if the right arrow of party stack is hovered.
-
#hovering_pokemon_sprite? ⇒ Boolean
Tell if the mouse is hovering a pokemon sprite & update cursor index in consequence.
-
#hovering_right_arrow? ⇒ Boolean
Tell if the right arrow is hovered.
-
#hovering_selection_mode_indicator? ⇒ Boolean
Tell if the mouse hover the selection mode indicator.
-
#initialize(viewport, mode, selection_mode) ⇒ Composition
constructor
Create a new Composition.
-
#update
Update the composition state.
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_animation, #update_position, #visible, #visible=, #with_cache, #with_font, #with_surface, #z, #z=
Constructor Details
#initialize(viewport, mode, selection_mode) ⇒ Composition
Create a new Composition
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 30 def initialize(, mode, selection_mode) super() @mode_handler = ModeHandler.new(mode, selection_mode) @selection_handler = SelectionHandler.new(@mode_handler) # @type [Yuki::Animation::TimedAnimation] @animation = nil # @type [PFM::Storage] @storage = nil @party = nil @box_index = 0 create_stack @selection_handler.cursor = @cursor_handler end |
Instance Attribute Details
#box_index ⇒ Integer (readonly)
Get the current box index
16 17 18 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 16 def box_index @box_index end |
#cursor_handler ⇒ CursorHandler (readonly)
Get the cursor object
22 23 24 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 22 def cursor_handler @cursor_handler end |
#mode_handler ⇒ ModeHandler (readonly)
Get the mode handler
7 8 9 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 7 def mode_handler @mode_handler end |
#party ⇒ Array<PFM::Pokemon>
Get the party
10 11 12 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 10 def party @party end |
#selection_handler ⇒ SelectionHandler (readonly)
Get the selection handler
25 26 27 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 25 def selection_handler @selection_handler end |
#storage ⇒ PFM::Storage
Get the storage object
13 14 15 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 13 def storage @storage end |
#summary ⇒ Summary (readonly)
Get the summary object
19 20 21 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 19 def summary @summary end |
Instance Method Details
#animate_left_arrow(middle_animation = nil)
Start animation for left arrow
72 73 74 75 76 77 78 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 72 def animate_left_arrow(middle_animation = nil) arrow = @arrow_left @animation = Yuki::Animation::ScalarAnimation.new(0.05, arrow, :x=, arrow.x, arrow.x - 2) @animation.play_before(middle_animation) if middle_animation @animation.play_before(Yuki::Animation::ScalarAnimation.new(0.05, arrow, :x=, arrow.x - 2, arrow.x)) @animation.start end |
#animate_right_arrow(middle_animation = nil)
Start animation for right arrow
62 63 64 65 66 67 68 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 62 def animate_right_arrow(middle_animation = nil) arrow = @arrow_right @animation = Yuki::Animation::ScalarAnimation.new(0.05, arrow, :x=, arrow.x, arrow.x + 2) @animation.play_before(middle_animation) if middle_animation @animation.play_before(Yuki::Animation::ScalarAnimation.new(0.05, arrow, :x=, arrow.x + 2, arrow.x)) @animation.start end |
#done? ⇒ boolean
Tell if the animation is done
55 56 57 58 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 55 def done? all_done = @summary.done? && @cursor.done? return @animation ? all_done && @animation.done? : all_done end |
#hovering_box_option? ⇒ Boolean
Tell if the box option is hovered
133 134 135 136 137 138 139 140 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 133 def hovering_box_option? if @box_stack.box_option_hovered? @cursor.select_box = true return true else return false end end |
#hovering_left_arrow? ⇒ Boolean
Tell if the left arrow is hovered
150 151 152 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 150 def hovering_left_arrow? return @arrow_left.simple_mouse_in? end |
#hovering_mode_indicator? ⇒ Boolean
Tell if the mouse hover the mode indicator
121 122 123 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 121 def hovering_mode_indicator? return @mode_indicator.simple_mouse_in? end |
#hovering_party_left_arrow? ⇒ Boolean
Tell if the left arrow of party stack is hovered
162 163 164 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 162 def hovering_party_left_arrow? return @party_stack.hovering_left_arrow? end |
#hovering_party_right_arrow? ⇒ Boolean
Tell if the right arrow of party stack is hovered
156 157 158 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 156 def hovering_party_right_arrow? return @party_stack.hovering_right_arrow? end |
#hovering_pokemon_sprite? ⇒ Boolean
Tell if the mouse is hovering a pokemon sprite & update cursor index in consequence
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 100 def hovering_pokemon_sprite? if @cursor.inbox return true if @box_stack.pokemon_sprites[@cursor.index].simple_mouse_in? elsif !@cursor.select_box return true if @party_stack.pokemon_sprites[@cursor.index].simple_mouse_in? end index = @party_stack.pokemon_sprites.index(&:simple_mouse_in?) if index @cursor.force_index(false, index) return true end index = @box_stack.pokemon_sprites.index(&:simple_mouse_in?) if index @cursor.force_index(true, index) return true end return false end |
#hovering_right_arrow? ⇒ Boolean
Tell if the right arrow is hovered
144 145 146 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 144 def hovering_right_arrow? return @arrow_right.simple_mouse_in? end |
#hovering_selection_mode_indicator? ⇒ Boolean
Tell if the mouse hover the selection mode indicator
127 128 129 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 127 def hovering_selection_mode_indicator? return @selection_mode_indicator.simple_mouse_in? end |
#update
Update the composition state
45 46 47 48 49 50 51 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00100 Composition.rb', line 45 def update @summary.update @cursor.update return if !@animation || @animation.done? @animation.update end |