mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
When we require a singleton, its instance name should be named by lowercase, since it is not a class. Relates to #128
53 lines
No EOL
1.2 KiB
JavaScript
Executable file
53 lines
No EOL
1.2 KiB
JavaScript
Executable file
define([
|
|
"Game/Client/Networker",
|
|
"Lib/Utilities/Protocol/Helper",
|
|
"Game/Client/GameController",
|
|
"Game/Client/User",
|
|
"Lib/Utilities/NotificationCenter"
|
|
],
|
|
|
|
function (Parent, ProtocolHelper, GameController, User) {
|
|
|
|
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);
|
|
|
|
nc.on(nc.ns.client.to.server.gameCommand.send, this.sendGameCommand, this);
|
|
}
|
|
|
|
Worker.prototype.sendCommand = function (command, options) {
|
|
var message = ProtocolHelper.encodeCommand(command, options);
|
|
//this.socketLink.send(message);
|
|
}
|
|
|
|
return Worker;
|
|
|
|
}); |