Class: BattleUI::SkillChoice::SpecialButton

Inherits:
UI::SpriteStack show all
Defined in:
scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00300 SkillChoice.rb

Overview

Element showing a special button

Constant Summary

Constants inherited from UI::SpriteStack

UI::SpriteStack::NO_INITIAL_IMAGE

Instance Attribute Summary

Attributes inherited from UI::SpriteStack

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

Instance Method Summary collapse

Methods inherited from UI::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, #with_cache, #with_font, #with_surface, #z, #z=

Constructor Details

#initialize(viewport, scene, type) ⇒ SpecialButton

Create a new special button

Parameters:



217
218
219
220
221
222
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00300 SkillChoice.rb', line 217

def initialize(viewport, scene, type)
  super(viewport)
  @scene = scene
  @type = type
  create_sprites
end

Instance Method Details

#data=(pokemon)

Set the data of the button

Parameters:



226
227
228
229
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00300 SkillChoice.rb', line 226

def data=(pokemon)
  super
  self.visible = (@type == :descr || @scene.logic.mega_evolve.can_pokemon_mega_evolve?(pokemon)) && true
end

#refresh(mega = false)

Update the special button content

Parameters:

  • mega (Boolean) (defaults to: false)


233
234
235
236
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00300 SkillChoice.rb', line 233

def refresh(mega = false)
  @text.text = @type == :descr ? 'Description' : 'Mega evolution'
  @background.set_bitmap(mega ? 'battle/button_mega_activated' : 'battle/button_mega', :interface) if @type == :mega
end

#visible=(visible)

Set the visibility of the button

Parameters:

  • visible (Boolean)


240
241
242
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00300 SkillChoice.rb', line 240

def visible=(visible)
  super(visible && (@type == :descr || (@data && @scene.logic.mega_evolve.can_pokemon_mega_evolve?(@data))))
end