From cb7f6ded60db8bc6f3f9e07f190d73da60b59d05 Mon Sep 17 00:00:00 2001 From: Sirspam Date: Thu, 2 Dec 2021 13:34:17 +0000 Subject: [PATCH] Fixed modal duplication --- Nya/UI/ViewControllers/NSFWConfirmModalController.cs | 9 ++++----- Nya/UI/ViewControllers/SettingsModalController.cs | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Nya/UI/ViewControllers/NSFWConfirmModalController.cs b/Nya/UI/ViewControllers/NSFWConfirmModalController.cs index fdbb867..2285288 100644 --- a/Nya/UI/ViewControllers/NSFWConfirmModalController.cs +++ b/Nya/UI/ViewControllers/NSFWConfirmModalController.cs @@ -45,12 +45,11 @@ private void noNSFW() private void Parse(Transform parentTransform) { - BSMLParser.instance.Parse(BeatSaberMarkupLanguage.Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), "Nya.UI.Views.NSFWConfirmModal.bsml"), parentTransform.gameObject, this); - modalView.SetField("_animateParentCanvas", false); - if (rootTransform != null && modalTransform != null) + if (!modalView) { - modalTransform.SetParent(rootTransform); - modalTransform.gameObject.SetActive(false); + BSMLParser.instance.Parse(BeatSaberMarkupLanguage.Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), "Nya.UI.Views.NSFWConfirmModal.bsml"), parentTransform.gameObject, this); + modalView.SetField("_animateParentCanvas", false); + modalView.name = "NyaNSFWConfirmaModal"; } } diff --git a/Nya/UI/ViewControllers/SettingsModalController.cs b/Nya/UI/ViewControllers/SettingsModalController.cs index 233b91b..a0fb379 100644 --- a/Nya/UI/ViewControllers/SettingsModalController.cs +++ b/Nya/UI/ViewControllers/SettingsModalController.cs @@ -61,12 +61,11 @@ private bool nsfwCheck private void Parse(Transform parentTransform) { - BSMLParser.instance.Parse(Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), "Nya.UI.Views.SettingsModal.bsml"), parentTransform.gameObject, this); - FieldAccessor.Set(ref modalView, "_animateParentCanvas", true); - if (rootTransform != null && modalTransform != null) + if (!modalView) { - modalTransform.SetParent(rootTransform); - modalTransform.gameObject.SetActive(false); + BSMLParser.instance.Parse(Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), "Nya.UI.Views.SettingsModal.bsml"), parentTransform.gameObject, this); + FieldAccessor.Set(ref modalView, "_animateParentCanvas", true); + modalView.name = "NyaSettingsModal"; } }