3 using Microsoft.Xna.Framework;
5 using System.Collections.Generic;
6 using System.Globalization;
29 private int currentPage = 0;
37 pageContainer.
BarScroll = MathHelper.Lerp(pageContainer.
BarScroll, targetScroll, 0.2f);
38 if (MathUtils.NearlyEqual(pageContainer.
BarScroll, targetScroll, 0.001f))
54 currentPage = pageIndex;
59 child.GetAllChildren().ForEach(c =>
65 c.CanBeFocused = (i == currentPage);
69 previewListBox?.GetAllChildren()?.ForEach(c =>
71 c.CanBeFocused =
false;
75 private void CreateNewGameMenu()
80 ScrollBarEnabled =
false,
81 ScrollBarVisible =
false,
82 AllowArrowKeyScroll =
false,
86 GUILayoutGroup createPageLayout()
90 return new GUILayoutGroup(
new RectTransform(Vector2.One * 0.95f, containerItem.RectTransform,
94 CreateFirstPage(createPageLayout());
95 CreateSecondPage(createPageLayout());
100 c.ClampMouseRectToParent =
true;
104 dd.ListBox.ClampMouseRectToParent =
false;
105 dd.ListBox.Content.ClampMouseRectToParent =
false;
110 private void CreateFirstPage(GUILayoutGroup firstPageLayout)
112 firstPageLayout.RelativeSpacing = 0.02f;
114 var columnContainer =
new GUILayoutGroup(
new RectTransform(
new Vector2(1.0f, 0.9f), firstPageLayout.RectTransform), isHorizontal:
true)
117 RelativeSpacing = 0.02f
120 var leftColumn =
new GUILayoutGroup(
new RectTransform(Vector2.One, columnContainer.RectTransform))
123 RelativeSpacing = 0.015f
126 var rightColumn =
new GUILayoutGroup(
new RectTransform(
new Vector2(1.5f, 1.0f), columnContainer.RectTransform))
129 RelativeSpacing = 0.015f
132 columnContainer.Recalculate();
135 new GUITextBlock(
new RectTransform(
new Vector2(1.0f, 0.02f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, TextManager.Get(
"SaveName"), font: GUIStyle.SubHeadingFont);
136 saveNameBox =
new GUITextBox(
new RectTransform(
new Vector2(1.0f, 0.05f), leftColumn.RectTransform) { MinSize = new Point(0, 20) },
string.Empty)
138 textFilterFunction = (
string str) => {
return ToolBox.RemoveInvalidFileNameChars(str); }
141 new GUITextBlock(
new RectTransform(
new Vector2(1.0f, 0.02f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, TextManager.Get(
"MapSeed"), font: GUIStyle.SubHeadingFont);
142 seedBox =
new GUITextBox(
new RectTransform(
new Vector2(1.0f, 0.05f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, ToolBox.RandomSeed(8));
144 new GUITextBlock(
new RectTransform(
new Vector2(1.0f, 0.02f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, TextManager.Get(
"SelectedSub"), font: GUIStyle.SubHeadingFont);
146 var moddedDropdown =
new GUIDropDown(
new RectTransform(
new Vector2(1f, 0.02f), leftColumn.RectTransform),
"", 3);
147 moddedDropdown.AddItem(TextManager.Get(
"clientpermission.all"),
CategoryFilter.All);
148 moddedDropdown.AddItem(TextManager.Get(
"servertag.modded.false"),
CategoryFilter.Vanilla);
149 moddedDropdown.AddItem(TextManager.Get(
"customrank"),
CategoryFilter.Custom);
150 moddedDropdown.Select(0);
152 var filterContainer =
new GUILayoutGroup(
new RectTransform(
new Vector2(1.0f, 0.05f), leftColumn.RectTransform), isHorizontal:
true)
157 subList =
new GUIListBox(
new RectTransform(
new Vector2(1.0f, 0.65f), leftColumn.RectTransform))
159 PlaySoundOnSelect =
true,
160 ScrollBarVisible =
true
163 var searchTitle =
new GUITextBlock(
new RectTransform(
new Vector2(0.001f, 1.0f), filterContainer.RectTransform), TextManager.Get(
"serverlog.filter"), textAlignment: Alignment.CenterLeft, font: GUIStyle.Font);
164 var searchBox =
new GUITextBox(
new RectTransform(
new Vector2(1.0f, 1.0f), filterContainer.RectTransform,
Anchor.CenterRight), font: GUIStyle.Font, createClearButton:
true);
165 filterContainer.RectTransform.MinSize = searchBox.RectTransform.MinSize;
166 searchBox.OnSelected += (sender, userdata) => { searchTitle.Visible =
false; };
167 searchBox.OnDeselected += (sender, userdata) => { searchTitle.Visible =
true; };
168 searchBox.OnTextChanged += (textBox, text) => { FilterSubs(subList, text);
return true; };
170 moddedDropdown.OnSelected = (component, data) =>
172 searchBox.Text =
string.Empty;
178 subList.OnSelected = OnSubSelected;
181 subPreviewContainer =
new GUILayoutGroup(
new RectTransform(
new Vector2(1.0f, 1.0f), rightColumn.RectTransform))
186 var firstPageButtonContainer =
new GUILayoutGroup(
new RectTransform(
new Vector2(1f, 0.08f),
187 firstPageLayout.RectTransform), childAnchor:
Anchor.BottomLeft, isHorizontal:
true)
189 RelativeSpacing = 0.025f
192 InitialMoneyText =
new GUITextBlock(
new RectTransform(
new Vector2(0.3f, 1f), firstPageButtonContainer.RectTransform),
"", font: GUIStyle.Font, textColor: GUIStyle.Green, textAlignment: Alignment.CenterLeft)
196 int initialMoney = CampaignSettings.CurrentSettings.InitialMoney;
197 if (subList.SelectedData is SubmarineInfo subInfo)
199 initialMoney -= subInfo.Price;
201 initialMoney = Math.Max(initialMoney, 0);
202 return TextManager.GetWithVariable(
"campaignstartingmoney",
"[money]",
string.Format(CultureInfo.InvariantCulture,
"{0:N0}", initialMoney));
206 CampaignCustomizeButton =
new GUIButton(
new RectTransform(
new Vector2(0.25f, 1f), firstPageButtonContainer.RectTransform,
Anchor.CenterLeft), TextManager.Get(
"SettingsButton"))
208 OnClicked = (tb, userdata) =>
210 CreateCustomizeWindow(CampaignSettings.CurrentSettings, settings =>
212 CampaignSettings prevSettings = CampaignSettings.CurrentSettings;
213 CampaignSettings.CurrentSettings = settings;
214 if (prevSettings.InitialMoney != settings.InitialMoney)
216 object selectedData = subList.SelectedData;
217 UpdateSubList(SubmarineInfo.SavedSubmarines);
218 if (selectedData is SubmarineInfo selectedSub && selectedSub.Price <= CampaignSettings.CurrentSettings.InitialMoney)
220 subList.Select(selectedData);
228 nextButton =
new GUIButton(
new RectTransform(
new Vector2(0.4f, 1f), firstPageButtonContainer.RectTransform,
Anchor.BottomRight), TextManager.Get(
"Next"))
230 OnClicked = (GUIButton btn,
object userData) =>
237 columnContainer.Recalculate();
238 leftColumn.Recalculate();
239 rightColumn.Recalculate();
242 private void CreateSecondPage(GUILayoutGroup secondPageLayout)
244 secondPageLayout.RelativeSpacing = 0.01f;
246 new GUITextBlock(
new RectTransform(
new Vector2(1.0f, 0.04f), secondPageLayout.RectTransform),
247 TextManager.Get(
"Crew"), font: GUIStyle.SubHeadingFont, textAlignment: Alignment.TopLeft);
249 characterInfoColumns =
new GUIListBox(
new RectTransform(
new Vector2(1.0f, 0.86f), secondPageLayout.RectTransform), isHorizontal:
true);
251 var secondPageButtonContainer =
new GUILayoutGroup(
new RectTransform(
new Vector2(1f, 0.08f),
252 secondPageLayout.RectTransform), childAnchor:
Anchor.BottomLeft, isHorizontal:
true)
254 RelativeSpacing = 0.2f
257 var backButton =
new GUIButton(
new RectTransform(
new Vector2(0.4f, 1f), secondPageButtonContainer.RectTransform,
Anchor.BottomRight), TextManager.Get(
"Back"))
259 OnClicked = (GUIButton btn,
object userData) =>
266 StartButton =
new GUIButton(
new RectTransform(
new Vector2(0.4f, 1f), secondPageButtonContainer.RectTransform,
Anchor.BottomRight), TextManager.Get(
"StartCampaignButton"))
268 OnClicked = FinishSetup
274 var characterInfos =
new List<(CharacterInfo Info, JobPrefab Job)>();
279 var variant = Rand.Range(0, jobPrefab.
Variants);
283 if (characterInfos.Count == 0)
285 DebugConsole.ThrowError($
"No starting crew found! If you're using mods, it may be that the mods have overridden the vanilla jobs without specifying which types of characters the starting crew should consist of. If you're the developer of the mod, ensure that you've set the {nameof(JobPrefab.InitialCount)} properties for the custom jobs.");
286 DebugConsole.AddWarning(
"Choosing the first available jobs as the starting crew...");
289 var variant = Rand.Range(0, jobPrefab.
Variants);
291 if (characterInfos.Count >= 3) {
break; }
294 characterInfos.Sort((a, b) => Math.Sign(b.Job.MinKarma - a.Job.MinKarma));
297 CharacterMenus?.ForEach(m => m.Dispose());
300 for (
int i = 0; i < characterInfos.Count; i++)
305 var (characterInfo, job) = characterInfos[i];
307 characterInfo.CreateIcon(
new RectTransform(
new Vector2(1.0f, 0.275f), subLayout.RectTransform));
309 var jobTextContainer =
315 Text = characterInfo.Name,
320 if (
string.IsNullOrWhiteSpace(sender.Text))
322 characterInfo.Name = characterInfo.GetRandomName(Rand.RandSync.Unsynced);
323 sender.Text = characterInfo.Name;
324 sender.UserData =
"random";
328 characterInfo.Name = sender.Text;
329 sender.UserData =
"user";
332 characterName.OnEnterPressed += (sender, text) =>
338 var customizationFrame =
343 OnHeadSwitch = menu =>
345 if (characterName.UserData is
string ud && ud ==
"random")
347 characterInfo.Name = characterInfo.GetRandomName(Rand.RandSync.Unsynced);
348 characterName.Text = characterInfo.Name;
349 characterName.UserData =
"random";
352 StealRandomizeButton(menu, jobTextContainer);
355 StealRandomizeButton(CharacterMenus[i], jobTextContainer);
359 private void CreateCustomizeWindow(CampaignSettings prevSettings, Action<CampaignSettings> onClosed =
null)
361 CampaignCustomizeSettings =
new GUIMessageBox(
"",
"",
new[] { TextManager.Get(
"OK") },
new Vector2(0.25f, 0.5f), minSize:
new Point(450, 350));
363 GUILayoutGroup campaignSettingContent =
new GUILayoutGroup(
new RectTransform(
new Vector2(0.95f, 0.8f), CampaignCustomizeSettings.Content.RectTransform,
Anchor.TopCenter));
366 CampaignSettingElements elements = CreateCampaignSettingList(campaignSettingContent, prevSettings,
true);
367 CampaignCustomizeSettings.Buttons[0].OnClicked += (button, o) =>
370 onClosed?.Invoke(elements.CreateSettings());
371 GameSettings.SaveCurrentConfig();
372 return CampaignCustomizeSettings.Close(button, o);
376 private static void StealRandomizeButton(CharacterInfo.AppearanceCustomizationMenu menu, GUIComponent parent)
379 var randomizeButton = menu.RandomizeButton;
380 var oldButton = parent.GetChild<GUIButton>();
381 parent.RemoveChild(oldButton);
382 randomizeButton.RectTransform.Parent = parent.RectTransform;
383 randomizeButton.RectTransform.RelativeSize = Vector2.One * 1.3f;
386 private bool FinishSetup(GUIButton btn,
object userdata)
388 if (
string.IsNullOrWhiteSpace(saveNameBox.Text))
390 saveNameBox.Flash(GUIStyle.Red);
394 SubmarineInfo selectedSub =
null;
396 if (subList.SelectedData is not SubmarineInfo) {
return false; }
397 selectedSub = subList.SelectedData as SubmarineInfo;
401 new GUIMessageBox(TextManager.Get(
"error"), TextManager.Get(
"undefinedsubmarineselected"));
405 if (
string.IsNullOrEmpty(selectedSub.MD5Hash.StringRepresentation))
407 ((GUITextBlock)subList.SelectedComponent).TextColor = Color.DarkRed * 0.8f;
408 subList.SelectedComponent.CanBeFocused =
false;
413 string savePath = SaveUtil.CreateSavePath(SaveUtil.SaveType.Singleplayer, saveNameBox.Text);
414 bool hasRequiredContentPackages = selectedSub.RequiredContentPackagesInstalled;
416 CampaignSettings settings = CampaignSettings.CurrentSettings;
418 if (selectedSub.HasTag(
SubmarineTag.Shuttle) || !hasRequiredContentPackages)
420 if (!hasRequiredContentPackages)
422 var msgBox =
new GUIMessageBox(TextManager.Get(
"ContentPackageMismatch"),
423 TextManager.GetWithVariable(
"ContentPackageMismatchWarning",
"[requiredcontentpackages]",
string.Join(
", ", selectedSub.RequiredContentPackages)),
424 new LocalizedString[] { TextManager.Get(
"Yes"), TextManager.Get(
"No") });
426 msgBox.Buttons[0].OnClicked = msgBox.Close;
427 msgBox.Buttons[0].OnClicked += (button, obj) =>
429 if (GUIMessageBox.MessageBoxes.Count == 0)
431 StartNewGame?.Invoke(selectedSub, savePath, seedBox.Text, settings);
436 msgBox.Buttons[1].OnClicked = msgBox.Close;
441 var msgBox =
new GUIMessageBox(TextManager.Get(
"ShuttleSelected"),
442 TextManager.Get(
"ShuttleWarning"),
443 new LocalizedString[] { TextManager.Get(
"Yes"), TextManager.Get(
"No") });
445 msgBox.Buttons[0].OnClicked = (button, obj) =>
447 StartNewGame?.Invoke(selectedSub, savePath, seedBox.Text, settings);
450 msgBox.Buttons[0].OnClicked += msgBox.Close;
452 msgBox.Buttons[1].OnClicked = msgBox.Close;
458 StartNewGame?.Invoke(selectedSub, savePath, seedBox.Text, settings);
466 seedBox.Text = ToolBox.RandomSeed(8);
469 private void FilterSubs(
GUIListBox subList,
string filter)
474 child.
Visible =
string.IsNullOrEmpty(filter) || sub.DisplayName.Contains(filter.ToLower(), StringComparison.OrdinalIgnoreCase);
478 private bool OnSubSelected(GUIComponent component,
object obj)
480 if (subPreviewContainer ==
null) {
return false; }
481 (subPreviewContainer.
Parent as GUILayoutGroup)?.Recalculate();
484 if (obj is not SubmarineInfo sub) {
return true; }
486 if (sub.Price > CampaignSettings.CurrentSettings.InitialMoney && !GameMain.DebugDraw)
494 sub.CreatePreviewWindow(subPreviewContainer);
500 string savePath = SaveUtil.CreateSavePath(SaveUtil.SaveType.Singleplayer);
501 saveNameBox.Text = Path.GetFileNameWithoutExtension(savePath);
506 List<SubmarineInfo> subsToShow;
509 subsToShow = submarines.Where(s => s.IsCampaignCompatibleIgnoreClass && s.IsVanillaSubmarine() == (subFilter ==
CategoryFilter.Vanilla)).ToList();
513 string downloadFolder = Path.GetFullPath(SaveUtil.SubmarineDownloadFolder);
514 subsToShow = submarines.Where(s => s.IsCampaignCompatibleIgnoreClass && Path.GetDirectoryName(Path.GetFullPath(s.FilePath)) != downloadFolder).ToList();
517 subsToShow.Sort((s1, s2) =>
520 if (!s1.IsCampaignCompatible) { p1 += 100000; }
522 if (!s2.IsCampaignCompatible) { p2 += 100000; }
523 return p1.CompareTo(p2) * 100 + s1.Name.CompareTo(s2.Name);
532 ToolBox.LimitString(sub.
DisplayName.
Value, GUIStyle.Font, subList.
Rect.Width - 65), style:
"ListBoxElement")
540 textBlock.TextColor = Color.Lerp(textBlock.TextColor, Color.DarkRed, .5f);
541 textBlock.ToolTip = TextManager.Get(
"ContentPackageMismatch") +
"\n\n" + textBlock.ToolTip.SanitizedString;
546 TextManager.GetWithVariable(
"currencyformat",
"[credits]",
string.Format(CultureInfo.InvariantCulture,
"{0:N0}", sub.
Price)), textAlignment: Alignment.BottomRight, font: GUIStyle.SmallFont)
548 TextColor = sub.
Price > CampaignSettings.CurrentSettings.InitialMoney ? GUIStyle.Red : textBlock.TextColor * 0.8f,
549 ToolTip = textBlock.ToolTip
552 TextManager.Get($
"submarineclass.{sub.SubmarineClass}"), textAlignment: Alignment.TopRight, font: GUIStyle.SmallFont)
555 ToolTip = textBlock.ToolTip
562 textBlock.CanBeFocused =
false;
563 textBlock.TextColor *= 0.5f;
570 var validSubs = subsToShow.Where(s => s.IsCampaignCompatible && s.Price <= CampaignSettings.CurrentSettings.InitialMoney).ToList();
571 if (validSubs.Count > 0)
573 subList.
Select(validSubs[Rand.Int(validSubs.Count)]);
578 public override void CreateLoadMenu(IEnumerable<CampaignMode.SaveInfo> saveFiles =
null)
580 prevSaveFiles?.Clear();
581 prevSaveFiles =
null;
582 loadGameContainer.ClearChildren();
584 if (saveFiles ==
null)
588 saveFiles = SaveUtil.GetSaveFiles(SaveUtil.SaveType.Singleplayer, logLoadErrors:
false);
594 RelativeSpacing = 0.03f
599 PlaySoundOnSelect =
true,
600 OnSelected = SelectSaveFile
603 new GUIButton(
new RectTransform(
new Vector2(0.6f, 0.08f), leftColumn.RectTransform), TextManager.Get(
"showinfolder"))
605 OnClicked = (btn, userdata) =>
607 var saveFolder = SaveUtil.GetSaveFolder(SaveUtil.SaveType.Singleplayer);
610 ToolBox.OpenFileWithShell(saveFolder);
615 TextManager.Get(
"error"),
616 TextManager.GetWithVariables(
"showinfoldererror", (
"[folder]", saveFolder), (
"[errormessage]", e.Message)));
622 foreach (var saveInfo
in saveFiles)
624 var saveFrame = CreateSaveElement(saveInfo);
625 if (saveFrame ==
null) {
continue; }
627 XElement docRoot = SaveUtil.ExtractGameSessionRootElementFromSaveFile(saveInfo.FilePath);
631 DebugConsole.ThrowError(
"Error loading save file \"" + saveInfo.FilePath +
"\". The file may be corrupted.");
632 saveFrame.GetChild<
GUITextBlock>().TextColor = GUIStyle.Red;
635 if (docRoot.GetChildElement(
"multiplayercampaign") !=
null)
641 if (!SaveUtil.IsSaveFileCompatible(docRoot))
643 saveFrame.GetChild<
GUITextBlock>().TextColor = GUIStyle.Red;
644 saveFrame.
ToolTip = TextManager.Get(
"campaignmode.incompatiblesave");
650 loadGameButton =
new GUIButton(
new RectTransform(
new Vector2(0.45f, 0.12f), loadGameContainer.RectTransform,
Anchor.BottomRight), TextManager.Get(
"LoadButton"))
652 OnClicked = (btn, obj) =>
654 if (saveList.SelectedData is not
CampaignMode.SaveInfo saveInfo) {
return false; }
655 if (
string.IsNullOrWhiteSpace(saveInfo.FilePath)) {
return false; }
656 LoadGame?.Invoke(saveInfo.FilePath, backupIndex: Option.None);
663 private bool SelectSaveFile(
GUIComponent component,
object obj)
665 if (obj is not
CampaignMode.SaveInfo saveInfo) {
return true; }
667 string fileName = saveInfo.FilePath;
669 XElement docRoot = SaveUtil.ExtractGameSessionRootElementFromSaveFile(fileName);
672 DebugConsole.ThrowError(
"Error loading save file \"" + fileName +
"\". The file may be corrupted.");
676 loadGameButton.
Enabled = SaveUtil.IsSaveFileCompatible(docRoot);
680 string subName = saveInfo.SubmarineName;
681 LocalizedString saveTime = saveInfo.SaveTime
682 .Select(t => (LocalizedString)t.ToLocalUserString())
683 .Fallback(TextManager.Get(
"Unknown"));
685 string mapseed = docRoot.GetAttributeString(
"mapseed",
"unknown");
687 Identifier locationNameIdentifier = docRoot.GetAttributeIdentifier(
"currentlocation", Identifier.Empty);
688 int locationNameFormatIndex = docRoot.GetAttributeInt(
"currentlocationnameformatindex", -1);
689 Identifier locationType = docRoot.GetAttributeIdentifier(
"locationtype", Identifier.Empty);
690 LevelData.LevelType levelType = docRoot.GetAttributeEnum(
"nextleveltype", LevelData.LevelType.LocationConnection);
692 LocalizedString locationName = locationType.IsEmpty || locationNameIdentifier.IsEmpty ?
693 LocalizedString.EmptyString :
694 Location.GetName(locationType, locationNameFormatIndex, locationNameIdentifier);
696 var saveFileFrame =
new GUIFrame(
697 new RectTransform(
new Vector2(0.45f, 0.6f), loadGameContainer.RectTransform,
Anchor.TopRight)
699 RelativeOffset = new Vector2(0.0f, 0.1f)
700 }, style:
"InnerFrame")
702 UserData =
"savefileframe"
705 var titleText =
new GUITextBlock(
706 new RectTransform(
new Vector2(0.9f, 0.2f), saveFileFrame.RectTransform,
Anchor.TopCenter)
708 RelativeOffset = new Vector2(0, 0.05f)
710 Path.GetFileNameWithoutExtension(fileName), font: GUIStyle.LargeFont, textAlignment: Alignment.Center);
711 titleText.Text = ToolBox.LimitString(titleText.Text, titleText.Font, titleText.Rect.Width);
713 var layoutGroup =
new GUILayoutGroup(
714 new RectTransform(
new Vector2(0.8f, 0.5f), saveFileFrame.RectTransform,
Anchor.Center)
716 RelativeOffset = new Vector2(0, 0.1f)
719 if (!locationName.IsNullOrEmpty())
721 new GUITextBlock(
new RectTransform(
new Vector2(1, 0), layoutGroup.RectTransform),
722 locationName, font: GUIStyle.SmallFont);
723 new GUITextBlock(
new RectTransform(
new Vector2(1, 0), layoutGroup.RectTransform),
724 TextManager.Get($
"savestate.{levelType}"), font: GUIStyle.SmallFont);
726 new GUIFrame(
new RectTransform(
new Vector2(0.0f, 0.05f), layoutGroup.RectTransform), style:
null);
728 new GUITextBlock(
new RectTransform(
new Vector2(1, 0), layoutGroup.RectTransform),
729 $
"{TextManager.Get("Submarine
")} : {subName}", font: GUIStyle.SmallFont);
730 new GUITextBlock(
new RectTransform(
new Vector2(1, 0), layoutGroup.RectTransform),
731 $
"{TextManager.Get("LastSaved
")} : {saveTime}", font: GUIStyle.SmallFont);
732 new GUITextBlock(
new RectTransform(
new Vector2(1, 0), layoutGroup.RectTransform),
733 $
"{TextManager.Get("MapSeed
")} : {mapseed}", font: GUIStyle.SmallFont);
735 GUILayoutGroup buttonContainer =
new GUILayoutGroup(
new RectTransform(
new Vector2(0.85f, 0.15f), saveFileFrame.RectTransform,
Anchor.BottomCenter)
737 RelativeOffset = new Vector2(0, 0.1f)
738 }, isHorizontal:
true)
740 RelativeSpacing = 0.05f,
744 new GUIButton(
new RectTransform(
new Vector2(0.5f, 1f), buttonContainer.RectTransform,
Anchor.CenterLeft), TextManager.Get(
"Delete"), style:
"GUIButtonSmall")
747 OnClicked = DeleteSave
750 new GUIButton(
new RectTransform(
new Vector2(0.5f, 1f), buttonContainer.RectTransform,
Anchor.CenterLeft), TextManager.Get(
"rollbackbutton"), style:
"GUIButtonSmall")
753 ToolTip = TextManager.Get(
"backuptooltip"),
754 OnClicked = ViewBackupMenu
760 private bool ViewBackupMenu(GUIButton btn,
object obj)
762 if (obj is not CampaignMode.SaveInfo saveInfo) {
return false; }
764 var indexData = SaveUtil.GetIndexData(saveInfo.FilePath);
765 CreateBackupMenu(indexData, index =>
767 LoadGame(saveInfo.FilePath, Option.Some(index.Index));
772 private void RemoveSaveFrame()
774 GUIComponent prevFrame =
null;
775 foreach (GUIComponent child
in loadGameContainer.Children)
777 if (child.UserData as
string !=
"savefileframe")
continue;
782 loadGameContainer.RemoveChild(prevFrame);
readonly GUIComponent newGameContainer
GUITextBlock InitialMoneyText
GUIButton CampaignCustomizeButton
Stores information about the Character that is needed between rounds in the menu etc....
static readonly Identifier HumanSpeciesName
GUIComponent GetChild(int index)
virtual void RemoveChild(GUIComponent child)
virtual void ClearChildren()
virtual RichString ToolTip
IEnumerable< GUIComponent > GetAllChildren()
Returns all child elements in the hierarchy.
RectTransform RectTransform
IEnumerable< GUIComponent > Children
void RecalculateChildren()
GUIFrame Content
A frame that contains the contents of the listbox. The frame itself is not rendered.
void Select(object userData, Force force=Force.No, AutoScroll autoScroll=AutoScroll.Enabled)
override void ClearChildren()
TextBoxEvent OnDeselected
static readonly PrefabCollection< JobPrefab > Prefabs
GUILayoutGroup subPreviewContainer
override void CreateLoadMenu(IEnumerable< CampaignMode.SaveInfo > saveFiles=null)
CharacterInfo.AppearanceCustomizationMenu[] CharacterMenus
void CreateDefaultSaveName()
void UpdateSubList(IEnumerable< SubmarineInfo > submarines)
SinglePlayerCampaignSetupUI(GUIComponent newGameContainer, GUIComponent loadGameContainer)
void SetPage(int pageIndex)
LocalizedString DisplayName
LocalizedString Description
bool IsCampaignCompatible
static IEnumerable< SubmarineInfo > SavedSubmarines
bool RequiredContentPackagesInstalled