Decoupled References to Enable Typescript

Added a Reference to Projector to Phaser.Plugin.Isometric.
Added a delegate addIsoSprite() to Phaser.Plugin.Isometric.
This commit is contained in:
edgarjcfn
2014-10-13 23:17:57 +02:00
parent ecdd3a6b61
commit 75e75d676c
4 changed files with 21 additions and 7 deletions
+10 -2
View File
@@ -45,9 +45,9 @@
Phaser.Plugin.Isometric = function (game, parent) {
Phaser.Plugin.call(this, game, parent);
this.projector = new Phaser.Plugin.Isometric.Projector(this.game, Phaser.Plugin.Isometric.CLASSIC);
// Add an instance of Isometric.Projector to game.iso if it doesn't exist already
this.game.iso = this.game.iso || new Phaser.Plugin.Isometric.Projector(this.game, Phaser.Plugin.Isometric.CLASSIC);
this.game.iso = this.game.iso || this.projector;
};
Phaser.Plugin.Isometric.prototype = Object.create(Phaser.Plugin.prototype);
@@ -965,6 +965,14 @@ Phaser.GameObjectFactory.prototype.isoSprite = function (x, y, z, key, frame, gr
};
Phaser.Plugin.Isometric.prototype.addIsoSprite = function (x, y, z, key, frame, group) {
console.log("game", this.game);
console.log("factory", this.game.add);
return Phaser.GameObjectFactory.prototype.isoSprite.call(this.game.add, x, y, z, key, frame, group);
};
Phaser.Utils.Debug.prototype.isoSprite = function (sprite, color, filled) {
if (!sprite.isoBounds) {
File diff suppressed because one or more lines are too long
+6
View File
@@ -264,6 +264,12 @@ Phaser.GameObjectFactory.prototype.isoSprite = function (x, y, z, key, frame, gr
};
Phaser.Plugin.Isometric.prototype.addIsoSprite = function (x, y, z, key, frame, group) {
return Phaser.GameObjectFactory.prototype.isoSprite.call(this.game.add, x, y, z, key, frame, group);
};
Phaser.Utils.Debug.prototype.isoSprite = function (sprite, color, filled) {
if (!sprite.isoBounds) {
+2 -2
View File
@@ -45,9 +45,9 @@
Phaser.Plugin.Isometric = function (game, parent) {
Phaser.Plugin.call(this, game, parent);
this.projector = new Phaser.Plugin.Isometric.Projector(this.game, Phaser.Plugin.Isometric.CLASSIC);
// Add an instance of Isometric.Projector to game.iso if it doesn't exist already
this.game.iso = this.game.iso || new Phaser.Plugin.Isometric.Projector(this.game, Phaser.Plugin.Isometric.CLASSIC);
this.game.iso = this.game.iso || this.projector;
};
Phaser.Plugin.Isometric.prototype = Object.create(Phaser.Plugin.prototype);