From 23de25d585b079870eee4f381e774f441cd04f65 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Fri, 16 Jun 2023 12:13:52 -0400 Subject: [PATCH] Implement nineslice for some UI windows --- public/images/ui/ball_window.png | Bin 411 -> 0 bytes public/images/ui/bmenu0.png | Bin 3117 -> 0 bytes public/images/ui/game_mode_select_window.png | Bin 330 -> 0 bytes public/images/ui/level_up_stats.png | Bin 426 -> 0 bytes public/images/ui/mmenu0.png | Bin 3357 -> 0 bytes .../images/ui/{boolean_window.png => window.png} | Bin src/battle-scene.ts | 5 +---- src/main.ts | 3 ++- src/ui/ball-ui-handler.ts | 4 ++-- src/ui/battle-message-ui-handler.ts | 3 ++- src/ui/confirm-ui-handler.ts | 9 ++++----- src/ui/game-mode-select-ui-handler.ts | 6 +++--- src/ui/option-select-ui-handler.ts | 8 ++++---- 13 files changed, 18 insertions(+), 20 deletions(-) delete mode 100644 public/images/ui/ball_window.png delete mode 100644 public/images/ui/bmenu0.png delete mode 100644 public/images/ui/game_mode_select_window.png delete mode 100644 public/images/ui/level_up_stats.png delete mode 100644 public/images/ui/mmenu0.png rename public/images/ui/{boolean_window.png => window.png} (100%) diff --git a/public/images/ui/ball_window.png b/public/images/ui/ball_window.png deleted file mode 100644 index e5945888cc6438ccad3df5aacea9cb99e6cf9064..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 411 zcmeAS@N?(olHy`uVBq!ia0vp^ML?Xu!3HD`9#(tHz`&T~>EaktaqI0B#iBzF5^WFV z*&1UcB_($Xb*_2BVe8g^A^8i(#Hmv!PMmmR>O>2zjF${6S9@5U*DhbYFWqc)M~B+; z;*5)H_X*DbrXLu()m1D+^LWMoiocC_o<8@uebIy4KRsD7N7>r2}t5lvyjA*?f7e%5?{6Y z%pT3fXa720=M%i>wr2Ia}rMu-sq;;1FE#(Q{9qQsT`SVSK)9-|}w|F`;rT!`h20DYMtDnm{r-UW|PO_gO diff --git a/public/images/ui/bmenu0.png b/public/images/ui/bmenu0.png deleted file mode 100644 index fba1a67364a9d3b2f1152c42d357168014a2d801..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3117 zcmZ8jS2!H%7X5|jEuuywy3sq)nbB)7Vi1WEhKMfFLS~2-IcoHbj3kUMN=8PB8r=w@ zjuI_`gL{-9+I8;v?!&#`UTd$1_3ekf_RCJVZEnCodyN(Vz+hykYjvR>7u2Svyy(A{ zbSj}w}!<-3^LA*xnt`b=L5{}QicUKP7YDyK%BAgH2;cA%E@r?Rz`x&a{?afq`jIbU+l z)s|`x&Eb+mD=>ZE9RL8E%675s?r8{-v64tsO2RYVmt1e5Jm+_DSvp%8D)Z9@U?C`S z_)J2&_8Ll!66JmNR%naD;~pLM@j;?{4U_gqfL)um-SzuB8@+-Q!qn8t^75o{C)B~Y z&o<%=*?zy(_Vm$Fr25Ih{`b#|f@nEMv;oE8_x6E3)57aRX*ADWW_~0aoYd2upYV+G zcN)165Mr!LmMs2By16fR9d zBZ68N4*=L{^lkeFp(aOpL@x{lpKoiO8eoM0%H1fQ9lTCHws0Ccfvu@5@j zdu^N&t(4c>F3+^loj55yhYEJKLz$tp4^Y3fR{dT6#Z-X?UX()7hsINNnO~;eDyg&#fQFG+P9P+gpQm`Zn^7h8FTJoEu zDjLdKy@2!D81n3B1YA;yyQ|-js@4PKqE2F)3}j!SYb-Us(SL*yij}WD*MCd*^+Awq zZZbPI?`uHaHI0`_1*>1nJea1FHDTQ{tv@-b# zr<}YoVc&JAI+%h5t=CGUL=g<-b-tlvh%iN%PZ}2UUKdojGEJjQL;l>dU4%cq*rZOl z;mT1br;D6y9KujSV4NlSsx)(WJgie$kR<^oCqhWMWK{hgKEg7hKjLF0uqIKGr(k$Z zAia0`fmaQc$}0(8@t&Av%yP%F{4)14-;M(<#zouz{h{?D#H#P1G1m(7ioyz|Teh5z z&AVKy+2R8D6~$zGXhi|us>(91_^QI=T$RCSb|aI*inke~*E~2p4m_)V1~pun&A4Hn z_0@Kyf6d@$)=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aUSM|pWtdf&ZT`vXT^9D%d%e0rq9>C0nbqfB#s-!z(N5fa2||M8o>JI8wZ^747X!`=2{&1@l)<*I@9tXZO4gM9LQKjzawduDBzDS%f?`z6x z%BaLSc;a>fTIvJcNgI6GxA6-HEwBG@k*6lJ)if7c_5)C)9?~I^Ya!TI{2V{jH0v+E zQ_*bR?0BHFtvd@{h@8~6znGudoez1^?w`9qHg8Cx2@e~+NH~mVg5e-Aheu^LkTozS+LTTSe&Y z?B#DAc%`K9@ZkRGc8CAGKWO(8k=1hZU4+wNrrIw zZwk1=EKLC*KokH%!vNrze90RC@IoE{Hk|-KJq-Z3Q6C+93;=)Wt7DC z$c^D=&@7P4FFOArm z?w(JvVd(@z{A8DRx0wv$T6{WHgGg%GVql`Gn=L0ymrXVXg?OD?h*p+v3KFZ@O(2dw zmh&$(sk*p{z1mOw;ZCqLdk+Ity&Xx5)zRMEjb!5_wp5$7u6S5MKs!6NuCQ&5HB}*< zU|E#V{H7|(Fc42f*{ document.fonts.load('10px pkmnems')); diff --git a/src/ui/ball-ui-handler.ts b/src/ui/ball-ui-handler.ts index 8cc8d9679..0264d9e82 100644 --- a/src/ui/ball-ui-handler.ts +++ b/src/ui/ball-ui-handler.ts @@ -8,7 +8,7 @@ import UiHandler from "./uiHandler"; export default class BallUiHandler extends UiHandler { private pokeballSelectContainer: Phaser.GameObjects.Container; - private pokeballSelectBg: Phaser.GameObjects.Image; + private pokeballSelectBg: Phaser.GameObjects.NineSlice; private countsText: Phaser.GameObjects.Text; private cursorObj: Phaser.GameObjects.Image; @@ -24,7 +24,7 @@ export default class BallUiHandler extends UiHandler { this.pokeballSelectContainer.setVisible(false); ui.add(this.pokeballSelectContainer); - this.pokeballSelectBg = this.scene.add.image(0, 0, 'ball_window'); + this.pokeballSelectBg = this.scene.add.nineslice(0, 0, 'window', null, 114, 96, 6, 6, 6, 6); this.pokeballSelectBg.setOrigin(0, 1); this.pokeballSelectContainer.add(this.pokeballSelectBg); diff --git a/src/ui/battle-message-ui-handler.ts b/src/ui/battle-message-ui-handler.ts index a9d32390f..0532ca793 100644 --- a/src/ui/battle-message-ui-handler.ts +++ b/src/ui/battle-message-ui-handler.ts @@ -54,7 +54,7 @@ export default class BattleMessageUiHandler extends MessageUiHandler { this.levelUpStatsContainer = levelUpStatsContainer; - const levelUpStatsBg = this.scene.add.image((this.scene.game.canvas.width / 6), -100, 'level_up_stats'); + const levelUpStatsBg = this.scene.add.nineslice((this.scene.game.canvas.width / 6), -100, 'window', null, 118, 100, 6, 6, 6, 6); levelUpStatsBg.setOrigin(1, 0); levelUpStatsContainer.add(levelUpStatsBg); @@ -75,6 +75,7 @@ export default class BattleMessageUiHandler extends MessageUiHandler { const levelUpStatsValuesContent = addTextObject(this.scene, (this.scene.game.canvas.width / 6) - 7, -94, '', TextStyle.WINDOW, { maxLines: 6 }); levelUpStatsValuesContent.setOrigin(1, 0); + levelUpStatsValuesContent.setAlign('right'); levelUpStatsContainer.add(levelUpStatsValuesContent); this.levelUpStatsValuesContent = levelUpStatsValuesContent; diff --git a/src/ui/confirm-ui-handler.ts b/src/ui/confirm-ui-handler.ts index 12cd43e16..d7d9d7add 100644 --- a/src/ui/confirm-ui-handler.ts +++ b/src/ui/confirm-ui-handler.ts @@ -1,6 +1,5 @@ -import BattleScene, { Button } from "../battle-scene"; +import BattleScene from "../battle-scene"; import OptionSelectUiHandler from "./option-select-ui-handler"; -import { addTextObject, TextStyle } from "./text"; import { Mode } from "./ui"; export default class ConfirmUiHandler extends OptionSelectUiHandler { @@ -11,11 +10,11 @@ export default class ConfirmUiHandler extends OptionSelectUiHandler { super(scene, Mode.CONFIRM); } - getWindowName(): string { - return 'boolean_window'; + getWindowWidth(): integer { + return 48; } - getWindowWidth(): integer { + getWindowHeight(): integer { return 48; } diff --git a/src/ui/game-mode-select-ui-handler.ts b/src/ui/game-mode-select-ui-handler.ts index 2092a945d..d76c9f7b8 100644 --- a/src/ui/game-mode-select-ui-handler.ts +++ b/src/ui/game-mode-select-ui-handler.ts @@ -8,11 +8,11 @@ export default class GameModeSelectUiHandler extends OptionSelectUiHandler { super(scene, Mode.GAME_MODE_SELECT); } - getWindowName(): string { - return 'game_mode_select_window'; + getWindowWidth(): integer { + return 64; } - getWindowWidth(): integer { + getWindowHeight(): number { return 64; } diff --git a/src/ui/option-select-ui-handler.ts b/src/ui/option-select-ui-handler.ts index 78b5007d1..06ae9a25c 100644 --- a/src/ui/option-select-ui-handler.ts +++ b/src/ui/option-select-ui-handler.ts @@ -7,7 +7,7 @@ export default abstract class OptionSelectUiHandler extends UiHandler { protected handlers: Function[]; protected optionSelectContainer: Phaser.GameObjects.Container; - protected optionSelectBg: Phaser.GameObjects.Image; + protected optionSelectBg: Phaser.GameObjects.NineSlice; private cursorObj: Phaser.GameObjects.Image; @@ -15,10 +15,10 @@ export default abstract class OptionSelectUiHandler extends UiHandler { super(scene, mode); } - abstract getWindowName(): string; - abstract getWindowWidth(): integer; + abstract getWindowHeight(): integer; + abstract getOptions(): string[]; setup() { @@ -28,7 +28,7 @@ export default abstract class OptionSelectUiHandler extends UiHandler { this.optionSelectContainer.setVisible(false); ui.add(this.optionSelectContainer); - this.optionSelectBg = this.scene.add.image(0, 0, this.getWindowName()); + this.optionSelectBg = this.scene.add.nineslice(0, 0, 'window', null, this.getWindowWidth(), this.getWindowHeight(), 6, 6, 6, 6); this.optionSelectBg.setOrigin(0, 1); this.optionSelectContainer.add(this.optionSelectBg);