1
0
Fork 0

Images to atlas (continued)

This commit is contained in:
Michaël Lemaire 2017-08-22 00:41:44 +02:00
parent 5c4ffa4509
commit ce9d2f85ed
20 changed files with 25 additions and 28 deletions

View file

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View file

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

View file

@ -48,18 +48,12 @@ module TS.SpaceTac.UI {
this.loadImage("battle/shiplist/hover.png");
this.loadImage("battle/shiplist/info-button.png");
this.loadImage("map/starsystem-background.png");
this.loadImage("map/current-location.png");
this.loadImage("map/name.png");
this.loadImage("map/subname.png");
this.loadSheet("map/action.png", 323, 192);
this.loadImage("map/orbit.png");
this.loadImage("map/boundaries.png");
this.loadSheet("map/buttons.png", 115, 191);
this.loadImage("map/location-star.png");
this.loadImage("map/location-planet.png");
this.loadImage("map/location-warp.png");
this.loadSheet("map/status.png", 32);
this.loadSheet("map/missions.png", 70);
this.loadSheet("map/mission-action.png", 192, 56);
this.loadImage("character/sheet.png");
this.loadImage("character/close.png");

View file

@ -40,19 +40,19 @@ module TS.SpaceTac.UI {
private update() {
this.clearContent();
let markers: [StarLocation | Star, number][] = [];
let markers: [StarLocation | Star, string][] = [];
let active = this.missions.getCurrent();
let spacing = 80;
let offset = 245 - active.length * spacing;
active.forEach((mission, idx) => {
let frame = mission.main ? 0 : 1;
this.addImageF(35, offset + spacing * idx, "map-missions", frame);
let image = mission.main ? "map-mission-main" : "map-mission-standard";
this.addImage(35, offset + spacing * idx, image);
this.addText(90, offset + spacing * idx, mission.current_part.title, "#d2e1f3", 20, false, false, 430, true);
let location = mission.current_part.getLocationHint();
if (location) {
markers.push([location, frame]);
markers.push([location, image]);
}
});

View file

@ -8,7 +8,7 @@ module TS.SpaceTac.UI {
private fleet: FleetDisplay;
constructor(parent: UniverseMapView, fleet: FleetDisplay) {
super(parent.game, 0, 0, "map-current-location");
super(parent.game, 0, 0, parent.getImageInfo("map-current-location").key, parent.getImageInfo("map-current-location").frame);
this.fleet = fleet;

View file

@ -3,19 +3,21 @@ module TS.SpaceTac.UI {
* Marker to show a mission location on the map
*/
export class MissionLocationMarker {
private view: BaseView
private container: Phaser.Group
private markers: [StarLocation | Star, number][]
private markers: [StarLocation | Star, string][]
private zoomed = true
private current_star: Star
constructor(view: BaseView, parent: Phaser.Group) {
this.view = view;
this.container = view.game.add.group(parent, "mission_markers");
}
/**
* Set the active markers (location and frame)
* Set the active markers (location and image name)
*/
setMarkers(markers: [StarLocation | Star, number][]): void {
setMarkers(markers: [StarLocation | Star, string][]): void {
this.markers = markers;
this.refresh();
}
@ -35,11 +37,11 @@ module TS.SpaceTac.UI {
refresh(): void {
this.container.removeAll(true);
this.markers.forEach(([location, frame], index) => {
this.markers.forEach(([location, name], index) => {
let focus = this.zoomed ? location : (location instanceof StarLocation ? location.star : location);
if (location !== this.current_star || !this.zoomed) {
let marker = this.getMarker(focus, index - 1);
let image = new Phaser.Image(this.container.game, marker.x, marker.y, "map-missions", frame);
let image = this.view.newImage(name, marker.x, marker.y);
image.scale.set(marker.scale);
image.anchor.set(0.5);
this.container.add(image);

View file

@ -62,7 +62,7 @@ module TS.SpaceTac.UI {
let title = mission.title;
let subtitle = `${capitalize(MissionDifficulty[mission.difficulty])} - Reward: ${mission.getRewardText()}`;
this.addImageF(320, yoffset, "map-missions", 1);
this.addImage(320, yoffset, "map-mission-standard");
if (title) {
this.addText(380, yoffset - 15, title, "#d2e1f3", 22, false, false, 620, true);
}

View file

@ -36,13 +36,13 @@ module TS.SpaceTac.UI {
let fleet_move = () => this.view.moveToLocation(location);
if (location.type == StarLocationType.STAR) {
location_sprite = this.addImage(location.x, location.y, "map-location-star", 0, fleet_move);
location_sprite = this.addImage(location.x, location.y, "map-location-star", fleet_move);
} else if (location.type == StarLocationType.PLANET) {
location_sprite = this.addImage(location.x, location.y, "map-location-planet", 0, fleet_move);
location_sprite = this.addImage(location.x, location.y, "map-location-planet", fleet_move);
location_sprite.rotation = Math.atan2(location.y, location.x);
this.addCircle(location.x, location.y);
} else if (location.type == StarLocationType.WARP) {
location_sprite = this.addImage(location.x, location.y, "map-location-warp", 0, fleet_move);
location_sprite = this.addImage(location.x, location.y, "map-location-warp", fleet_move);
location_sprite.rotation = Math.atan2(location.y, location.x);
}
@ -61,7 +61,7 @@ module TS.SpaceTac.UI {
if (location_sprite) {
let frame = this.getBadgeFrame(location);
let status_badge = this.addImage(location.x + 0.005, location.y + 0.005, "map-status", frame);
let status_badge = this.addImage(location.x + 0.005, location.y + 0.005, `map-status-${frame}`);
this.locations.push([location, location_sprite, status_badge]);
}
});
@ -80,10 +80,11 @@ module TS.SpaceTac.UI {
this.view.tooltip.bindStaticText(this.label, `Level ${this.starsystem.level} starsystem`);
}
addImage(x: number, y: number, key: string, frame = 0, onclick: Function | null = null): Phaser.Image {
addImage(x: number, y: number, name: string, onclick: Function | null = null): Phaser.Image {
x /= this.scale.x;
y /= this.scale.y;
let image = onclick ? this.game.add.button(x, y, key, onclick, undefined, frame, frame) : this.game.add.image(x, y, key, frame);
let info = this.view.getImageInfo(name);
let image = onclick ? this.game.add.button(x, y, info.key, onclick, undefined, info.frame, info.frame) : this.game.add.image(x, y, info.key, info.frame);
image.anchor.set(0.5, 0.5);
this.addChild(image);
return image;
@ -107,17 +108,17 @@ module TS.SpaceTac.UI {
/**
* Return the frame to use for info badge.
*/
getBadgeFrame(location: StarLocation): number {
getBadgeFrame(location: StarLocation): string {
if (this.player.hasVisitedLocation(location)) {
if (location.encounter) {
return 2;
return "enemy";
} else if (location.shop) {
return 3;
return "dockyard";
} else {
return 1;
return "clear";
}
} else {
return 0;
return "unvisited";
}
}