@@ -9,9 +9,7 @@ class PauseMenu {
99 activated : ( ) => {
1010 $ . DispatchEvent ( 'MainMenuResumeGame' ) ;
1111 } ,
12- hovered : ( ) => {
13- if ( this . continueBox . IsValid ( ) ) this . continueBox . visible = false ;
14- } ,
12+ hovered : ( ) => { } ,
1513 unhovered : ( ) => { } ,
1614 focusIsHover : true
1715 } ,
@@ -22,53 +20,18 @@ class PauseMenu {
2220 activated : ( ) => {
2321 $ . DispatchEvent ( 'MainMenuOpenNestedPage' , 'SinglePlayer' , 'campaigns/content-selector-main' , undefined ) ;
2422 } ,
25- hovered : ( ) => {
26- if ( this . continueBox . IsValid ( ) ) this . continueBox . visible = false ;
27- } ,
23+ hovered : ( ) => { } ,
2824 unhovered : ( ) => { } ,
2925 focusIsHover : true
3026 } ,
31- {
32- id : 'CampaignContinueBtn' ,
33- headline : '#MainMenu_SaveRestore_LoadAuto' ,
34- tagline : '#MainMenu_SaveRestore_LoadAuto_Tagline' ,
35- activated : ( ) => {
36- if ( ! this . latestSave ) return ;
37-
38- UiToolkitAPI . ShowGenericPopupTwoOptionsBgStyle (
39- $ . Localize ( '#Action_LoadGame_Confirm' ) ,
40- $ . Localize ( '#Action_LoadGame_Auto_Message' ) ,
41- 'warning-popup' ,
42- $ . Localize ( '#Action_LoadGame' ) ,
43- ( ) => {
44- $ . DispatchEvent ( 'MainMenuCloseAllPages' ) ;
45- $ . DispatchEvent ( 'LoadingScreenClearLastMap' ) ;
46- $ . Schedule ( 0.001 , ( ) => GameInterfaceAPI . ConsoleCommand ( `load "${ this . latestSave . fileName } "` ) ) ;
47- } ,
48- $ . Localize ( '#UI_Cancel' ) ,
49- ( ) => { } ,
50- 'blur'
51- ) ;
52- } ,
53- hovered : ( ) => {
54- if ( this . continueBtnEnabled && this . continueBox . IsValid ( ) ) this . continueBox . visible = true ;
55- } ,
56- unhovered : ( ) => {
57- if ( this . continueBox . IsValid ( ) ) this . continueBox . visible = false ;
58- } ,
59- additionalClasses : 'mainmenu__nav__btn__no-gradient' ,
60- focusIsHover : true
61- } ,
6227 {
6328 id : 'LoadGameBtn' ,
6429 headline : '#MainMenu_SaveRestore_Main' ,
6530 tagline : '#MainMenu_SaveRestore_Main_Tagline' ,
6631 activated : ( ) => {
6732 $ . DispatchEvent ( 'MainMenuOpenNestedPage' , 'GameSaves' , 'campaigns/saves-list' , undefined ) ;
6833 } ,
69- hovered : ( ) => {
70- if ( this . continueBox . IsValid ( ) ) this . continueBox . visible = false ;
71- } ,
34+ hovered : ( ) => { } ,
7235 focusIsHover : true
7336 } ,
7437 {
@@ -78,9 +41,7 @@ class PauseMenu {
7841 activated : ( ) => {
7942 $ . DispatchEvent ( 'MainMenuOpenNestedPage' , 'Content' , 'main-menu/addons' , undefined ) ;
8043 } ,
81- hovered : ( ) => {
82- if ( this . continueBox . IsValid ( ) ) this . continueBox . visible = false ;
83- }
44+ hovered : ( ) => { }
8445 } ,
8546 {
8647 id : 'SettingsKeyboardBtn' ,
@@ -89,9 +50,7 @@ class PauseMenu {
8950 activated : ( ) => {
9051 $ . DispatchEvent ( 'MainMenuOpenNestedPage' , 'Settings' , 'settings/settings' , undefined ) ;
9152 } ,
92- hovered : ( ) => {
93- if ( this . continueBox . IsValid ( ) ) this . continueBox . visible = false ;
94- } ,
53+ hovered : ( ) => { } ,
9554 focusIsHover : true
9655 } ,
9756 {
@@ -117,21 +76,11 @@ class PauseMenu {
11776 'blur'
11877 ) ;
11978 } ,
120- hovered : ( ) => {
121- if ( this . continueBox . IsValid ( ) ) this . continueBox . visible = false ;
122- } ,
79+ hovered : ( ) => { } ,
12380 focusIsHover : true
12481 }
12582 ] ;
12683
127- // i copied and pasted this code, sue me
128- // maybe fix it up later...
129- static continueBox = $ < Panel > ( '#ContinueBox' ) ! ;
130- static continueBoxText = $ < Label > ( '#ContinueSaveTagline' ) ! ;
131- static continueImg = $ < Image > ( '#ContinueSaveThumb' ) ! ;
132- static continueBtnEnabled : boolean = false ;
133- static continueBtn : string = 'CampaignContinueBtn' ;
134-
13584 // map panel
13685 static mapPane = $ < Panel > ( '#MapPanel' ) ! ;
13786 static mapImage = $ < Image > ( '#MapImage' ) ! ;
@@ -183,28 +132,12 @@ class PauseMenu {
183132 }
184133 } ) ;
185134
186- this . setContinueDetails ( ) ;
187-
188135 this . setMapPanel ( ) ;
136+ this . setLogo ( ) ;
189137 }
190138
191- static setContinueDetails ( ) {
192- if ( ! CampaignAPI . IsCampaignActive ( ) ) {
193- this . continueBox . visible = false ;
194- this . continueBtnEnabled = false ;
195- const continueBtnText = $ . Localize ( '#MainMenu_SaveRestore_NoSaves' ) ;
196-
197- $ . DispatchEvent ( 'MainMenuSetButtonProps' , this . continueBtn , {
198- taglineText : continueBtnText ,
199- enabled : this . continueBtnEnabled
200- } ) ;
201-
202- $ . DispatchEvent ( 'MainMenuSetLogo' , 'file://{images}/logo.svg' ) ;
203- $ . DispatchEvent ( 'MainMenuSetLogoSize' , CampaignLogoSizePreset . STANDARD ) ;
204- return ;
205- }
206-
207- let c = CampaignAPI . GetActiveCampaign ( ) ! ;
139+ static setLogo ( ) {
140+ const c = CampaignAPI . GetActiveCampaign ( ) ;
208141 if ( c ) {
209142 const meta = CampaignAPI . GetCampaignMeta ( null ) ! ;
210143 const logo = meta . get ( CampaignMeta . FULL_LOGO ) ;
@@ -218,72 +151,9 @@ class PauseMenu {
218151 $ . DispatchEvent ( 'MainMenuSetLogoSize' , CampaignLogoSizePreset . STANDARD ) ;
219152 }
220153 } else {
221- $ . DispatchEvent ( 'MainMenuSetLogo' , '' ) ;
154+ $ . DispatchEvent ( 'MainMenuSetLogo' , 'file://{images}/logo.svg ' ) ;
222155 $ . DispatchEvent ( 'MainMenuSetLogoSize' , CampaignLogoSizePreset . STANDARD ) ;
223156 }
224-
225- this . continueBox . visible = false ;
226-
227- const isWsSingle = isSingleWsCampaign ( c ) ;
228-
229- const group = isWsSingle ? SpecialString . AUTO_WS : `${ c . bucket . id } /${ c . campaign . id } ` ;
230-
231- const saves = GameSavesAPI . GetGameSaves ( )
232- . filter ( ( a ) => {
233- return isWsSingle ? a . mapGroup . startsWith ( group ) : a . mapGroup === group ;
234- } )
235- . sort ( ( a , b ) => Number ( b . fileTime ) - Number ( a . fileTime ) ) ;
236-
237- this . continueBtnEnabled = false ;
238- let continueBtnText = $ . Localize ( '#MainMenu_SaveRestore_NoSaves' ) ;
239-
240- $ . DispatchEvent ( 'MainMenuSetButtonProps' , this . continueBtn , {
241- taglineText : continueBtnText ,
242- enabled : this . continueBtnEnabled
243- } ) ;
244-
245- if ( saves . length === 0 ) {
246- $ . Warning ( 'PAUSE MENU: No saves' ) ;
247- return ;
248- }
249-
250- // set the continue button states
251-
252- this . latestSave = saves [ 0 ] ;
253-
254- if ( isWsSingle ) {
255- const realCampaign = CampaignAPI . FindCampaign ( this . latestSave . mapGroup ) ;
256- if ( realCampaign ) {
257- c = realCampaign ;
258- } else {
259- $ . Warning ( `Associated campaign ID ${ this . latestSave . mapGroup } could not be found` ) ;
260- }
261- }
262-
263- const savChapter : ChapterInfo | undefined =
264- this . latestSave . chapter < c . campaign . chapters . length
265- ? c . campaign . chapters [ this . latestSave . chapter ]
266- : undefined ;
267-
268- if ( ! savChapter ) {
269- $ . Warning ( 'PAUSE MENU: Map could not be found for Campaign' ) ;
270- return ;
271- }
272-
273- const thumb = `file://{__saves}/${ this . latestSave . fileName . replace ( '.sav' , '.tga' ) } ` ;
274- this . continueImg . SetImage ( thumb ) ;
275-
276- const date = new Date ( Number ( this . latestSave . fileTime ) ) ;
277- this . continueBoxText . text = convertTime ( date ) ;
278- const chapterName = isWsSingle ? c . campaign . title : $ . Localize ( savChapter . title ) ;
279- continueBtnText = chapterName . replace ( '\n' , ': ' ) ;
280-
281- this . continueBtnEnabled = true ;
282-
283- $ . DispatchEvent ( 'MainMenuSetButtonProps' , this . continueBtn , {
284- taglineText : continueBtnText ,
285- enabled : this . continueBtnEnabled
286- } ) ;
287157 }
288158
289159 static setMapPanel ( ) {
0 commit comments