From fddf7a3916ce5dc6bb2d55947c65fbb47e415772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Wed, 20 Dec 2017 19:57:28 +0100 Subject: [PATCH] Replaced success factor display with a bar --- TODO.md | 1 - .../battle/actionbar/power-generated.png | Bin 0 -> 893 bytes .../exported/battle/hud/ship-success-back.png | Bin 0 -> 429 bytes .../exported/battle/hud/ship-success-fill.png | Bin 0 -> 358 bytes graphics/ui/battle.svg | 498 +++++++++++++++--- src/ui/battle/Arena.ts | 2 +- src/ui/battle/Targetting.ts | 7 +- src/ui/common/UIBuilder.ts | 11 +- 8 files changed, 442 insertions(+), 77 deletions(-) create mode 100644 graphics/exported/battle/actionbar/power-generated.png create mode 100644 graphics/exported/battle/hud/ship-success-back.png create mode 100644 graphics/exported/battle/hud/ship-success-fill.png diff --git a/TODO.md b/TODO.md index 5de8f8c..c7e590d 100644 --- a/TODO.md +++ b/TODO.md @@ -42,7 +42,6 @@ Battle ------ * Investigate cooldown not resetting properly the usage count -* Replace success factor percentage with a bar * Add a voluntary retreat option * Add scroll buttons when there are too many actions * Toggle bar/text display in power section of action bar diff --git a/graphics/exported/battle/actionbar/power-generated.png b/graphics/exported/battle/actionbar/power-generated.png new file mode 100644 index 0000000000000000000000000000000000000000..1d57e74908094e284521c5f420297e727ee386ff GIT binary patch literal 893 zcmV-@1A_dCP)1<15(b<$?UxEGt(r=yGK4<3AS^LJupX2X*&57poL zj4THfc5Dy8O(7IOI#<4&SBb=g!tQKDN^0e}i6|Fxo{I6WZcB;)ashQTEw3Z5DBhnrcw-XhJrD+_2$RdFLEozs`62wL+sZFc1Z$urgeqNXmKaLa}GhzSwZh_odh}-jp;j z^aVYk5SG2((IH_BmQ%#7qb)@To>rP47qPME!r|WbyGGkc1E2>KNivqP{=qNsUkKeE zWn%*s(PB?*u6GXZ|Fno)Sg}%?W7|D38x$a8C#V8>7o#39!p12ywV4RUhHDjnFTFEf z1kM$+9iy{v-cv*{Yq$<)3zAGnNOxgHCLjw{VDoHXULjF(TbqYKkHe2H{!>*@W2Pk&#A&Tqx=k?k=s#Oh0QkONRb%%(2uT_c9%6iBmCA82fI zg*dI|@hbi$v6GX>+o($T3fK@NVuaNL;;&`YdMlOyPK*+$X(o!ea{8QJK3&DXBzAPv z`trGcC=EYH@ut-4Q`<%vQK@Puceh)yaS3-FZi>1#+cu(iy}SF-*&Su@--|y0w>^)) Tq0>{Y00000NkvXXu0mjf^ID0( literal 0 HcmV?d00001 diff --git a/graphics/exported/battle/hud/ship-success-back.png b/graphics/exported/battle/hud/ship-success-back.png new file mode 100644 index 0000000000000000000000000000000000000000..59aac92dd87469205b764ea54b9c568607e0986a GIT binary patch literal 429 zcmV;e0aE^nP)vL>*gwgzJj2G zxQK`-^Z^tRK@kV*s=E%lIl73mh)Y|l6f6`SD)BaH;-HTZ2svb8v@9OwS=xjyl&+(-k%U>XUgC+(MXYG8Kh@Tw&M0>8KM z+WIWUVL$-Yb!ohR*d14`189})`EjSyy?c17+Mee}-4`0E3udNDwZZ=6oam{bTy3@s zaT*Z7>-p50?c$f?mIV-Kzq=Yc0U(6ti=?o2?a}O;lzP-np_00wG?r~xDSb~YA79rk z%ectrGEUTCVan%*lxZ55EBm)q0U&gFQplwnmYImUEfl7apfHlD_etv%{_Z5i`x*EF XJiBIsy8=3R00000NkvXXu0mjffc&;P literal 0 HcmV?d00001 diff --git a/graphics/exported/battle/hud/ship-success-fill.png b/graphics/exported/battle/hud/ship-success-fill.png new file mode 100644 index 0000000000000000000000000000000000000000..ac66243b3d562dde85288a6c5e4264b97ce98136 GIT binary patch literal 358 zcmeAS@N?(olHy`uVBq!ia0vp^7C_9&!3HGL7rYk(QY^(zo*^7SP{WbZ0g^26h%9Dc z;5!1sj8nDwq=ABxC9V-A!TD(=<%vb94CUqJdYO6I#mR{Use1WE>9gP2NC6c+_H=O! zvFN>f#n786QReu^_xr1D9*H>iJUCFcaG`33@AMH8uzgu`l!%9RI2 zi+Q=a0$egKmX`ltHtm_Z+y~=-%iezxW(a-qanVI#iv->kpSIlJxwdlwlR)hD*|Q4Y zS)I|dyqOz&w}bE8na|R(Ef-2BrGCEdb;FFiez{!ELYhDxdljr^Oi41#eV#FS&#uVO7nJoYN za?$4>v32biW7XxCu%1tyqAMR~ch}k~mhlh6%QPp0 + + + + + @@ -2833,6 +2849,357 @@ y1="123.97214" x2="111.73327" y2="123.97214" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml - + @@ -2925,6 +3292,24 @@ width="100%" height="100%" transform="rotate(75,864.85174,532.53795)" /> + + + inkscape:label="New ship HUD" + style="display:inline"> - - - - - - @@ -3207,28 +3571,6 @@ inkscape:export-xdpi="96" inkscape:export-ydpi="96" /> - - - - - - + transform="translate(-194.15008,-152.18179)"> + sodipodi:nodetypes="ccccccc" + inkscape:export-filename="/home/michael/workspace/perso/spacetac/graphics/exported/battle/hud/ship-success-back.png" + inkscape:export-xdpi="96" + inkscape:export-ydpi="96" /> + + + style="display:none"> - - + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccc" + inkscape:export-filename="/home/michael/workspace/perso/spacetac/graphics/exported/battle/actionbar/power-generated.png" + inkscape:export-xdpi="96" + inkscape:export-ydpi="96" + transform="matrix(0.78107246,0,0,1.2558385,1575.6416,-121.92861)" /> { let sprite = new ArenaShip(this, ship); - this.layer_ships.add(sprite); + (ship.alive ? this.layer_ships : this.layer_garbage).add(sprite); this.ship_sprites.push(sprite); }); } diff --git a/src/ui/battle/Targetting.ts b/src/ui/battle/Targetting.ts index deb15df..7433afc 100644 --- a/src/ui/battle/Targetting.ts +++ b/src/ui/battle/Targetting.ts @@ -127,14 +127,13 @@ module TK.SpaceTac.UI { ships.forEach(iship => { let builder = new UIBuilder(this.view, impacts); - let indicator = builder.image("battle-hud-ship-impacted", iship.arena_x, iship.arena_y); - indicator.anchor.set(0.5, 0.5); + let indicator = builder.image("battle-hud-ship-impacted", iship.arena_x, iship.arena_y, true); if (action instanceof TriggerAction) { let success = action.getSuccessFactor(ship, iship); builder.in(indicator, builder => { - builder.text(`${Math.round(success * 100)}%`, 0, -32, - { center: true, color: "#c69b70", size: 14, shadow: true }); + builder.image("battle-hud-ship-success-back", -29, -50); + builder.valuebar("battle-hud-ship-success-fill", -28, -49).setValue(success, 1); }); } }); diff --git a/src/ui/common/UIBuilder.ts b/src/ui/common/UIBuilder.ts index 72c77ba..63ebcc7 100644 --- a/src/ui/common/UIBuilder.ts +++ b/src/ui/common/UIBuilder.ts @@ -169,7 +169,7 @@ module TK.SpaceTac.UI { let result = this.game.add.image(x, y, info.key, info.frame); result.name = name; if (centered) { - result.anchor.set(0.5) + result.anchor.set(0.5); } this.add(result); return result; @@ -198,6 +198,15 @@ module TK.SpaceTac.UI { return result; } + /** + * Add a value bar + */ + valuebar(name: string, x = 0, y = 0, orientation = ValueBarOrientation.EAST): ValueBar { + let result = new ValueBar(this.view, name, orientation, x, y); + this.add(result.node); + return result; + } + /** * Add a fragment shader area, with optional fallback image */