Makes singleton variable name of NotificationCenter lowercase

When we require a singleton, its instance name should be named
by lowercase, since it is not a class.

Relates to #128
This commit is contained in:
logsol 2016-10-10 22:11:55 +02:00
parent ffc55a204a
commit 3cb2e39a18
57 changed files with 262 additions and 262 deletions

View file

@ -9,7 +9,7 @@ define([
"Lib/Utilities/Assert",
],
function (PhysicsEngine, TiledLevel, Player, Nc, Doll, GameObject, Item, Assert) {
function (PhysicsEngine, TiledLevel, Player, nc, Doll, GameObject, Item, Assert) {
"use strict";
@ -24,8 +24,8 @@ function (PhysicsEngine, TiledLevel, Player, Nc, Doll, GameObject, Item, Assert)
this.physicsEngine.setCollisionDetector();
this.ncTokens = [
Nc.on(Nc.ns.core.game.worldUpdateObjects.add, this.onWorldUpdateObjectAdd, this),
Nc.on(Nc.ns.core.game.worldUpdateObjects.remove, this.onWorldUpdateObjectRemove, this)
nc.on(nc.ns.core.game.worldUpdateObjects.add, this.onWorldUpdateObjectAdd, this),
nc.on(nc.ns.core.game.worldUpdateObjects.remove, this.onWorldUpdateObjectRemove, this)
];
this.loadLevel(options.levelUid);
@ -116,10 +116,10 @@ function (PhysicsEngine, TiledLevel, Player, Nc, Doll, GameObject, Item, Assert)
}
// FIXME ns.client in core?
Nc.trigger(Nc.ns.client.game.events.destroy);
nc.trigger(nc.ns.client.game.events.destroy);
// Testing after destroy if worldUpdateObjects is empty
// events.game.destroy -> gameobjects.destroy() -> Nc.trigger(worldUpdateObjects.remove)
// events.game.destroy -> gameobjects.destroy() -> nc.trigger(worldUpdateObjects.remove)
if(Object.keys(this.worldUpdateObjects).length > 0) {
console.warn('Not all worldUpdateObjects have been removed... ', Object.keys(this.worldUpdateObjects));
}
@ -127,7 +127,7 @@ function (PhysicsEngine, TiledLevel, Player, Nc, Doll, GameObject, Item, Assert)
this.physicsEngine.destroy();
this.worldUpdateObjects = null;
Nc.off(this.ncTokens);
nc.off(this.ncTokens);
};
return GameController;

View file

@ -9,7 +9,7 @@ define([
"Lib/Utilities/Assert"
],
function (Parent, Exception, Box2D, Settings, CollisionDetector, Item, Nc, Assert) {
function (Parent, Exception, Box2D, Settings, CollisionDetector, Item, nc, Assert) {
"use strict";
@ -45,7 +45,7 @@ function (Parent, Exception, Box2D, Settings, CollisionDetector, Item, Nc, Asser
this.createFixtures();
this.body.SetActive(false);
Nc.trigger(Nc.ns.core.game.worldUpdateObjects.add, this);
nc.trigger(nc.ns.core.game.worldUpdateObjects.add, this);
}
Doll.prototype = Object.create(Parent.prototype);
@ -481,7 +481,7 @@ function (Parent, Exception, Box2D, Settings, CollisionDetector, Item, Nc, Asser
};
Doll.prototype.destroy = function() {
Nc.trigger(Nc.ns.core.game.worldUpdateObjects.remove, this);
nc.trigger(nc.ns.core.game.worldUpdateObjects.remove, this);
Parent.prototype.destroy.call(this);
};

View file

@ -5,7 +5,7 @@ define([
"Lib/Utilities/NotificationCenter"
],
function (Box2D, Exception, Assert, Nc) {
function (Box2D, Exception, Assert, nc) {
"use strict";
@ -17,7 +17,7 @@ function (Box2D, Exception, Assert, Nc) {
this.body = physicsEngine.createBody(def);
this.ncTokens = (this.ncTokens || []).concat([
Nc.on(Nc.ns.client.game.events.destroy, this.destroy, this)
nc.on(nc.ns.client.game.events.destroy, this.destroy, this)
]);
}
@ -33,7 +33,7 @@ function (Box2D, Exception, Assert, Nc) {
throw new Exception("can not destroy body");
}
Nc.off(this.ncTokens);
nc.off(this.ncTokens);
};
GameObject.prototype.getBody = function() {

View file

@ -8,7 +8,7 @@ define([
"Lib/Utilities/Assert"
],
function (Parent, Box2D, Options, Settings, Exception, Nc, Assert) {
function (Parent, Box2D, Options, Settings, Exception, nc, Assert) {
"use strict";
@ -41,7 +41,7 @@ function (Parent, Box2D, Options, Settings, Exception, Nc, Assert) {
this.body.SetBullet(true);
}
Nc.trigger(Nc.ns.core.game.worldUpdateObjects.add, this);
nc.trigger(nc.ns.core.game.worldUpdateObjects.add, this);
}
Item.prototype = Object.create(Parent.prototype);
@ -158,7 +158,7 @@ function (Parent, Box2D, Options, Settings, Exception, Nc, Assert) {
};
Item.prototype.destroy = function() {
Nc.trigger(Nc.ns.core.game.worldUpdateObjects.remove, this);
nc.trigger(nc.ns.core.game.worldUpdateObjects.remove, this);
Parent.prototype.destroy.call(this);
};

View file

@ -8,7 +8,7 @@ define([
"Game/Config/ItemSettings",
],
function (Parent, Box2D, Settings, Nc, Assert, Options, ItemSettings) {
function (Parent, Box2D, Settings, nc, Assert, Options, ItemSettings) {
"use strict";

View file

@ -9,7 +9,7 @@ define([
"json!Game/Asset/RubeDoll.json" // using requirejs json loader plugin
],
function (Parent, RubeLoader, Box2D, Settings, Assert, Nc, Matrix, RubeDollJson) {
function (Parent, RubeLoader, Box2D, Settings, Assert, nc, Matrix, RubeDollJson) {
"use strict";

View file

@ -7,7 +7,7 @@ define([
"Lib/Utilities/Assert"
],
function (Parent, Box2D, Settings, Exception, Nc, Assert) {
function (Parent, Box2D, Settings, Exception, nc, Assert) {
"use strict";

View file

@ -10,7 +10,7 @@ define([
"Game/" + GLOBALS.context + "/GameObjects/Items/RagDoll",
"Game/" + GLOBALS.context + "/GameObjects/Items/RubeDoll"
], function (Settings, Box2D, Nc, Abstract, CollisionDetector, Tile, Item, Skateboard, RagDoll, RubeDoll) {
], function (Settings, Box2D, nc, Abstract, CollisionDetector, Tile, Item, Skateboard, RagDoll, RubeDoll) {
"use strict";
@ -34,7 +34,7 @@ define([
Level.prototype.setup = function(levelData) { // jshint unused:false
this.isLoaded = true;
Nc.trigger(Nc.ns.core.game.events.level.loaded);
nc.trigger(nc.ns.core.game.events.level.loaded);
};
Level.prototype.createItems = function(options) {

View file

@ -13,7 +13,7 @@ define([
"Game/" + GLOBALS.context + "/GameObjects/Item",
"Game/" + GLOBALS.context + "/GameObjects/Items/Skateboard",
], function (Parent, Settings, ItemSettings, Box2D, Options, Exception, Nc, Assert, AbstractLayer, CollisionDetector, Tile, Item, Skateboard) {
], function (Parent, Settings, ItemSettings, Box2D, Options, Exception, nc, Assert, AbstractLayer, CollisionDetector, Tile, Item, Skateboard) {
"use strict";

View file

@ -5,7 +5,7 @@ define([
"Lib/Utilities/NotificationCenter"
],
function (Settings, Box2D, CollisionDetector, Nc) {
function (Settings, Box2D, CollisionDetector, nc) {
"use strict";
@ -19,7 +19,7 @@ function (Settings, Box2D, CollisionDetector, Nc) {
this.worldQueue = [];
this.ncTokens = [
Nc.on(Nc.ns.channel.engine.worldQueue.add, this.addToWorldQueue, this)
nc.on(nc.ns.channel.engine.worldQueue.add, this.addToWorldQueue, this)
];
}
@ -62,7 +62,7 @@ function (Settings, Box2D, CollisionDetector, Nc) {
}
Engine.prototype.destroy = function() {
Nc.offAll(this.ncTokens);
nc.offAll(this.ncTokens);
delete this.world;
};

View file

@ -9,7 +9,7 @@ define([
"Game/" + GLOBALS.context + "/GameObjects/Items/RubeDoll"
],
function (Doll, PlayerController, Settings, Nc, Exception, ColorConverter, SpectatorDoll, RubeDoll) {
function (Doll, PlayerController, Settings, nc, Exception, ColorConverter, SpectatorDoll, RubeDoll) {
"use strict";