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 (PhysicsEngine, TiledLevel, Player, NotificationCenter) {
|
||||
function (PhysicsEngine, TiledLevel, Player, Nc) {
|
||||
|
||||
function GameController () {
|
||||
this.players = {};
|
||||
|
|
@ -16,10 +16,10 @@ function (PhysicsEngine, TiledLevel, Player, NotificationCenter) {
|
|||
this.physicsEngine = new PhysicsEngine();
|
||||
this.physicsEngine.setCollisionDetector();
|
||||
|
||||
NotificationCenter.on("game/level/loaded", this.onLevelLoaded, this);
|
||||
Nc.on("game/level/loaded", this.onLevelLoaded, this);
|
||||
|
||||
NotificationCenter.on("game/object/add", this.onGameObjectAdd, this);
|
||||
NotificationCenter.on("game/object/remove", this.onGameObjectRemove, this);
|
||||
Nc.on("game/object/add", this.onGameObjectAdd, this);
|
||||
Nc.on("game/object/remove", this.onGameObjectRemove, this);
|
||||
|
||||
this.update();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ define([
|
|||
"Lib/Utilities/NotificationCenter"
|
||||
],
|
||||
|
||||
function (Parent, Box2D, Settings, NotificationCenter) {
|
||||
function (Parent, Box2D, Settings, Nc) {
|
||||
|
||||
function RagDoll(physicsEngine, uid, options) {
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ function (Parent, Box2D, Settings, NotificationCenter) {
|
|||
);
|
||||
|
||||
|
||||
NotificationCenter.trigger("game/object/add", 'animated', this);
|
||||
Nc.trigger("game/object/add", 'animated', this);
|
||||
}
|
||||
|
||||
RagDoll.prototype = Object.create(Parent.prototype);
|
||||
|
|
@ -362,7 +362,7 @@ function (Parent, Box2D, Settings, NotificationCenter) {
|
|||
};
|
||||
|
||||
RagDoll.prototype.destroy = function() {
|
||||
NotificationCenter.trigger("game/object/remove", 'animated', this);
|
||||
Nc.trigger("game/object/remove", 'animated', this);
|
||||
var world = this.body.GetWorld();
|
||||
Parent.prototype.destroy.call(this);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ define([
|
|||
"Game/" + GLOBALS.context + "/GameObjects/Items/Skateboard",
|
||||
"Game/" + GLOBALS.context + "/GameObjects/Items/RagDoll"
|
||||
|
||||
], function (Settings, Box2D, NotificationCenter, Exception, CollisionDetector, Tile, Item, Skateboard, RagDoll) {
|
||||
], function (Settings, Box2D, Nc, Exception, CollisionDetector, Tile, Item, Skateboard, RagDoll) {
|
||||
|
||||
function Level (uid, engine, gameObjects) {
|
||||
this.uid = uid;
|
||||
|
|
@ -28,7 +28,7 @@ define([
|
|||
self.createTiles();
|
||||
self.createItems();
|
||||
self.isLoaded = true;
|
||||
NotificationCenter.trigger("game/level/loaded");
|
||||
Nc.trigger("game/level/loaded");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ define([
|
|||
var options = items[i];
|
||||
var uid = "item-" + i;
|
||||
var item = this.createItem(uid, options);
|
||||
this.gameObjects.animated.push(item); // FIXME: use NotificationCenter
|
||||
this.gameObjects.animated.push(item); // FIXME: use Nc
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ define([
|
|||
"Lib/Utilities/NotificationCenter"
|
||||
],
|
||||
|
||||
function (Settings, Box2D, CollisionDetector, NotificationCenter) {
|
||||
function (Settings, Box2D, CollisionDetector, Nc) {
|
||||
|
||||
function Engine () {
|
||||
this.world = new Box2D.Dynamics.b2World(
|
||||
|
|
@ -17,7 +17,7 @@ function (Settings, Box2D, CollisionDetector, NotificationCenter) {
|
|||
this.lastStep = Date.now();
|
||||
this.worldQueue = [];
|
||||
|
||||
NotificationCenter.on("engine/addToWorldQueue", this.addToWorldQueue, this);
|
||||
Nc.on("engine/addToWorldQueue", this.addToWorldQueue, this);
|
||||
}
|
||||
|
||||
Engine.prototype.getWorld = function () {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ define([
|
|||
],
|
||||
|
||||
|
||||
function (Doll, Settings, NotificationCenter, Exception, SpectatorDoll, RagDoll) {
|
||||
function (Doll, Settings, Nc, Exception, SpectatorDoll, RagDoll) {
|
||||
|
||||
function Player (id, physicsEngine) {
|
||||
this.stats = {
|
||||
|
|
@ -39,7 +39,7 @@ function (Doll, Settings, NotificationCenter, Exception, SpectatorDoll, RagDoll)
|
|||
this.doll = new Doll(this.physicsEngine, "doll-" + this.id, this);
|
||||
this.doll.spawn(x, y);
|
||||
this.isSpawned = true;
|
||||
NotificationCenter.trigger("game/object/add", 'animated', this.doll);
|
||||
Nc.trigger("game/object/add", 'animated', this.doll);
|
||||
}
|
||||
|
||||
Player.prototype.getPosition = function () {
|
||||
|
|
@ -119,14 +119,14 @@ function (Doll, Settings, NotificationCenter, Exception, SpectatorDoll, RagDoll)
|
|||
|
||||
this.isSpawned = false;
|
||||
|
||||
NotificationCenter.trigger("game/object/remove", 'animated', this.doll);
|
||||
Nc.trigger("game/object/remove", 'animated', this.doll);
|
||||
this.doll.destroy();
|
||||
this.doll = null;
|
||||
|
||||
this.ragDoll = ragDoll;
|
||||
|
||||
|
||||
NotificationCenter.trigger("player/killed", this);
|
||||
Nc.trigger("player/killed", this);
|
||||
};
|
||||
|
||||
Player.prototype.update = function () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue