Class: UI::Quest::QuestList
- Inherits:
-
SpriteStack
- Object
- SpriteStack
- UI::Quest::QuestList
- Defined in:
- scripts/01450 Systems/08000 Quest/00002 UI_Quest/00500 Quest_List.rb
Constant Summary collapse
- NB_QUEST_BUTTON =
Number of buttons generated
7
- BUTTON_OFFSET =
Offset between each button
28
- BASE_X =
Base X coordinate
19
- BASE_Y =
Base Y coordinate
41
Constants inherited from SpriteStack
Instance Attribute Summary collapse
- #buttons ⇒ Array<QuestButton> readonly
-
#index ⇒ Integer
Index of the current active item.
- #timing writeonly
Attributes inherited from SpriteStack
#animated, #data, #moving, #stack, #viewport, #x, #y
Instance Method Summary collapse
-
#change_mode(mode) ⇒ Yuki::Animation::ScalarAnimation
Change the right button mode and return the animation.
-
#initialize(viewport, quest_hash, category) ⇒ QuestList
constructor
Create a new QuestList.
-
#last_index? ⇒ Boolean
Tell if the current index is the same as the last quest for this category.
-
#move_down
Move all the buttons down.
-
#move_up
Move all the buttons up.
-
#number_of_buttons ⇒ Integer
Return the number of buttons registered in the stack.
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, #update_animation, #update_position, #visible, #visible=, #with_cache, #with_font, #with_surface, #z, #z=
Constructor Details
#initialize(viewport, quest_hash, category) ⇒ QuestList
Create a new QuestList
23 24 25 26 27 28 29 30 31 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/00500 Quest_List.rb', line 23 def initialize(, quest_hash, category) super() @quest_hash = quest_hash @quest_array = quest_hash.map { |_key, value| value } @timing = :slow @category = category @index = 0 end |
Instance Attribute Details
#buttons ⇒ Array<QuestButton> (readonly)
15 16 17 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/00500 Quest_List.rb', line 15 def @buttons end |
#index ⇒ Integer
Returns index of the current active item.
13 14 15 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/00500 Quest_List.rb', line 13 def index @index end |
#timing=(value)
17 18 19 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/00500 Quest_List.rb', line 17 def timing=(value) @timing = value end |
Instance Method Details
#change_mode(mode) ⇒ Yuki::Animation::ScalarAnimation
Change the right button mode and return the animation
71 72 73 74 75 76 77 78 79 80 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/00500 Quest_List.rb', line 71 def change_mode(mode) anim = Yuki::Animation animation = @buttons[0].change_mode(mode) coord = (mode == :compact ? -87 : 87) (1..5).each do |i| bt = @buttons[i] animation.parallel_add(anim.move_discreet(0.5, bt, bt.x, bt.y, bt.x, @buttons[i].y + coord, distortion: :SMOOTH_DISTORTION)) end return animation end |
#last_index? ⇒ Boolean
Tell if the current index is the same as the last quest for this category
64 65 66 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/00500 Quest_List.rb', line 64 def last_index? return index == @quest_array.size - 1 end |
#move_down
Move all the buttons down
55 56 57 58 59 60 61 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/00500 Quest_List.rb', line 55 def move_down @buttons.last.quest = @quest_array[index + (NB_QUEST_BUTTON - 1)] animation = move_down_animation @buttons.rotate!(1) self.index = index + 1 return animation end |
#move_up
Move all the buttons up
46 47 48 49 50 51 52 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/00500 Quest_List.rb', line 46 def move_up @buttons.last.quest = @quest_array[index - 1] animation = move_up_animation @buttons.rotate!(-1) self.index = index - 1 return animation end |
#number_of_buttons ⇒ Integer
Return the number of buttons registered in the stack
35 36 37 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/00500 Quest_List.rb', line 35 def return @quest_array.size end |