Class: GameMachine::Handlers::Request
Constant Summary
Constants inherited
from Actor::Base
Actor::Base::ON_RECEIVE_HOOKS
Instance Method Summary
collapse
Methods included from Commands
#commands
Methods inherited from Actor::Base
aspect, aspects, find, find_by_address, find_distributed, find_distributed_local, find_remote, hashring, local_path, model_filter, #onReceive, player_controller, #receive_message, #schedule_message, #sender, set_player_controller
Instance Method Details
#on_receive(message) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/game_machine/handlers/request.rb', line 10
def on_receive(message)
if message.is_a?(MessageLib::ClientMessage)
if message.has_player_logout
if Authentication.authenticated?(message.player)
unregister_client(message)
end
elsif message.has_player
update_entities(message)
if Authentication.authenticated?(message.player)
game_handler.tell(message)
else
if @auth_handler.authenticate!(message.player)
register_client(message)
game_handler.tell(message)
end
end
else
unhandled(message)
end
else
unhandled(message)
end
end
|
#post_init(*args) ⇒ Object
6
7
8
|
# File 'lib/game_machine/handlers/request.rb', line 6
def post_init(*args)
@auth_handler = Authentication.new
end
|