mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
added server input controller
This commit is contained in:
parent
c256f8a729
commit
371592f167
1 changed files with 31 additions and 0 deletions
31
app/Game/Server/Control/InputController.js
Normal file
31
app/Game/Server/Control/InputController.js
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
define([
|
||||||
|
"Game/Core/Control/InputController",
|
||||||
|
"Game/Core/NotificationCenter",
|
||||||
|
"Game/Core/Protocol/Parser"
|
||||||
|
],
|
||||||
|
|
||||||
|
function(Parent, NotificationCenter, Parser) {
|
||||||
|
|
||||||
|
function InputController(player) {
|
||||||
|
|
||||||
|
Parent.call(this, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
InputController.prototype = Object.create(Parent.prototype);
|
||||||
|
|
||||||
|
InputController.prototype.applyCommand = function(options) {
|
||||||
|
var message;
|
||||||
|
if (typeof options == "string") {
|
||||||
|
message = Parser.decode(options);
|
||||||
|
} else {
|
||||||
|
message = options;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var command in message) {
|
||||||
|
this[command].call(this, message[command]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return InputController;
|
||||||
|
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue