mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
refactored Server and Lobby
This commit is contained in:
parent
42475c9b38
commit
d83376d5c7
26 changed files with 29 additions and 29 deletions
44
app/Game/Channel/Control/PlayerController.js
Executable file
44
app/Game/Channel/Control/PlayerController.js
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
define([
|
||||
"Game/Core/Control/PlayerController",
|
||||
"Lib/Utilities/NotificationCenter",
|
||||
"Lib/Utilities/Protocol/Parser"
|
||||
],
|
||||
|
||||
function(Parent, Nc, Parser) {
|
||||
|
||||
function PlayerController(player) {
|
||||
|
||||
Parent.call(this, player);
|
||||
}
|
||||
|
||||
PlayerController.prototype = Object.create(Parent.prototype);
|
||||
|
||||
/*
|
||||
* retrieves move (and other) commands from client and executes them at the server
|
||||
*/
|
||||
PlayerController.prototype.applyCommand = function(options) {
|
||||
// FIXME: remove this function and use ProtocolHelper.applyCommand() instead
|
||||
// Don't forget to change the function names to on...
|
||||
var message;
|
||||
if (typeof options == "string") {
|
||||
message = Parser.decode(options);
|
||||
} else {
|
||||
message = options;
|
||||
}
|
||||
|
||||
for (var command in message) {
|
||||
this[command].call(this, message[command]);
|
||||
}
|
||||
};
|
||||
|
||||
PlayerController.prototype.handActionRequest = function(options) {
|
||||
if (options) this.player.handActionRequest(options.x, options.y);
|
||||
};
|
||||
|
||||
PlayerController.prototype.suicide = function() {
|
||||
this.player.suicide();
|
||||
};
|
||||
|
||||
return PlayerController;
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue