From 371592f1678c5e598c2eaf73a60ecd5ae54107cd Mon Sep 17 00:00:00 2001 From: Logsol Date: Sat, 5 Jan 2013 06:17:26 +0100 Subject: [PATCH] added server input controller --- app/Game/Server/Control/InputController.js | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 app/Game/Server/Control/InputController.js diff --git a/app/Game/Server/Control/InputController.js b/app/Game/Server/Control/InputController.js new file mode 100644 index 0000000..ba44ca2 --- /dev/null +++ b/app/Game/Server/Control/InputController.js @@ -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; + +}); \ No newline at end of file