diff --git a/mar/GameObject.ts b/mar/GameObject.ts index e5b9e40..dcc1e81 100644 --- a/mar/GameObject.ts +++ b/mar/GameObject.ts @@ -250,14 +250,17 @@ class Cubot extends GameObject { private updateHologram(holoMode: HologramMode, holoColor: number, holoValue: number, holoStr: string): void { + let fillColor: string = (holoColor & 0xFFFFFF).toString(16); + fillColor = "#" + ("000000".substr(fillColor.length) + fillColor); + //Create hologram if not exist, set style if (this.hologram == undefined) { this.hologram = mar.game.make.text(0, 32, ""); this.hologram.anchor.set(0.5, 0); this.addChild(this.hologram); - this.hologram.setStyle(config.holoStyle(holoColor)); + this.hologram.setStyle(config.holoStyle(fillColor)); } else { - this.hologram.setStyle(config.holoStyle(holoColor)); + this.hologram.setStyle(config.holoStyle(fillColor)); } switch (holoMode) { diff --git a/mar/app.js b/mar/app.js index 4344d3d..cf4aee1 100644 --- a/mar/app.js +++ b/mar/app.js @@ -923,15 +923,17 @@ var Cubot = /** @class */ (function (_super) { this.updateHologram(json.holoMode, json.holoC, json.holo, json.holoStr); }; Cubot.prototype.updateHologram = function (holoMode, holoColor, holoValue, holoStr) { + var fillColor = (holoColor & 0xFFFFFF).toString(16); + fillColor = "#" + ("000000".substr(fillColor.length) + fillColor); //Create hologram if not exist, set style if (this.hologram == undefined) { this.hologram = mar.game.make.text(0, 32, ""); this.hologram.anchor.set(0.5, 0); this.addChild(this.hologram); - this.hologram.setStyle(config.holoStyle(holoColor)); + this.hologram.setStyle(config.holoStyle(fillColor)); } else { - this.hologram.setStyle(config.holoStyle(holoColor)); + this.hologram.setStyle(config.holoStyle(fillColor)); } switch (holoMode) { case HologramMode.CLEARED: diff --git a/mar/app.min.js b/mar/app.min.js index 94e57fb..cf5ad13 100644 --- a/mar/app.min.js +++ b/mar/app.min.js @@ -41,22 +41,22 @@ var Cubot=function(b){function a(a){var c=b.call(this,Util.getIsoX(a.x),Util.get c.animations.add("walk_n",mar.animationFrames.walk_n);c.animations.add("dig_w",mar.animationFrames.dig_w);c.animations.add("dig_s",mar.animationFrames.dig_s);c.animations.add("dig_e",mar.animationFrames.dig_e);c.animations.add("dig_n",mar.animationFrames.dig_n);c.createUsername();c.updateDirection();c.tint=c.getTint();return c}__extends(a,b);a.prototype.onTileHover=function(){mar.game.add.tween(this).to({isoZ:45},200,Phaser.Easing.Quadratic.InOut,!0);mar.game.add.tween(this.scale).to({x:1.2,y:1.2}, 200,Phaser.Easing.Linear.None,!0);this.tint=config.cubotHoverTint;void 0!==this.text&&(this.text.visible=!0);this.hovered=!0};a.prototype.onTileExit=function(){mar.game.add.tween(this).to({isoZ:15},400,Phaser.Easing.Bounce.Out,!0);mar.game.add.tween(this.scale).to({x:1,y:1},200,Phaser.Easing.Linear.None,!0);void 0!==this.text&&(this.text.visible=!1);this.hovered=!1;this.tint=this.getTint()};a.prototype.getTint=function(){return this.hovered?config.cubotHoverTint:this.energy<=config.lowEnergy?config.lowEnergyTint: config.cubotTint};a.prototype.updateObject=function(a){DEBUG&&console.log("Updating Cubot object");this.action=a.action;this.energy=a.energy;this.direction=a.direction;this.createInventory([a.heldItem]);this.heldItem=a.heldItem;this.tint=this.getTint();this.isAt(a.x,a.y)||this.action!=Action.WALKING||(this.tileX=a.x,this.tileY=a.y,this.walk());if(this.action==Action.DIGGING)switch(this.direction){case Direction.NORTH:this.animations.play("dig_n",60);break;case Direction.SOUTH:this.animations.play("dig_s", -60);break;case Direction.EAST:this.animations.play("dig_e",60);break;case Direction.WEST:this.animations.play("dig_w",60)}this.updateDirection();this.updateHologram(a.holoMode,a.holoC,a.holo,a.holoStr)};a.prototype.updateHologram=function(a,b,e,f){void 0==this.hologram&&(this.hologram=mar.game.make.text(0,32,""),this.hologram.anchor.set(.5,0),this.addChild(this.hologram));this.hologram.setStyle(config.holoStyle(b));switch(a){case HologramMode.CLEARED:this.hologram.text="";break;case HologramMode.DEC:this.hologram.text= -Number(e).toString();break;case HologramMode.HEX:this.hologram.text="0x"+("0000"+Number(e).toString(16).toUpperCase()).slice(-4);break;case HologramMode.STRING:this.hologram.text=f.replace(/[\n|\t]/g,"")}};a.prototype.updateDirection=function(){switch(this.direction){case Direction.NORTH:this.animations.frameName="cubot/walk_n/0001";break;case Direction.EAST:this.animations.frameName="cubot/walk_e/0001";break;case Direction.SOUTH:this.animations.frameName="cubot/walk_s/0001";break;case Direction.WEST:this.animations.frameName= -"cubot/walk_w/0001"}};a.prototype.walk=function(){var a=this,b=function(b){b=mar.game.add.tween(a).to({isoX:Util.getIsoX(a.tileX),isoY:Util.getIsoY(a.tileY)},b,Phaser.Easing.Linear.None,!0);switch(a.direction){case Direction.NORTH:a.animations.play("walk_n",60,!0);break;case Direction.SOUTH:a.animations.play("walk_s",60,!0);break;case Direction.EAST:a.animations.play("walk_e",60,!0);break;case Direction.WEST:a.animations.play("walk_w",60,!0)}b.onComplete.add(function(){a.animations.stop();a.updateDirection(); -a.isoX=Util.getIsoX(a.tileX);a.isoY=Util.getIsoY(a.tileY);a.onTileExit();for(var b=0;b { + holoStyle: (fill: string) => { return { fontSize: 32, fill: fill ? fill : config.hologramFill,