Class: UI::Quest::RewardScreen

Inherits:
SpriteStack show all
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

SpriteStack::NO_INITIAL_IMAGE

Instance Attribute Summary

Attributes inherited from SpriteStack

#animated, #data, #moving, #stack, #viewport, #x, #y

Instance Method Summary collapse

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

Parameters:



14
15
16
17
18
19
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/00110 RewardScreen.rb', line 14

def initialize(viewport, x, y)
  super(viewport, x, y)
  @quest = nil
  @index_display = 0
  create_prize_back
end

Instance Method Details

#quest=(quest)

Reload all sub-component with a new quest

Parameters:



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

Parameters:

  • direction (Symbol)

    :left of :right



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