Class: UI::Quest::RewardScreen
- Inherits:
-
SpriteStack
- Object
- SpriteStack
- UI::Quest::RewardScreen
- Defined in:
- scripts/01450 Systems/08000 Quest/00002 UI_Quest/00110 RewardScreen.rb
Constant Summary collapse
- REWARD_COORDINATE =
[ [3, 1], [137, 1], [3, 36], [137, 36] ]
Constants inherited from SpriteStack
Instance Attribute Summary
Attributes inherited from SpriteStack
#animated, #data, #moving, #stack, #viewport, #x, #y
Instance Method Summary collapse
-
#initialize(viewport, x, y) ⇒ RewardScreen
constructor
Initialize the RewardScreen component.
-
#quest=(quest)
Reload all sub-component with a new quest.
-
#scroll_rewards(direction)
Scroll the rewards if there's more than 4 rewards.
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, x, y) ⇒ RewardScreen
Initialize the RewardScreen component
14 15 16 17 18 19 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/00110 RewardScreen.rb', line 14 def initialize(, x, y) super(, x, y) @quest = nil @index_display = 0 create_prize_back end |
Instance Method Details
#quest=(quest)
Reload all sub-component with a new quest
34 35 36 37 38 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/00110 RewardScreen.rb', line 34 def quest=(quest) @quest = quest @index_display = 0 regenerate_rewards end |
#scroll_rewards(direction)
Scroll the rewards if there's more than 4 rewards
23 24 25 26 27 28 29 30 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/00110 RewardScreen.rb', line 23 def scroll_rewards(direction) return if quest_data.earnings.size < 5 @index_display += (direction == :left ? -1 : 1) @index_display = 0 if @index_display > quest_data.earnings.size / 4 @index_display = quest_data.earnings.size / 4 if @index_display < 0 regenerate_rewards(true) end |