From e07e267ddcfa6d23077228b78725fda9f1c455bd Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Wed, 20 Dec 2023 22:22:15 -0500 Subject: [PATCH] Refactor windows and add alternate window skins --- public/images/ui/bg_command.png | Bin 2714 -> 0 bytes public/images/ui/bg_fight.png | Bin 595 -> 0 bytes public/images/ui/command_fight_labels.png | Bin 0 -> 234 bytes public/images/ui/option_select_window_1.png | Bin 312 -> 0 bytes public/images/ui/option_select_window_2.png | Bin 339 -> 0 bytes public/images/ui/option_select_window_3.png | Bin 362 -> 0 bytes public/images/ui/party_message.png | Bin 346 -> 0 bytes public/images/ui/party_message_large.png | Bin 378 -> 0 bytes public/images/ui/party_message_options.png | Bin 342 -> 0 bytes .../images/ui/party_message_options_wide.png | Bin 334 -> 0 bytes public/images/ui/window.png | Bin 3879 -> 0 bytes public/images/ui/windows/trim.ps1 | 3 ++ public/images/ui/windows/window_1.png | Bin 0 -> 3041 bytes public/images/ui/windows/window_2.png | Bin 0 -> 3040 bytes public/images/ui/windows/window_3.png | Bin 0 -> 3042 bytes public/images/ui/windows/window_4.png | Bin 0 -> 3038 bytes src/battle-scene.ts | 14 ++---- src/egg-hatch-phase.ts | 4 +- src/system/settings.ts | 13 ++++-- src/ui/abstact-option-select-ui-handler.ts | 3 +- src/ui/achvs-ui-handler.ts | 13 +++--- src/ui/ball-ui-handler.ts | 3 +- src/ui/battle-message-ui-handler.ts | 30 +++++++++++- src/ui/biome-select-ui-handler.ts | 7 +-- src/ui/command-ui-handler.ts | 3 +- src/ui/egg-gacha-ui-handler.ts | 8 ++-- src/ui/egg-list-ui-handler.ts | 6 +++ src/ui/fight-ui-handler.ts | 3 +- src/ui/menu-ui-handler.ts | 3 +- src/ui/party-ui-handler.ts | 21 +++++---- src/ui/settings-ui-handler.ts | 5 +- src/ui/starter-select-ui-handler.ts | 6 +++ src/ui/ui.ts | 3 +- src/ui/vouchers-ui-handler.ts | 11 +++-- src/ui/window.ts | 43 ++++++++++++++++++ 35 files changed, 151 insertions(+), 51 deletions(-) delete mode 100644 public/images/ui/bg_command.png delete mode 100644 public/images/ui/bg_fight.png create mode 100644 public/images/ui/command_fight_labels.png delete mode 100644 public/images/ui/option_select_window_1.png delete mode 100644 public/images/ui/option_select_window_2.png delete mode 100644 public/images/ui/option_select_window_3.png delete mode 100644 public/images/ui/party_message.png delete mode 100644 public/images/ui/party_message_large.png delete mode 100644 public/images/ui/party_message_options.png delete mode 100644 public/images/ui/party_message_options_wide.png delete mode 100644 public/images/ui/window.png create mode 100644 public/images/ui/windows/trim.ps1 create mode 100644 public/images/ui/windows/window_1.png create mode 100644 public/images/ui/windows/window_2.png create mode 100644 public/images/ui/windows/window_3.png create mode 100644 public/images/ui/windows/window_4.png create mode 100644 src/ui/window.ts diff --git a/public/images/ui/bg_command.png b/public/images/ui/bg_command.png deleted file mode 100644 index 073261fa782ac3730db7073a832428495e1762ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2714 zcmbuB={pn*|HVhPa8C@zP7zrWvW_*zGPs2pyK2a8ETQaXBx^&BWQih6WEaEOLRrSx z%HG%pCB{w}Cd=dZyRPRicwU@yo$I{#zBw;G-(*X37?4$f6#xJLO^gk!0027O^Q>@@ z>D&=LMGF7`Q%wZiKE%o;^h#h*fQL8I{Ypr9p!*f~FmDe4AdG~w^GjE%0v?Y@2QfV5 zfc7oc%cv1{$6R~wMNZ{v1yE8;wJ`h~R!!sN+S5NH!l$tormyvRs(MV558Vbb1w?$> zbRKVU?>FaL#AtnsM3E!S%~tm=hbA^wlqAF)z232pqeY_1sJZX}{ol$_Ivdyj?ngc1 zJXxcZMhSj=q|IGHqxf_HQzOX_f1a+CI)&m7h37T6rEYgY^G02l!nTg~&?f`4UuoJ8 zyC6#`zXk=qa?JSsgKmqbdOe6@Tm}BTpQn{g|%|P81cm~4ju^?wK-CUa)r>Br*5O7 zOk|5?_%i5&4be9a1`K#<#2Y$VO1&(kileQc`ZcA!7k3iUG>{EB*DMI#veuq&R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D5mO$ zw2n!J6&;g+kOl%s0S|O`4pk0k$IsFky$$JqA=Gc-B*ha;RT8ik;cH=}P0fD7Z9k*| z+&mFc=Q}aeMH?{P}@8`0f{0A*%P*Rd~8Jfl=jqL8dj3wb`sQxfRfQV|jzLFw!-yT$=Y%fec@__PANA=PV8zG#!Xat>rw!>~n1gF)XXom(x&1YOt@J3jp}(R%<~!|E zt9g3E=H1?*cD-u_)kH1rHy06hQJNPQEGPKONfCnsBQQa;!CL->?bFONu8vQeikT%p z$u+sv=GLkS5c>6pZ){M$GP3^9ehB-V7%PYiBzFpip0pq1p;->EH#znt9 zejn@+NvHLAn_0o;l%0b^7eL4GKimIbSP|^Bp|rEF4O3$zx=~DvQ7>p*5TeMOWIHWcmzrkHndhWOcedMQg7<~Xjhxlu#_BKTV_izX`ipIhLIq7i`^YpoZsE(l*q7T4+Cz(v0FAp#=G&iV*BA)yQ D&592- diff --git a/public/images/ui/bg_fight.png b/public/images/ui/bg_fight.png deleted file mode 100644 index 538fe67bc9d7c74145cb33628f483df81cf70302..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 595 zcmeAS@N?(olHy`uVBq!ia0y~yU~~Yo4LI0~)y=$BIC_sem z!fZip57*8WF+oAQd|s-iNKToelRV8~rqNPwujzWRY3wtTT#_UnCm0IdcrU}r8aHpY z_Ph4=N6%mOj;pyQU&^o~>F1uFj*fUQ#wA(T>Nd<+uY5i}lvVD+@89oN%r^S+=Kt#Z zo(#`^W}AGS?RAj(l-TDLvoD+4R!9HsIba}kweovW@!zys_BGu)VV|d-Iw&hM%X!N0 ztP6%!Wf4H}R-I2yq7VJVZYn8#3vXXAPd09UxAKN?!5#Y*YgeSVUq52%pb*I<*R0<=%}IdE!J|Ya@4kK8TtNwsG!-)@<~h9wR`wiZ z5>T`G7FTu0^wl!6e?UbkZ%luceRj*haDsvAJ$4S^5Rv=)`D^~TxL=7Zt>|L zpDDa$urXo3+Gs6(slBSK!dEYjS?7DG%bR4=^1BT0uI{P-{lN+-{x{8DbW4wyYNE=Q zH@wOP!TVQo^mNSIdlnK?U#}lZ+7~8T;ZPb}w(j-KhhL-Z^mn^I@OEW8CfdUz)5sX~ aiT#Jo#m7IE2893<3xlVtpUXO@geCyBivDx} diff --git a/public/images/ui/command_fight_labels.png b/public/images/ui/command_fight_labels.png new file mode 100644 index 0000000000000000000000000000000000000000..257d0e5d93f6ba29ba88f1fd3ff7f9a26bf8849c GIT binary patch literal 234 zcmVQjZ>e+8q6ndkU1|tTN1T0%A=iG-wM|om^vF%iZSzz;onF?+s=R zy*J!}IkSc_uDQCOMQY-~#}TWXNKITB2QX_;)#&aRbmIPhMJFeI(av59$RBWMs6osPUg)? kW#uhv`L*}w>+HB4eiHhpE&&V6B>(^b07*qoM6N<$f|QkCP5=M^ literal 0 HcmV?d00001 diff --git a/public/images/ui/option_select_window_1.png b/public/images/ui/option_select_window_1.png deleted file mode 100644 index 429be5b295824a155346e3600d65c38357d75469..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 312 zcmeAS@N?(olHy`uVBq!ia0vp^2|%pC!3HGX9;gigQvW?&978hhy`7~vt=T|=&AviZ zTUmMHi4&(zO_f=A{D$%u30tP3r>9PMq&(H1xMS^t)Ohaos~9&LPg;;RX~v&cm8*(> zxXc#rIQ`$I=HzcKW$lEri{H<`)IVS+^VF{D%o-1Si=!oBmSQgrHvQ6+nEQU3*mvKx z516Oj^VqcH#yRs}d7gE}83y0dR_&T}<($%#^Y)uQf8O|Ho6G5K0u2l-3`_zH91aW$ z42)=;|2htvTBiEw?40ZC+Oz(fZvSV=C;Mf*U$UF~9zVJ*Smbcj&KKarGkoB&Ow~Ygv>qlTvFnGH9xvXFoKVDs-Jg$cob^L@dqfy|&`3YK1&am6d!C z!?$=It^ITU@bo?FBT`z==>7U<`Iqs{;lOu`(`SmlW?w$zoR<5Io7U)71rT@AE?}X96zD>Us-ce|NA-h wHOzWq%ejxa%`~1_dih!Fk>^?4R(Y@7!K9z&9kW3zOcmq|Pgg&ebxsLQ09D?7p#T5? diff --git a/public/images/ui/option_select_window_3.png b/public/images/ui/option_select_window_3.png deleted file mode 100644 index d10d044a850a3ee0b84a2b201a72978344324504..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 362 zcmeAS@N?(olHy`uVBq!ia0vp^2|(dF)S-5y0bdbdwnsdTdBS&dM@f6ocqyE<-| zopsNcxa$2!`S0fguS<8I3D7)VQCCwND%xd>7aL0OW1VV+p|}Xd=A}z?c+YqWB)(rJT35={(5KZ zZFlj$oqksfyaWT+{cj3dwSV7*E033l#P4T3eks;Y!)(?Lp`~A@pIy!I{Ppxz=Xd^M YXxDr>9QrQsPSVGCq@V^ZjJcE3;49OMkxP;!;vu z&)Lv1qbP6IdJP-7d5d$)moZJ%dMc9tUSCk~B2f0`cmIiUX_FgIoqaBnT-SSctH|U| z25;_d+2-Gm>;2khuKMG7(MdzT@9fQQqeS}J7k4_cmfh7;YTIp*Q)l;L2}5aQ^>g!M zOdQM#JPig6hZt}&IG8^iH+VA1msM-iw{!R3*6ev#C%vYk*=x~<*G4yf&Y4#4-E&wZ zIYN`)bmn*b!~AaFw7V{UHx3vIVCg!07@c_LI3~& diff --git a/public/images/ui/party_message_large.png b/public/images/ui/party_message_large.png deleted file mode 100644 index 7720ab2ace4a5b1775dcd0fa7204e94b6c7a22cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 378 zcmeAS@N?(olHy`uVBq!ia0y~yU}OWbwKzazpw8E$KmkWj7srr_TW{|w7TtDWXnm;O z@3>&Wf`tzb9XQ}5zwr1A!Kxm)g9aM{3Kk|jaB?&jSNZBA^pxr5`{qd(XWy(3JK;R( z%+fnd6H?ZeO8j$wc>MBupUWq;F08y3_vz2~@<}N(ym#78n=dJEcG}_jw%0S3{yX__ ztH^5ChHCD{2%ee z8|#vfwZD~XS6zK|f%5HApG)`Zy?P#h`Ns6Zkn6F<-u;Gqwmki};3kLFl}op(@()f> kDb_SU%;34{n$;iX*AIP9s@imdKI;Vst0HaQ&L;wH) diff --git a/public/images/ui/party_message_options.png b/public/images/ui/party_message_options.png deleted file mode 100644 index b0fd8f12294f657ff50a055ae9956db2818d227d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 342 zcmeAS@N?(olHy`uVBq!ia0vp^_kdWAgAGVJ_b*^(U|^K>ba4!+xb^m~V$fj+k%ouU z{aA}qQ&Lk>QdKv(Kah}VOfG2gP%#3EJw0{8N}%=Jlr(_}F17Q|xb2-;Z}w_wS4YOJ zZ^{j!JeJ{C%S-y(pRag5cjW;mFUzC1e|x*Qg!taBdvkla2mj)e2M!%8?y}o|>{-yG z1f>n9)|O}HT9@vyH@kRkt>!`dr;`@Hf2Y6gZAi)S!xxVvuF>M_yET8BEqkAf2tNH5Y`pZ>YlaA=T~l7&mVO`d>veOI+lB_Ar99WKt>UoPZ8YVz b44=<2$9JQdr_U5%crkdo`njxgN@xNAHW`su diff --git a/public/images/ui/party_message_options_wide.png b/public/images/ui/party_message_options_wide.png deleted file mode 100644 index fba84a08bc6d6670a47d019b0f4cc6b82f35dbd0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 334 zcmV-U0kQsxP)J@qk=+1!@xkp!otEFVaM1Jc8nb%aB$Gj(6I2qz_1RajnpL?jXQlmm;^n2 zvO=DnBy};~1XQl%?A#;P%lTa)v`hunF}v#P`$LlCx)^V#_$GfGnGC8mPF^X0s+kKe zOazsmvU8({t(T|1Qw)(QVK>>b(y%^A4_mSJ=bnjSS8dly8dlLZzdz(;MJ={kY#0k( z3BiJ30fGex76c0rEI_azSb$&wf(5|>1Pc%>2o@k%fMD^jg3Xqh3aYTx;%cXB-k}*- zmBH?@{<(xWPJX$YAPq%HtbU^o6Q=>X;5OMk&s48 z0qOYge($~O{d0djarW7JKkKaX>xt9Tfsuh2KmY)MOhaAO;I@kX4I;wZ{0R5#IRHS) z9fUCPH?Rq0^Y-;}ba8iJ^G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fWx$WR#^!4%gq}HM)p{5)A`Vw=KC}1kyTpsXjIpn)`QK$4*Om(@1CXP|`#VWmB^!9riJo1JMyFSQ~ zcofK^UmWg`|5UL@^o(_`Kn7vZwoxsgn-lfwd7FXe9LB4uaUjhUy2ug|%x z+>nS2bN^K9R`#$Wj`Xa0N1fXnj9QbKUDK&;oamYa)6)&J5#2Y zvaDyTwWvR?c=!+;YU|f9oh4~dfV#oep6Op<8Ne^Dz0}R3V)j!7qHAzZ3E2txgVk<; zq(7*>0K(Jv0RWsB7Znvf4HcFD-5757gq+Y+dG#(urXDNvLIZw+UA^vmDgm`ibj!R( zf>AM8W9Ny^Rji0JHsxKD45*R-s6bmrEFX+u2A% zET!nGDL%aaxVWDywG0=UL@=JOSbwz?{;Sm-BO|%RNwA{0AMX&F0JyfypQtY1w;OWJ z1++UYY3`o7!L5(ej-ar37M!;pOUo@7jo?pfX=<{m+Y+SdD8>j#_FTdp$OC=ipx zr;`h{4A_s>MlH`3BTJmkz!%FGJ>yb00_Krlo&#`+*dqSl6w!ef6>Hzc;xN~c?ng4c z@u;p>W3qAK1n&V>sAGi_;2#{Ly0gKy8<(co?b-3EBrG(4fSRVXD{BUTyzx9Fqz0?6 UF`TP5-aa0np{Ao+scaqfACx6d&Hw-a diff --git a/public/images/ui/windows/trim.ps1 b/public/images/ui/windows/trim.ps1 new file mode 100644 index 000000000..54356943e --- /dev/null +++ b/public/images/ui/windows/trim.ps1 @@ -0,0 +1,3 @@ +Get-ChildItem -Path "*.png" | ForEach-Object { + magick.exe convert -trim $_.FullName $_.FullName +} \ No newline at end of file diff --git a/public/images/ui/windows/window_1.png b/public/images/ui/windows/window_1.png new file mode 100644 index 0000000000000000000000000000000000000000..edfef03f924ffeb6fcac7b7144ca16457e918447 GIT binary patch literal 3041 zcmZ`*3p|ti8-K^#FXb+m(;|1V&2rh%$}VS{Od26kW;UBJW}=HQ*Ax*Vm20A$B6F?& zZc#%;x*QdSq?{<7%7pTNr_2AG&*%K#_w(%e{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#j- literal 0 HcmV?d00001 diff --git a/public/images/ui/windows/window_2.png b/public/images/ui/windows/window_2.png new file mode 100644 index 0000000000000000000000000000000000000000..7da47310d64435b7f5fb1618b0416e3f28a46f7c GIT binary patch literal 3040 zcmZ`*4LFl~8-K=pR5%)GF*S(`* zL;{WsdJU;TWx-#IT$UmLK#no7SQ3*)0{{a-jKGF)*B;S&&=W66J&DI5Oevf1Pz--5 zNyS%^23KCQI=6p8&Q0@-`da7an$gjA|0m6@K6@4RI;buJEFO!@6~LBq)c4(sju<)} zC0QRe4HWt?$_CVADGyBhQpD%(SER;NDEh&RPa?NqJa-3ZRL>v|N@hNMGVZRf@BOkv zKAYbO6c7-!I_m0hRp;$nFMhOTWn}9m&F4iA3Rl7G*asp%r*k@~34!wIAxH8p38=Gm z-c$Zw7L=DhFEfgQvrNYKds&9FyhOaG4V&YrLg6*K*qtM@0;Q9pj_W8b=5IkIGM^AI zg3DjT$#Fv;u5{>Sie#LAk^4>P$X*108vp%xC&!b9Ie08c&9e5_vW8}LTq{L`G&;YF0dU)8iDKv07vuz zAU+WQ7QjdG69B+N1HkWo0AO_v0M+V0`{-_1EdT8UCubg6ECulfQuCo1Ro9n7;lssB)Y^d5`3t@ zCA#4i-YBh+Rna#J9!7wg<|7nuE}0sIj9`ZcFhdwf?%@aqa{1q4nO@@g?g2taX>s=& z!{+(hS=9=svc77aY>ucHTKiUgmm;PqI^@Lcou{*h5;gVV37doV^aVh>)%q^y+$cn9 zZR8`!<2c|>cde0qkF9ziRq%&p(<_IwW7fUB|IzKhErC-} z+NuD;&v5v@EOVE9hv3)R{PdiSGu_uEGm)sp@&uaOi=KhD{-D#VOy>7Yi*3eyGhQ7( z`Gw)Q<@J*gXyeSfrLkk0WaXOH+&TH9CPRP-x>v&g*cO`8);ShjG+lA?U{%?Kp6*SP z^3csQ8Zv7)7(2F!(j9r0ZpY@7KVgeI`=2hPn%#x*PXQxxm*R{%-e41&Tuul=^a}|s zleoe5R_L2iJ(8BJT?5mZv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X{g+@9y`3o56>YgW2dJyPE|B*8U?jJw)S&6{=ZHL8j5oOo8G z^I;`4aenqryBsK-y@guYQ7n1tByG?xasFs${_Yyxud%m#mMf=RH(|Xe>rm|3p^r01 z6IaS!S^4Jny(oWR_4)9H=!aU61LE_A&2@5vbQeeDfeR%%)k%D$XnZ$_m@wv8<_3Bk znPBav@s#eZngD@FZ=!3s_$Yyk#Lci zF~GM+A==}{BY+2o2n{cB$XYO055t|zB$KxS;3NZpV-5rgh)apfLjHm!Ad-N1Z{U|F^2b)2G(a#Dz zRuChUM+J`p@fLp+0rzT-HM9J)NY%Kx5Y(uNHH=6W6N_i@LR}bKS5Otm04$M+T;~8j z$WZyouwe(Xxvm^4odKYch!nFX8W`U6GfV(q$_*_1Pe02Xe(@bhUiXts1WP(InV}3G zfZmBhA_~4q#{7*y4x;)p92mjAJU;+qjzsuZEsEQ!`ZL2S;SkH`dwj|Ngt$?fKjW@! zCNF}@WdMKe*}R|fZIGoUW`Sc5md@rxaaq28JisN47RaI_2<#v#EBLkm?FrI0|DgFW zLg`!!#tP(ZV+A8ZDRy`VUuzYRz4~(Eq(Ri+Fea7G3*$1lt8|Bg4Dm<^ c|B(*tCnFFLOFg~GHeduG6P*YZcyIoH0Y3Z1>i_@% literal 0 HcmV?d00001 diff --git a/public/images/ui/windows/window_4.png b/public/images/ui/windows/window_4.png new file mode 100644 index 0000000000000000000000000000000000000000..69c5bce9dc988b7022487fbf69f4be1b30f6c38c GIT binary patch literal 3038 zcmZ`*3p|ti8-HhWizK&{Rg>ID+eoZJY;EMSMsBHWvoR(!n@c!YsKjB%^(b;lN2yH6 zt%MRo9qH7;k&y0gmDnkA-Z|C(oX_X{_wIS0@9%xS-{<+gd-nPKo>L?j!s=BURsjI8 z+JT58gI+^oFerGpCu8s~a8dq&{lv@b;AT+@rh*gz>`2T!G4Ro|?~{DE4qh zV6N?f2twBrz$nBO3qKS>?Fbn?dHnRsF{TyS(ttI(X_Yb#;;3O zGC6z^aE=J4HBr`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_Volume]: new Array(11).fill(null).map((_, i) => i ? (i * 10).toString() : 'Mute'), [Setting.SE_Volume]: new Array(11).fill(null).map((_, i) => i ? (i * 10).toString() : 'Mute'), - [Setting.Show_Stats_on_Level_Up]: [ 'Off', 'On' ] + [Setting.Show_Stats_on_Level_Up]: [ 'Off', 'On' ], + [Setting.Window_Type]: new Array(4).fill(null).map((_, i) => (i + 1).toString()) }; export const settingDefaults: SettingDefaults = { @@ -29,7 +32,8 @@ export const settingDefaults: SettingDefaults = { [Setting.Master_Volume]: 5, [Setting.BGM_Volume]: 10, [Setting.SE_Volume]: 10, - [Setting.Show_Stats_on_Level_Up]: 1 + [Setting.Show_Stats_on_Level_Up]: 1, + [Setting.Window_Type]: 1 }; export function setSetting(scene: BattleScene, setting: Setting, value: integer): boolean { @@ -52,6 +56,9 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer) case Setting.Show_Stats_on_Level_Up: scene.showLevelUpStats = settingOptions[setting][value] === 'On'; break; + case Setting.Window_Type: + updateWindowType(scene, parseInt(settingOptions[setting][value])); + break; } return true; diff --git a/src/ui/abstact-option-select-ui-handler.ts b/src/ui/abstact-option-select-ui-handler.ts index 88ae5953d..3c57fb5a0 100644 --- a/src/ui/abstact-option-select-ui-handler.ts +++ b/src/ui/abstact-option-select-ui-handler.ts @@ -2,6 +2,7 @@ import BattleScene, { Button } from "../battle-scene"; import { TextStyle, addTextObject } from "./text"; import { Mode } from "./ui"; import UiHandler from "./ui-handler"; +import { addWindow } from "./window"; export default abstract class AbstractOptionSelectUiHandler extends UiHandler { protected handlers: Function[]; @@ -29,7 +30,7 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler { this.optionSelectContainer.setVisible(false); ui.add(this.optionSelectContainer); - this.optionSelectBg = this.scene.add.nineslice(0, 0, 'window', null, this.getWindowWidth(), this.getWindowHeight(), 6, 6, 6, 6); + this.optionSelectBg = addWindow(this.scene, 0, 0, this.getWindowWidth(), this.getWindowHeight()); this.optionSelectBg.setOrigin(1, 1); this.optionSelectContainer.add(this.optionSelectBg); diff --git a/src/ui/achvs-ui-handler.ts b/src/ui/achvs-ui-handler.ts index ab08f4600..edf770e57 100644 --- a/src/ui/achvs-ui-handler.ts +++ b/src/ui/achvs-ui-handler.ts @@ -3,6 +3,7 @@ import { Achv, achvs } from "../system/achv"; import MessageUiHandler from "./message-ui-handler"; import { TextStyle, addTextObject } from "./text"; import { Mode } from "./ui"; +import { addWindow } from "./window"; export default class AchvsUiHandler extends MessageUiHandler { private achvsContainer: Phaser.GameObjects.Container; @@ -27,14 +28,14 @@ export default class AchvsUiHandler extends MessageUiHandler { this.achvsContainer.setInteractive(new Phaser.Geom.Rectangle(0, 0, this.scene.game.canvas.width / 6, this.scene.game.canvas.height / 6), Phaser.Geom.Rectangle.Contains); - const headerBg = this.scene.add.nineslice(0, 0, 'window', null, (this.scene.game.canvas.width / 6) - 2, 24, 6, 6, 6, 6); + const headerBg = addWindow(this.scene, 0, 0, (this.scene.game.canvas.width / 6) - 2, 24); headerBg.setOrigin(0, 0); const headerText = addTextObject(this.scene, 0, 0, 'Achievements', TextStyle.SETTINGS_LABEL); headerText.setOrigin(0, 0); headerText.setPositionRelative(headerBg, 8, 4); - this.achvIconsBg = this.scene.add.nineslice(0, headerBg.height, 'window', null, (this.scene.game.canvas.width / 6) - 2, (this.scene.game.canvas.height / 6) - headerBg.height - 68, 6, 6, 6, 6); + this.achvIconsBg = addWindow(this.scene, 0, headerBg.height, (this.scene.game.canvas.width / 6) - 2, (this.scene.game.canvas.height / 6) - headerBg.height - 68); this.achvIconsBg.setOrigin(0, 0); this.achvIconsContainer = this.scene.add.container(6, headerBg.height + 6); @@ -53,28 +54,28 @@ export default class AchvsUiHandler extends MessageUiHandler { this.achvIconsContainer.add(icon); } - const titleBg = this.scene.add.nineslice(0, headerBg.height + this.achvIconsBg.height, 'window', null, 174, 24, 6, 6, 6, 6); + const titleBg = addWindow(this.scene, 0, headerBg.height + this.achvIconsBg.height, 174, 24); titleBg.setOrigin(0, 0); this.titleText = addTextObject(this.scene, 0, 0, '', TextStyle.WINDOW); this.titleText.setOrigin(0, 0); this.titleText.setPositionRelative(titleBg, 8, 4); - const scoreBg = this.scene.add.nineslice(titleBg.x + titleBg.width, titleBg.y, 'window', null, 46, 24, 6, 6, 6, 6); + const scoreBg = addWindow(this.scene, titleBg.x + titleBg.width, titleBg.y, 46, 24); scoreBg.setOrigin(0, 0); this.scoreText = addTextObject(this.scene, 0, 0, '', TextStyle.WINDOW); this.scoreText.setOrigin(0, 0); this.scoreText.setPositionRelative(scoreBg, 8, 4); - const unlockBg = this.scene.add.nineslice(scoreBg.x + scoreBg.width, scoreBg.y, 'window', null, 98, 24, 6, 6, 6, 6); + const unlockBg = addWindow(this.scene, scoreBg.x + scoreBg.width, scoreBg.y, 98, 24); unlockBg.setOrigin(0, 0); this.unlockText = addTextObject(this.scene, 0, 0, '', TextStyle.WINDOW); this.unlockText.setOrigin(0, 0); this.unlockText.setPositionRelative(unlockBg, 8, 4); - const descriptionBg = this.scene.add.nineslice(0, titleBg.y + titleBg.height, 'window', null, (this.scene.game.canvas.width / 6) - 2, 42, 6, 6, 6, 6); + const descriptionBg = addWindow(this.scene, 0, titleBg.y + titleBg.height, (this.scene.game.canvas.width / 6) - 2, 42); descriptionBg.setOrigin(0, 0); const descriptionText = addTextObject(this.scene, 0, 0, '', TextStyle.WINDOW, { maxLines: 2 }); diff --git a/src/ui/ball-ui-handler.ts b/src/ui/ball-ui-handler.ts index 2e0f8cd8f..0682f4ea3 100644 --- a/src/ui/ball-ui-handler.ts +++ b/src/ui/ball-ui-handler.ts @@ -5,6 +5,7 @@ import { addTextObject, TextStyle } from "./text"; import { Command } from "./command-ui-handler"; import { Mode } from "./ui"; import UiHandler from "./ui-handler"; +import { addWindow } from "./window"; export default class BallUiHandler extends UiHandler { private pokeballSelectContainer: Phaser.GameObjects.Container; @@ -24,7 +25,7 @@ export default class BallUiHandler extends UiHandler { this.pokeballSelectContainer.setVisible(false); ui.add(this.pokeballSelectContainer); - this.pokeballSelectBg = this.scene.add.nineslice(0, 0, 'window', null, 114, 96, 6, 6, 6, 6); + this.pokeballSelectBg = addWindow(this.scene, 0, 0, 114, 96); 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 56576f719..88a0f323d 100644 --- a/src/ui/battle-message-ui-handler.ts +++ b/src/ui/battle-message-ui-handler.ts @@ -4,6 +4,7 @@ import UI, { Mode } from "./ui"; import * as Utils from "../utils"; import MessageUiHandler from "./message-ui-handler"; import { getStatName, Stat } from "../data/pokemon-stat"; +import { addWindow } from "./window"; export default class BattleMessageUiHandler extends MessageUiHandler { private levelUpStatsContainer: Phaser.GameObjects.Container; @@ -12,6 +13,8 @@ export default class BattleMessageUiHandler extends MessageUiHandler { private nameText: Phaser.GameObjects.Text; public bg: Phaser.GameObjects.Image; + public commandWindow: Phaser.GameObjects.NineSlice; + public movesWindowContainer: Phaser.GameObjects.Container; public nameBoxContainer: Phaser.GameObjects.Container; constructor(scene: BattleScene) { @@ -30,6 +33,28 @@ export default class BattleMessageUiHandler extends MessageUiHandler { this.bg = bg; + this.commandWindow = addWindow(this.scene, 201, -1, 118, 46); + this.commandWindow.setOrigin(0, 1); + this.commandWindow.setVisible(false); + ui.add(this.commandWindow); + + this.movesWindowContainer = this.scene.add.container(1, -1); + this.movesWindowContainer.setVisible(false); + + const movesWindow = addWindow(this.scene, 0, 0, 243, 46); + movesWindow.setOrigin(0, 1); + this.movesWindowContainer.add(movesWindow); + + const moveDetailsWindow = addWindow(this.scene, 238, 0, 80, 46, false, true, 2, 133); + moveDetailsWindow.setOrigin(0, 1); + this.movesWindowContainer.add(moveDetailsWindow); + + const commandFightLabels = this.scene.add.image(246, -10, 'command_fight_labels'); + commandFightLabels.setOrigin(0, 1); + this.movesWindowContainer.add(commandFightLabels); + + ui.add(this.movesWindowContainer); + const messageContainer = this.scene.add.container(12, -39); ui.add(messageContainer); @@ -68,7 +93,7 @@ export default class BattleMessageUiHandler extends MessageUiHandler { this.levelUpStatsContainer = levelUpStatsContainer; - const levelUpStatsBg = this.scene.add.nineslice((this.scene.game.canvas.width / 6), -100, 'window', null, 128, 100, 6, 6, 6, 6); + const levelUpStatsBg = addWindow(this.scene, (this.scene.game.canvas.width / 6), -100, 128, 100); levelUpStatsBg.setOrigin(1, 0); levelUpStatsContainer.add(levelUpStatsBg); @@ -98,7 +123,8 @@ export default class BattleMessageUiHandler extends MessageUiHandler { show(args: any[]): void { super.show(args); - this.bg.setTexture('bg'); + this.commandWindow.setVisible(false); + this.movesWindowContainer.setVisible(false); this.message.setWordWrapWidth(1780); } diff --git a/src/ui/biome-select-ui-handler.ts b/src/ui/biome-select-ui-handler.ts index 752307b93..e7ba600c0 100644 --- a/src/ui/biome-select-ui-handler.ts +++ b/src/ui/biome-select-ui-handler.ts @@ -4,10 +4,11 @@ import { addTextObject, TextStyle } from "./text"; import { Mode } from "./ui"; import UiHandler from "./ui-handler"; import * as Utils from "../utils"; +import { addWindow } from "./window"; export default class BiomeSelectUiHandler extends UiHandler { private biomeSelectContainer: Phaser.GameObjects.Container; - private biomeSelectBg: Phaser.GameObjects.Image; + private biomeSelectBg: Phaser.GameObjects.NineSlice; private biomesText: Phaser.GameObjects.Text; private biomeChoices: Biome[]; @@ -26,7 +27,7 @@ export default class BiomeSelectUiHandler extends UiHandler { this.biomeSelectContainer.setVisible(false); ui.add(this.biomeSelectContainer); - this.biomeSelectBg = this.scene.add.image(0, 0, 'option_select_window_2'); + this.biomeSelectBg = addWindow(this.scene, 0, 0, 96, 32); this.biomeSelectBg.setOrigin(0, 1); this.biomeSelectContainer.add(this.biomeSelectBg); @@ -50,7 +51,7 @@ export default class BiomeSelectUiHandler extends UiHandler { if (this.biomeChoices.length <= 1) return; - this.biomeSelectBg.setTexture(`option_select_window_${this.biomeChoices.length}`) + this.biomeSelectBg.height = (this.biomeChoices.length + 1) * 16; this.biomesText.setText(this.biomeChoices.map(b => getBiomeName(b)).join('\n')); this.biomesText.setPositionRelative(this.biomeSelectBg, 16, 9); this.biomeSelectHandler = args[1] as Function; diff --git a/src/ui/command-ui-handler.ts b/src/ui/command-ui-handler.ts index 2294fdfbf..90f7a0172 100644 --- a/src/ui/command-ui-handler.ts +++ b/src/ui/command-ui-handler.ts @@ -45,7 +45,8 @@ export default class CommandUiHandler extends UiHandler { this.commandsContainer.setVisible(true); const messageHandler = this.getUi().getMessageHandler(); - messageHandler.bg.setTexture('bg_command'); + messageHandler.commandWindow.setVisible(true); + messageHandler.movesWindowContainer.setVisible(false); messageHandler.message.setWordWrapWidth(1110); messageHandler.showText(`What will\n${(this.scene.getCurrentPhase() as CommandPhase).getPokemon().name} do?`, 0); this.setCursor(this.getCursor()); diff --git a/src/ui/egg-gacha-ui-handler.ts b/src/ui/egg-gacha-ui-handler.ts index dcdebe51d..c04ab9124 100644 --- a/src/ui/egg-gacha-ui-handler.ts +++ b/src/ui/egg-gacha-ui-handler.ts @@ -8,6 +8,7 @@ import { EGG_SEED, Egg, GachaType, getEggTierDefaultHatchWaves, getEggDescriptor import { Voucher, VoucherType, getVoucherTypeIcon } from "../system/voucher"; import { getPokemonSpecies } from "../data/pokemon-species"; import { Type } from "../data/type"; +import { addWindow } from "./window"; const defaultText = 'Select a machine.'; @@ -144,7 +145,8 @@ export default class EggGachaUiHandler extends MessageUiHandler { this.eggGachaOptionsContainer = this.scene.add.container((this.scene.game.canvas.width / 6), 148); this.eggGachaContainer.add(this.eggGachaOptionsContainer); - this.eggGachaOptionSelectBg = this.scene.add.nineslice(0, 0, 'window', null, 96, 112, 6, 6, 6, 6); + + this.eggGachaOptionSelectBg = addWindow(this.scene, 0, 0, 96, 112); this.eggGachaOptionSelectBg.setOrigin(1, 1); this.eggGachaOptionsContainer.add(this.eggGachaOptionSelectBg); @@ -167,7 +169,7 @@ export default class EggGachaUiHandler extends MessageUiHandler { new Array(Utils.getEnumKeys(VoucherType).length).fill(null).map((_, i) => { const container = this.scene.add.container((this.scene.game.canvas.width / 6) - 56 * i, 0); - const bg = this.scene.add.nineslice(0, 0, 'window', null, 56, 22, 6, 6, 6, 6); + const bg = addWindow(this.scene, 0, 0, 56, 22); bg.setOrigin(1, 0); container.add(bg); @@ -200,7 +202,7 @@ export default class EggGachaUiHandler extends MessageUiHandler { const gachaMessageBoxContainer = this.scene.add.container(0, 148); this.eggGachaContainer.add(gachaMessageBoxContainer); - const gachaMessageBox = this.scene.add.nineslice(0, 0, 'window', null, 320, 32, 6, 6, 6, 6); + const gachaMessageBox = addWindow(this.scene, 0, 0, 320, 32); gachaMessageBox.setOrigin(0, 0); gachaMessageBoxContainer.add(gachaMessageBox); diff --git a/src/ui/egg-list-ui-handler.ts b/src/ui/egg-list-ui-handler.ts index e62524316..5be0eef90 100644 --- a/src/ui/egg-list-ui-handler.ts +++ b/src/ui/egg-list-ui-handler.ts @@ -5,6 +5,7 @@ import { TextStyle, addTextObject } from "./text"; import MessageUiHandler from "./message-ui-handler"; import { EGG_SEED, Egg, GachaType, getEggGachaTypeDescriptor, getEggHatchWavesMessage, getEggDescriptor } from "../data/egg"; import * as Utils from "../utils"; +import { addWindow } from "./window"; export default class EggListUiHandler extends MessageUiHandler { private eggListContainer: Phaser.GameObjects.Container; @@ -39,6 +40,11 @@ export default class EggListUiHandler extends MessageUiHandler { starterSelectBg.setOrigin(0, 0); this.eggListContainer.add(starterSelectBg); + this.eggListContainer.add(addWindow(this.scene, 1, 85, 106, 22)); + this.eggListContainer.add(addWindow(this.scene, 1, 102, 106, 50, true)); + this.eggListContainer.add(addWindow(this.scene, 1, 147, 106, 32, true)); + this.eggListContainer.add(addWindow(this.scene, 107, 1, 212, 178)); + this.iconAnimHandler = new PokemonIconAnimHandler(); this.iconAnimHandler.setup(this.scene); diff --git a/src/ui/fight-ui-handler.ts b/src/ui/fight-ui-handler.ts index 3ae3360ec..90fc9ca34 100644 --- a/src/ui/fight-ui-handler.ts +++ b/src/ui/fight-ui-handler.ts @@ -42,7 +42,8 @@ export default class FightUiHandler extends UiHandler { this.fieldIndex = args.length ? args[0] as integer : 0; const messageHandler = this.getUi().getMessageHandler(); - messageHandler.bg.setTexture('bg_fight'); + messageHandler.commandWindow.setVisible(false); + messageHandler.movesWindowContainer.setVisible(true); this.setCursor(this.getCursor()); this.displayMoves(); } diff --git a/src/ui/menu-ui-handler.ts b/src/ui/menu-ui-handler.ts index 1dc3aecaf..da488880a 100644 --- a/src/ui/menu-ui-handler.ts +++ b/src/ui/menu-ui-handler.ts @@ -3,6 +3,7 @@ import { TextStyle, addTextObject } from "./text"; import { Mode } from "./ui"; import UiHandler from "./ui-handler"; import * as Utils from "../utils"; +import { addWindow } from "./window"; export enum MenuOptions { SETTINGS, @@ -31,7 +32,7 @@ export default class MenuUiHandler extends UiHandler { this.menuContainer.setInteractive(new Phaser.Geom.Rectangle(0, 0, this.scene.game.canvas.width / 6, this.scene.game.canvas.height / 6), Phaser.Geom.Rectangle.Contains); - this.menuBg = this.scene.add.nineslice((this.scene.game.canvas.width / 6) - 92, 0, 'window', null, 90, (this.scene.game.canvas.height / 6) - 2, 6, 6, 6, 6); + this.menuBg = addWindow(this.scene, (this.scene.game.canvas.width / 6) - 92, 0, 90, (this.scene.game.canvas.height / 6) - 2); this.menuBg.setOrigin(0, 0); this.menuContainer.add(this.menuBg); diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index ebcc2146c..6aebec20a 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -12,6 +12,7 @@ import { getGenderColor, getGenderSymbol } from "../data/gender"; import { StatusEffect } from "../data/status-effect"; import PokemonIconAnimHandler, { PokemonIconAnimMode } from "./pokemon-icon-anim-handler"; import { pokemonEvolutions } from "../data/pokemon-evolutions"; +import { addWindow } from "./window"; const defaultMessage = 'Choose a Pokémon.'; @@ -63,7 +64,7 @@ export default class PartyUiHandler extends MessageUiHandler { private partySlotsContainer: Phaser.GameObjects.Container; private partySlots: PartySlot[]; private partyCancelButton: PartyCancelButton; - private partyMessageBox: Phaser.GameObjects.Image; + private partyMessageBox: Phaser.GameObjects.NineSlice; private optionsMode: boolean; private optionsScroll: boolean; @@ -131,7 +132,7 @@ export default class PartyUiHandler extends MessageUiHandler { const partyMessageBoxContainer = this.scene.add.container(0, -32); partyContainer.add(partyMessageBoxContainer); - const partyMessageBox = this.scene.add.image(1, 31, 'party_message'); + const partyMessageBox = addWindow(this.scene, 1, 31, 262, 30); partyMessageBox.setOrigin(0, 1); partyMessageBoxContainer.add(partyMessageBox); @@ -446,10 +447,10 @@ export default class PartyUiHandler extends MessageUiHandler { text = defaultMessage; if (text?.indexOf('\n') === -1) { - this.partyMessageBox.setTexture('party_message'); + this.partyMessageBox.setSize(262, 30); this.message.setY(10); } else { - this.partyMessageBox.setTexture('party_message_large'); + this.partyMessageBox.setSize(262, 42); this.message.setY(-5); } @@ -462,10 +463,6 @@ export default class PartyUiHandler extends MessageUiHandler { this.optionsMode = true; - const wideOptions = this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER; - - this.partyMessageBox.setTexture(`party_message_options${wideOptions ? '_wide' : ''}`); - let optionsMessage = 'Do what with this Pokémon?'; switch (this.partyUiMode) { @@ -486,6 +483,10 @@ export default class PartyUiHandler extends MessageUiHandler { this.updateOptions(); + const wideOptions = this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER; + + this.partyMessageBox.setSize(262 - (wideOptions ? 88 : 38), 30); + this.setCursor(0); } @@ -579,7 +580,7 @@ export default class PartyUiHandler extends MessageUiHandler { this.options.push(PartyOption.CANCEL); - const optionBg = this.scene.add.nineslice(0, 0, 'window', null, wideOptions ? 144 : 94, 16 * this.options.length + 13, 6, 6, 6, 6); + const optionBg = addWindow(this.scene, 0, 0, wideOptions ? 144 : 94, 16 * this.options.length + 13); optionBg.setOrigin(1, 1); this.optionsContainer.add(optionBg); @@ -701,7 +702,7 @@ export default class PartyUiHandler extends MessageUiHandler { this.optionsContainer.removeAll(true); this.eraseOptionsCursor(); - this.partyMessageBox.setTexture('party_message'); + this.partyMessageBox.setSize(262, 30); this.showText(null, 0); } diff --git a/src/ui/settings-ui-handler.ts b/src/ui/settings-ui-handler.ts index b75736c65..9c0cf8df0 100644 --- a/src/ui/settings-ui-handler.ts +++ b/src/ui/settings-ui-handler.ts @@ -3,6 +3,7 @@ import { Setting, settingDefaults, settingOptions } from "../system/settings"; import { TextStyle, addTextObject, getTextColor } from "./text"; import { Mode } from "./ui"; import UiHandler from "./ui-handler"; +import { addWindow } from "./window"; export default class SettingsUiHandler extends UiHandler { private settingsContainer: Phaser.GameObjects.Container; @@ -27,14 +28,14 @@ export default class SettingsUiHandler extends UiHandler { this.settingsContainer.setInteractive(new Phaser.Geom.Rectangle(0, 0, this.scene.game.canvas.width / 6, this.scene.game.canvas.height / 6), Phaser.Geom.Rectangle.Contains); - const headerBg = this.scene.add.nineslice(0, 0, 'window', null, (this.scene.game.canvas.width / 6) - 2, 24, 6, 6, 6, 6); + const headerBg = addWindow(this.scene, 0, 0, (this.scene.game.canvas.width / 6) - 2, 24); headerBg.setOrigin(0, 0); const headerText = addTextObject(this.scene, 0, 0, 'Options', TextStyle.SETTINGS_LABEL); headerText.setOrigin(0, 0); headerText.setPositionRelative(headerBg, 8, 4); - this.optionsBg = this.scene.add.nineslice(0, headerBg.height, 'window', null, (this.scene.game.canvas.width / 6) - 2, (this.scene.game.canvas.height / 6) - headerBg.height - 2, 6, 6, 6, 6); + this.optionsBg = addWindow(this.scene, 0, headerBg.height, (this.scene.game.canvas.width / 6) - 2, (this.scene.game.canvas.height / 6) - headerBg.height - 2); this.optionsBg.setOrigin(0, 0); this.optionsContainer = this.scene.add.container(0, 0); diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 1a71efc4c..32c2f0537 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -13,6 +13,7 @@ import { DexAttr, DexEntry } from "../system/game-data"; import * as Utils from "../utils"; import PokemonIconAnimHandler, { PokemonIconAnimMode } from "./pokemon-icon-anim-handler"; import { StatsContainer } from "./stats-container"; +import { addWindow } from "./window"; export type StarterSelectCallback = (starters: Starter[]) => void; @@ -96,6 +97,11 @@ export default class StarterSelectUiHandler extends MessageUiHandler { starterSelectBg.setOrigin(0, 0); this.starterSelectContainer.add(starterSelectBg); + this.starterSelectContainer.add(addWindow(this.scene, 107, 1, 34, 92)); + this.starterSelectContainer.add(addWindow(this.scene, 107, 93, 34, 57)); + this.starterSelectContainer.add(addWindow(this.scene, 107, 145, 34, 34, true)); + this.starterSelectContainer.add(addWindow(this.scene, 141, 1, 178, 178)); + this.iconAnimHandler = new PokemonIconAnimHandler(); this.iconAnimHandler.setup(this.scene); diff --git a/src/ui/ui.ts b/src/ui/ui.ts index 110189f5a..dc09be05f 100644 --- a/src/ui/ui.ts +++ b/src/ui/ui.ts @@ -25,6 +25,7 @@ import EggListUiHandler from './egg-list-ui-handler'; import EggGachaUiHandler from './egg-gacha-ui-handler'; import VouchersUiHandler from './vouchers-ui-handler'; import VoucherBar from './voucher-bar'; +import { addWindow } from './window'; export enum Mode { MESSAGE, @@ -134,7 +135,7 @@ export default class UI extends Phaser.GameObjects.Container { this.tooltipContainer = this.scene.add.container(0, 0); this.tooltipContainer.setVisible(false); - this.tooltipBg = this.scene.add.nineslice(0, 0, 'window', null, 128, 31, 6, 6, 6, 6); + this.tooltipBg = addWindow(this.scene, 0, 0, 128, 31); this.tooltipBg.setOrigin(0, 0); this.tooltipTitle = addTextObject(this.scene, 64, 4, '', TextStyle.TOOLTIP_TITLE); diff --git a/src/ui/vouchers-ui-handler.ts b/src/ui/vouchers-ui-handler.ts index a8d0421cc..7a84343c8 100644 --- a/src/ui/vouchers-ui-handler.ts +++ b/src/ui/vouchers-ui-handler.ts @@ -3,6 +3,7 @@ import { Voucher, getVoucherTypeIcon, getVoucherTypeName, vouchers } from "../sy import MessageUiHandler from "./message-ui-handler"; import { TextStyle, addTextObject } from "./text"; import { Mode } from "./ui"; +import { addWindow } from "./window"; export default class VouchersUiHandler extends MessageUiHandler { private vouchersContainer: Phaser.GameObjects.Container; @@ -26,14 +27,14 @@ export default class VouchersUiHandler extends MessageUiHandler { this.vouchersContainer.setInteractive(new Phaser.Geom.Rectangle(0, 0, this.scene.game.canvas.width / 6, this.scene.game.canvas.height / 6), Phaser.Geom.Rectangle.Contains); - const headerBg = this.scene.add.nineslice(0, 0, 'window', null, (this.scene.game.canvas.width / 6) - 2, 24, 6, 6, 6, 6); + const headerBg = addWindow(this.scene, 0, 0, (this.scene.game.canvas.width / 6) - 2, 24); headerBg.setOrigin(0, 0); const headerText = addTextObject(this.scene, 0, 0, 'Vouchers', TextStyle.SETTINGS_LABEL); headerText.setOrigin(0, 0); headerText.setPositionRelative(headerBg, 8, 4); - this.voucherIconsBg = this.scene.add.nineslice(0, headerBg.height, 'window', null, (this.scene.game.canvas.width / 6) - 2, (this.scene.game.canvas.height / 6) - headerBg.height - 68, 6, 6, 6, 6); + this.voucherIconsBg = addWindow(this.scene, 0, headerBg.height, (this.scene.game.canvas.width / 6) - 2, (this.scene.game.canvas.height / 6) - headerBg.height - 68); this.voucherIconsBg.setOrigin(0, 0); this.voucherIconsContainer = this.scene.add.container(6, headerBg.height + 6); @@ -52,21 +53,21 @@ export default class VouchersUiHandler extends MessageUiHandler { this.voucherIconsContainer.add(icon); } - const titleBg = this.scene.add.nineslice(0, headerBg.height + this.voucherIconsBg.height, 'window', null, 220, 24, 6, 6, 6, 6); + const titleBg = addWindow(this.scene, 0, headerBg.height + this.voucherIconsBg.height, 220, 24); titleBg.setOrigin(0, 0); this.titleText = addTextObject(this.scene, 0, 0, '', TextStyle.WINDOW); this.titleText.setOrigin(0, 0); this.titleText.setPositionRelative(titleBg, 8, 4); - const unlockBg = this.scene.add.nineslice(titleBg.x + titleBg.width, titleBg.y, 'window', null, 98, 24, 6, 6, 6, 6); + const unlockBg = addWindow(this.scene, titleBg.x + titleBg.width, titleBg.y, 98, 24); unlockBg.setOrigin(0, 0); this.unlockText = addTextObject(this.scene, 0, 0, '', TextStyle.WINDOW); this.unlockText.setOrigin(0, 0); this.unlockText.setPositionRelative(unlockBg, 8, 4); - const descriptionBg = this.scene.add.nineslice(0, titleBg.y + titleBg.height, 'window', null, (this.scene.game.canvas.width / 6) - 2, 42, 6, 6, 6, 6); + const descriptionBg = addWindow(this.scene, 0, titleBg.y + titleBg.height, (this.scene.game.canvas.width / 6) - 2, 42); descriptionBg.setOrigin(0, 0); const descriptionText = addTextObject(this.scene, 0, 0, '', TextStyle.WINDOW, { maxLines: 2 }); diff --git a/src/ui/window.ts b/src/ui/window.ts new file mode 100644 index 000000000..55ecfdd6c --- /dev/null +++ b/src/ui/window.ts @@ -0,0 +1,43 @@ +import BattleScene from "../battle-scene"; + +export function addWindow(scene: BattleScene, x: number, y: number, width: number, height: number, mergeMaskTop?: boolean, mergeMaskLeft?: boolean, maskOffsetX?: number, maskOffsetY?: number): Phaser.GameObjects.NineSlice { + const window = scene.add.nineslice(x, y, `window_${scene.windowType}`, null, width, height, 8, 8, 8, 8); + window.setOrigin(0, 0); + + if (mergeMaskTop || mergeMaskLeft) { + const maskRect = scene.make.graphics({}); + maskRect.setScale(6); + maskRect.fillStyle(0xFFFFFF); + maskRect.beginPath(); + maskRect.fillRect(window.x + (mergeMaskLeft ? 2 : 0) + (maskOffsetX || 0), window.y + (mergeMaskTop ? 2 : 0) + (maskOffsetY || 0), window.width - (mergeMaskLeft ? 2 : 0), window.height - (mergeMaskTop ? 2 : 0)); + window.setMask(maskRect.createGeometryMask()); + } + + return window; +} + +export function updateWindowType(scene: BattleScene, windowTypeIndex: integer): void { + const windowObjects: Phaser.GameObjects.NineSlice[] = []; + const traverse = (object: any) => { + if (object.hasOwnProperty('children')) { + const children = object.children as Phaser.GameObjects.DisplayList; + for (let child of children.getAll()) + traverse(child); + } else if (object instanceof Phaser.GameObjects.Container) { + for (let child of object.getAll()) + traverse(child); + } else if (object instanceof Phaser.GameObjects.NineSlice) { + if (object.texture.key.startsWith('window_')) + windowObjects.push(object); + } + } + + traverse(scene); + + scene.windowType = windowTypeIndex; + + const windowKey = `window_${windowTypeIndex}`; + + for (let window of windowObjects) + window.setTexture(windowKey); +} \ No newline at end of file