Class: GameMachine::Routes

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
server/lib/game_machine/routes.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRoutes


11
12
13
14
# File 'server/lib/game_machine/routes.rb', line 11

def initialize
  @game_message_routes = {}
  @entity_routes = {}
end

Instance Attribute Details

#entity_routesObject (readonly)

Returns the value of attribute entity_routes


4
5
6
# File 'server/lib/game_machine/routes.rb', line 4

def entity_routes
  @entity_routes
end

#game_message_routesObject (readonly)

Returns the value of attribute game_message_routes


4
5
6
# File 'server/lib/game_machine/routes.rb', line 4

def game_message_routes
  @game_message_routes
end

Class Method Details

.game_messages(&block) ⇒ Object


7
8
9
# File 'server/lib/game_machine/routes.rb', line 7

def self.game_messages(&block)
  instance.instance_eval(&block)
end

Instance Method Details

#route(id, params) ⇒ Object


16
17
18
19
20
21
22
23
24
# File 'server/lib/game_machine/routes.rb', line 16

def route(id, params)
  distributed = params[:distributed] ? true : false
  game_message_routes[id] = params
  JavaLib::GameMessageRoute.add(id,params[:to],distributed)
  if params[:name]
    JavaLib::GameMessageRoute.add(params[:name],params[:to],distributed)
    game_message_routes[params[:name]] = params
  end
end