mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
changed function( to function (
This commit is contained in:
parent
26f3d22db7
commit
7e5eeb0a27
36 changed files with 209 additions and 209 deletions
|
|
@ -3,13 +3,13 @@
|
|||
"Game/Core/NotificationCenter"
|
||||
],
|
||||
|
||||
function(GameController, NotificationCenter) {
|
||||
function (GameController, NotificationCenter) {
|
||||
|
||||
function Channel(coordinatorLink) {
|
||||
var self = this;
|
||||
|
||||
this.coordinatorLink = coordinatorLink;
|
||||
this.coordinatorLink.receive = function(message) { self.onMessage(message) };
|
||||
this.coordinatorLink.receive = function (message) { self.onMessage(message) };
|
||||
|
||||
this.users = {};
|
||||
|
||||
|
|
@ -17,20 +17,20 @@
|
|||
this.gameController.loadLevel("default.json");
|
||||
/*
|
||||
var self = this;
|
||||
NotificationCenter.on("processGameCommandFromUser", function(topic, args) {
|
||||
NotificationCenter.on("processGameCommandFromUser", function (topic, args) {
|
||||
self.processGameCommandFromUser.apply(self, args);
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
Channel.validateName = function(name){
|
||||
Channel.validateName = function (name){
|
||||
return true;
|
||||
}
|
||||
|
||||
// Messages look like:
|
||||
// {channel: {setName: 'foo'}}
|
||||
// {user: {jupm: null}, id: 12}
|
||||
Channel.prototype.onMessage = function(message) {
|
||||
Channel.prototype.onMessage = function (message) {
|
||||
|
||||
for(var recipient in message) {
|
||||
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
}
|
||||
};
|
||||
|
||||
Channel.prototype.forward = function(target, message) {
|
||||
Channel.prototype.forward = function (target, message) {
|
||||
for(var command in message) {
|
||||
if(typeof target[command] == 'function'){
|
||||
target[command].call(target, message[command]);
|
||||
|
|
@ -61,13 +61,13 @@
|
|||
}
|
||||
};
|
||||
|
||||
Channel.prototype.setName = function(name) {
|
||||
Channel.prototype.setName = function (name) {
|
||||
this.name = name;
|
||||
console.log(' created channel ' + name);
|
||||
}
|
||||
|
||||
/*
|
||||
Channel.prototype.addUser = function(user){
|
||||
Channel.prototype.addUser = function (user){
|
||||
var userIds = Object.keys(this.users);
|
||||
|
||||
this.users[user.id] = user;
|
||||
|
|
@ -78,20 +78,20 @@
|
|||
NotificationCenter.trigger('user/joined', user);
|
||||
}
|
||||
|
||||
Channel.prototype.releaseUser = function(user) {
|
||||
Channel.prototype.releaseUser = function (user) {
|
||||
this.gameController.userIdLeft(user.id);
|
||||
|
||||
this.sendCommandToAllUsersExcept("userLeft", user.id, user);
|
||||
delete this.users[user.id];
|
||||
}
|
||||
|
||||
Channel.prototype.sendCommandToAllUsers = function(command, options) {
|
||||
Channel.prototype.sendCommandToAllUsers = function (command, options) {
|
||||
for(var id in this.users) {
|
||||
this.users[id].sendCommand(command, options);
|
||||
}
|
||||
}
|
||||
|
||||
Channel.prototype.sendCommandToAllUsersExcept = function(command, options, except_user) {
|
||||
Channel.prototype.sendCommandToAllUsersExcept = function (command, options, except_user) {
|
||||
for(var id in this.users) {
|
||||
if (id != except_user.id) {
|
||||
this.users[id].sendCommand(command, options);
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
Channel.prototype.processGameCommandFromUser = function(command, options, user) {
|
||||
Channel.prototype.processGameCommandFromUser = function (command, options, user) {
|
||||
this.gameController.progressGameCommandFromUser(command, options, user);
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue