diff --git a/graphics/ui/ui.blend b/graphics/ui/ui.blend index 8317d8a..cb0d4b1 100644 Binary files a/graphics/ui/ui.blend and b/graphics/ui/ui.blend differ diff --git a/src/assets/images/battle/shiplist-ap-empty.png b/src/assets/images/battle/shiplist-ap-empty.png new file mode 100644 index 0000000..f8e3c34 Binary files /dev/null and b/src/assets/images/battle/shiplist-ap-empty.png differ diff --git a/src/assets/images/battle/shiplist-ap-full.png b/src/assets/images/battle/shiplist-ap-full.png new file mode 100644 index 0000000..20ef570 Binary files /dev/null and b/src/assets/images/battle/shiplist-ap-full.png differ diff --git a/src/assets/images/battle/shiplist-hull-empty.png b/src/assets/images/battle/shiplist-hull-empty.png new file mode 100644 index 0000000..748674c Binary files /dev/null and b/src/assets/images/battle/shiplist-hull-empty.png differ diff --git a/src/assets/images/battle/shiplist-hull-full.png b/src/assets/images/battle/shiplist-hull-full.png new file mode 100644 index 0000000..2013ff6 Binary files /dev/null and b/src/assets/images/battle/shiplist-hull-full.png differ diff --git a/src/assets/images/battle/shiplist-shield-empty.png b/src/assets/images/battle/shiplist-shield-empty.png new file mode 100644 index 0000000..7dcdbbc Binary files /dev/null and b/src/assets/images/battle/shiplist-shield-empty.png differ diff --git a/src/assets/images/battle/shiplist-shield-full.png b/src/assets/images/battle/shiplist-shield-full.png new file mode 100644 index 0000000..5248cc0 Binary files /dev/null and b/src/assets/images/battle/shiplist-shield-full.png differ diff --git a/src/scripts/view/Preload.ts b/src/scripts/view/Preload.ts index 5591ce0..2a7d4a3 100644 --- a/src/scripts/view/Preload.ts +++ b/src/scripts/view/Preload.ts @@ -17,6 +17,12 @@ module SpaceTac.View { this.loadImage("battle/shiplist-playing.png"); this.loadImage("battle/shiplist-own.png"); this.loadImage("battle/shiplist-enemy.png"); + this.loadImage("battle/shiplist-ap-empty.png"); + this.loadImage("battle/shiplist-ap-full.png"); + this.loadImage("battle/shiplist-hull-empty.png"); + this.loadImage("battle/shiplist-hull-full.png"); + this.loadImage("battle/shiplist-shield-empty.png"); + this.loadImage("battle/shiplist-shield-full.png"); this.loadImage("battle/background.jpg"); this.loadImage("battle/arena/background.png"); this.loadImage("battle/actionbar.png"); diff --git a/src/scripts/view/battle/ShipListItem.ts b/src/scripts/view/battle/ShipListItem.ts index 06d8e4a..161d4bc 100644 --- a/src/scripts/view/battle/ShipListItem.ts +++ b/src/scripts/view/battle/ShipListItem.ts @@ -12,6 +12,9 @@ module SpaceTac.View { // Shield display shield: ValueBar; + // Action points display + ap: ValueBar; + // Portrait layer_portrait: Phaser.Image; @@ -58,13 +61,23 @@ module SpaceTac.View { this.layer_hover.visible = false; this.addChild(this.layer_hover); - this.hull = ValueBar.newStandard(list.battleview.game, 85, 28); - this.hull.scale.set(0.1, 0.1); + this.hull = ValueBar.newStyled(list.battleview.game, "battle-shiplist-hull", 76, 23); this.addChild(this.hull); - this.shield = ValueBar.newStandard(list.battleview.game, 85, 46); - this.shield.scale.set(0.1, 0.1); + this.shield = ValueBar.newStyled(list.battleview.game, "battle-shiplist-shield", 76, 35); this.addChild(this.shield); + + this.ap = ValueBar.newStyled(list.battleview.game, "battle-shiplist-ap", 76, 47); + this.addChild(this.ap); + + this.updateAttributes(); + } + + // Update attributes from associated ship + updateAttributes() { + this.attributeChanged(this.ship.hull); + this.attributeChanged(this.ship.shield); + this.attributeChanged(this.ship.ap_current); } // Called when an attribute for this ship changed through the battle log @@ -73,6 +86,8 @@ module SpaceTac.View { this.hull.setValue(attribute.current, attribute.maximal); } else if (attribute.code === Game.AttributeCode.Shield) { this.shield.setValue(attribute.current, attribute.maximal); + } else if (attribute.code === Game.AttributeCode.AP) { + this.ap.setValue(attribute.current, attribute.maximal); } } diff --git a/src/scripts/view/common/ValueBar.ts b/src/scripts/view/common/ValueBar.ts index 8fbda05..50677f0 100644 --- a/src/scripts/view/common/ValueBar.ts +++ b/src/scripts/view/common/ValueBar.ts @@ -32,6 +32,13 @@ module SpaceTac.View { return result; } + // Create a quick styled bar + static newStyled(game: Phaser.Game, base_key: string, x: number, y: number): ValueBar { + var result = new ValueBar(game, x, y, base_key + "-empty"); + result.setBarImage(base_key + "-full"); + return result; + } + // Build an value bar sprite // background is the key to the image to use as background constructor(game: Phaser.Game, x: number, y: number, background: string,