-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f5c977
commit d96a04d
Showing
1 changed file
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,27 @@ | ||
namespace OWML.Utils | ||
using UnityEngine; | ||
|
||
namespace OWML.Utils | ||
{ | ||
public static class MenuExtensions | ||
{ | ||
public static void SetMessage(this PopupMenu menu, string message) => menu._labelText.text = message; | ||
|
||
public static void SetButtonVisible(this SubmitAction buttonAction, bool visible) | ||
{ | ||
var activeAlpha = 1; | ||
|
||
if (LoadManager.GetCurrentScene() == OWScene.TitleScreen) | ||
{ | ||
var titleAnimationController = Resources.FindObjectsOfTypeAll<TitleScreenManager>()[0]._gfxController; | ||
activeAlpha = titleAnimationController.IsTitleAnimationComplete() ? 1 : 0; | ||
if (titleAnimationController.IsFadingInMenuOptions()) | ||
{ | ||
activeAlpha = 1; | ||
} | ||
} | ||
|
||
buttonAction.gameObject.SetActive(visible); | ||
buttonAction.GetComponent<CanvasGroup>().alpha = visible ? activeAlpha : 0; | ||
} | ||
} | ||
} |