mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
replaced NotificationCenter with Nc
This commit is contained in:
parent
da913c4709
commit
672a46efa8
35 changed files with 160 additions and 161 deletions
|
|
@ -5,7 +5,7 @@ define([
|
|||
"Lib/Utilities/NotificationCenter"
|
||||
],
|
||||
|
||||
function (Parent, DomController, Settings, NotificationCenter) {
|
||||
function (Parent, DomController, Settings, Nc) {
|
||||
|
||||
function MouseInput() {
|
||||
Parent.call(this);
|
||||
|
|
@ -37,7 +37,7 @@ function (Parent, DomController, Settings, NotificationCenter) {
|
|||
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;
|
||||
|
||||
NotificationCenter.trigger("input/onHandActionRequest", x, y);
|
||||
Nc.trigger("input/onHandActionRequest", x, y);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ define([
|
|||
"Lib/Utilities/NotificationCenter"
|
||||
],
|
||||
|
||||
function (NotificationCenter) {
|
||||
function (Nc) {
|
||||
|
||||
function XyInput() {
|
||||
this.x = null;
|
||||
|
|
@ -12,7 +12,7 @@ function (NotificationCenter) {
|
|||
XyInput.prototype.onXyChange = function(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
NotificationCenter.trigger('input/onXyChange', x, y);
|
||||
Nc.trigger('input/onXyChange', x, y);
|
||||
}
|
||||
|
||||
return XyInput;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ define([
|
|||
"Lib/Utilities/NotificationCenter"
|
||||
],
|
||||
|
||||
function (Parent, KeyboardInput, MouseInput, NotificationCenter) {
|
||||
function (Parent, KeyboardInput, MouseInput, Nc) {
|
||||
|
||||
function PlayerController (me) {
|
||||
|
||||
|
|
@ -14,8 +14,8 @@ function (Parent, KeyboardInput, MouseInput, NotificationCenter) {
|
|||
this.keyboardInput = new KeyboardInput(this);
|
||||
this.xyInput = new MouseInput(this);
|
||||
|
||||
NotificationCenter.on("input/onXyChange", this.setXY, this);
|
||||
NotificationCenter.on("input/onHandActionRequest", this.handActionRequest, this);
|
||||
Nc.on("input/onXyChange", this.setXY, this);
|
||||
Nc.on("input/onHandActionRequest", this.handActionRequest, this);
|
||||
|
||||
var keys = {
|
||||
w:87,
|
||||
|
|
@ -64,33 +64,33 @@ function (Parent, KeyboardInput, MouseInput, NotificationCenter) {
|
|||
|
||||
PlayerController.prototype.moveLeft = function () {
|
||||
Parent.prototype.moveLeft.call(this);
|
||||
NotificationCenter.trigger('sendGameCommand', 'moveLeft');
|
||||
Nc.trigger('sendGameCommand', 'moveLeft');
|
||||
}
|
||||
|
||||
PlayerController.prototype.moveRight = function () {
|
||||
Parent.prototype.moveRight.call(this);
|
||||
NotificationCenter.trigger('sendGameCommand', 'moveRight');
|
||||
Nc.trigger('sendGameCommand', 'moveRight');
|
||||
}
|
||||
|
||||
PlayerController.prototype.stop = function () {
|
||||
Parent.prototype.stop.call(this);
|
||||
NotificationCenter.trigger('sendGameCommand', 'stop');
|
||||
Nc.trigger('sendGameCommand', 'stop');
|
||||
}
|
||||
|
||||
PlayerController.prototype.jump = function () {
|
||||
Parent.prototype.jump.call(this);
|
||||
NotificationCenter.trigger('sendGameCommand', 'jump');
|
||||
Nc.trigger('sendGameCommand', 'jump');
|
||||
}
|
||||
|
||||
PlayerController.prototype.jumpStop = function () {
|
||||
Parent.prototype.jumpStop.call(this);
|
||||
NotificationCenter.trigger('sendGameCommand', 'jumpStop');
|
||||
Nc.trigger('sendGameCommand', 'jumpStop');
|
||||
}
|
||||
|
||||
PlayerController.prototype.setXY = function(x, y) {
|
||||
var options = {x:x, y:y};
|
||||
Parent.prototype.lookAt.call(this, options);
|
||||
NotificationCenter.trigger('sendGameCommand', 'lookAt', options);
|
||||
Nc.trigger('sendGameCommand', 'lookAt', options);
|
||||
};
|
||||
|
||||
PlayerController.prototype.handActionLeft = function() {
|
||||
|
|
@ -102,20 +102,20 @@ function (Parent, KeyboardInput, MouseInput, NotificationCenter) {
|
|||
};
|
||||
|
||||
PlayerController.prototype.suicide = function() {
|
||||
NotificationCenter.trigger("sendGameCommand", "suicide");
|
||||
Nc.trigger("sendGameCommand", "suicide");
|
||||
};
|
||||
|
||||
PlayerController.prototype.handActionRequest = function(x, y) {
|
||||
var options = {x:x, y:y};
|
||||
NotificationCenter.trigger("sendGameCommand", "handActionRequest", options);
|
||||
Nc.trigger("sendGameCommand", "handActionRequest", options);
|
||||
};
|
||||
|
||||
PlayerController.prototype.showInfo = function() {
|
||||
NotificationCenter.trigger("game/toggleInfo", true);
|
||||
Nc.trigger("game/toggleInfo", true);
|
||||
};
|
||||
|
||||
PlayerController.prototype.hideInfo = function() {
|
||||
NotificationCenter.trigger("game/toggleInfo", false);
|
||||
Nc.trigger("game/toggleInfo", false);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue