replaced NotificationCenter with Nc

This commit is contained in:
logsol 2014-03-01 11:07:23 +01:00
parent da913c4709
commit 672a46efa8
35 changed files with 160 additions and 161 deletions

View file

@ -5,7 +5,7 @@ define([
"Lib/Utilities/Exception"
],
function (Parent, Settings, NotificationCenter, Exception) {
function (Parent, Settings, Nc, Exception) {
function Doll(physicsEngine, uid, player) {
this.animationDef = {
@ -35,12 +35,12 @@ function (Parent, Settings, NotificationCenter, Exception) {
if(!state) throw new Exception("action state is undefined");
if(this.animatedMeshes[this.actionState]) {
NotificationCenter.trigger("view/updateMesh", this.animatedMeshes[this.actionState], { visible: false });
Nc.trigger("view/updateMesh", this.animatedMeshes[this.actionState], { visible: false });
}
Parent.prototype.setActionState.call(this, state);
NotificationCenter.trigger("view/updateMesh", this.animatedMeshes[this.actionState], { visible: true });
Nc.trigger("view/updateMesh", this.animatedMeshes[this.actionState], { visible: true });
}
Doll.prototype.createMesh = function() {
@ -73,10 +73,10 @@ function (Parent, Settings, NotificationCenter, Exception) {
var callback = function(mesh) {
self.animatedMeshes[key] = mesh;
NotificationCenter.trigger("view/addMesh", mesh);
Nc.trigger("view/addMesh", mesh);
};
NotificationCenter.trigger("view/createAnimatedMesh", texturePaths, callback, {
Nc.trigger("view/createAnimatedMesh", texturePaths, callback, {
visible: false,
pivot: {
x: 35/2,
@ -92,9 +92,9 @@ function (Parent, Settings, NotificationCenter, Exception) {
var texturePath = Settings.GRAPHICS_PATH + "Characters/Chuck/head.png";
var callback = function (mesh) {
self.headMesh = mesh;
NotificationCenter.trigger("view/addMesh", mesh);
Nc.trigger("view/addMesh", mesh);
}
NotificationCenter.trigger("view/createMesh", texturePath, callback, {
Nc.trigger("view/createMesh", texturePath, callback, {
pivot: {
x: 5,
y: 12
@ -112,7 +112,7 @@ function (Parent, Settings, NotificationCenter, Exception) {
if(oldLookDirection != this.lookDirection) {
for(var key in this.animatedMeshes) {
NotificationCenter.trigger("view/updateMesh",
Nc.trigger("view/updateMesh",
this.animatedMeshes[key],
{
xScale: this.lookDirection
@ -123,7 +123,7 @@ function (Parent, Settings, NotificationCenter, Exception) {
var angle = Math.atan2(this.lookAtXY.x, this.lookAtXY.y) / 2 - 0.7855 * this.lookDirection; // 0.7855 = 45°
NotificationCenter.trigger("view/updateMesh",
Nc.trigger("view/updateMesh",
this.headMesh,
{
xScale: this.lookDirection,
@ -135,17 +135,17 @@ function (Parent, Settings, NotificationCenter, Exception) {
Doll.prototype.destroy = function () {
for (var key in this.animatedMeshes) {
NotificationCenter.trigger("view/removeMesh", this.animatedMeshes[key]);
Nc.trigger("view/removeMesh", this.animatedMeshes[key]);
}
NotificationCenter.trigger("view/removeMesh", this.headMesh);
Nc.trigger("view/removeMesh", this.headMesh);
Parent.prototype.destroy.call(this);
}
Doll.prototype.render = function() {
if(this.actionState) {
NotificationCenter.trigger("view/updateMesh",
Nc.trigger("view/updateMesh",
this.animatedMeshes[this.actionState],
{
x: this.body.GetPosition().x * Settings.RATIO,
@ -154,7 +154,7 @@ function (Parent, Settings, NotificationCenter, Exception) {
}
);
NotificationCenter.trigger("view/updateMesh",
Nc.trigger("view/updateMesh",
this.headMesh,
{
x: this.body.GetPosition().x * Settings.RATIO,

View file

@ -4,7 +4,7 @@ define([
"Lib/Utilities/NotificationCenter"
],
function (Parent, Exception, NotificationCenter) {
function (Parent, Exception, Nc) {
function GameObject(physicsEngine, uid) {
Parent.call(this, physicsEngine, uid);

View file

@ -4,7 +4,7 @@ define([
"Lib/Utilities/NotificationCenter"
],
function (Parent, Settings, NotificationCenter) {
function (Parent, Settings, Nc) {
function Item(physicsEngine, uid, options) {
Parent.call(this, physicsEngine, uid, options);
@ -22,10 +22,10 @@ function (Parent, Settings, NotificationCenter) {
var callback = function(mesh) {
self.mesh = mesh;
NotificationCenter.trigger("view/addMesh", mesh);
Nc.trigger("view/addMesh", mesh);
}
NotificationCenter.trigger("view/createMesh",
Nc.trigger("view/createMesh",
texturePath,
callback,
{
@ -40,13 +40,13 @@ function (Parent, Settings, NotificationCenter) {
};
Item.prototype.destroy = function() {
NotificationCenter.trigger("view/removeMesh", this.mesh);
Nc.trigger("view/removeMesh", this.mesh);
Parent.prototype.destroy.call(this);
};
Item.prototype.render = function() {
NotificationCenter.trigger("view/updateMesh",
Nc.trigger("view/updateMesh",
this.mesh,
{
x: this.body.GetPosition().x * Settings.RATIO,
@ -62,7 +62,7 @@ function (Parent, Settings, NotificationCenter) {
Parent.prototype.flip.call(this, direction);
if(oldFlipDirection != direction) {
NotificationCenter.trigger("view/updateMesh",
Nc.trigger("view/updateMesh",
this.mesh,
{
xScale: direction

View file

@ -5,7 +5,7 @@ define([
"Lib/Utilities/NotificationCenter"
],
function (Parent, CoreItem, Settings, NotificationCenter) {
function (Parent, CoreItem, Settings, Nc) {
function RagDoll(physicsEngine, uid, options) {
this.limbMeshes = {};
@ -37,10 +37,10 @@ function (Parent, CoreItem, Settings, NotificationCenter) {
self.limbMeshes[name] = mesh;
}
NotificationCenter.trigger("view/addMesh", mesh);
Nc.trigger("view/addMesh", mesh);
}
NotificationCenter.trigger("view/createMesh",
Nc.trigger("view/createMesh",
texturePath + name + ".png",
callback,
{
@ -60,7 +60,7 @@ function (Parent, CoreItem, Settings, NotificationCenter) {
if(this.limbs) {
for(var name in this.limbMeshes) {
if(this.limbs[name]) {
NotificationCenter.trigger("view/updateMesh",
Nc.trigger("view/updateMesh",
this.limbMeshes[name],
{
x: this.limbs[name].GetPosition().x * Settings.RATIO,
@ -80,7 +80,7 @@ function (Parent, CoreItem, Settings, NotificationCenter) {
CoreItem.prototype.flip.call(this, direction);
if(oldFlipDirection != direction) {
NotificationCenter.trigger("view/updateMesh",
Nc.trigger("view/updateMesh",
this.mesh,
{
xScale: direction
@ -88,7 +88,7 @@ function (Parent, CoreItem, Settings, NotificationCenter) {
);
for (var name in this.limbMeshes) {
NotificationCenter.trigger("view/updateMesh",
Nc.trigger("view/updateMesh",
this.limbMeshes[name],
{
xScale: direction
@ -100,7 +100,7 @@ function (Parent, CoreItem, Settings, NotificationCenter) {
RagDoll.prototype.destroy = function() {
for (var name in this.limbMeshes) {
NotificationCenter.trigger("view/removeMesh", this.limbMeshes[name]);
Nc.trigger("view/removeMesh", this.limbMeshes[name]);
};
Parent.prototype.destroy.call(this);

View file

@ -4,7 +4,7 @@ define([
"Lib/Utilities/NotificationCenter"
],
function (Parent, Settings, NotificationCenter) {
function (Parent, Settings, Nc) {
function Tile(physicsEngine, uid, options) {
Parent.call(this, physicsEngine, uid, options);
@ -27,10 +27,10 @@ function (Parent, Settings, NotificationCenter) {
var callback = function(mesh) {
self.mesh = mesh;
NotificationCenter.trigger("view/addMesh", mesh);
Nc.trigger("view/addMesh", mesh);
}
NotificationCenter.trigger("view/createMesh",
Nc.trigger("view/createMesh",
texturePath,
callback,
{
@ -45,13 +45,13 @@ function (Parent, Settings, NotificationCenter) {
};
Tile.prototype.destroy = function() {
NotificationCenter.trigger("view/removeMesh", this.mesh);
Nc.trigger("view/removeMesh", this.mesh);
Parent.prototype.destroy.call(this);
};
Tile.prototype.render = function() {
NotificationCenter.trigger("view/updateMesh",
Nc.trigger("view/updateMesh",
this.mesh,
{
x: this.body.GetPosition().x * Settings.RATIO,