Skip to content

Commit

Permalink
Fixed modal duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirspam committed Dec 2, 2021
1 parent ae29e2c commit cb7f6de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions Nya/UI/ViewControllers/NSFWConfirmModalController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}

Expand Down
9 changes: 4 additions & 5 deletions Nya/UI/ViewControllers/SettingsModalController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ModalView, bool>.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<ModalView, bool>.Set(ref modalView, "_animateParentCanvas", true);
modalView.name = "NyaSettingsModal";
}
}

Expand Down

0 comments on commit cb7f6de

Please sign in to comment.