Added action bar background
This commit is contained in:
parent
9a6b0d3c6c
commit
be72bfd4d1
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -10,4 +10,5 @@
|
||||||
/core
|
/core
|
||||||
/node_modules
|
/node_modules
|
||||||
/src/vendor
|
/src/vendor
|
||||||
|
/graphics/**/*.blend?*
|
||||||
|
|
||||||
|
|
BIN
graphics/ui/brushedmetal.jpg
Normal file
BIN
graphics/ui/brushedmetal.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 128 KiB |
BIN
graphics/ui/ui.blend
Normal file
BIN
graphics/ui/ui.blend
Normal file
Binary file not shown.
BIN
src/assets/images/ui/battle/actionbar.png
Normal file
BIN
src/assets/images/ui/battle/actionbar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 78 KiB |
|
@ -9,7 +9,7 @@ html, body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.game {
|
.game {
|
||||||
width: 800px;
|
width: 1280px;
|
||||||
height: 600px;
|
height: 720px;
|
||||||
margin: 20px auto;
|
margin: 20px auto;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ module SpaceTac {
|
||||||
// Router between game views
|
// Router between game views
|
||||||
export class GameRouter extends Phaser.Game {
|
export class GameRouter extends Phaser.Game {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(800, 600, Phaser.AUTO, '-space-tac');
|
super(1280, 720, Phaser.AUTO, '-space-tac');
|
||||||
|
|
||||||
this.state.add('boot', View.Boot);
|
this.state.add('boot', View.Boot);
|
||||||
this.state.add('preload', View.Preload);
|
this.state.add('preload', View.Preload);
|
||||||
|
|
|
@ -13,6 +13,7 @@ module SpaceTac.View {
|
||||||
this.load.image("ui-shiplist-own", "assets/images/battle/shiplist-own.png");
|
this.load.image("ui-shiplist-own", "assets/images/battle/shiplist-own.png");
|
||||||
this.load.image("ui-shiplist-enemy", "assets/images/battle/shiplist-enemy.png");
|
this.load.image("ui-shiplist-enemy", "assets/images/battle/shiplist-enemy.png");
|
||||||
this.load.image("ui-arena-background", "assets/images/battle/arena-background.png");
|
this.load.image("ui-arena-background", "assets/images/battle/arena-background.png");
|
||||||
|
this.load.image("ui-battle-actionbar", "assets/images/ui/battle/actionbar.png");
|
||||||
this.load.image("ui-ship-card", "assets/images/battle/ship-card.png");
|
this.load.image("ui-ship-card", "assets/images/battle/ship-card.png");
|
||||||
this.load.image("arena-ship", "assets/images/battle/ship01.png");
|
this.load.image("arena-ship", "assets/images/battle/ship01.png");
|
||||||
this.load.image("ui-bar-standard-background", "assets/images/ui/bars/standard-background.png");
|
this.load.image("ui-bar-standard-background", "assets/images/ui/bars/standard-background.png");
|
||||||
|
|
|
@ -2,7 +2,7 @@ module SpaceTac.View {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Bar with all available action icons displayed
|
// Bar with all available action icons displayed
|
||||||
export class ActionBar extends Phaser.Group {
|
export class ActionBar extends Phaser.Sprite {
|
||||||
// Link to the parent battleview
|
// Link to the parent battleview
|
||||||
battleview: BattleView;
|
battleview: BattleView;
|
||||||
|
|
||||||
|
@ -14,19 +14,12 @@ module SpaceTac.View {
|
||||||
this.battleview = battleview;
|
this.battleview = battleview;
|
||||||
this.actions = [];
|
this.actions = [];
|
||||||
|
|
||||||
super(battleview.game, battleview.ui);
|
super(battleview.game, 170, 0, "ui-battle-actionbar");
|
||||||
battleview.ui.add(this);
|
battleview.ui.add(this);
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the bar status (and position)
|
|
||||||
update() {
|
|
||||||
super.update();
|
|
||||||
|
|
||||||
this.x = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear the action icons
|
// Clear the action icons
|
||||||
clearAll(): void {
|
clearAll(): void {
|
||||||
this.actions.forEach((action: ActionIcon) => {
|
this.actions.forEach((action: ActionIcon) => {
|
||||||
|
@ -37,7 +30,7 @@ module SpaceTac.View {
|
||||||
|
|
||||||
// Add an action icon
|
// Add an action icon
|
||||||
addAction(ship: Game.Ship, action: Game.BaseAction): ActionIcon {
|
addAction(ship: Game.Ship, action: Game.BaseAction): ActionIcon {
|
||||||
var icon = new ActionIcon(this, this.actions.length * 50, 0, ship, action);
|
var icon = new ActionIcon(this, 110 + this.actions.length * 50, 25, ship, action);
|
||||||
this.actions.push(icon);
|
this.actions.push(icon);
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ module SpaceTac.View {
|
||||||
this.action = action;
|
this.action = action;
|
||||||
|
|
||||||
super(bar.game, x, y, "action-" + action.code);
|
super(bar.game, x, y, "action-" + action.code);
|
||||||
bar.add(this);
|
bar.addChild(this);
|
||||||
|
|
||||||
// TODO Handle action.canBeUsed() result to enable/disable the button
|
// TODO Handle action.canBeUsed() result to enable/disable the button
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue