Class: UI::Quest::Composition
- Inherits:
-
SpriteStack
- Object
- SpriteStack
- UI::Quest::Composition
- Defined in:
- scripts/01450 Systems/08000 Quest/00002 UI_Quest/09999 Composition.rb
Constant Summary
Constants inherited from SpriteStack
Instance Attribute Summary collapse
-
#button_state ⇒ Symbol
Get the current state of the button.
-
#scrollbar ⇒ UI::Quest::ScrollBar
Get the scrollbar element.
Attributes inherited from SpriteStack
#animated, #data, #moving, #stack, #viewport, #x, #y
Instance Method Summary collapse
-
#change_deployed_mode(mode)
Change the state in the deployed mode.
-
#change_mode_quest(mode)
Change the mode of the first button.
-
#current_list ⇒ QuestList?
Get the current QuestList.
-
#done? ⇒ Boolean
Tells if all animations are done.
-
#index ⇒ Integer
Get the current QuestList index.
-
#initialize(viewport, sub_viewport, sub_viewport2, quests) ⇒ Composition
constructor
Create the Composition of the scene.
-
#input_direction(direction, timing = :slow)
Input the direction of the scrolling.
-
#scroll_objective_list(direction)
Scroll through the objective list depending on the direction.
-
#swap_rewards(direction)
Swap through the rewards depending on the direction.
-
#update
Update all animations.
-
#update_category(new_category)
Update the current category and launch the corresponding procedure.
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_animation, #update_position, #visible, #visible=, #with_cache, #with_font, #with_surface, #z, #z=
Constructor Details
#initialize(viewport, sub_viewport, sub_viewport2, quests) ⇒ Composition
Create the Composition of the scene
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/09999 Composition.rb', line 16 def initialize(, , , quests) super() @viewport = @sub_viewport = @sub_viewport2 = @quests = quests @animation_handler = Yuki::Animation::Handler.new @category = :primary @state = :compact # Possible states being :compact and :deployed create_quest_list create_frame create_category_window create_arrow create_quest_description create_quest_current_objective create_quest_rewards create_quest_objective_list end |
Instance Attribute Details
#button_state ⇒ Symbol
Get the current state of the button
9 10 11 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/09999 Composition.rb', line 9 def @button_state end |
#scrollbar ⇒ UI::Quest::ScrollBar
Get the scrollbar element
6 7 8 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/09999 Composition.rb', line 6 def @scrollbar end |
Instance Method Details
#change_deployed_mode(mode)
Change the state in the deployed mode
105 106 107 108 109 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/09999 Composition.rb', line 105 def change_deployed_mode(mode) @description.visible = (mode == :descr) @rewards.visible = (mode == :rewards) @objective_list.visible = (mode == :objectives) end |
#change_mode_quest(mode)
Change the mode of the first button
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/09999 Composition.rb', line 85 def change_mode_quest(mode) reload_deployed_components if mode == :deployed animation = current_list.change_mode(mode) anim = Yuki::Animation coord = mode == :deployed ? 87 : -87 coord2 = mode == :deployed ? 63 : -63 animation.parallel_add(anim.scalar(0.5, @sub_viewport.rect, :height=, @sub_viewport.rect.height, @sub_viewport.rect.height + coord, distortion: :SMOOTH_DISTORTION)) objective_list_anim = anim.wait(0.12) objective_list_anim.play_before(anim.send_command_to(@sub_viewport2, :visible=, true)) if mode == :deployed objective_list_anim.play_before(anim.scalar(0.28, @sub_viewport2.rect, :height=, @sub_viewport2.rect.height, @sub_viewport2.rect.height + coord2, distortion: :SMOOTH_DISTORTION)) objective_list_anim.play_before(anim.send_command_to(@sub_viewport2, :visible=, false)) if mode != :deployed animation.parallel_add(objective_list_anim) animation.start @animation_handler[:deploy] = animation if animation end |
#current_list ⇒ QuestList?
Get the current QuestList
125 126 127 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/09999 Composition.rb', line 125 def current_list return @sym_to_list[@category] end |
#done? ⇒ Boolean
Tells if all animations are done
48 49 50 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/09999 Composition.rb', line 48 def done? return @animation_handler.done? end |
#index ⇒ Integer
Get the current QuestList index
68 69 70 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/09999 Composition.rb', line 68 def index return current_list.index end |
#input_direction(direction, timing = :slow)
Input the direction of the scrolling
75 76 77 78 79 80 81 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/09999 Composition.rb', line 75 def input_direction(direction, timing = :slow) return if current_list.last_index? && direction == :DOWN return if current_list.index == 0 && direction == :UP move_list(direction, timing) if @scrollbar.visible == true end |
#scroll_objective_list(direction)
Scroll through the objective list depending on the direction
119 120 121 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/09999 Composition.rb', line 119 def scroll_objective_list(direction) @objective_list.scroll_text(direction) end |
#swap_rewards(direction)
Swap through the rewards depending on the direction
113 114 115 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/09999 Composition.rb', line 113 def swap_rewards(direction) @rewards.scroll_rewards(direction) end |
#update
Update all animations
39 40 41 42 43 44 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/09999 Composition.rb', line 39 def update @arrow.update return if @animation_handler.empty? @animation_handler.update end |
#update_category(new_category)
Update the current category and launch the corresponding procedure
54 55 56 57 58 59 60 61 62 63 64 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/09999 Composition.rb', line 54 def update_category(new_category) return if @category == new_category old_category = @category @category = new_category @category_display.update_category_text(@category) swap_lists(old_category) update_arrow end |