Removed action cancel button
This commit is contained in:
parent
4ba37774aa
commit
125ed792fb
1
TODO
1
TODO
|
@ -1,5 +1,4 @@
|
|||
* Add auto-move to attack
|
||||
* Re-style cancel button and allow to cancel by clicking the action again
|
||||
* Fix energy depleter effect not fading after one turn
|
||||
* Add equipment info (or summary) in ship tooltip
|
||||
* Handle effects overflowing ship tooltip when too numerous
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
|
@ -19,9 +20,22 @@
|
|||
sodipodi:docname="battle.svg"
|
||||
inkscape:export-filename="/tmp/whole.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90">
|
||||
inkscape:export-ydpi="90"
|
||||
enable-background="new">
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
id="linearGradient5947"
|
||||
osb:paint="gradient">
|
||||
<stop
|
||||
style="stop-color:#f2f2f2;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5949" />
|
||||
<stop
|
||||
style="stop-color:#f2f2f2;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop5951" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient10006">
|
||||
|
@ -388,6 +402,48 @@
|
|||
stdDeviation="1.4344999"
|
||||
id="feGaussianBlur5963" />
|
||||
</filter>
|
||||
<filter
|
||||
style="color-interpolation-filters:sRGB"
|
||||
inkscape:label="Outer Glow"
|
||||
id="filter6021-3-2">
|
||||
<feFlood
|
||||
flood-opacity="0.709804"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood"
|
||||
id="feFlood6023-6-9" />
|
||||
<feComposite
|
||||
in="flood"
|
||||
in2="SourceGraphic"
|
||||
operator="in"
|
||||
result="composite1"
|
||||
id="feComposite6025-7-1" />
|
||||
<feGaussianBlur
|
||||
in="composite1"
|
||||
stdDeviation="4.2"
|
||||
result="blur"
|
||||
id="feGaussianBlur6027-5-2" />
|
||||
<feOffset
|
||||
dx="0"
|
||||
dy="0"
|
||||
result="offset"
|
||||
id="feOffset6029-3-7" />
|
||||
<feComposite
|
||||
in="SourceGraphic"
|
||||
in2="offset"
|
||||
operator="over"
|
||||
result="composite2"
|
||||
id="feComposite6031-5-0" />
|
||||
</filter>
|
||||
<filter
|
||||
inkscape:collect="always"
|
||||
style="color-interpolation-filters:sRGB"
|
||||
id="filter4497">
|
||||
<feBlend
|
||||
inkscape:collect="always"
|
||||
mode="lighten"
|
||||
in2="BackgroundImage"
|
||||
id="feBlend4499" />
|
||||
</filter>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
|
@ -396,11 +452,11 @@
|
|||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="11.313709"
|
||||
inkscape:cx="56.720009"
|
||||
inkscape:cy="752.24415"
|
||||
inkscape:zoom="8.0000004"
|
||||
inkscape:cx="262.84553"
|
||||
inkscape:cy="1129.2716"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer14"
|
||||
inkscape:current-layer="layer27"
|
||||
showgrid="false"
|
||||
units="px"
|
||||
showguides="true"
|
||||
|
@ -928,7 +984,8 @@
|
|||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer10"
|
||||
inkscape:label="Actions background">
|
||||
inkscape:label="Actions background"
|
||||
style="display:inline">
|
||||
<rect
|
||||
style="opacity:1;fill:#4c555b;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:16;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter5827)"
|
||||
id="rect4439"
|
||||
|
@ -1191,18 +1248,69 @@
|
|||
width="100%"
|
||||
height="100%" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer27"
|
||||
inkscape:label="Action icon selected"
|
||||
style="display:inline;opacity:1;filter:url(#filter4497)">
|
||||
<path
|
||||
style="opacity:1;fill:#e0f3ff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:10.39999962;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 288.98108,-24.305884 0,10.076267 -10.07626,0"
|
||||
id="rect4438"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccc"
|
||||
inkscape:export-filename="/home/michael/workspace/perso/spacetac/out/assets/images/battle/action-selected.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90" />
|
||||
<use
|
||||
x="0"
|
||||
y="0"
|
||||
xlink:href="#rect4438"
|
||||
id="use4441"
|
||||
transform="matrix(-1,0,0,1,504.47831,0)"
|
||||
width="100%"
|
||||
height="100%"
|
||||
inkscape:export-filename="/home/michael/workspace/perso/spacetac/out/assets/images/battle/action-selected.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90" />
|
||||
<use
|
||||
x="0"
|
||||
y="0"
|
||||
xlink:href="#rect4438"
|
||||
id="use4443"
|
||||
transform="matrix(1,0,0,-1,0,-101.95737)"
|
||||
width="100%"
|
||||
height="100%"
|
||||
inkscape:export-filename="/home/michael/workspace/perso/spacetac/out/assets/images/battle/action-selected.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90" />
|
||||
<use
|
||||
x="0"
|
||||
y="0"
|
||||
xlink:href="#rect4438"
|
||||
id="use4445"
|
||||
transform="matrix(-1,0,0,-1,504.5061,-101.94119)"
|
||||
width="100%"
|
||||
height="100%"
|
||||
inkscape:export-filename="/home/michael/workspace/perso/spacetac/out/assets/images/battle/action-selected.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer24"
|
||||
inkscape:label="Action icon active"
|
||||
style="display:inline">
|
||||
style="display:none">
|
||||
<ellipse
|
||||
style="opacity:1;fill:#97d3fb;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:10.39999962;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter10850)"
|
||||
id="path10840"
|
||||
cx="285.67114"
|
||||
cy="-51.10569"
|
||||
rx="1.7677671"
|
||||
ry="32.79208" />
|
||||
ry="32.79208"
|
||||
inkscape:export-filename="/home/michael/workspace/perso/spacetac/out/assets/images/battle/action-active.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90" />
|
||||
<use
|
||||
x="0"
|
||||
y="0"
|
||||
|
@ -1210,7 +1318,10 @@
|
|||
id="use10854"
|
||||
transform="translate(-66.998368,0)"
|
||||
width="100%"
|
||||
height="100%" />
|
||||
height="100%"
|
||||
inkscape:export-filename="/home/michael/workspace/perso/spacetac/out/assets/images/battle/action-active.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90" />
|
||||
<use
|
||||
x="0"
|
||||
y="0"
|
||||
|
@ -1218,7 +1329,10 @@
|
|||
id="use10856"
|
||||
transform="matrix(0,1,-1,0,201.15465,-370.01085)"
|
||||
width="100%"
|
||||
height="100%" />
|
||||
height="100%"
|
||||
inkscape:export-filename="/home/michael/workspace/perso/spacetac/out/assets/images/battle/action-active.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90" />
|
||||
<use
|
||||
x="0"
|
||||
y="0"
|
||||
|
@ -1226,7 +1340,10 @@
|
|||
id="use10858"
|
||||
transform="matrix(0,1,-1,0,200.97788,-303.54282)"
|
||||
width="100%"
|
||||
height="100%" />
|
||||
height="100%"
|
||||
inkscape:export-filename="/home/michael/workspace/perso/spacetac/out/assets/images/battle/action-active.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
|
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 84 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 4.4 KiB |
BIN
out/assets/images/battle/action-selected.png
Normal file
BIN
out/assets/images/battle/action-selected.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 410 B |
Binary file not shown.
Before Width: | Height: | Size: 6.2 KiB |
|
@ -32,9 +32,9 @@ module SpaceTac.View {
|
|||
this.loadImage("battle/arena/background.png");
|
||||
this.loadImage("battle/arena/ap-indicator.png");
|
||||
this.loadImage("battle/actionbar.png");
|
||||
this.loadImage("battle/actionbar-cancel.png");
|
||||
this.loadImage("battle/action-inactive.png");
|
||||
this.loadImage("battle/action-active.png");
|
||||
this.loadImage("battle/action-selected.png");
|
||||
this.loadImage("battle/action-tooltip.png");
|
||||
this.loadImage("battle/actionpointsnone.png");
|
||||
this.loadImage("battle/actionpointsempty.png");
|
||||
|
|
|
@ -67,20 +67,24 @@ module SpaceTac.View.Specs {
|
|||
// Weapon 1 leaves all choices open
|
||||
bar.actions[1].processClick();
|
||||
checkFading([], [0, 1, 2, 3]);
|
||||
bar.actionEnded();
|
||||
|
||||
// Weapon 2 can't be fired twice
|
||||
bar.actions[2].processClick();
|
||||
checkFading([2], [0, 1, 3]);
|
||||
bar.actionEnded();
|
||||
|
||||
// Not enough AP for both weapons
|
||||
ship.ap_current.set(7);
|
||||
bar.actions[2].processClick();
|
||||
checkFading([1, 2], [0, 3]);
|
||||
bar.actionEnded();
|
||||
|
||||
// Not enough AP to move
|
||||
ship.ap_current.set(3);
|
||||
bar.actions[1].processClick();
|
||||
checkFading([0, 1, 2], [3]);
|
||||
bar.actionEnded();
|
||||
|
||||
// Dynamic AP usage for move actions
|
||||
ship.ap_current.set(6);
|
||||
|
@ -94,6 +98,7 @@ module SpaceTac.View.Specs {
|
|||
checkFading([0, 1, 2], [3]);
|
||||
bar.actions[0].processHover(Game.Target.newFromLocation(5, 8));
|
||||
checkFading([0, 1, 2], [3]);
|
||||
bar.actionEnded();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -17,9 +17,6 @@ module SpaceTac.View {
|
|||
// Current ship, whose actions are displayed
|
||||
ship: Game.Ship;
|
||||
|
||||
// Cancel button
|
||||
cancel: Phaser.Button;
|
||||
|
||||
// Create an empty action bar
|
||||
constructor(battleview: BattleView) {
|
||||
super(battleview.game);
|
||||
|
@ -41,14 +38,6 @@ module SpaceTac.View {
|
|||
this.actionpointstemp.setBarImage("battle-actionpointsfull");
|
||||
this.addChild(this.actionpointstemp);
|
||||
|
||||
// Cancel button
|
||||
this.cancel = new Phaser.Button(this.game, 849, 8, "battle-actionbar-cancel", () => {
|
||||
this.actionEnded();
|
||||
});
|
||||
this.cancel.visible = false;
|
||||
this.cancel.input.useHandCursor = true;
|
||||
this.addChild(this.cancel);
|
||||
|
||||
// Tooltip
|
||||
this.tooltip = new ActionTooltip(this);
|
||||
this.addChild(this.tooltip);
|
||||
|
@ -61,7 +50,6 @@ module SpaceTac.View {
|
|||
});
|
||||
this.actions = [];
|
||||
this.tooltip.setAction(null);
|
||||
Animation.fadeOut(this.game, this.cancel, 200);
|
||||
}
|
||||
|
||||
// Add an action icon
|
||||
|
@ -123,7 +111,6 @@ module SpaceTac.View {
|
|||
|
||||
// Called by an action icon when the action is selected
|
||||
actionStarted(): void {
|
||||
Animation.fadeIn(this.game, this.cancel, 200);
|
||||
}
|
||||
|
||||
// Called by an action icon when the action has been applied
|
||||
|
@ -133,7 +120,6 @@ module SpaceTac.View {
|
|||
action.resetState();
|
||||
});
|
||||
this.battleview.exitTargettingMode();
|
||||
Animation.fadeOut(this.game, this.cancel, 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,9 @@ module SpaceTac.View {
|
|||
// True if the action can be used
|
||||
active: boolean;
|
||||
|
||||
// True if the action is selected for use
|
||||
selected: boolean;
|
||||
|
||||
// True if an action is currently selected, and this one won't be available after its use
|
||||
fading: boolean;
|
||||
|
||||
|
@ -28,6 +31,9 @@ module SpaceTac.View {
|
|||
// Layer applied when the action is active
|
||||
private layer_active: Phaser.Image;
|
||||
|
||||
// Layer applied when the action is selected
|
||||
private layer_selected: Phaser.Image;
|
||||
|
||||
// Create an icon for a single ship action
|
||||
constructor(bar: ActionBar, x: number, y: number, ship: Game.Ship, action: Game.BaseAction) {
|
||||
super(bar.game, x, y, "battle-action-inactive");
|
||||
|
@ -41,12 +47,20 @@ module SpaceTac.View {
|
|||
|
||||
// Active layer
|
||||
this.active = false;
|
||||
this.layer_active = new Phaser.Image(this.game, 0, 0, "battle-action-active", 0);
|
||||
this.layer_active = new Phaser.Image(this.game, this.width / 2, this.height / 2, "battle-action-active", 0);
|
||||
this.layer_active.anchor.set(0.5, 0.5);
|
||||
this.layer_active.visible = false;
|
||||
this.addChild(this.layer_active);
|
||||
|
||||
// Selected layer
|
||||
this.selected = false;
|
||||
this.layer_selected = new Phaser.Image(this.game, this.width / 2, this.height / 2, "battle-action-selected", 0);
|
||||
this.layer_selected.anchor.set(0.5, 0.5);
|
||||
this.layer_selected.visible = false;
|
||||
this.addChild(this.layer_selected);
|
||||
|
||||
// Icon layer
|
||||
this.layer_icon = new Phaser.Image(this.game, this.layer_active.width / 2, this.layer_active.height / 2, "battle-actions-" + action.code, 0);
|
||||
this.layer_icon = new Phaser.Image(this.game, this.width / 2, this.height / 2, "battle-actions-" + action.code, 0);
|
||||
this.layer_icon.anchor.set(0.5, 0.5);
|
||||
this.layer_icon.scale.set(0.25, 0.25);
|
||||
this.addChild(this.layer_icon);
|
||||
|
@ -74,8 +88,10 @@ module SpaceTac.View {
|
|||
if (!this.action.canBeUsed(this.battleview.battle, this.ship)) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Action started", this.action);
|
||||
if (this.selected) {
|
||||
this.bar.actionEnded();
|
||||
return;
|
||||
}
|
||||
|
||||
// End any previously selected action
|
||||
this.bar.actionEnded();
|
||||
|
@ -87,11 +103,8 @@ module SpaceTac.View {
|
|||
// Update fading statuses
|
||||
this.bar.updateFadings(this.action.getActionPointsUsage(this.battleview.battle, this.ship, null));
|
||||
|
||||
// Set the lighting color to highlight
|
||||
if (this.game.renderType !== Phaser.HEADLESS) {
|
||||
// Tint doesn't work in headless renderer
|
||||
this.layer_active.tint = 0xFFD060;
|
||||
}
|
||||
// Set the selected state
|
||||
this.setSelected(true);
|
||||
|
||||
if (this.action.needs_target) {
|
||||
// Switch to targetting mode (will apply action when a target is selected)
|
||||
|
@ -118,8 +131,6 @@ module SpaceTac.View {
|
|||
|
||||
// Called when a target is selected
|
||||
processSelection(target: Game.Target): void {
|
||||
console.log("Action target", this.action, target);
|
||||
|
||||
if (this.action.apply(this.battleview.battle, this.ship, target)) {
|
||||
this.bar.actionEnded();
|
||||
}
|
||||
|
@ -130,12 +141,18 @@ module SpaceTac.View {
|
|||
if (this.targetting) {
|
||||
this.targetting = null;
|
||||
}
|
||||
this.layer_active.tint = 0xFFFFFF;
|
||||
this.setSelected(false);
|
||||
this.updateActiveStatus();
|
||||
this.updateFadingStatus(this.ship.ap_current.current);
|
||||
this.battleview.arena.range_hint.clearPrimary();
|
||||
}
|
||||
|
||||
// Set the selected state on this icon
|
||||
setSelected(selected: boolean) {
|
||||
this.selected = selected;
|
||||
Animation.setVisibility(this.game, this.layer_selected, this.selected, 300);
|
||||
}
|
||||
|
||||
// Update the active status, from the action canBeUsed result
|
||||
updateActiveStatus(): void {
|
||||
var old_active = this.active;
|
||||
|
@ -152,12 +169,7 @@ module SpaceTac.View {
|
|||
var old_fading = this.fading;
|
||||
this.fading = this.active && !this.action.canBeUsed(this.battleview.battle, this.ship, remaining_ap);
|
||||
if (this.fading != old_fading) {
|
||||
if (this.fading) {
|
||||
this.game.tweens.create(this.layer_active).to({ alpha: 0.4 }, 100).delay(180).to({ alpha: 1 }, 90).to({ alpha: 0.4 }, 80).delay(130).to({ alpha: 1 }, 100).to({ alpha: 0.4 }, 90).delay(160).to({ alpha: 0.8 }, 70).loop(true).start();
|
||||
} else {
|
||||
this.game.tweens.removeFrom(this.layer_active);
|
||||
this.layer_active.alpha = this.active ? 1 : 0;
|
||||
}
|
||||
Animation.setVisibility(this.game, this.layer_active, this.active && !this.fading, 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue