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);
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
4
app/Game/Server/Collision/Detector.js
Normal file → Executable file
4
app/Game/Server/Collision/Detector.js
Normal file → Executable file
|
|
@ -3,7 +3,7 @@ define([
|
|||
"Game/Core/Collision/Detector"
|
||||
],
|
||||
|
||||
function(Box2D, Parent) {
|
||||
function (Box2D, Parent) {
|
||||
|
||||
function Detector() {
|
||||
Parent.call(this);
|
||||
|
|
@ -11,7 +11,7 @@ function(Box2D, Parent) {
|
|||
|
||||
Detector.prototype = Object.create(Parent.prototype);
|
||||
|
||||
Detector.prototype.handleStand = function(point, isColliding) {
|
||||
Detector.prototype.handleStand = function (point, isColliding) {
|
||||
throw "Implement this function";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
define([
|
||||
],
|
||||
|
||||
function() {
|
||||
function () {
|
||||
|
||||
function CoordinatorLink(process) {
|
||||
this.process = process;
|
||||
}
|
||||
|
||||
CoordinatorLink.prototype.send = function(message) {
|
||||
CoordinatorLink.prototype.send = function (message) {
|
||||
this.process.send(message);
|
||||
};
|
||||
|
||||
CoordinatorLink.prototype.receive = function(message) {
|
||||
CoordinatorLink.prototype.receive = function (message) {
|
||||
throw 'This method is abstract and must be overwritten by Channel';
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ define([
|
|||
"Game/Core/NotificationCenter"
|
||||
],
|
||||
|
||||
function(Parent, PhysicsEngine, Settings, InputController, requestAnimFrame, NotificationCenter) {
|
||||
function (Parent, PhysicsEngine, Settings, InputController, requestAnimFrame, NotificationCenter) {
|
||||
|
||||
function GameController () {
|
||||
Parent.call(this, new PhysicsEngine());
|
||||
|
|
@ -23,7 +23,7 @@ function(Parent, PhysicsEngine, Settings, InputController, requestAnimFrame, Not
|
|||
|
||||
GameController.prototype = Object.create(Parent.prototype);
|
||||
/*
|
||||
GameController.prototype.update = function() {
|
||||
GameController.prototype.update = function () {
|
||||
|
||||
requestAnimFrame(this.update.bind(this));
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ function(Parent, PhysicsEngine, Settings, InputController, requestAnimFrame, Not
|
|||
}
|
||||
}
|
||||
|
||||
GameController.prototype.userJoined = function(user) {
|
||||
GameController.prototype.userJoined = function (user) {
|
||||
Parent.prototype.userJoined.call(this, user);
|
||||
|
||||
var id = user.id;
|
||||
|
|
@ -41,19 +41,19 @@ function(Parent, PhysicsEngine, Settings, InputController, requestAnimFrame, Not
|
|||
this.inputControllers[id] = new InputController(player);
|
||||
}
|
||||
|
||||
GameController.prototype.userLeft = function(user) {
|
||||
GameController.prototype.userLeft = function (user) {
|
||||
Parent.prototype.userLeft.call(this, user);
|
||||
delete this.inputControllers[user.id];
|
||||
}
|
||||
|
||||
GameController.prototype.progressGameCommandFromUser = function(command, options, user) {
|
||||
GameController.prototype.progressGameCommandFromUser = function (command, options, user) {
|
||||
var inputController = this.inputControllers[user.id];
|
||||
if (typeof inputController[command] == 'function') {
|
||||
inputController[command](options);
|
||||
}
|
||||
}
|
||||
|
||||
GameController.prototype.updateWorld = function() {
|
||||
GameController.prototype.updateWorld = function () {
|
||||
|
||||
var update = {};
|
||||
var isUpdateNeeded = false;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ define([
|
|||
"Game/Core/NotificationCenter"
|
||||
],
|
||||
|
||||
function(Parent, ProtocolHelper, NotificationCenter) {
|
||||
function (Parent, ProtocolHelper, NotificationCenter) {
|
||||
|
||||
function User(id, coordinator) {
|
||||
Parent.call(this, id);
|
||||
|
|
@ -18,17 +18,17 @@ function(Parent, ProtocolHelper, NotificationCenter) {
|
|||
|
||||
User.prototype = Object.create(Parent.prototype);
|
||||
|
||||
User.prototype.init = function(socketLink){
|
||||
User.prototype.init = function (socketLink){
|
||||
|
||||
var self = this;
|
||||
|
||||
}
|
||||
/*
|
||||
User.prototype.setChannel = function(channel) {
|
||||
User.prototype.setChannel = function (channel) {
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
User.prototype.sendCommand = function(command, options) {
|
||||
User.prototype.sendCommand = function (command, options) {
|
||||
|
||||
var message = ProtocolHelper.encodeCommand(command, options);
|
||||
this.socketLink.send(message);
|
||||
|
|
@ -36,7 +36,7 @@ function(Parent, ProtocolHelper, NotificationCenter) {
|
|||
|
||||
|
||||
|
||||
User.prototype.toString = function() {
|
||||
User.prototype.toString = function () {
|
||||
return "[User " + this.id + "]";
|
||||
};
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue