Class: UI::Summary_Skill

Inherits:
SpriteStack show all
Defined in:
scripts/01450 Systems/00102 Party/00002 UI/00400 Summary_Skills.rb

Overview

UI part displaying a Skill in the Summary_Skills UI

Direct Known Subclasses

Remind_Skill

Constant Summary collapse

FINAL_COORDINATES =

Array describing the various coordinates of the skills in the UI

[
  [28, 138], [174, 138],
  [28, 170], [174, 170]
]
SELECTED_COLOR =

Color when it's selected

Color.new(0, 200, 0, 255)
NO_SELECT_COLOR =

Color when it's not selected

Color.new(0, 0, 0, 0)

Constants inherited from SpriteStack

UI::SpriteStack::NO_INITIAL_IMAGE

Instance Attribute Summary collapse

Attributes inherited from SpriteStack

#animated, #data, #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, #with_cache, #with_font, #with_surface, #z, #z=

Constructor Details

#initialize(viewport, index) ⇒ Summary_Skill

Create a new skill

Parameters:



150
151
152
153
154
155
156
157
158
159
160
# File 'scripts/01450 Systems/00102 Party/00002 UI/00400 Summary_Skills.rb', line 150

def initialize(viewport, index)
  super(viewport, *FINAL_COORDINATES[index % FINAL_COORDINATES.size])
  # @type [Sprite::WithColor]
  @selector = push(-8, 0, selector_name, type: Sprite::WithColor)
  push(0, 2, nil, type: TypeSprite)
  add_text(34, 0, 110, 16, :name, type: SymText)
  @pp_text = add_text(34, 16, 110, 16, text_get(27, 32)) # PP
  add_text(34, 16, 100, 16, pp_method, 1, type: SymText, color: 1)
  @selected = false
  self.moving = false
end

Instance Attribute Details

#movingBoolean

Returns if the move is currently being moved.

Returns:

  • (Boolean)

    if the move is currently being moved



146
147
148
# File 'scripts/01450 Systems/00102 Party/00002 UI/00400 Summary_Skills.rb', line 146

def moving
  @moving
end

#selectedBoolean

Returns if the move is currently selected.

Returns:

  • (Boolean)

    if the move is currently selected



144
145
146
# File 'scripts/01450 Systems/00102 Party/00002 UI/00400 Summary_Skills.rb', line 144

def selected
  @selected
end

Instance Method Details

#data=(skill)

Set the skill data

Parameters:



164
165
166
167
168
169
# File 'scripts/01450 Systems/00102 Party/00002 UI/00400 Summary_Skills.rb', line 164

def data=(skill)
  super
  return unless (self.visible = skill ? true : false)
  @selector.visible = @selected
  self.moving = false
end

#visibleBoolean

Get the visibility of the sprite

Returns:

  • (Boolean)


180
181
182
# File 'scripts/01450 Systems/00102 Party/00002 UI/00400 Summary_Skills.rb', line 180

def visible
  return @stack[1].visible
end

#visible=(value)

Set the visibility of the sprite

Parameters:

  • value (Boolean)

    new visibility



173
174
175
176
# File 'scripts/01450 Systems/00102 Party/00002 UI/00400 Summary_Skills.rb', line 173

def visible=(value)
  super(value && @data)
  @selector.visible = value && (@selected || @moving)
end