mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
nc merge
This commit is contained in:
commit
f7ca9d2393
23 changed files with 69 additions and 67 deletions
|
|
@ -50,7 +50,7 @@
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if(!this.gameController.level || !this.gameController.level.isLoaded) {
|
if(!this.gameController.level || !this.gameController.level.isLoaded) {
|
||||||
var token = Nc.on("game/level/loaded", function() {
|
var token = Nc.on(Nc.ns.core.game.events.level.loaded, function() {
|
||||||
self.sendJoinSuccess(options);
|
self.sendJoinSuccess(options);
|
||||||
Nc.off(token);
|
Nc.off(token);
|
||||||
});
|
});
|
||||||
|
|
@ -82,14 +82,14 @@
|
||||||
|
|
||||||
//Nc.trigger('user/' + user.id + "/joinSuccess", options);
|
//Nc.trigger('user/' + user.id + "/joinSuccess", options);
|
||||||
user.sendControlCommand("joinSuccess", options);
|
user.sendControlCommand("joinSuccess", options);
|
||||||
Nc.trigger('user/joined', user);
|
Nc.trigger(Nc.ns.channel.events.user.joined, user);
|
||||||
|
|
||||||
this.broadcastControlCommandExcept("userJoined", user.options, user);
|
this.broadcastControlCommandExcept("userJoined", user.options, user);
|
||||||
};
|
};
|
||||||
|
|
||||||
Channel.prototype.onReleaseUser = function (userId) {
|
Channel.prototype.onReleaseUser = function (userId) {
|
||||||
var user = this.users[userId];
|
var user = this.users[userId];
|
||||||
Nc.trigger('user/left', userId);
|
Nc.trigger(Nc.ns.channel.events.user.left, userId);
|
||||||
delete this.users[userId];
|
delete this.users[userId];
|
||||||
|
|
||||||
this.broadcastControlCommand("userLeft", userId);
|
this.broadcastControlCommand("userLeft", userId);
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,11 @@ function (Parent, PhysicsEngine, Settings, PlayerController, requestAnimFrame, N
|
||||||
|
|
||||||
Parent.call(this);
|
Parent.call(this);
|
||||||
|
|
||||||
Nc.on('user/joined', this.onUserJoined, this);
|
Nc.on(Nc.ns.channel.events.user.joined, this.onUserJoined, this);
|
||||||
Nc.on('user/left', this.onUserLeft, this);
|
Nc.on(Nc.ns.channel.events.user.left, this.onUserLeft, this);
|
||||||
Nc.on(Nc.ns.channel.events.user.level.reset, this.onResetLevel, this);
|
Nc.on(Nc.ns.channel.events.user.level.reset, this.onResetLevel, this);
|
||||||
Nc.on(Nc.ns.channel.events.user.client.ready, this.onClientReady, this);
|
Nc.on(Nc.ns.channel.events.user.client.ready, this.onClientReady, this);
|
||||||
|
|
||||||
Nc.on('player/killed', this.onPlayerKilled, this);
|
Nc.on('player/killed', this.onPlayerKilled, this);
|
||||||
|
|
||||||
console.checkpoint('starting game controller for channel ' + channel.name);
|
console.checkpoint('starting game controller for channel ' + channel.name);
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ function (Nc, Channel) {
|
||||||
};
|
};
|
||||||
|
|
||||||
PipeToServer.prototype.onMessage = function (message) {
|
PipeToServer.prototype.onMessage = function (message) {
|
||||||
Nc.trigger(message.recipient + '/controlCommand', message);
|
Nc.trigger(Nc.ns.channel.events.controlCommand + recipient, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
PipeToServer.prototype.destroy = function() {
|
PipeToServer.prototype.destroy = function() {
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ function (Parent, DomController, Settings, Nc) {
|
||||||
var x = (((e.clientX - this.offsetLeft) / Settings.STAGE_WIDTH) * 2) - 1;
|
var x = (((e.clientX - this.offsetLeft) / Settings.STAGE_WIDTH) * 2) - 1;
|
||||||
var y = (((Settings.STAGE_HEIGHT - (e.clientY - this.offsetTop)) / Settings.STAGE_HEIGHT) * 2) -1;
|
var y = (((Settings.STAGE_HEIGHT - (e.clientY - this.offsetTop)) / Settings.STAGE_HEIGHT) * 2) -1;
|
||||||
|
|
||||||
Nc.trigger("input/onHandActionRequest", x, y);
|
Nc.trigger(Nc.ns.client.input.handAction.request, x, y);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ function (Nc) {
|
||||||
XyInput.prototype.onXyChange = function(x, y) {
|
XyInput.prototype.onXyChange = function(x, y) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
Nc.trigger('input/onXyChange', x, y);
|
Nc.trigger(Nc.ns.client.input.xy.change, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
return XyInput;
|
return XyInput;
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ function (Parent, KeyboardInput, MouseInput, Nc) {
|
||||||
this.keyboardInput = new KeyboardInput(this);
|
this.keyboardInput = new KeyboardInput(this);
|
||||||
this.xyInput = new MouseInput(this);
|
this.xyInput = new MouseInput(this);
|
||||||
|
|
||||||
Nc.on("input/onXyChange", this.setXY, this);
|
Nc.on(Nc.ns.client.input.xy.change, this.setXY, this);
|
||||||
Nc.on("input/onHandActionRequest", this.handActionRequest, this);
|
Nc.on(Nc.ns.client.input.handAction.request, this.handActionRequest, this);
|
||||||
|
|
||||||
var keys = {
|
var keys = {
|
||||||
w:87,
|
w:87,
|
||||||
|
|
@ -64,33 +64,33 @@ function (Parent, KeyboardInput, MouseInput, Nc) {
|
||||||
|
|
||||||
PlayerController.prototype.moveLeft = function () {
|
PlayerController.prototype.moveLeft = function () {
|
||||||
Parent.prototype.moveLeft.call(this);
|
Parent.prototype.moveLeft.call(this);
|
||||||
Nc.trigger('sendGameCommand', 'moveLeft');
|
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, 'moveLeft');
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerController.prototype.moveRight = function () {
|
PlayerController.prototype.moveRight = function () {
|
||||||
Parent.prototype.moveRight.call(this);
|
Parent.prototype.moveRight.call(this);
|
||||||
Nc.trigger('sendGameCommand', 'moveRight');
|
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, 'moveRight');
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerController.prototype.stop = function () {
|
PlayerController.prototype.stop = function () {
|
||||||
Parent.prototype.stop.call(this);
|
Parent.prototype.stop.call(this);
|
||||||
Nc.trigger('sendGameCommand', 'stop');
|
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, 'stop');
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerController.prototype.jump = function () {
|
PlayerController.prototype.jump = function () {
|
||||||
Parent.prototype.jump.call(this);
|
Parent.prototype.jump.call(this);
|
||||||
Nc.trigger('sendGameCommand', 'jump');
|
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, 'jump');
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerController.prototype.jumpStop = function () {
|
PlayerController.prototype.jumpStop = function () {
|
||||||
Parent.prototype.jumpStop.call(this);
|
Parent.prototype.jumpStop.call(this);
|
||||||
Nc.trigger('sendGameCommand', 'jumpStop');
|
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, 'jumpStop');
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerController.prototype.setXY = function(x, y) {
|
PlayerController.prototype.setXY = function(x, y) {
|
||||||
var options = {x:x, y:y};
|
var options = {x:x, y:y};
|
||||||
Parent.prototype.lookAt.call(this, options);
|
Parent.prototype.lookAt.call(this, options);
|
||||||
Nc.trigger('sendGameCommand', 'lookAt', options);
|
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, 'lookAt', options);
|
||||||
};
|
};
|
||||||
|
|
||||||
PlayerController.prototype.handActionLeft = function() {
|
PlayerController.prototype.handActionLeft = function() {
|
||||||
|
|
@ -102,20 +102,20 @@ function (Parent, KeyboardInput, MouseInput, Nc) {
|
||||||
};
|
};
|
||||||
|
|
||||||
PlayerController.prototype.suicide = function() {
|
PlayerController.prototype.suicide = function() {
|
||||||
Nc.trigger("sendGameCommand", "suicide");
|
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, "suicide");
|
||||||
};
|
};
|
||||||
|
|
||||||
PlayerController.prototype.handActionRequest = function(x, y) {
|
PlayerController.prototype.handActionRequest = function(x, y) {
|
||||||
var options = {x:x, y:y};
|
var options = {x:x, y:y};
|
||||||
Nc.trigger("sendGameCommand", "handActionRequest", options);
|
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, "handActionRequest", options);
|
||||||
};
|
};
|
||||||
|
|
||||||
PlayerController.prototype.showInfo = function() {
|
PlayerController.prototype.showInfo = function() {
|
||||||
Nc.trigger("game/toggleInfo", true);
|
Nc.trigger(Nc.ns.client.view.gameInfo.toggle, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
PlayerController.prototype.hideInfo = function() {
|
PlayerController.prototype.hideInfo = function() {
|
||||||
Nc.trigger("game/toggleInfo", false);
|
Nc.trigger(Nc.ns.client.view.gameInfo.toggle, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque
|
||||||
this.view = ViewManager.createView();
|
this.view = ViewManager.createView();
|
||||||
this.me = null;
|
this.me = null;
|
||||||
|
|
||||||
Nc.on("game/toggleInfo", this.toggleInfo, this);
|
Nc.on(Nc.ns.client.view.gameInfo.toggle, this.toggleInfo, this);
|
||||||
|
|
||||||
Parent.call(this);
|
Parent.call(this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,12 @@ function (Parent, Settings, Nc, Exception) {
|
||||||
if(!state) throw new Exception("action state is undefined");
|
if(!state) throw new Exception("action state is undefined");
|
||||||
|
|
||||||
if(this.animatedMeshes[this.actionState]) {
|
if(this.animatedMeshes[this.actionState]) {
|
||||||
Nc.trigger("view/updateMesh", this.animatedMeshes[this.actionState], { visible: false });
|
Nc.trigger(Nc.ns.client.view.mesh.update, this.animatedMeshes[this.actionState], { visible: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
Parent.prototype.setActionState.call(this, state);
|
Parent.prototype.setActionState.call(this, state);
|
||||||
|
|
||||||
Nc.trigger("view/updateMesh", this.animatedMeshes[this.actionState], { visible: true });
|
Nc.trigger(Nc.ns.client.view.mesh.update, this.animatedMeshes[this.actionState], { visible: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
Doll.prototype.createMesh = function() {
|
Doll.prototype.createMesh = function() {
|
||||||
|
|
@ -74,7 +74,7 @@ function (Parent, Settings, Nc, Exception) {
|
||||||
|
|
||||||
var callback = function(mesh) {
|
var callback = function(mesh) {
|
||||||
self.animatedMeshes[key] = mesh;
|
self.animatedMeshes[key] = mesh;
|
||||||
Nc.trigger("view/addMesh", mesh);
|
Nc.trigger(Nc.ns.client.view.mesh.add, mesh);
|
||||||
};
|
};
|
||||||
|
|
||||||
Nc.trigger("view/createAnimatedMesh", texturePaths, callback, {
|
Nc.trigger("view/createAnimatedMesh", texturePaths, callback, {
|
||||||
|
|
@ -93,7 +93,7 @@ function (Parent, Settings, Nc, Exception) {
|
||||||
var texturePath = Settings.GRAPHICS_PATH + "Characters/Chuck/head.png";
|
var texturePath = Settings.GRAPHICS_PATH + "Characters/Chuck/head.png";
|
||||||
var callback = function (mesh) {
|
var callback = function (mesh) {
|
||||||
self.headMesh = mesh;
|
self.headMesh = mesh;
|
||||||
Nc.trigger("view/addMesh", mesh);
|
Nc.trigger(Nc.ns.client.view.mesh.add, mesh);
|
||||||
}
|
}
|
||||||
Nc.trigger("view/createMesh", texturePath, callback, {
|
Nc.trigger("view/createMesh", texturePath, callback, {
|
||||||
pivot: {
|
pivot: {
|
||||||
|
|
@ -113,7 +113,7 @@ function (Parent, Settings, Nc, Exception) {
|
||||||
|
|
||||||
if(oldLookDirection != this.lookDirection) {
|
if(oldLookDirection != this.lookDirection) {
|
||||||
for(var key in this.animatedMeshes) {
|
for(var key in this.animatedMeshes) {
|
||||||
Nc.trigger("view/updateMesh",
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
this.animatedMeshes[key],
|
this.animatedMeshes[key],
|
||||||
{
|
{
|
||||||
xScale: this.lookDirection
|
xScale: this.lookDirection
|
||||||
|
|
@ -124,7 +124,7 @@ function (Parent, Settings, Nc, Exception) {
|
||||||
|
|
||||||
var angle = Math.atan2(this.lookAtXY.x, this.lookAtXY.y) / 2 - 0.7855 * this.lookDirection; // 0.7855 = 45°
|
var angle = Math.atan2(this.lookAtXY.x, this.lookAtXY.y) / 2 - 0.7855 * this.lookDirection; // 0.7855 = 45°
|
||||||
|
|
||||||
Nc.trigger("view/updateMesh",
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
this.headMesh,
|
this.headMesh,
|
||||||
{
|
{
|
||||||
xScale: this.lookDirection,
|
xScale: this.lookDirection,
|
||||||
|
|
@ -136,17 +136,17 @@ function (Parent, Settings, Nc, Exception) {
|
||||||
|
|
||||||
Doll.prototype.destroy = function () {
|
Doll.prototype.destroy = function () {
|
||||||
for (var key in this.animatedMeshes) {
|
for (var key in this.animatedMeshes) {
|
||||||
Nc.trigger("view/removeMesh", this.animatedMeshes[key]);
|
Nc.trigger(Nc.ns.client.view.mesh.remove, this.animatedMeshes[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Nc.trigger("view/removeMesh", this.headMesh);
|
Nc.trigger(Nc.ns.client.view.mesh.remove, this.headMesh);
|
||||||
|
|
||||||
Parent.prototype.destroy.call(this);
|
Parent.prototype.destroy.call(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Doll.prototype.render = function() {
|
Doll.prototype.render = function() {
|
||||||
if(this.actionState) {
|
if(this.actionState) {
|
||||||
Nc.trigger("view/updateMesh",
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
this.animatedMeshes[this.actionState],
|
this.animatedMeshes[this.actionState],
|
||||||
{
|
{
|
||||||
x: this.body.GetPosition().x * Settings.RATIO,
|
x: this.body.GetPosition().x * Settings.RATIO,
|
||||||
|
|
@ -155,7 +155,7 @@ function (Parent, Settings, Nc, Exception) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
Nc.trigger("view/updateMesh",
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
this.headMesh,
|
this.headMesh,
|
||||||
{
|
{
|
||||||
x: this.body.GetPosition().x * Settings.RATIO,
|
x: this.body.GetPosition().x * Settings.RATIO,
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ function (Parent, Settings, Nc) {
|
||||||
|
|
||||||
var callback = function(mesh) {
|
var callback = function(mesh) {
|
||||||
self.mesh = mesh;
|
self.mesh = mesh;
|
||||||
Nc.trigger("view/addMesh", mesh);
|
Nc.trigger(Nc.ns.client.view.mesh.add, mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
Nc.trigger("view/createMesh",
|
Nc.trigger("view/createMesh",
|
||||||
|
|
@ -40,13 +40,13 @@ function (Parent, Settings, Nc) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Item.prototype.destroy = function() {
|
Item.prototype.destroy = function() {
|
||||||
Nc.trigger("view/removeMesh", this.mesh);
|
Nc.trigger(Nc.ns.client.view.mesh.remove, this.mesh);
|
||||||
Parent.prototype.destroy.call(this);
|
Parent.prototype.destroy.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
Item.prototype.render = function() {
|
Item.prototype.render = function() {
|
||||||
|
|
||||||
Nc.trigger("view/updateMesh",
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
this.mesh,
|
this.mesh,
|
||||||
{
|
{
|
||||||
x: this.body.GetPosition().x * Settings.RATIO,
|
x: this.body.GetPosition().x * Settings.RATIO,
|
||||||
|
|
@ -62,7 +62,7 @@ function (Parent, Settings, Nc) {
|
||||||
Parent.prototype.flip.call(this, direction);
|
Parent.prototype.flip.call(this, direction);
|
||||||
|
|
||||||
if(oldFlipDirection != direction) {
|
if(oldFlipDirection != direction) {
|
||||||
Nc.trigger("view/updateMesh",
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
this.mesh,
|
this.mesh,
|
||||||
{
|
{
|
||||||
xScale: direction
|
xScale: direction
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ function (Parent, CoreItem, Settings, Nc) {
|
||||||
self.limbMeshes[name] = mesh;
|
self.limbMeshes[name] = mesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
Nc.trigger("view/addMesh", mesh);
|
Nc.trigger(Nc.ns.client.view.mesh.add, mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
Nc.trigger("view/createMesh",
|
Nc.trigger("view/createMesh",
|
||||||
|
|
@ -60,7 +60,7 @@ function (Parent, CoreItem, Settings, Nc) {
|
||||||
if(this.limbs) {
|
if(this.limbs) {
|
||||||
for(var name in this.limbMeshes) {
|
for(var name in this.limbMeshes) {
|
||||||
if(this.limbs[name]) {
|
if(this.limbs[name]) {
|
||||||
Nc.trigger("view/updateMesh",
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
this.limbMeshes[name],
|
this.limbMeshes[name],
|
||||||
{
|
{
|
||||||
x: this.limbs[name].GetPosition().x * Settings.RATIO,
|
x: this.limbs[name].GetPosition().x * Settings.RATIO,
|
||||||
|
|
@ -80,7 +80,7 @@ function (Parent, CoreItem, Settings, Nc) {
|
||||||
CoreItem.prototype.flip.call(this, direction);
|
CoreItem.prototype.flip.call(this, direction);
|
||||||
|
|
||||||
if(oldFlipDirection != direction) {
|
if(oldFlipDirection != direction) {
|
||||||
Nc.trigger("view/updateMesh",
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
this.mesh,
|
this.mesh,
|
||||||
{
|
{
|
||||||
xScale: direction
|
xScale: direction
|
||||||
|
|
@ -88,7 +88,7 @@ function (Parent, CoreItem, Settings, Nc) {
|
||||||
);
|
);
|
||||||
|
|
||||||
for (var name in this.limbMeshes) {
|
for (var name in this.limbMeshes) {
|
||||||
Nc.trigger("view/updateMesh",
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
this.limbMeshes[name],
|
this.limbMeshes[name],
|
||||||
{
|
{
|
||||||
xScale: direction
|
xScale: direction
|
||||||
|
|
@ -100,7 +100,7 @@ function (Parent, CoreItem, Settings, Nc) {
|
||||||
|
|
||||||
RagDoll.prototype.destroy = function() {
|
RagDoll.prototype.destroy = function() {
|
||||||
for (var name in this.limbMeshes) {
|
for (var name in this.limbMeshes) {
|
||||||
Nc.trigger("view/removeMesh", this.limbMeshes[name]);
|
Nc.trigger(Nc.ns.client.view.mesh.remove, this.limbMeshes[name]);
|
||||||
};
|
};
|
||||||
|
|
||||||
Parent.prototype.destroy.call(this);
|
Parent.prototype.destroy.call(this);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ function (Parent, Settings, Nc) {
|
||||||
|
|
||||||
var callback = function(mesh) {
|
var callback = function(mesh) {
|
||||||
self.mesh = mesh;
|
self.mesh = mesh;
|
||||||
Nc.trigger("view/addMesh", mesh);
|
Nc.trigger(Nc.ns.client.view.mesh.add, mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
Nc.trigger("view/createMesh",
|
Nc.trigger("view/createMesh",
|
||||||
|
|
@ -45,13 +45,13 @@ function (Parent, Settings, Nc) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Tile.prototype.destroy = function() {
|
Tile.prototype.destroy = function() {
|
||||||
Nc.trigger("view/removeMesh", this.mesh);
|
Nc.trigger(Nc.ns.client.view.mesh.remove, this.mesh);
|
||||||
Parent.prototype.destroy.call(this);
|
Parent.prototype.destroy.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tile.prototype.render = function() {
|
Tile.prototype.render = function() {
|
||||||
|
|
||||||
Nc.trigger("view/updateMesh",
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
this.mesh,
|
this.mesh,
|
||||||
{
|
{
|
||||||
x: this.body.GetPosition().x * Settings.RATIO,
|
x: this.body.GetPosition().x * Settings.RATIO,
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ function (Parent, Settings, Nc, PIXI) {
|
||||||
loader.onComplete = function() { callback(levelData); };
|
loader.onComplete = function() { callback(levelData); };
|
||||||
loader.onProgress = function() {
|
loader.onProgress = function() {
|
||||||
var progress = parseInt(100 / numPaths * ++count, 10) + 1;
|
var progress = parseInt(100 / numPaths * ++count, 10) + 1;
|
||||||
Nc.trigger("view/updateLoader", progress);
|
Nc.trigger(Nc.ns.client.view.preloadBar.update, progress);
|
||||||
}
|
}
|
||||||
loader.load();
|
loader.load();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ function (ProtocolHelper, GameController, User, Nc, Settings, DomController) {
|
||||||
ProtocolHelper.applyCommand(message, self);
|
ProtocolHelper.applyCommand(message, self);
|
||||||
});
|
});
|
||||||
|
|
||||||
Nc.on("sendGameCommand", this.sendGameCommand, this);
|
Nc.on(Nc.ns.client.to.server.gameCommand.send, this.sendGameCommand, this);
|
||||||
Nc.on("game/level/loaded", this.onLevelLoaded, this);
|
Nc.on(Nc.ns.core.game.events.level.loaded, this.onLevelLoaded, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Socket callbacks
|
// Socket callbacks
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ function (Parent, Settings, DomController, Box2D, Nc) {
|
||||||
|
|
||||||
this.debugMode = false;
|
this.debugMode = false;
|
||||||
|
|
||||||
Nc.on("view/toggleDebugMode", this.onToggleDebugMode, this);
|
Nc.on(Nc.ns.client.view.debugMode.toggle, this.onToggleDebugMode, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Engine.prototype = Object.create(Parent.prototype);
|
Engine.prototype = Object.create(Parent.prototype);
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ function (Parent, Nc, Settings) {
|
||||||
|
|
||||||
Player.prototype.destroy = function() {
|
Player.prototype.destroy = function() {
|
||||||
Parent.prototype.destroy.call(this);
|
Parent.prototype.destroy.call(this);
|
||||||
Nc.trigger("view/removePlayerInfo", this.playerInfoView);
|
Nc.trigger(Nc.ns.client.view.playerInfo.remove, this.playerInfoView);
|
||||||
};
|
};
|
||||||
|
|
||||||
return Player;
|
return Player;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ function (Settings, Nc, Stats, Screenfull) {
|
||||||
|
|
||||||
window.onresize = function() {
|
window.onresize = function() {
|
||||||
if(Screenfull.enabled) {
|
if(Screenfull.enabled) {
|
||||||
Nc.trigger("view/fullscreenChange", Screenfull.isFullscreen);
|
Nc.trigger(Nc.ns.client.view.fullscreen.change, Screenfull.isFullscreen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@ function (Settings, Nc, Stats, Screenfull) {
|
||||||
var checkbox = document.createElement("input");
|
var checkbox = document.createElement("input");
|
||||||
checkbox.type = "checkbox";
|
checkbox.type = "checkbox";
|
||||||
checkbox.onclick = function(e) {
|
checkbox.onclick = function(e) {
|
||||||
Nc.trigger("view/toggleDebugMode", e.target.checked);
|
Nc.trigger(Nc.ns.client.view.debugMode.toggle, e.target.checked);
|
||||||
self.getDebugCanvas().style.display = e.target.checked ? "" : "none";
|
self.getDebugCanvas().style.display = e.target.checked ? "" : "none";
|
||||||
}
|
}
|
||||||
label.appendChild(checkbox);
|
label.appendChild(checkbox);
|
||||||
|
|
|
||||||
|
|
@ -14,20 +14,21 @@ function (DomController, Settings, Exception, Nc) {
|
||||||
|
|
||||||
Nc.on("view/createMesh", this.createMesh, this);
|
Nc.on("view/createMesh", this.createMesh, this);
|
||||||
Nc.on("view/createAnimatedMesh", this.createAnimatedMesh, this);
|
Nc.on("view/createAnimatedMesh", this.createAnimatedMesh, this);
|
||||||
Nc.on("view/addMesh", this.addMesh, this);
|
Nc.on(Nc.ns.client.view.mesh.add, this.addMesh, this);
|
||||||
Nc.on("view/removeMesh", this.removeMesh, this);
|
Nc.on(Nc.ns.client.view.mesh.remove, this.removeMesh, this);
|
||||||
Nc.on("view/updateMesh", this.updateMesh, this);
|
Nc.on(Nc.ns.client.view.mesh.update, this.updateMesh, this);
|
||||||
|
|
||||||
Nc.on("view/fullscreenChange", this.onFullscreenChange, this);
|
Nc.on(Nc.ns.client.view.fullscreen.change, this.onFullscreenChange, this);
|
||||||
Nc.on("view/toggleDebugMode", this.onToggleDebugMode, this);
|
Nc.on(Nc.ns.client.view.debugMode.toggle, this.onToggleDebugMode, this);
|
||||||
|
|
||||||
Nc.on("view/toggleInfo", this.onToggleInfo, this);
|
Nc.on("view/toggleInfo", this.onToggleInfo, this);
|
||||||
|
|
||||||
Nc.on(Nc.ns.client.view.playerInfo.createAndAdd, this.onCreateAndAddPlayerInfo, this);
|
Nc.on(Nc.ns.client.view.playerInfo.createAndAdd, this.onCreateAndAddPlayerInfo, this);
|
||||||
Nc.on(Nc.ns.client.view.playerInfo.update, this.onUpdatePlayerInfo, this);
|
Nc.on(Nc.ns.client.view.playerInfo.update, this.onUpdatePlayerInfo, this);
|
||||||
Nc.on("view/removePlayerInfo", this.onRemovePlayerInfo, this);
|
Nc.on(Nc.ns.client.view.playerInfo.remove, this.onRemovePlayerInfo, this);
|
||||||
|
|
||||||
Nc.on("view/updateLoader", this.onUpdateLoader, this);
|
|
||||||
|
Nc.on(Nc.ns.client.view.preloadBar.update, this.onUpdateLoader, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractView.prototype.isWebGlEnabled = function () {
|
AbstractView.prototype.isWebGlEnabled = function () {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ define(function() {
|
||||||
GRAPHICS_SUBPATH_CHARACTERS: 'Characters/',
|
GRAPHICS_SUBPATH_CHARACTERS: 'Characters/',
|
||||||
GRAPHICS_SUBPATH_TILES: 'Tiles/',
|
GRAPHICS_SUBPATH_TILES: 'Tiles/',
|
||||||
MAPS_PATH: 'static/maps/tiled/',
|
MAPS_PATH: 'static/maps/tiled/',
|
||||||
DEFAULT_LEVELS: ['stones2', 'debug'],
|
DEFAULT_LEVELS: ['debug', 'stones2', 'debug'],
|
||||||
|
|
||||||
RATIO: 21, //35
|
RATIO: 21, //35
|
||||||
// original tile size is 25 but we want it to resize to 20
|
// original tile size is 25 but we want it to resize to 20
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,10 @@ function (PhysicsEngine, TiledLevel, Player, Nc) {
|
||||||
this.physicsEngine = new PhysicsEngine();
|
this.physicsEngine = new PhysicsEngine();
|
||||||
this.physicsEngine.setCollisionDetector();
|
this.physicsEngine.setCollisionDetector();
|
||||||
|
|
||||||
Nc.on("game/level/loaded", this.onLevelLoaded, this);
|
Nc.on(Nc.ns.core.game.events.level.loaded, this.onLevelLoaded, this);
|
||||||
|
|
||||||
Nc.on("game/object/add", this.onGameObjectAdd, this);
|
Nc.on(Nc.ns.core.game.gameObject.add, this.onGameObjectAdd, this);
|
||||||
Nc.on("game/object/remove", this.onGameObjectRemove, this);
|
Nc.on(Nc.ns.core.game.gameObject.remove, this.onGameObjectRemove, this);
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ function (Parent, Box2D, Settings, Nc) {
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
Nc.trigger("game/object/add", 'animated', this);
|
Nc.trigger(Nc.ns.core.game.gameObject.add, 'animated', this);
|
||||||
}
|
}
|
||||||
|
|
||||||
RagDoll.prototype = Object.create(Parent.prototype);
|
RagDoll.prototype = Object.create(Parent.prototype);
|
||||||
|
|
@ -362,7 +362,7 @@ function (Parent, Box2D, Settings, Nc) {
|
||||||
};
|
};
|
||||||
|
|
||||||
RagDoll.prototype.destroy = function() {
|
RagDoll.prototype.destroy = function() {
|
||||||
Nc.trigger("game/object/remove", 'animated', this);
|
Nc.trigger(Nc.ns.core.game.gameObject.remove, 'animated', this);
|
||||||
var world = this.body.GetWorld();
|
var world = this.body.GetWorld();
|
||||||
Parent.prototype.destroy.call(this);
|
Parent.prototype.destroy.call(this);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ define([
|
||||||
self.createTiles();
|
self.createTiles();
|
||||||
self.createItems();
|
self.createItems();
|
||||||
self.isLoaded = true;
|
self.isLoaded = true;
|
||||||
Nc.trigger("game/level/loaded");
|
Nc.trigger(Nc.ns.core.game.events.level.loaded);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ function (Doll, Settings, Nc, Exception, SpectatorDoll, RagDoll) {
|
||||||
this.doll = new Doll(this.physicsEngine, "doll-" + this.id, this);
|
this.doll = new Doll(this.physicsEngine, "doll-" + this.id, this);
|
||||||
this.doll.spawn(x, y);
|
this.doll.spawn(x, y);
|
||||||
this.isSpawned = true;
|
this.isSpawned = true;
|
||||||
Nc.trigger("game/object/add", 'animated', this.doll);
|
Nc.trigger(Nc.ns.core.game.gameObject.add, 'animated', this.doll);
|
||||||
}
|
}
|
||||||
|
|
||||||
Player.prototype.getPosition = function () {
|
Player.prototype.getPosition = function () {
|
||||||
|
|
@ -120,7 +120,7 @@ function (Doll, Settings, Nc, Exception, SpectatorDoll, RagDoll) {
|
||||||
|
|
||||||
this.isSpawned = false;
|
this.isSpawned = false;
|
||||||
|
|
||||||
Nc.trigger("game/object/remove", 'animated', this.doll);
|
Nc.trigger(Nc.ns.core.game.gameObject.remove, 'animated', this.doll);
|
||||||
this.doll.destroy();
|
this.doll.destroy();
|
||||||
this.doll = null;
|
this.doll = null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ function (Parent, ProtocolHelper, GameController, User, Nc) {
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
Nc.on("sendGameCommand", this.sendGameCommand, this);
|
Nc.on(Nc.ns.client.to.server.gameCommand.send, this.sendGameCommand, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Worker.prototype.sendCommand = function (command, options) {
|
Worker.prototype.sendCommand = function (command, options) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue