Class: UI::QuestInformer
- Inherits:
-
SpriteStack
- Object
- SpriteStack
- UI::QuestInformer
- Defined in:
- scripts/01450 Systems/08000 Quest/00002 UI_Quest/00200 QuestInformer.rb
Constant Summary collapse
- ME_TO_PLAY =
Name of the ME to play
'audio/me/rosa_keyitemobtained'
- BASE_Y =
Base Y of the informer
34
- OFFSET_Y =
Offset Y between each informer
24
- OFFSET_TEXT_X =
Offset X between the two textes
4
- TRANSITION_LENGHT =
Lenght of a transition
30
- TEXT_MOVE_LENGHT =
Lenght of the text move
30
- TEXT_REMAIN_LENGHT =
Time the player has to read the text
90
Constants inherited from SpriteStack
Instance Attribute Summary
Attributes inherited from SpriteStack
#animated, #data, #moving, #stack, #viewport, #x, #y
Instance Method Summary collapse
-
#done? ⇒ Boolean
Tell if the animation is finished.
-
#initialize(viewport, name, is_new, index) ⇒ QuestInformer
constructor
Create a new quest informer UI.
-
#update
Update the animation for the quest informer.
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, name, is_new, index) ⇒ QuestInformer
Create a new quest informer UI
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/00200 QuestInformer.rb', line 22 def initialize(, name, is_new, index) super(, 0, BASE_Y + index * OFFSET_Y) @background = add_background('quest/quest_bg') @background.opacity = 0 text = ext_text(9000, is_new ? 147 : 148) @info_text = add_text(0, 3, 0, 16, text, 0, 0, color: is_new ? 13 : 12) @name_text = add_text(@info_text.real_width + OFFSET_TEXT_X, 3, 0, 16, name, 0, 0) @max_x = (.rect.width - @name_text.real_width) / 2 @info_ini_x = @info_text.x = -(@max_x * 2 + @name_text.x) @name_ini_x = @name_text.x = -(@max_x * 2) @counter = 0 play_sound(index) end |
Instance Method Details
#done? ⇒ Boolean
Tell if the animation is finished
52 53 54 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/00200 QuestInformer.rb', line 52 def done? (@background.disposed? || @background.opacity == 0) && @counter >= PHASE_END end |
#update
Update the animation for the quest informer
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'scripts/01450 Systems/08000 Quest/00002 UI_Quest/00200 QuestInformer.rb', line 37 def update if @counter < TRANSITION_LENGHT @background.opacity = (@counter + 1) * 255 / TRANSITION_LENGHT elsif @counter < PHASE2 base_x = (@counter - TRANSITION_LENGHT + 1) * @max_x * 3 / TEXT_MOVE_LENGHT @info_text.x = base_x + @info_ini_x @name_text.x = base_x + @name_ini_x elsif @counter.between?(PHASE3, PHASE_END) @info_text.opacity = @name_text.opacity = @background.opacity = (PHASE_END - @counter) * 255 / TRANSITION_LENGHT end @counter += 1 end |