mirror of
https://github.com/simon987/Much-Assembly-Required-Frontend.git
synced 2025-04-10 14:26:44 +00:00
Added dig animation
This commit is contained in:
parent
8119ababb2
commit
2e85abf645
@ -9,11 +9,7 @@ let defaultText =
|
||||
"Version 1.3A, 1985-05-17\n" +
|
||||
"Initialising Universal Communication Port connection...Done\n" +
|
||||
"Current date is 2790-01-14\n" +
|
||||
"Cubot Status: Much Assembly Required" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"More text down here\n";
|
||||
"Cubot Status: Much Assembly Required";
|
||||
|
||||
enum ConsoleMode {
|
||||
CLEAR,
|
||||
|
@ -222,9 +222,22 @@ class Cubot extends GameObject {
|
||||
// }
|
||||
}
|
||||
|
||||
// if (this.action == Action.DIGGING) {
|
||||
// //TODO dig animation
|
||||
// }
|
||||
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);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.updateDirection();
|
||||
this.updateHologram(json.holoMode, json.holoC, json.holo, json.holoStr);
|
||||
|
27
mar/app.js
27
mar/app.js
@ -896,9 +896,22 @@ var Cubot = /** @class */ (function (_super) {
|
||||
// //TODO
|
||||
// }
|
||||
}
|
||||
// if (this.action == Action.DIGGING) {
|
||||
// //TODO dig animation
|
||||
// }
|
||||
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);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.updateDirection();
|
||||
this.updateHologram(json.holoMode, json.holoC, json.holo, json.holoStr);
|
||||
};
|
||||
@ -1191,7 +1204,6 @@ var RadioTower = /** @class */ (function (_super) {
|
||||
}(GameObject));
|
||||
var VaultDoor = /** @class */ (function (_super) {
|
||||
__extends(VaultDoor, _super);
|
||||
|
||||
function VaultDoor(json) {
|
||||
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/VaultDoor") || this;
|
||||
_this.anchor.set(myVarX, myVarY);
|
||||
@ -1202,7 +1214,6 @@ var VaultDoor = /** @class */ (function (_super) {
|
||||
_this.tileY = json.y;
|
||||
return _this;
|
||||
}
|
||||
|
||||
VaultDoor.prototype.onTileHover = function () {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 25}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
@ -1521,11 +1532,7 @@ var defaultText = " _______ __ __\n" +
|
||||
"Version 1.3A, 1985-05-17\n" +
|
||||
"Initialising Universal Communication Port connection...Done\n" +
|
||||
"Current date is 2790-01-14\n" +
|
||||
"Cubot Status: Much Assembly Required" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"More text down here\n";
|
||||
"Cubot Status: Much Assembly Required";
|
||||
var ConsoleMode;
|
||||
(function (ConsoleMode) {
|
||||
ConsoleMode[ConsoleMode["CLEAR"] = 0] = "CLEAR";
|
||||
|
31
mar/app.min.js
vendored
31
mar/app.min.js
vendored
@ -40,21 +40,22 @@ mar.game.make.text(0,0,a,{fontSize:22,fill:config.textFill,stroke:config.textStr
|
||||
var Cubot=function(b){function a(a){var c=b.call(this,Util.getIsoX(a.x),Util.getIsoY(a.y),15,"sheet",null)||this;c.queuedAnimations=[];c.hovered=!1;DEBUG&&console.log("Creating Cubot object");c.anchor.set(.5,0);c.id=a.i;c.tileX=a.x;c.tileY=a.y;c.username=a.parent;c.heldItem=a.heldItem;c.direction=a.direction;c.action=a.action;c.energy=a.energy;c.animations.add("walk_w",mar.animationFrames.walk_w);c.animations.add("walk_s",mar.animationFrames.walk_s);c.animations.add("walk_e",mar.animationFrames.walk_e);
|
||||
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.tint=this.getTint();this.isAt(a.x,a.y)||this.action!=Action.WALKING||(this.tileX=a.x,this.tileY=a.y,this.walk());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<a.queuedAnimations.length;b++)a.queuedAnimations[b](config.walkDuration/2),a.queuedAnimations.splice(b,1)})};this.animations.currentAnim.isPlaying?this.queuedAnimations.push(b):b(config.walkDuration)};a.prototype.createUsername=
|
||||
function(){var a=mar.game.make.text(0,-24,this.username,{fontSize:22,fill:config.textFill,stroke:config.textStroke,strokeThickness:2,font:"fixedsys"});a.alpha=.85;a.anchor.set(.5,0);this.username===mar.client.username?a.tint=config.selfUsernameColor:this.alpha=config.otherCubotAlpha;this.addChild(a)};return a}(GameObject),HarvesterNPC=function(b){function a(a){a=b.call(this,a)||this;a.animations.add("walk_w",mar.animationFrames.harvester_walk_w);a.animations.add("walk_s",mar.animationFrames.harvester_walk_s);
|
||||
a.animations.add("walk_e",mar.animationFrames.harvester_walk_e);a.animations.add("walk_n",mar.animationFrames.harvester_walk_n);a.updateDirection();a.setText("Harvester NPC");a.text.visible=!1;return a}__extends(a,b);a.prototype.getTint=function(){return config.cubotTint};a.prototype.updateDirection=function(){switch(this.direction){case Direction.NORTH:this.animations.frameName="harvester/walk_n/0001";break;case Direction.EAST:this.animations.frameName="harvester/walk_e/0001";break;case Direction.SOUTH:this.animations.frameName=
|
||||
"harvester/walk_s/0001";break;case Direction.WEST:this.animations.frameName="harvester/walk_w/0001"}};a.prototype.updateObject=function(a){DEBUG&&console.log("Updating Harvester NPC object");this.action=a.action;this.direction=a.direction;this.isAt(a.x,a.y)||this.action!=Action.WALKING||(this.tileX=a.x,this.tileY=a.y,this.walk());this.updateDirection()};a.prototype.createUsername=function(){};return a}(Cubot),BiomassBlob=function(b){function a(a){var c=b.call(this,Util.getIsoX(a.x),Util.getIsoY(a.y),
|
||||
10,"sheet",1)||this;DEBUG&&console.log("Creating Biomass object");c.anchor.set(.5,0);c.id=a.i;c.tileX=a.x;c.tileY=a.y;c.tint=config.biomassTint;c.animations.add("idle",mar.animationFrames.biomassIdle);c.animations.play("idle",45,!0);c.setText("Biomass");c.text.visible=!1;return c}__extends(a,b);a.prototype.onTileHover=function(){mar.game.tweens.removeFrom(this);mar.game.add.tween(this).to({isoZ:45},200,Phaser.Easing.Quadratic.InOut,!0);this.tint=config.biomassHoverTint;mar.game.add.tween(this.scale).to({x:1.2,
|
||||
y:1.2},200,Phaser.Easing.Linear.None,!0);this.text.visible=!0};a.prototype.onTileExit=function(){mar.game.tweens.removeFrom(this);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);this.tint=config.biomassTint;this.text.visible=!1};a.prototype.updateObject=function(a){DEBUG&&console.log("Updating Biomass object")};return a}(GameObject),Factory=function(b){function a(a){var c=b.call(this,Util.getIsoX(a.x),
|
||||
Util.getIsoY(a.y),15,"sheet","objects/factory")||this;c.anchor.set(.5,.25);c.setText("Factory");c.text.visible=!1;c.id=a.i;c.tileX=a.x;c.tileY=a.y;return c}__extends(a,b);a.prototype.onTileHover=function(){mar.game.tweens.removeFrom(this);mar.game.add.tween(this).to({isoZ:25},200,Phaser.Easing.Quadratic.InOut,!0);mar.game.add.tween(this.scale).to({x:1.06,y:1.06},200,Phaser.Easing.Linear.None,!0);this.tint=config.cubotHoverTint;this.text.visible=!0};a.prototype.onTileExit=function(){mar.game.tweens.removeFrom(this);
|
||||
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);this.tint=config.cubotTint;this.text.visible=!1};a.prototype.updateObject=function(a){};a.prototype.isAt=function(a,b){return(this.tileX===a||this.tileX+1===a)&&(this.tileY+1===b||this.tileY===b)};return a}(GameObject),RadioTower=function(b){function a(a){var c=b.call(this,Util.getIsoX(a.x),Util.getIsoY(a.y),15,"sheet","objects/RadioTower")||this;c.anchor.set(.48,
|
||||
.65);c.setText("Radio Tower");c.text.visible=!1;c.id=a.i;c.tileX=a.x;c.tileY=a.y;return c}__extends(a,b);a.prototype.onTileHover=function(){mar.game.tweens.removeFrom(this);mar.game.add.tween(this).to({isoZ:25},200,Phaser.Easing.Quadratic.InOut,!0);mar.game.add.tween(this.scale).to({x:1.06,y:1.06},200,Phaser.Easing.Linear.None,!0);this.tint=config.cubotHoverTint;this.text.visible=!0};a.prototype.onTileExit=function(){mar.game.tweens.removeFrom(this);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);this.tint=config.cubotTint;this.text.visible=!1};a.prototype.updateObject=function(a){};return a}(GameObject),VaultDoor=function(b){function a(a){var c=b.call(this,Util.getIsoX(a.x),Util.getIsoY(a.y),15,"sheet","objects/VaultDoor")||this;c.anchor.set(myVarX,myVarY);c.setText("Vault");c.text.visible=!1;c.id=a.i;c.tileX=a.x;c.tileY=a.y;return c}__extends(a,b);a.prototype.onTileHover=function(){mar.game.tweens.removeFrom(this);
|
||||
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.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<a.queuedAnimations.length;b++)a.queuedAnimations[b](config.walkDuration/2),a.queuedAnimations.splice(b,1)})};this.animations.currentAnim.isPlaying?this.queuedAnimations.push(b):b(config.walkDuration)};a.prototype.createUsername=function(){var a=mar.game.make.text(0,-24,this.username,{fontSize:22,fill:config.textFill,stroke:config.textStroke,strokeThickness:2,font:"fixedsys"});a.alpha=.85;a.anchor.set(.5,0);this.username===mar.client.username?
|
||||
a.tint=config.selfUsernameColor:this.alpha=config.otherCubotAlpha;this.addChild(a)};return a}(GameObject),HarvesterNPC=function(b){function a(a){a=b.call(this,a)||this;a.animations.add("walk_w",mar.animationFrames.harvester_walk_w);a.animations.add("walk_s",mar.animationFrames.harvester_walk_s);a.animations.add("walk_e",mar.animationFrames.harvester_walk_e);a.animations.add("walk_n",mar.animationFrames.harvester_walk_n);a.updateDirection();a.setText("Harvester NPC");a.text.visible=!1;return a}__extends(a,
|
||||
b);a.prototype.getTint=function(){return config.cubotTint};a.prototype.updateDirection=function(){switch(this.direction){case Direction.NORTH:this.animations.frameName="harvester/walk_n/0001";break;case Direction.EAST:this.animations.frameName="harvester/walk_e/0001";break;case Direction.SOUTH:this.animations.frameName="harvester/walk_s/0001";break;case Direction.WEST:this.animations.frameName="harvester/walk_w/0001"}};a.prototype.updateObject=function(a){DEBUG&&console.log("Updating Harvester NPC object");
|
||||
this.action=a.action;this.direction=a.direction;this.isAt(a.x,a.y)||this.action!=Action.WALKING||(this.tileX=a.x,this.tileY=a.y,this.walk());this.updateDirection()};a.prototype.createUsername=function(){};return a}(Cubot),BiomassBlob=function(b){function a(a){var c=b.call(this,Util.getIsoX(a.x),Util.getIsoY(a.y),10,"sheet",1)||this;DEBUG&&console.log("Creating Biomass object");c.anchor.set(.5,0);c.id=a.i;c.tileX=a.x;c.tileY=a.y;c.tint=config.biomassTint;c.animations.add("idle",mar.animationFrames.biomassIdle);
|
||||
c.animations.play("idle",45,!0);c.setText("Biomass");c.text.visible=!1;return c}__extends(a,b);a.prototype.onTileHover=function(){mar.game.tweens.removeFrom(this);mar.game.add.tween(this).to({isoZ:45},200,Phaser.Easing.Quadratic.InOut,!0);this.tint=config.biomassHoverTint;mar.game.add.tween(this.scale).to({x:1.2,y:1.2},200,Phaser.Easing.Linear.None,!0);this.text.visible=!0};a.prototype.onTileExit=function(){mar.game.tweens.removeFrom(this);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);this.tint=config.biomassTint;this.text.visible=!1};a.prototype.updateObject=function(a){DEBUG&&console.log("Updating Biomass object")};return a}(GameObject),Factory=function(b){function a(a){var c=b.call(this,Util.getIsoX(a.x),Util.getIsoY(a.y),15,"sheet","objects/factory")||this;c.anchor.set(.5,.25);c.setText("Factory");c.text.visible=!1;c.id=a.i;c.tileX=a.x;c.tileY=a.y;return c}__extends(a,b);a.prototype.onTileHover=
|
||||
function(){mar.game.tweens.removeFrom(this);mar.game.add.tween(this).to({isoZ:25},200,Phaser.Easing.Quadratic.InOut,!0);mar.game.add.tween(this.scale).to({x:1.06,y:1.06},200,Phaser.Easing.Linear.None,!0);this.tint=config.cubotHoverTint;this.text.visible=!0};a.prototype.onTileExit=function(){mar.game.tweens.removeFrom(this);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);this.tint=config.cubotTint;
|
||||
this.text.visible=!1};a.prototype.updateObject=function(a){};a.prototype.isAt=function(a,b){return(this.tileX===a||this.tileX+1===a)&&(this.tileY+1===b||this.tileY===b)};return a}(GameObject),RadioTower=function(b){function a(a){var c=b.call(this,Util.getIsoX(a.x),Util.getIsoY(a.y),15,"sheet","objects/RadioTower")||this;c.anchor.set(.48,.65);c.setText("Radio Tower");c.text.visible=!1;c.id=a.i;c.tileX=a.x;c.tileY=a.y;return c}__extends(a,b);a.prototype.onTileHover=function(){mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ:25},200,Phaser.Easing.Quadratic.InOut,!0);mar.game.add.tween(this.scale).to({x:1.06,y:1.06},200,Phaser.Easing.Linear.None,!0);this.tint=config.cubotHoverTint;this.text.visible=!0};a.prototype.onTileExit=function(){mar.game.tweens.removeFrom(this);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);this.tint=config.cubotTint;this.text.visible=!1};a.prototype.updateObject=
|
||||
function(a){};return a}(GameObject),Direction;(function(b){b[b.NORTH=0]="NORTH";b[b.EAST=1]="EAST";b[b.SOUTH=2]="SOUTH";b[b.WEST=3]="WEST"})(Direction||(Direction={}));var TileType;(function(b){b[b.PLAIN=0]="PLAIN";b[b.WALL=1]="WALL";b[b.IRON=2]="IRON";b[b.COPPER=3]="COPPER"})(TileType||(TileType={}));
|
||||
function(a){};return a}(GameObject),VaultDoor=function(b){function a(a){var c=b.call(this,Util.getIsoX(a.x),Util.getIsoY(a.y),15,"sheet","objects/VaultDoor")||this;c.anchor.set(myVarX,myVarY);c.setText("Vault");c.text.visible=!1;c.id=a.i;c.tileX=a.x;c.tileY=a.y;return c}__extends(a,b);a.prototype.onTileHover=function(){mar.game.tweens.removeFrom(this);mar.game.add.tween(this).to({isoZ:25},200,Phaser.Easing.Quadratic.InOut,!0);mar.game.add.tween(this.scale).to({x:1.06,y:1.06},200,Phaser.Easing.Linear.None,
|
||||
!0);this.tint=config.cubotHoverTint;this.text.visible=!0};a.prototype.onTileExit=function(){mar.game.tweens.removeFrom(this);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);this.tint=config.cubotTint;this.text.visible=!1};a.prototype.updateObject=function(a){};return a}(GameObject),Direction;
|
||||
(function(b){b[b.NORTH=0]="NORTH";b[b.EAST=1]="EAST";b[b.SOUTH=2]="SOUTH";b[b.WEST=3]="WEST"})(Direction||(Direction={}));var TileType;(function(b){b[b.PLAIN=0]="PLAIN";b[b.WALL=1]="WALL";b[b.IRON=2]="IRON";b[b.COPPER=3]="COPPER"})(TileType||(TileType={}));
|
||||
var Tile=function(b){function a(a,d,e,f){e=b.call(this,mar.game,Util.getIsoX(a),Util.getIsoY(d),0,"sheet",e)||this;e.baseZ=0;e.tileX=a;e.tileY=d;e.anchor.set(.5,f);return e}__extends(a,b);a.createTile=function(a,b,e){switch(a){case TileType.WALL:return new WallTile(b,e);case TileType.IRON:return new IronTile(b,e);case TileType.COPPER:return new CopperTile(b,e);default:return new PlainTile(b,e)}};a.prototype.onHover=function(){this.tint=config.tileHoverTint;mar.game.add.tween(this).to({isoZ:this.baseZ+
|
||||
8},200,Phaser.Easing.Quadratic.InOut,!0);mar.tileIndicator.tileX=this.tileX;mar.tileIndicator.tileY=this.tileY;mar.tileIndicator.tileType=this.tileType};a.prototype.onExit=function(){this.tint=this.baseTint;mar.game.add.tween(this).to({isoZ:this.baseZ},200,Phaser.Easing.Quadratic.InOut,!0)};a.prototype.setText=function(a,b){void 0!==this.textSprite&&this.textSprite.destroy();this.textSprite=mar.game.make.text(0,16,a,{fontSize:22,fill:b,stroke:"#FFFFFF",strokeThickness:1,font:"fixedsys"});this.textSprite.alpha=
|
||||
.6;this.textSprite.anchor.set(.5,0);this.addChild(this.textSprite)};return a}(Phaser.Plugin.Isometric.IsoSprite),PlainTile=function(b){function a(a,d){a=b.call(this,a,d,config.plainSprite,0)||this;a.baseTint=config.tileTint;a.tint=a.baseTint;a.tileType="plain";return a}__extends(a,b);return a}(Tile),WallTile=function(b){function a(a,d){a=b.call(this,a,d,config.wallSprite,.2)||this;a.baseTint=config.wallTint;a.tint=a.baseTint;a.tileType="wall";return a}__extends(a,b);return a}(Tile),IronTile=function(b){function a(a,
|
||||
@ -64,7 +65,7 @@ d){a=b.call(this,a,d,config.plainSprite,0)||this;a.baseTint=config.oreTint;a.tin
|
||||
function(){void 0!=this.bigMessage&&(this.bigMessage.destroy(),DEBUG&&console.log("[MAR] Destroyed big message"))};b.prototype.getObject=function(a){for(var b=0;b<this.objects.length;b++)if(this.objects[b].id===a)return this.objects[b];return null};b.prototype.handleObjectsUpdate=function(a){for(var b=0;b<this.objects.length;b++)this.objects[b].updated=!1;for(b=0;b<a.length;b++){var d=this.getObject(a[b].i);null!==d?(d.updated=!0,d.updateObject(a[b])):(d=GameObject.createObject(a[b]),null!=d?(d.updated=
|
||||
!0,this.objects.push(d),mar.isoGroup.add(d)):DEBUG&&console.log("Couldn't create object with objType "+a[b].t))}for(b=0;b<this.objects.length;b++)this.objects[b].updated||("guest"!==mar.client.username&&this.objects[b]instanceof Cubot&&this.objects[b].username===mar.client.username&&(mar.client.findMyRobot(),DEBUG&&console.log("[MAR] Following Cubot "+mar.client.username)),this.objects[b].destroy(),this.objects.splice(b,1))};b.prototype.updateTerrain=function(a,b){for(var c=0;c<this.objects.length;c++)this.objects[c].destroy();
|
||||
for(c=0;c<this.tiles.length;c++)this.tiles[c].destroy();this.objects=[];this.tiles=[];this.setTerrain(a,b);mar.game.iso.topologicalSort(mar.isoGroup)};return b}(),WorldArrow=function(b){function a(a,d,e,f){var c=b.call(this,mar.game,a,d,10,"sheet",e)||this;c.hoverText=mar.game.make.text(10,10,Direction[f],config.arrowTextStyle);c.addChild(c.hoverText);c.hoverText.visible=!1;c.hoverText.anchor.set(0,0);c.inputEnabled=!0;c.events.onInputDown.add(function(){var a=mar.client.worldX+Util.getDeltaX(f),
|
||||
b=mar.client.worldY+Util.getDeltaY(f);mar.client.worldX=a%mar.client.maxWidth;mar.client.worldY=b%mar.client.maxWidth;mar.client.requestTerrain()});c.events.onInputOver.add(function(){c.tint=config.arrowHoverTint;c.hoverText.visible=!0;document.body.style.cursor="pointer"});c.events.onInputOut.add(function(){c.tint=config.arrowTint;c.hoverText.visible=!1;document.body.style.cursor="default"});return c}__extends(a,b);return a}(Phaser.Plugin.Isometric.IsoSprite),defaultText=" _______ __ __\n| _ |.-----.---.-.----.| |--.|__|.----.-----.----.-----.\n| || _ | _ | __|| || || __| _ | _| _ |\n|___|___|| __|___._|____||__|__||__||____|_____|__| | __|\n |__| |__|\n\nVersion 1.3A, 1985-05-17\nInitialising Universal Communication Port connection...Done\nCurrent date is 2790-01-14\nCubot Status: Much Assembly Required\n\n\nMore text down here\n",
|
||||
b=mar.client.worldY+Util.getDeltaY(f);mar.client.worldX=a%mar.client.maxWidth;mar.client.worldY=b%mar.client.maxWidth;mar.client.requestTerrain()});c.events.onInputOver.add(function(){c.tint=config.arrowHoverTint;c.hoverText.visible=!0;document.body.style.cursor="pointer"});c.events.onInputOut.add(function(){c.tint=config.arrowTint;c.hoverText.visible=!1;document.body.style.cursor="default"});return c}__extends(a,b);return a}(Phaser.Plugin.Isometric.IsoSprite),defaultText=" _______ __ __\n| _ |.-----.---.-.----.| |--.|__|.----.-----.----.-----.\n| || _ | _ | __|| || || __| _ | _| _ |\n|___|___|| __|___._|____||__|__||__||____|_____|__| | __|\n |__| |__|\n\nVersion 1.3A, 1985-05-17\nInitialising Universal Communication Port connection...Done\nCurrent date is 2790-01-14\nCubot Status: Much Assembly Required",
|
||||
ConsoleMode;(function(b){b[b.CLEAR=0]="CLEAR";b[b.NORMAL=1]="NORMAL"})(ConsoleMode||(ConsoleMode={}));
|
||||
var PlainTextConsoleMode=function(){return function(b,a){this.width=b;this.dialImage=a}}(),PlainTextConsole=function(){function b(a,c,d,e,f,h){this.colorToggled=!1;this.autoScroll=!0;this.modes=[];this.lastLineLength=0;this.txtDiv=document.getElementById(c);this.colorButton=document.getElementById(d);this.scrollButton=document.getElementById(e);this.resetButton=document.getElementById(f);this.widthDial=document.getElementById(h);var g=this;this.colorButton.onclick=function(){g.toggleColor(g)};this.scrollButton.onclick=
|
||||
function(){g.toggleScrolling(g)};this.resetButton.onclick=function(){g.reset(g)};this.widthDial.onclick=function(){b.widthDialClick(g)};this.consoleText=this.txtDiv.innerHTML=a;this.modes.push(new PlainTextConsoleMode(16,"./images/knob-170.png"));this.modes.push(new PlainTextConsoleMode(24,"./images/knob-123.png"));this.modes.push(new PlainTextConsoleMode(40,"./images/knob-90.png"));this.modes.push(new PlainTextConsoleMode(56,"./images/knob-65.png"));this.modes.push(new PlainTextConsoleMode(64,"./images/knob-10.png"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user