Class: UI::Storage::Summary
- Inherits:
-
UI::SpriteStack
- Object
- UI::SpriteStack
- UI::Storage::Summary
- Defined in:
- scripts/01450 Systems/00200 Storage/00002 UI_Storage/00203 Summary.rb
Overview
Stack responsive of showing a summary
Constant Summary collapse
- POSITION =
Position of the summary depending on the state
[ [210, 200], # Reduced [210, 10] # Developped ]
- LETTER_POSITION =
Position of the letter depending on the state
[ [1, 0], # Reduced [95, 15] # Developped ]
- TEXT_TRANSITION_TIME =
Time between each text transition
2
Constants inherited from UI::SpriteStack
UI::SpriteStack::NO_INITIAL_IMAGE
Instance Attribute Summary collapse
-
#reduced ⇒ Boolean
readonly
Tell if the UI is reduced or not.
Attributes inherited from UI::SpriteStack
#animated, #data, #moving, #stack, #viewport, #x, #y
Instance Method Summary collapse
-
#data=(pokemon)
Update the shown pokemon.
-
#done? ⇒ boolean
Tell if the animation is done.
-
#initialize(viewport, reduced) ⇒ Summary
constructor
Create a new summary object.
-
#no_egg(object)
Set an object invisible if the Pokemon is an egg.
-
#reduce
Reduce the UI (start animation).
-
#show
Show the UI (start animation).
-
#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, reduced) ⇒ Summary
Create a new summary object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00203 Summary.rb', line 23 def initialize(, reduced) super(, *POSITION[1]) # Initially in developped making easier to create the stack @reduced = reduced @invisible_if_egg = [] # @type [Yuki::Animation::TimedAnimation] @animation = nil @last_time = Graphics.current_time @last_text = 0 create_stack reset_text_visibility set_position(*POSITION[0]) if reduced end |
Instance Attribute Details
#reduced ⇒ Boolean (readonly)
Tell if the UI is reduced or not
7 8 9 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00203 Summary.rb', line 7 def reduced @reduced end |
Instance Method Details
#data=(pokemon)
Update the shown pokemon
53 54 55 56 57 58 59 60 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00203 Summary.rb', line 53 def data=(pokemon) super @pokemon = pokemon if @sprite.visible reset_text_visibility @invisible_if_egg.each { |sprite| sprite.visible = false } if @pokemon&.egg? end end |
#done? ⇒ boolean
Tell if the animation is done
64 65 66 67 68 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00203 Summary.rb', line 64 def done? return true unless @animation return @animation.done? end |
#no_egg(object)
Set an object invisible if the Pokemon is an egg
47 48 49 50 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00203 Summary.rb', line 47 def no_egg(object) @invisible_if_egg << object return object end |
#reduce
Reduce the UI (start animation)
71 72 73 74 75 76 77 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00203 Summary.rb', line 71 def reduce return if @reduced @animation = Yuki::Animation.move_discreet(0.2, self, *POSITION[1], *POSITION[0]) @animation.start @reduced = true end |
#show
Show the UI (start animation)
80 81 82 83 84 85 86 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00203 Summary.rb', line 80 def show return unless @reduced @animation = Yuki::Animation.move_discreet(0.2, self, *POSITION[0], *POSITION[1]) @animation.start @reduced = false end |
#update
Update the composition state
37 38 39 40 41 42 43 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00203 Summary.rb', line 37 def update @sprite&.update update_text_transition return if !@animation || @animation.done? @animation.update end |