2015-04-07 00:00:00 +00:00
|
|
|
/// <reference path="../BaseView.ts"/>
|
|
|
|
|
2017-09-24 22:23:22 +00:00
|
|
|
module TK.SpaceTac.UI {
|
2017-02-09 19:16:49 +00:00
|
|
|
/**
|
|
|
|
* Interactive map of the universe
|
|
|
|
*/
|
2015-04-07 00:00:00 +00:00
|
|
|
export class UniverseMapView extends BaseView {
|
2015-03-19 00:00:00 +00:00
|
|
|
// Displayed universe
|
2017-06-05 17:53:27 +00:00
|
|
|
universe = new Universe()
|
2015-03-19 00:00:00 +00:00
|
|
|
|
|
|
|
// Interacting player
|
2017-06-05 17:53:27 +00:00
|
|
|
player = new Player()
|
2015-03-19 00:00:00 +00:00
|
|
|
|
2017-06-08 21:58:23 +00:00
|
|
|
// Interaction enabled or not
|
|
|
|
interactive = true
|
|
|
|
|
2017-03-15 21:40:19 +00:00
|
|
|
// Layers
|
2017-06-05 17:53:27 +00:00
|
|
|
layer_universe: Phaser.Group
|
|
|
|
layer_overlay: Phaser.Group
|
2017-03-15 21:40:19 +00:00
|
|
|
|
2017-01-26 00:01:31 +00:00
|
|
|
// Star systems
|
2017-06-05 17:53:27 +00:00
|
|
|
starsystems: StarSystemDisplay[] = []
|
|
|
|
|
|
|
|
// Links between stars
|
|
|
|
starlinks_group: Phaser.Group
|
|
|
|
starlinks: Phaser.Graphics[] = []
|
2015-03-24 00:00:00 +00:00
|
|
|
|
2017-01-30 00:40:33 +00:00
|
|
|
// Fleets
|
2017-06-05 17:53:27 +00:00
|
|
|
player_fleet: FleetDisplay
|
2017-01-30 00:40:33 +00:00
|
|
|
|
2017-07-11 22:28:45 +00:00
|
|
|
// Markers
|
2017-06-05 17:53:27 +00:00
|
|
|
current_location: CurrentLocationMarker
|
2017-07-11 22:28:45 +00:00
|
|
|
mission_markers: MissionLocationMarker
|
2017-03-15 23:45:52 +00:00
|
|
|
|
2017-06-05 22:05:34 +00:00
|
|
|
// Actions for selected location
|
|
|
|
actions: MapLocationMenu
|
2017-02-09 19:16:49 +00:00
|
|
|
|
2017-06-27 15:42:28 +00:00
|
|
|
// Active missions
|
|
|
|
missions: ActiveMissionsDisplay
|
2017-10-08 21:26:33 +00:00
|
|
|
conversation: MissionConversationDisplay
|
2017-06-27 15:42:28 +00:00
|
|
|
|
2017-02-28 00:07:37 +00:00
|
|
|
// Character sheet
|
2017-06-05 17:53:27 +00:00
|
|
|
character_sheet: CharacterSheet
|
2017-02-28 00:07:37 +00:00
|
|
|
|
2017-01-26 00:01:31 +00:00
|
|
|
// Zoom level
|
2017-06-05 17:53:27 +00:00
|
|
|
zoom = 0
|
2017-06-05 22:05:34 +00:00
|
|
|
zoom_in: Phaser.Button
|
|
|
|
zoom_out: Phaser.Button
|
2015-03-19 00:00:00 +00:00
|
|
|
|
2017-07-16 17:55:38 +00:00
|
|
|
// Options button
|
|
|
|
button_options: Phaser.Button
|
|
|
|
|
2017-02-09 19:16:49 +00:00
|
|
|
/**
|
|
|
|
* Init the view, binding it to a universe
|
|
|
|
*/
|
2017-02-09 00:00:35 +00:00
|
|
|
init(universe: Universe, player: Player) {
|
2015-04-07 00:00:00 +00:00
|
|
|
super.init();
|
|
|
|
|
2015-03-19 00:00:00 +00:00
|
|
|
this.universe = universe;
|
|
|
|
this.player = player;
|
|
|
|
}
|
|
|
|
|
2017-02-09 19:16:49 +00:00
|
|
|
/**
|
|
|
|
* Create view graphics
|
|
|
|
*/
|
2015-03-19 00:00:00 +00:00
|
|
|
create() {
|
2015-04-07 00:00:00 +00:00
|
|
|
super.create();
|
|
|
|
|
2017-10-15 17:54:37 +00:00
|
|
|
let builder = new UIBuilder(this);
|
|
|
|
|
2017-10-11 20:58:08 +00:00
|
|
|
this.layer_universe = this.getLayer("universe");
|
|
|
|
this.layer_overlay = this.getLayer("overlay");
|
2015-03-19 00:00:00 +00:00
|
|
|
|
2017-06-05 17:53:27 +00:00
|
|
|
this.starlinks_group = this.game.add.group(this.layer_universe);
|
2017-01-26 23:01:04 +00:00
|
|
|
this.starlinks = this.universe.starlinks.map(starlink => {
|
|
|
|
let loc1 = starlink.first.getWarpLocationTo(starlink.second);
|
|
|
|
let loc2 = starlink.second.getWarpLocationTo(starlink.first);
|
|
|
|
|
|
|
|
let result = new Phaser.Graphics(this.game);
|
2017-03-09 17:11:00 +00:00
|
|
|
if (loc1 && loc2) {
|
2017-06-05 17:53:27 +00:00
|
|
|
result.lineStyle(0.01, 0x6cc7ce);
|
2017-03-09 17:11:00 +00:00
|
|
|
result.moveTo(starlink.first.x - 0.5 + loc1.x, starlink.first.y - 0.5 + loc1.y);
|
|
|
|
result.lineTo(starlink.second.x - 0.5 + loc2.x, starlink.second.y - 0.5 + loc2.y);
|
|
|
|
}
|
2017-05-10 16:49:08 +00:00
|
|
|
result.data.link = starlink;
|
2017-01-26 23:01:04 +00:00
|
|
|
return result;
|
|
|
|
});
|
2017-06-05 17:53:27 +00:00
|
|
|
this.starlinks.forEach(starlink => this.starlinks_group.add(starlink));
|
2017-01-26 23:01:04 +00:00
|
|
|
|
2017-01-30 00:40:33 +00:00
|
|
|
this.player_fleet = new FleetDisplay(this, this.player.fleet);
|
|
|
|
|
2017-01-26 00:01:31 +00:00
|
|
|
this.starsystems = this.universe.stars.map(star => new StarSystemDisplay(this, star));
|
2017-03-15 21:40:19 +00:00
|
|
|
this.starsystems.forEach(starsystem => this.layer_universe.add(starsystem));
|
2015-03-19 00:00:00 +00:00
|
|
|
|
2017-03-15 21:40:19 +00:00
|
|
|
this.layer_universe.add(this.player_fleet);
|
2017-01-30 00:40:33 +00:00
|
|
|
|
2017-03-15 23:45:52 +00:00
|
|
|
this.current_location = new CurrentLocationMarker(this, this.player_fleet);
|
|
|
|
this.layer_universe.add(this.current_location);
|
|
|
|
|
2017-07-11 22:28:45 +00:00
|
|
|
this.mission_markers = new MissionLocationMarker(this, this.layer_universe);
|
|
|
|
|
2017-06-05 22:05:34 +00:00
|
|
|
this.actions = new MapLocationMenu(this);
|
|
|
|
this.actions.setPosition(30, 30);
|
|
|
|
this.actions.moveToLayer(this.layer_overlay);
|
|
|
|
|
2017-07-11 22:28:45 +00:00
|
|
|
this.missions = new ActiveMissionsDisplay(this, this.player.missions, this.mission_markers);
|
2017-06-27 15:42:28 +00:00
|
|
|
this.missions.setPosition(20, 720);
|
|
|
|
this.missions.moveToLayer(this.layer_overlay);
|
|
|
|
|
2017-06-08 17:32:57 +00:00
|
|
|
this.zoom_in = new Phaser.Button(this.game, 1540, 172, "map-buttons", () => this.setZoom(this.zoom + 1), undefined, 3, 0);
|
2017-06-05 22:05:34 +00:00
|
|
|
this.zoom_in.anchor.set(0.5, 0.5);
|
2017-07-19 23:22:18 +00:00
|
|
|
UIComponent.setButtonSound(this.zoom_in);
|
2017-06-05 22:05:34 +00:00
|
|
|
this.layer_overlay.add(this.zoom_in);
|
|
|
|
this.tooltip.bindStaticText(this.zoom_in, "Zoom in");
|
2017-06-08 17:32:57 +00:00
|
|
|
this.zoom_out = new Phaser.Button(this.game, 1540, 958, "map-buttons", () => this.setZoom(this.zoom - 1), undefined, 4, 1);
|
2017-06-05 22:05:34 +00:00
|
|
|
this.zoom_out.anchor.set(0.5, 0.5);
|
2017-07-19 23:22:18 +00:00
|
|
|
UIComponent.setButtonSound(this.zoom_out);
|
2017-06-05 22:05:34 +00:00
|
|
|
this.layer_overlay.add(this.zoom_out);
|
|
|
|
this.tooltip.bindStaticText(this.zoom_out, "Zoom out");
|
2017-07-16 17:55:38 +00:00
|
|
|
this.button_options = new Phaser.Button(this.game, 1436, 69, "map-buttons", () => this.showOptions(), undefined, 5, 2);
|
|
|
|
this.button_options.angle = -90;
|
|
|
|
this.button_options.anchor.set(0.5, 0.5);
|
2017-07-19 23:22:18 +00:00
|
|
|
UIComponent.setButtonSound(this.button_options);
|
2017-07-16 17:55:38 +00:00
|
|
|
this.layer_overlay.add(this.button_options);
|
|
|
|
this.tooltip.bindStaticText(this.button_options, "Game options");
|
2017-02-28 00:07:37 +00:00
|
|
|
|
|
|
|
this.character_sheet = new CharacterSheet(this, this.getWidth() - 307);
|
|
|
|
this.character_sheet.show(this.player.fleet.ships[0], false);
|
|
|
|
this.character_sheet.hide(false);
|
2017-03-15 21:40:19 +00:00
|
|
|
this.layer_overlay.add(this.character_sheet);
|
2015-03-25 00:00:00 +00:00
|
|
|
|
2017-10-08 21:26:33 +00:00
|
|
|
this.conversation = new MissionConversationDisplay(this);
|
2017-06-29 17:25:38 +00:00
|
|
|
this.conversation.moveToLayer(this.layer_overlay);
|
|
|
|
|
2017-06-01 22:37:43 +00:00
|
|
|
this.gameui.audio.startMusic("spring-thaw");
|
2015-04-22 21:42:40 +00:00
|
|
|
|
2015-03-19 00:00:00 +00:00
|
|
|
// Inputs
|
2017-10-08 21:26:33 +00:00
|
|
|
this.inputs.bind(" ", "Conversation step", () => this.conversation.forward());
|
2017-06-29 17:25:38 +00:00
|
|
|
this.inputs.bind("Escape", "Skip conversation", () => this.conversation.skipConversation());
|
2017-05-10 16:49:08 +00:00
|
|
|
this.inputs.bindCheat("r", "Reveal whole map", () => this.revealAll());
|
2017-06-29 17:25:38 +00:00
|
|
|
this.inputs.bindCheat("n", "Next story step", () => {
|
|
|
|
if (this.player.missions.main) {
|
|
|
|
this.player.missions.main.current_part.forceComplete();
|
|
|
|
this.backToRouter();
|
|
|
|
}
|
|
|
|
});
|
2017-03-15 21:40:19 +00:00
|
|
|
|
2017-10-15 17:54:37 +00:00
|
|
|
this.setZoom(2, 0);
|
|
|
|
|
|
|
|
// Add a shader background
|
|
|
|
builder.shader("map-background", { width: this.getWidth(), height: this.getHeight() }, 0, 0, () => {
|
|
|
|
let scale = this.layer_universe.scale.x;
|
|
|
|
return {
|
|
|
|
offset: { x: (920 - this.layer_universe.x) / scale, y: -(540 - this.layer_universe.y) / scale },
|
|
|
|
scale: scale
|
|
|
|
}
|
|
|
|
});
|
2017-05-04 23:19:28 +00:00
|
|
|
|
|
|
|
// Trigger an auto-save any time we go back to the map
|
|
|
|
this.autoSave();
|
2015-03-19 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2017-02-09 19:16:49 +00:00
|
|
|
/**
|
|
|
|
* Leaving the view, unbind and destroy
|
|
|
|
*/
|
2015-03-19 00:00:00 +00:00
|
|
|
shutdown() {
|
2017-03-09 17:11:00 +00:00
|
|
|
this.universe = new Universe();
|
|
|
|
this.player = new Player();
|
2015-04-07 00:00:00 +00:00
|
|
|
|
|
|
|
super.shutdown();
|
2015-03-19 00:00:00 +00:00
|
|
|
}
|
2015-03-19 00:00:00 +00:00
|
|
|
|
2017-05-10 16:49:08 +00:00
|
|
|
/**
|
|
|
|
* Refresh the view
|
|
|
|
*/
|
|
|
|
refresh() {
|
2017-09-11 23:29:15 +00:00
|
|
|
if (this.player.getBattle()) {
|
|
|
|
this.backToRouter();
|
|
|
|
} else {
|
|
|
|
this.setZoom(this.zoom);
|
|
|
|
this.character_sheet.updateFleet(this.player.fleet);
|
|
|
|
this.player_fleet.updateShipSprites();
|
|
|
|
}
|
2017-07-09 21:18:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check active missions.
|
|
|
|
*
|
|
|
|
* When any mission status changes, a refresh is triggered.
|
|
|
|
*/
|
|
|
|
checkMissionsUpdate() {
|
|
|
|
if (this.missions.checkUpdate()) {
|
|
|
|
this.refresh();
|
|
|
|
}
|
2017-05-10 16:49:08 +00:00
|
|
|
}
|
|
|
|
|
2017-02-09 19:16:49 +00:00
|
|
|
/**
|
|
|
|
* Update info on all star systems (fog of war, available data...)
|
|
|
|
*/
|
2017-06-05 22:05:34 +00:00
|
|
|
updateInfo(current_star: Star | null, interactive = true) {
|
2017-03-15 23:45:52 +00:00
|
|
|
this.current_location.setZoom(this.zoom);
|
2017-07-11 22:28:45 +00:00
|
|
|
if (current_star) {
|
|
|
|
this.mission_markers.setZoom(this.zoom, current_star);
|
|
|
|
}
|
2017-03-15 23:45:52 +00:00
|
|
|
|
2017-05-10 16:49:08 +00:00
|
|
|
this.starlinks.forEach(linkgraphics => {
|
|
|
|
let link = <StarLink>linkgraphics.data.link;
|
|
|
|
linkgraphics.visible = this.player.hasVisitedSystem(link.first) || this.player.hasVisitedSystem(link.second);
|
|
|
|
})
|
|
|
|
|
2017-03-09 23:21:34 +00:00
|
|
|
this.starsystems.forEach(system => system.updateInfo(this.zoom, system.starsystem == current_star));
|
2017-02-09 19:16:49 +00:00
|
|
|
|
2018-01-16 00:08:24 +00:00
|
|
|
this.actions.setFromLocation(this.session.getLocation(), this);
|
2017-06-05 22:05:34 +00:00
|
|
|
|
2017-07-09 21:18:05 +00:00
|
|
|
this.missions.checkUpdate();
|
2017-07-16 17:55:38 +00:00
|
|
|
this.conversation.updateFromMissions(this.player.missions, () => this.checkMissionsUpdate());
|
2017-06-27 15:42:28 +00:00
|
|
|
|
2017-06-05 22:05:34 +00:00
|
|
|
if (interactive) {
|
|
|
|
this.setInteractionEnabled(true);
|
2017-02-09 19:16:49 +00:00
|
|
|
}
|
2017-01-30 00:40:33 +00:00
|
|
|
}
|
|
|
|
|
2017-02-09 19:16:49 +00:00
|
|
|
/**
|
|
|
|
* Reveal the whole map (this is a cheat)
|
|
|
|
*/
|
2015-03-19 00:00:00 +00:00
|
|
|
revealAll(): void {
|
2017-01-29 18:34:38 +00:00
|
|
|
this.universe.stars.forEach(star => {
|
|
|
|
star.locations.forEach(location => {
|
2018-01-16 00:08:24 +00:00
|
|
|
this.player.fleet.setVisited(location);
|
2017-01-29 18:34:38 +00:00
|
|
|
});
|
2015-03-19 00:00:00 +00:00
|
|
|
});
|
2017-05-10 16:49:08 +00:00
|
|
|
this.refresh();
|
2017-01-26 00:01:31 +00:00
|
|
|
}
|
|
|
|
|
2017-02-09 19:16:49 +00:00
|
|
|
/**
|
|
|
|
* Set the camera to center on a target, and to display a given span in height
|
|
|
|
*/
|
|
|
|
setCamera(x: number, y: number, span: number, duration = 500, easing = Phaser.Easing.Cubic.InOut) {
|
2017-01-26 00:01:31 +00:00
|
|
|
let scale = 1000 / span;
|
2017-10-15 17:54:37 +00:00
|
|
|
let dest_x = 920 - x * scale;
|
|
|
|
let dest_y = 540 - y * scale;
|
|
|
|
if (duration) {
|
|
|
|
this.tweens.create(this.layer_universe.position).to({ x: dest_x, y: dest_y }, duration, easing).start();
|
|
|
|
this.tweens.create(this.layer_universe.scale).to({ x: scale, y: scale }, duration, easing).start();
|
|
|
|
} else {
|
|
|
|
this.layer_universe.position.set(dest_x, dest_y);
|
|
|
|
this.layer_universe.scale.set(scale);
|
|
|
|
}
|
2017-01-26 00:01:31 +00:00
|
|
|
}
|
|
|
|
|
2017-07-09 16:31:18 +00:00
|
|
|
/**
|
|
|
|
* Set the camera to include all direct-jump accessible stars
|
|
|
|
*/
|
2017-10-15 17:54:37 +00:00
|
|
|
setCameraOnAccessible(star: Star, duration: number) {
|
2017-07-19 23:22:18 +00:00
|
|
|
let accessible = star.getNeighbors().concat([star]);
|
2017-07-09 16:31:18 +00:00
|
|
|
let xmin = min(accessible.map(star => star.x));
|
|
|
|
let xmax = max(accessible.map(star => star.x));
|
|
|
|
let ymin = min(accessible.map(star => star.y));
|
|
|
|
let ymax = max(accessible.map(star => star.y));
|
|
|
|
let dmax = Math.max(xmax - xmin, ymax - ymin);
|
2017-10-15 17:54:37 +00:00
|
|
|
this.setCamera(xmin + (xmax - xmin) * 0.5, ymin + (ymax - ymin) * 0.5, dmax * 1.2, duration);
|
2017-07-09 16:31:18 +00:00
|
|
|
}
|
|
|
|
|
2017-06-05 17:53:27 +00:00
|
|
|
/**
|
|
|
|
* Set the alpha value for all links
|
|
|
|
*/
|
2017-10-15 17:54:37 +00:00
|
|
|
setLinksAlpha(alpha: number, duration = 500) {
|
|
|
|
if (duration) {
|
|
|
|
this.game.add.tween(this.starlinks_group).to({ alpha: alpha }, duration * Math.abs(this.starlinks_group.alpha - alpha)).start();
|
|
|
|
} else {
|
|
|
|
this.starlinks_group.alpha = alpha;
|
|
|
|
}
|
2017-06-05 17:53:27 +00:00
|
|
|
}
|
|
|
|
|
2017-02-09 19:16:49 +00:00
|
|
|
/**
|
|
|
|
* Set the current zoom level (0, 1 or 2)
|
|
|
|
*/
|
2017-10-15 17:54:37 +00:00
|
|
|
setZoom(level: number, duration = 500) {
|
2018-01-16 00:08:24 +00:00
|
|
|
let current_star = this.session.getLocation().star;
|
2017-03-09 17:11:00 +00:00
|
|
|
if (!current_star || level <= 0) {
|
2017-10-15 17:54:37 +00:00
|
|
|
this.setCamera(0, 0, this.universe.radius * 2, duration);
|
|
|
|
this.setLinksAlpha(1, duration);
|
2017-01-26 00:01:31 +00:00
|
|
|
this.zoom = 0;
|
|
|
|
} else if (level == 1) {
|
2017-10-15 17:54:37 +00:00
|
|
|
this.setCameraOnAccessible(current_star, duration);
|
|
|
|
this.setLinksAlpha(0.6, duration);
|
2017-01-26 00:01:31 +00:00
|
|
|
this.zoom = 1;
|
|
|
|
} else {
|
2017-10-15 17:54:37 +00:00
|
|
|
this.setCamera(current_star.x, current_star.y, current_star.radius * 2, duration);
|
|
|
|
this.setLinksAlpha(0.2, duration);
|
2017-01-26 00:01:31 +00:00
|
|
|
this.zoom = 2;
|
|
|
|
}
|
2017-03-09 23:21:34 +00:00
|
|
|
|
|
|
|
this.updateInfo(current_star);
|
2015-03-19 00:00:00 +00:00
|
|
|
}
|
2017-02-09 19:16:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Do the jump animation to another system
|
2017-06-05 22:05:34 +00:00
|
|
|
*
|
|
|
|
* This will only work if current location is a warp
|
2017-02-09 19:16:49 +00:00
|
|
|
*/
|
2017-06-05 22:05:34 +00:00
|
|
|
doJump(): void {
|
2018-01-16 00:08:24 +00:00
|
|
|
let location = this.session.getLocation();
|
2017-06-08 21:58:23 +00:00
|
|
|
if (this.interactive && location && location.type == StarLocationType.WARP && location.jump_dest) {
|
2017-06-05 22:05:34 +00:00
|
|
|
let dest_location = location.jump_dest;
|
2017-02-09 19:16:49 +00:00
|
|
|
let dest_star = dest_location.star;
|
|
|
|
this.player_fleet.moveToLocation(dest_location, 3, duration => {
|
2017-06-05 22:05:34 +00:00
|
|
|
this.timer.schedule(duration / 2, () => this.updateInfo(dest_star, false));
|
2017-02-09 19:16:49 +00:00
|
|
|
this.setCamera(dest_star.x, dest_star.y, dest_star.radius * 2, duration, Phaser.Easing.Cubic.Out);
|
2017-06-05 22:05:34 +00:00
|
|
|
}, () => {
|
|
|
|
this.setInteractionEnabled(true);
|
2017-07-10 22:50:38 +00:00
|
|
|
this.refresh();
|
2017-02-09 19:16:49 +00:00
|
|
|
});
|
2017-06-05 22:05:34 +00:00
|
|
|
this.setInteractionEnabled(false);
|
2017-02-09 19:16:49 +00:00
|
|
|
}
|
|
|
|
}
|
2017-06-05 22:05:34 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Open the dockyard interface
|
|
|
|
*
|
|
|
|
* This will only work if current location has a dockyard
|
|
|
|
*/
|
|
|
|
openShop(): void {
|
2018-01-16 00:08:24 +00:00
|
|
|
let location = this.session.getLocation();
|
2017-06-08 21:58:23 +00:00
|
|
|
if (this.interactive && location && location.shop) {
|
2017-06-05 22:05:34 +00:00
|
|
|
this.character_sheet.setShop(location.shop);
|
|
|
|
this.character_sheet.show(this.player.fleet.ships[0]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-09 21:18:05 +00:00
|
|
|
/**
|
|
|
|
* Open the missions dialog (job posting)
|
|
|
|
*
|
|
|
|
* This will only work if current location has a dockyard
|
|
|
|
*/
|
|
|
|
openMissions(): void {
|
2018-01-16 00:08:24 +00:00
|
|
|
let location = this.session.getLocation();
|
2017-07-09 21:18:05 +00:00
|
|
|
if (this.interactive && location && location.shop) {
|
|
|
|
new MissionsDialog(this, location.shop, this.player, () => this.checkMissionsUpdate());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-05 22:05:34 +00:00
|
|
|
/**
|
|
|
|
* Move the fleet to another location
|
|
|
|
*/
|
|
|
|
moveToLocation(dest: StarLocation): void {
|
2018-01-16 00:08:24 +00:00
|
|
|
if (this.interactive && !dest.is(this.player.fleet.location)) {
|
2017-06-05 22:05:34 +00:00
|
|
|
this.setInteractionEnabled(false);
|
2017-07-16 17:55:38 +00:00
|
|
|
this.player_fleet.moveToLocation(dest, 1, null, () => {
|
|
|
|
this.setInteractionEnabled(true);
|
|
|
|
this.refresh();
|
|
|
|
});
|
2017-06-05 22:05:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the interactive state
|
|
|
|
*/
|
|
|
|
setInteractionEnabled(enabled: boolean) {
|
2017-06-08 21:58:23 +00:00
|
|
|
this.interactive = enabled && !this.session.spectator;
|
2017-06-05 22:05:34 +00:00
|
|
|
this.actions.setVisible(enabled && this.zoom == 2, 300);
|
2017-06-27 15:42:28 +00:00
|
|
|
this.missions.setVisible(enabled && this.zoom == 2, 300);
|
2017-06-05 22:05:34 +00:00
|
|
|
this.animations.setVisible(this.zoom_in, enabled && this.zoom < 2, 300);
|
|
|
|
this.animations.setVisible(this.zoom_out, enabled && this.zoom > 0, 300);
|
2017-07-16 17:55:38 +00:00
|
|
|
this.animations.setVisible(this.button_options, enabled, 300);
|
2017-06-05 22:05:34 +00:00
|
|
|
this.animations.setVisible(this.character_sheet, enabled, 300);
|
|
|
|
}
|
2015-03-19 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|