class Core::Game::Combat::SelectSpell

Attributes

actor[R]
selected[R]

Public Class Methods

new(x, y, actor) click to toggle source
Calls superclass method Core::GUI::Window::new
# File lib/game/combat/gui/select_spell.rb, line 8
def initialize(x, y, actor)
  super(x, y, 384, 256, Core::Trans.menu(:select_spell), true, "gui/container_background", true)
  @close.proc = lambda { close!; @parent.abort_action(actor) }
  save_pos(:combat_gui_spell_select_window_x, :combat_gui_spell_select_window_y)
  add(:container, Core::GUI::Container.new(8, 8, 184, 240, 24))
  add(:info, Core::GUI::Textfield.new(200, 8, 176, 240, ""))
  @actor = actor
  setup_skill_select
  @selected = nil
end

Private Instance Methods

clicked(spell) click to toggle source
# File lib/game/combat/gui/select_spell.rb, line 31
def clicked(spell)
  get(:info).text = Core::Trans.spell("#{spell.name}_desc".to_sym)
  @selected = spell
end
setup_skill_select() click to toggle source
# File lib/game/combat/gui/select_spell.rb, line 21
def setup_skill_select
  char = @actor.character
  c = get(:container)
  y = 8
  char.spells.each { |spell, level|
    c.add(Core::GUI::Button.new(0, y, c.w-24, c.ch, Core::Trans.spell(spell.name), lambda { clicked(spell) }))
    y += c.ch
  }
end