1
0
Fork 0

Added action icons

This commit is contained in:
Michaël Lemaire 2015-02-23 01:00:00 +01:00
parent 93cf052f5e
commit 01877b8e37
13 changed files with 125 additions and 13 deletions

114
graphics/ui/actions.svg Normal file
View file

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
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#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="297mm"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="actions.svg"
inkscape:export-filename="/home/michael/workspace/spacetac/graphics/ui/temp.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs4">
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath3925">
<path
style="fill:#40686f;fill-opacity:0.37542665;stroke:#68a3ad;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
d="m 343.37404,232.575 0,280 280,0 0,-280 -280,0 z m 240.65625,13.34375 10.625,10.59375 -106.09375,106.0625 105.5,105.5 -10.59375,10.59375 -105.5,-105.46875 -98.40625,98.40625 -10.625,-10.59375 98.4375,-98.4375 -99,-99 10.59375,-10.59375 99,99 106.0625,-106.0625 z"
id="path3927"
inkscape:connector-curvature="0" />
</clipPath>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
inkscape:cx="444.96825"
inkscape:cy="400.52375"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1920"
inkscape:window-height="1030"
inkscape:window-x="0"
inkscape:window-y="25"
inkscape:window-maximized="1"
inkscape:snap-global="true"
inkscape:snap-bbox="false"
inkscape:snap-nodes="true"
inkscape:snap-bbox-midpoints="false">
<inkscape:grid
type="xygrid"
id="grid3004" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<path
style="fill:#4b818a;fill-opacity:1;stroke:none"
d="m 160,362.36218 210,0 -95,-120 10,85 -125,0 z"
id="path3006"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccc" />
<path
style="fill:#40686f;fill-opacity:1;stroke:none"
d="m 160,362.36218 210,0 -95,120 10,-85 -125,0 z"
id="path3006-7"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccc" />
<path
sodipodi:type="arc"
style="fill:none;stroke:#68a3ad;stroke-width:31.39999962;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3794"
sodipodi:cx="480"
sodipodi:cy="362.36218"
sodipodi:rx="110"
sodipodi:ry="110"
d="m 590,362.36218 a 110,110 0 1 1 -220,0 110,110 0 1 1 220,0 z"
transform="translate(16.625964,-0.19999977)"
clip-path="url(#clipPath3925)"
inkscape:export-filename="/home/michael/workspace/spacetac/graphics/ui/temp.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
style="fill:#43903f;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"
d="m 160,632.36218 120,210 0,-130 z"
id="path3935"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
style="fill:#4a6c48;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"
d="m 280,842.36218 0,-130 230,-150 z"
id="path3937"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -6,7 +6,7 @@ module SpaceTac.Game {
// Type of slot this equipment will fit in
slot: SlotType;
// Base name, lower cased
// Base name that will be given to generated equipment
name: string;
// Capability requirement ranges (indexed by AttributeCode)
@ -64,7 +64,7 @@ module SpaceTac.Game {
var result = new Equipment();
result.slot = this.slot;
result.code = Tools.getClassName(this);
result.code = (this.name || "").toLowerCase().replace(/ /g, "");
result.name = this.name;
result.distance = this.distance.getProportional(power);

View file

@ -16,10 +16,5 @@ module SpaceTac.Game {
return objectCopy;
}
// Get a class name, from an instance
static getClassName(object: any): string {
return object.constructor.name;
}
}
}

View file

@ -9,7 +9,7 @@ module SpaceTac.Game {
can_target_space: boolean;
constructor(equipment: Equipment, can_target_space: boolean = false) {
super("fire", true, equipment);
super("fire-" + equipment.code, true, equipment);
this.can_target_space = can_target_space;
}

View file

@ -15,7 +15,7 @@ module SpaceTac.Game.Specs {
expect(effect.value).toEqual(51);
var action = equipment.action;
expect(action.code).toEqual("fire");
expect(action.code).toEqual("fire-superfireweapon");
expect(action.needs_target).toBe(true);
});

View file

@ -18,7 +18,7 @@ module SpaceTac.Game.Specs {
var equipment = template.generateFixed(0.0);
expect(equipment.slot).toEqual(SlotType.Weapon);
expect(equipment.code).toEqual("LootTemplate");
expect(equipment.code).toEqual("bulletator");
expect(equipment.name).toEqual("Bulletator");
expect(equipment.distance).toEqual(1);
expect(equipment.blast).toEqual(1);
@ -32,7 +32,7 @@ module SpaceTac.Game.Specs {
equipment = template.generateFixed(1.0);
expect(equipment.slot).toEqual(SlotType.Weapon);
expect(equipment.code).toEqual("LootTemplate");
expect(equipment.code).toEqual("bulletator");
expect(equipment.name).toEqual("Bulletator");
expect(equipment.distance).toEqual(3);
expect(equipment.blast).toEqual(1);
@ -46,7 +46,7 @@ module SpaceTac.Game.Specs {
equipment = template.generateFixed(0.5);
expect(equipment.slot).toEqual(SlotType.Weapon);
expect(equipment.code).toEqual("LootTemplate");
expect(equipment.code).toEqual("bulletator");
expect(equipment.name).toEqual("Bulletator");
expect(equipment.distance).toEqual(2);
expect(equipment.blast).toEqual(1);

View file

@ -28,6 +28,8 @@ module SpaceTac.View {
this.loadImage("battle/arena/shipspriteplaying.png");
this.loadImage("battle/ship-card.png");
this.loadImage("battle/actions/move.png");
this.loadImage("battle/actions/endturn.png");
this.loadImage("battle/actions/fire-gatlinggun.png");
this.loadImage("battle/weapon/bullet.png");
this.loadImage("ship/scout/sprite.png");
this.loadImage("ship/scout/portrait.png");

View file

@ -39,7 +39,7 @@ module SpaceTac.View {
this.addChild(this.layer_active);
// Icon layer
this.layer_icon = new Phaser.Image(this.game, 14, 17, "battle-actions-" + action.code, 0);
this.layer_icon = new Phaser.Image(this.game, 15, 18, "battle-actions-" + action.code, 0);
this.addChild(this.layer_icon);
// Click process
@ -106,6 +106,7 @@ module SpaceTac.View {
updateActiveStatus(): void {
var active = this.action.canBeUsed(this.battleview.battle, this.ship);
Animation.setVisibility(this.game, this.layer_active, active, 500);
this.game.tweens.create(this.layer_icon).to({alpha: active ? 1 : 0.3}, 500).start();
this.input.useHandCursor = active;
}
}