From 966f709b09402141797ac7c423e2fc307218aa6c Mon Sep 17 00:00:00 2001 From: logsol Date: Wed, 11 Dec 2013 21:23:34 +0100 Subject: [PATCH] added lab for local game engine testing (create apache vhost to chuck.js directory and open chuck.local/lab - this runs the gamecode but with an extended networker (worker) which omits all networking --- lab/Worker.js | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ lab/app | 1 + lab/client.js | 19 ++++++++++++++++++ lab/index.html | 34 ++++++++++++++++++++++++++++++++ lab/static | 1 + 5 files changed, 108 insertions(+) create mode 100644 lab/Worker.js create mode 120000 lab/app create mode 100755 lab/client.js create mode 100755 lab/index.html create mode 120000 lab/static diff --git a/lab/Worker.js b/lab/Worker.js new file mode 100644 index 0000000..a09b454 --- /dev/null +++ b/lab/Worker.js @@ -0,0 +1,53 @@ +define([ + "Game/Client/Networker", + "Game/Core/Protocol/Helper", + "Game/Client/GameController", + "Game/Client/User", + "Game/Core/NotificationCenter" +], + +function (Parent, ProtocolHelper, GameController, User, NotificationCenter) { + + function Worker () { + //this.socketLink = socketLink; + this.gameController = null; + this.users = {}; + + this.init(); + } + + Worker.prototype = Object.create(Parent.prototype); + + Worker.prototype.init = function () { + + + ProtocolHelper.applyCommand({ + "joinSuccess":{ + "userId":"k31HvnDM7Jy6mfmKOe3y", + "channelName":"dungeon", + "joinedUsers":[], + "spawnedPlayers":[] + } + }, this); + + ProtocolHelper.applyCommand({ + "gameCommand":{ + "spawnPlayer":{ + "id":"k31HvnDM7Jy6mfmKOe3y", + "x":150, + "y":50 + } + } + }, this); + + NotificationCenter.on("sendGameCommand", this.sendGameCommand, this); + } + + Worker.prototype.sendCommand = function (command, options) { + var message = ProtocolHelper.encodeCommand(command, options); + //this.socketLink.send(message); + } + + return Worker; + +}); \ No newline at end of file diff --git a/lab/app b/lab/app new file mode 120000 index 0000000..5df94d9 --- /dev/null +++ b/lab/app @@ -0,0 +1 @@ +../app \ No newline at end of file diff --git a/lab/client.js b/lab/client.js new file mode 100755 index 0000000..8d7a42f --- /dev/null +++ b/lab/client.js @@ -0,0 +1,19 @@ +requirejs.config({ + baseUrl: 'app', + deps: ['Lib/Utilities/Extensions'] +}); + +var inspector = {}; + +requirejs([ + "Game/Config/Settings", + "Worker.js" +], + +function (Settings, Worker) { + + var worker = new Worker(); + + inspector.worker = worker; + inspector.settings = Settings; +}); \ No newline at end of file diff --git a/lab/index.html b/lab/index.html new file mode 100755 index 0000000..988275e --- /dev/null +++ b/lab/index.html @@ -0,0 +1,34 @@ + + + + Chuck + + + +
+
+ + + diff --git a/lab/static b/lab/static new file mode 120000 index 0000000..4dab164 --- /dev/null +++ b/lab/static @@ -0,0 +1 @@ +../static \ No newline at end of file