From e62e237d4571e22983e1397d22bd16e3ad57076c Mon Sep 17 00:00:00 2001 From: Bitl Date: Thu, 4 Nov 2021 10:13:37 -0700 Subject: [PATCH] fixed saving issues --- .../CharacterCustomizationShared.cs | 15 ++++++-- .../Compact/CharacterCustomizationCompact.cs | 3 +- .../CharacterCustomizationExtended.cs | 3 +- .../Forms/LauncherForm/LauncherFormShared.cs | 35 +++++++++++-------- .../Stylish/LauncherFormStylish.cs | 29 +-------------- .../LauncherFormStylishInterface.xaml.cs | 4 +-- 6 files changed, 39 insertions(+), 50 deletions(-) diff --git a/Novetus/NovetusCore/CharCustom/CharacterCustomizationShared.cs b/Novetus/NovetusCore/CharCustom/CharacterCustomizationShared.cs index 3ec38ce..9a7e5dc 100644 --- a/Novetus/NovetusCore/CharCustom/CharacterCustomizationShared.cs +++ b/Novetus/NovetusCore/CharCustom/CharacterCustomizationShared.cs @@ -160,6 +160,13 @@ class CharacterCustomizationShared GlobalFuncs.ReloadLoadoutValue(); } + public void CloseEvent() + { + GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, ""); + GlobalFuncs.ReloadLoadoutValue(); + SaveOutfit(false); + } + public void ChangeTabs() { ColorView.SelectedIndices.Clear(); @@ -610,10 +617,13 @@ class CharacterCustomizationShared } } - public void SaveOutfit() + public void SaveOutfit(bool box = true) { GlobalFuncs.Customization(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization, true); - MessageBox.Show("Outfit Saved!", "Novetus - Outfit Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); + if (box) + { + MessageBox.Show("Outfit Saved!", "Novetus - Outfit Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); + } } public void LoadOutfit() @@ -721,6 +731,7 @@ class CharacterCustomizationShared public void Launch3DView() { GlobalFuncs.ReloadLoadoutValue(); + SaveOutfit(false); //HACK! try { diff --git a/Novetus/NovetusCore/CharCustom/Forms/Compact/CharacterCustomizationCompact.cs b/Novetus/NovetusCore/CharCustom/Forms/Compact/CharacterCustomizationCompact.cs index 4898031..6c50277 100644 --- a/Novetus/NovetusCore/CharCustom/Forms/Compact/CharacterCustomizationCompact.cs +++ b/Novetus/NovetusCore/CharCustom/Forms/Compact/CharacterCustomizationCompact.cs @@ -34,8 +34,7 @@ public partial class CharacterCustomizationCompact : Form void CharacterCustomizationClose(object sender, CancelEventArgs e) { - GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, ""); - GlobalFuncs.ReloadLoadoutValue(); + characterCustomizationForm.CloseEvent(); } #region Hats diff --git a/Novetus/NovetusCore/CharCustom/Forms/Extended/CharacterCustomizationExtended.cs b/Novetus/NovetusCore/CharCustom/Forms/Extended/CharacterCustomizationExtended.cs index f0463ae..8c35752 100644 --- a/Novetus/NovetusCore/CharCustom/Forms/Extended/CharacterCustomizationExtended.cs +++ b/Novetus/NovetusCore/CharCustom/Forms/Extended/CharacterCustomizationExtended.cs @@ -36,8 +36,7 @@ public partial class CharacterCustomizationExtended : Form void CharacterCustomizationClose(object sender, CancelEventArgs e) { - GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, ""); - GlobalFuncs.ReloadLoadoutValue(); + characterCustomizationForm.CloseEvent(); } #region Hats diff --git a/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs b/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs index c8d749c..ef100bb 100644 --- a/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs +++ b/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs @@ -291,19 +291,7 @@ namespace NovetusLauncher public void CloseEvent(CancelEventArgs e) { - if (GlobalVars.AdminMode) - { - DialogResult closeNovetus = MessageBox.Show("You are in Admin Mode.\nAre you sure you want to quit Novetus?", "Novetus - Admin Mode Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); - if (closeNovetus == DialogResult.No) - { - e.Cancel = true; - } - else - { - CloseEventInternal(); - } - } - else if (GlobalVars.GameOpened != GlobalVars.OpenedGame.None) + if (GlobalVars.GameOpened != GlobalVars.OpenedGame.None) { switch (GlobalVars.GameOpened) { @@ -317,9 +305,28 @@ namespace NovetusLauncher break; } } + else + { + if (GlobalVars.AdminMode) + { + DialogResult closeNovetus = MessageBox.Show("You are in Admin Mode.\nAre you sure you want to quit Novetus?", "Novetus - Admin Mode Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + if (closeNovetus == DialogResult.No) + { + e.Cancel = true; + } + else + { + CloseEventInternal(); + } + } + else + { + CloseEventInternal(); + } + } } - private void ShowCloseError(string text, string title, CancelEventArgs e) + public void ShowCloseError(string text, string title, CancelEventArgs e) { DialogResult closeNovetus = MessageBox.Show(text + "\nYou must close the game before closing Novetus.", "Novetus - " + title + " is Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error); if (closeNovetus == DialogResult.OK) diff --git a/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylish.cs b/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylish.cs index dccab6d..20b7789 100644 --- a/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylish.cs +++ b/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylish.cs @@ -89,38 +89,11 @@ namespace NovetusLauncher void LauncherFormStylish_Close(object sender, CancelEventArgs e) { - CloseEvent(e); + launcherFormStylishInterface1.launcherForm.CloseEvent(e); } #endregion #region Functions - public void CloseEvent(CancelEventArgs e) - { - if (GlobalVars.AdminMode) - { - DialogResult closeNovetus = MessageBox.Show("You are in Admin Mode.\nAre you sure you want to quit Novetus?", "Novetus - Admin Mode Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); - if (closeNovetus == DialogResult.No) - { - e.Cancel = true; - } - else - { - CloseEventInternal(); - } - } - } - - public void CloseEventInternal() - { - WriteConfigValues(); - - if (GlobalVars.UserConfiguration.DiscordPresence) - { - DiscordRPC.Shutdown(); - } - - Application.Exit(); - } void splashLabel_Paint(object sender, PaintEventArgs e) { diff --git a/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylishInterface.xaml.cs b/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylishInterface.xaml.cs index c890e15..6988265 100644 --- a/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylishInterface.xaml.cs +++ b/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylishInterface.xaml.cs @@ -467,13 +467,13 @@ namespace NovetusLauncher { case 0: GlobalVars.UserConfiguration.LauncherStyle = Settings.Style.Extended; - FormParent.CloseEventInternal(); + launcherForm.CloseEventInternal(); System.Diagnostics.Process.Start(System.Windows.Forms.Application.ExecutablePath); System.Windows.Forms.Application.Exit(); break; case 1: GlobalVars.UserConfiguration.LauncherStyle = Settings.Style.Compact; - FormParent.CloseEventInternal(); + launcherForm.CloseEventInternal(); System.Diagnostics.Process.Start(System.Windows.Forms.Application.ExecutablePath); System.Windows.Forms.Application.Exit(); break;