Class: UI::MoveTeaching::Skill
- Inherits:
-
SpriteStack
- Object
- SpriteStack
- UI::MoveTeaching::Skill
- Defined in:
- scripts/01450 Systems/00301 MoveTeaching/00002 UI/00050 Skill.rb
Overview
UI part displaying a Skill in the Skill Learn UI
Constant Summary collapse
- FINAL_COORDINATES =
Array describing the various coordinates of the skills in the UI
[ [28, 156], [174, 156], [28, 188], [174, 188] ]
- FORGET_COLOR =
Color when it's selected
Color.new(0, 200, 0, 255)
- NORMAL_COLOR =
Color when it's not selected
Color.new(0, 0, 0, 0)
Constants inherited from SpriteStack
Instance Attribute Summary collapse
-
#forget ⇒ Boolean
If the move is currently being moved.
-
#selected ⇒ Boolean
If the move is currently selected.
Attributes inherited from SpriteStack
#animated, #data, #moving, #stack, #viewport, #x, #y
Instance Method Summary collapse
-
#data=(skill)
Set the skill data.
-
#initialize(viewport, index) ⇒ Skill
constructor
Create a new Skill.
-
#visible ⇒ Boolean
Get the visibility of the sprite.
-
#visible=(value)
Set the visibility of the sprite.
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, #with_cache, #with_font, #with_surface, #z, #z=
Constructor Details
#initialize(viewport, index) ⇒ Skill
Create a new Skill
21 22 23 24 25 26 27 28 29 |
# File 'scripts/01450 Systems/00301 MoveTeaching/00002 UI/00050 Skill.rb', line 21 def initialize(, index) super(, *FINAL_COORDINATES[index % FINAL_COORDINATES.size], default_cache: :interface) create_graphics create_texts @selected = false self.forget = false @skill_index = index self.visible = false end |
Instance Attribute Details
#forget ⇒ Boolean
Returns if the move is currently being moved.
17 18 19 |
# File 'scripts/01450 Systems/00301 MoveTeaching/00002 UI/00050 Skill.rb', line 17 def forget @forget end |
#selected ⇒ Boolean
Returns if the move is currently selected.
15 16 17 |
# File 'scripts/01450 Systems/00301 MoveTeaching/00002 UI/00050 Skill.rb', line 15 def selected @selected end |
Instance Method Details
#data=(skill)
Set the skill data
33 34 35 36 37 38 |
# File 'scripts/01450 Systems/00301 MoveTeaching/00002 UI/00050 Skill.rb', line 33 def data=(skill) super return unless (self.visible = skill ? true : false) @selector.visible = @selected self.forget = false end |
#visible ⇒ Boolean
Get the visibility of the sprite
49 50 51 |
# File 'scripts/01450 Systems/00301 MoveTeaching/00002 UI/00050 Skill.rb', line 49 def visible return @stack[1].visible end |
#visible=(value)
Set the visibility of the sprite
42 43 44 45 |
# File 'scripts/01450 Systems/00301 MoveTeaching/00002 UI/00050 Skill.rb', line 42 def visible=(value) super(value && @data) @selector.visible = value && (@selected || @forget) end |