class RuneRb::Player::InterfaceState

Attributes

current_interface[R]
enter_amount_id[R]
enter_amount_interface[R]

Enter amount data

enter_amount_slot[R]
listeners[R]
player[R]

Public Class Methods

new(player) click to toggle source
# File app/model/player/interfacestate.rb, line 13
def initialize(player)
  @player = player
  
  @listeners = []
end

Public Instance Methods

add_listener(container, listener) click to toggle source
# File app/model/player/interfacestate.rb, line 38
def add_listener(container, listener)
  container.add_listener listener
  @listeners << listener
end
enter_amount_open?() click to toggle source
# File app/model/player/interfacestate.rb, line 50
def enter_amount_open?
  @enter_amount_interface != -1
end
interface_closed() click to toggle source
# File app/model/player/interfacestate.rb, line 28
def interface_closed
  @current_interface = -1
  @enter_amount_interface = -1
  @listeners.each {|e|
    @player.inventory.listeners.delete e
    @player.equipment.listeners.delete e
    @player.bank.listeners.delete e
  }
end
interface_opened(id) click to toggle source
# File app/model/player/interfacestate.rb, line 23
def interface_opened(id)
  interface_closed if @current_interface != -1
  @current_interface = id
end
interface_opened?(id) click to toggle source
# File app/model/player/interfacestate.rb, line 19
def interface_opened?(id)
  @current_interface == id
end
open_amount_interface(interface_id, slot, id) click to toggle source
# File app/model/player/interfacestate.rb, line 43
def open_amount_interface(interface_id, slot, id)
  @enter_amount_interface = interface_id
  @enter_amount_slot = slot
  @enter_amount_id = id
  @player.io.send_amount_interface
end