Skip to content

Commit b6ef7c6

Browse files
committed
chore: remove load last save from pause menu
1 parent 63033a1 commit b6ef7c6

4 files changed

Lines changed: 16 additions & 169 deletions

File tree

layout/pages/main-menu/pause-menu.xml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,6 @@
2727
</snippets>
2828

2929
<Panel class="full" hittest="false" onload="PauseMenu.onLoad()">
30-
<Panel id="ContinueBox" class="mainmenu__display-box" hittest="false" hittestchildren="false">
31-
<Panel>
32-
<Image
33-
id="ContinueSaveThumb"
34-
class="mainmenu__display-box__img"
35-
src="file://{images}/menu/fallback/programmer_art_logo.png"
36-
textureheight="1920"
37-
texturewidth="1080"
38-
scaling="stretch-to-cover-preserve-aspect"
39-
/>
40-
</Panel>
41-
<Panel class="mainmenu__display-box__details">
42-
<Panel class="vertical-align-center flow-down ml-3">
43-
<Label id="ContinueSaveTagline" class="mainmenu__display-box__tagline" text="[PH] Tagline" />
44-
</Panel>
45-
</Panel>
46-
</Panel>
47-
4830
<Panel id="MapPanel" hittest="false" class="full">
4931
<Panel class="mainmenu__addon" hittest="false">
5032
<Panel class="full mainmenu__addon__bg" />

scripts/common/dev.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -219,22 +219,17 @@ class VirtualCampaign implements CampaignInfo {
219219

220220
function SetSourceIndicatorFromData(indicator: GenericPanel, campaignPair: CampaignPair) {
221221
indicator.visible = GameInterfaceAPI.GetSettingInt('developer') > 0;
222-
if (!indicator.visible)
223-
return;
222+
if (!indicator.visible) return;
224223

225224
const tp = indicator.FindChild<TooltipPanel>('TooltipPanel');
226225
const img = indicator.FindChildTraverse<Image>('ImagePanel');
227226

228227
const meta = WorkshopAPI.GetAddonMeta(campaignPair.bucket.addon_id);
229228
if (meta.workshopid !== BigInt(0)) {
230-
if (tp)
231-
tp.AddClass('fancy-blue');
232-
if (img)
233-
img.SetImage('file://{images}/icons/steam.svg');
229+
if (tp) tp.AddClass('fancy-blue');
230+
if (img) img.SetImage('file://{images}/icons/steam.svg');
234231
} else {
235-
if (tp)
236-
tp.AddClass('fancy-purple');
237-
if (img)
238-
img.SetImage('file://{images}/social/home.svg');
232+
if (tp) tp.AddClass('fancy-purple');
233+
if (img) img.SetImage('file://{images}/social/home.svg');
239234
}
240235
}

scripts/hud/cc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class CloseCaptioning {
230230
});
231231
$.RegisterForUnhandledEvent('MapLoaded', () => {
232232
this.wipeCaptions();
233-
ClosedCaptionsAPI.SetCaptioningExpiryMethod( CloseCaptioningExpiryMethod.STACK );
233+
ClosedCaptionsAPI.SetCaptioningExpiryMethod(CloseCaptioningExpiryMethod.STACK);
234234
});
235235

236236
this.updateStyle();

scripts/pages/main-menu/pause-menu.ts

Lines changed: 10 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)