1
0
Fork 0

Added attributes to ship tooltip

This commit is contained in:
Michaël Lemaire 2017-01-11 01:38:08 +01:00
parent e0da46390d
commit 6c47655472
10 changed files with 995 additions and 138 deletions

View file

@ -6,3 +6,20 @@
This is a work-in-progress technology preview. Graphics are mostly placeholders at the moment.
[PLAY](http://thunderk.github.io/spacetac/) directly in your browser, no dependency required.
## Attributes
* **Initiative** - Ability to play before other ships in the play order
* **Hull** - Amout of damage that a ship can receive before having to shut down all its systems
* **Shield** - Amount of damage that the shield equipments may absorb to protect the Hull
* **Power** - Available action points (some actions require more power than others)
* **Power recovery** - Power generated at the end of a ship's turn
## Capabilities
* **Materials** - Usage of physical materials such as bullets, shells...
* **Electronics** - Components of computers and communication
* **Energy** - Raw energy manipulation
* **Human** - Management of a human team and resources
* **Gravity** - Interaction with gravitational forces
* **Time** - Manipulation of time

File diff suppressed because it is too large Load diff

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -81,6 +81,11 @@ module SpaceTac.Game {
this.fix();
}
// Get current value
getValue(): number {
return Math.floor(this.current);
}
// Set an absolute value
// Returns true if the value changed
set(value: number): boolean {

View file

@ -37,7 +37,8 @@ module SpaceTac.View {
this.loadImage("battle/actionpointsempty.png");
this.loadImage("battle/actionpointsfull.png");
this.loadImage("battle/actionpointspart.png");
this.loadImage("battle/ship-tooltip.png");
this.loadImage("battle/ship-tooltip-own.png");
this.loadImage("battle/ship-tooltip-enemy.png");
this.loadImage("battle/arena/ship-hover.png");
this.loadImage("battle/arena/ship-normal-enemy.png");
this.loadImage("battle/arena/ship-normal-own.png");

View file

@ -12,15 +12,15 @@ module SpaceTac.View {
this.icon = null;
this.main_title = new Phaser.Text(this.game, 325, 20, "", { font: "24px Arial", fill: "#ffffff" });
this.main_title = new Phaser.Text(this.game, 325, 20, "", { font: "24pt Arial", fill: "#ffffff" });
this.main_title.anchor.set(0.5, 0);
this.addChild(this.main_title);
this.sub_title = new Phaser.Text(this.game, 325, 60, "", { font: "22px Arial", fill: "#ffffff" });
this.sub_title = new Phaser.Text(this.game, 325, 60, "", { font: "22pt Arial", fill: "#ffffff" });
this.sub_title.anchor.set(0.5, 0);
this.addChild(this.sub_title);
this.cost = new Phaser.Text(this.game, 325, 100, "", { font: "20px Arial", fill: "#ffff00" });
this.cost = new Phaser.Text(this.game, 325, 100, "", { font: "20pt Arial", fill: "#ffff00" });
this.cost.anchor.set(0.5, 0);
this.addChild(this.cost);
}
@ -37,7 +37,7 @@ module SpaceTac.View {
this.position.set(action.x, action.y + action.height + action.bar.actionpoints.height);
this.main_title.setText(action.action.equipment ? action.action.equipment.name : action.action.name);
this.sub_title.setText(action.action.equipment ? action.action.name : "");
this.cost.setText(action.action.equipment ? `Cost: ${action.action.equipment.ap_usage.toPrecision(3)} energy` : "");
this.cost.setText(action.action.equipment ? `Cost: ${action.action.equipment.ap_usage.toPrecision(3)} power` : "");
Animation.fadeIn(this.game, this, 200, 0.9);
} else {

View file

@ -46,14 +46,14 @@ module SpaceTac.View {
this.layer_hover.visible = false;
this.addChild(this.layer_hover);
this.energy = ValueBar.newStyled(this.game, "battle-shiplist-energy", 90, 39, true);
this.addChild(this.energy);
this.hull = ValueBar.newStyled(this.game, "battle-shiplist-hull", 90, 39, true);
this.addChild(this.hull);
this.shield = ValueBar.newStyled(this.game, "battle-shiplist-shield", 98, 39, true);
this.addChild(this.shield);
this.hull = ValueBar.newStyled(this.game, "battle-shiplist-hull", 106, 39, true);
this.addChild(this.hull);
this.energy = ValueBar.newStyled(this.game, "battle-shiplist-energy", 106, 39, true);
this.addChild(this.energy);
this.active_effects = new Phaser.Group(this.game);
this.active_effects.position.set(63, 9);

View file

@ -3,23 +3,70 @@ module SpaceTac.View {
export class ShipTooltip extends Phaser.Sprite {
battleview: BattleView;
title: Phaser.Text;
attr_hull: Phaser.Text;
attr_shield: Phaser.Text;
attr_power: Phaser.Text;
attr_materials: Phaser.Text;
attr_electronics: Phaser.Text;
attr_energy: Phaser.Text;
attr_human: Phaser.Text;
attr_gravity: Phaser.Text;
attr_time: Phaser.Text;
constructor(parent: BattleView) {
super(parent.game, 0, 0, "battle-ship-tooltip");
super(parent.game, 0, 0, "battle-ship-tooltip-own");
this.visible = false;
this.battleview = parent;
this.title = new Phaser.Text(this.game, 247, 10, "", { font: "24px Arial", fill: "#ffffff" });
this.title = new Phaser.Text(this.game, 250, 10, "", { font: "24pt Arial", fill: "#ffffff" });
this.title.anchor.set(0.5, 0);
this.addChild(this.title);
this.attr_hull = new Phaser.Text(this.game, 97, 86, "", { font: "18pt Arial", fill: "#eb4e4a", fontWeight: "bold" });
this.attr_hull.anchor.set(0.5, 0.5);
this.addChild(this.attr_hull);
this.attr_shield = new Phaser.Text(this.game, 250, 86, "", { font: "18pt Arial", fill: "#2ad8dc", fontWeight: "bold" });
this.attr_shield.anchor.set(0.5, 0.5);
this.addChild(this.attr_shield);
this.attr_power = new Phaser.Text(this.game, 397, 86, "", { font: "18pt Arial", fill: "#ffdd4b", fontWeight: "bold" });
this.attr_power.anchor.set(0.5, 0.5);
this.addChild(this.attr_power);
this.attr_materials = new Phaser.Text(this.game, 217, 149, "", { font: "14pt Arial", fill: "#d5d5ff", fontWeight: "bold" });
this.attr_materials.anchor.set(0.5, 0.5);
this.addChild(this.attr_materials);
this.attr_electronics = new Phaser.Text(this.game, 447, 149, "", { font: "14pt Arial", fill: "#d5d5ff", fontWeight: "bold" });
this.attr_electronics.anchor.set(0.5, 0.5);
this.addChild(this.attr_electronics);
this.attr_energy = new Phaser.Text(this.game, 217, 176, "", { font: "14pt Arial", fill: "#d5d5ff", fontWeight: "bold" });
this.attr_energy.anchor.set(0.5, 0.5);
this.addChild(this.attr_energy);
this.attr_human = new Phaser.Text(this.game, 447, 176, "", { font: "14pt Arial", fill: "#d5d5ff", fontWeight: "bold" });
this.attr_human.anchor.set(0.5, 0.5);
this.addChild(this.attr_human);
this.attr_gravity = new Phaser.Text(this.game, 447, 203, "", { font: "14pt Arial", fill: "#d5d5ff", fontWeight: "bold" });
this.attr_gravity.anchor.set(0.5, 0.5);
this.addChild(this.attr_gravity);
this.attr_time = new Phaser.Text(this.game, 217, 203, "", { font: "14pt Arial", fill: "#d5d5ff", fontWeight: "bold" });
this.attr_time.anchor.set(0.5, 0.5);
this.addChild(this.attr_time);
parent.ui.add(this);
}
// Set current ship to display, null to hide
setShip(ship: Game.Ship | null): void {
console.log(ship);
if (ship) {
var enemy = ship.getPlayer() != this.battleview.player;
this.loadTexture(`battle-ship-tooltip-${enemy ? "enemy" : "own"}`);
// Find ship sprite to position next to it
var sprite = this.battleview.arena.findShipSprite(ship);
if (sprite) {
@ -41,6 +88,15 @@ module SpaceTac.View {
// Fill info
this.title.setText(ship.name);
this.attr_hull.setText(ship.hull.getValue().toString());
this.attr_shield.setText(ship.shield.getValue().toString());
this.attr_power.setText(ship.ap_current.getValue().toString());
this.attr_materials.setText(ship.cap_material.getValue().toString());
this.attr_electronics.setText(ship.cap_electronics.getValue().toString());
this.attr_energy.setText(ship.cap_energy.getValue().toString());
this.attr_human.setText(ship.cap_human.getValue().toString());
this.attr_gravity.setText(ship.cap_gravity.getValue().toString());
this.attr_time.setText(ship.cap_time.getValue().toString());
Animation.fadeIn(this.game, this, 200, 0.9);
} else {