Added contextual UI switching depending on level type

This commit is contained in:
journaliciouz
2025-11-08 21:08:01 +01:00
parent 0e55248698
commit 2ec53629c6
2 changed files with 83 additions and 0 deletions

View File

@@ -9,11 +9,17 @@ using Core.Lifecycle;
public class PlayerHudManager : ManagedBehaviour
{
public enum UIMode { Overworld, Puzzle, Minigame, HideAll };
public UIMode currentUIMode;
private AppSwitcher _appSwitcher;
public GameObject landscapeObject;
public GameObject portraitObject;
public GameObject cinematicsParentObject;
public GameObject CinematicBackground;
public GameObject appSwitcher;
public GameObject eagleEye;
[HideInInspector] public Image cinematicSprites;
[HideInInspector] public Image cinematicBackgroundSprites;
@@ -30,6 +36,7 @@ public class PlayerHudManager : ManagedBehaviour
public static PlayerHudManager Instance => _instance;
private new void Awake()
{
base.Awake();
if (Instance != null)
{
Destroy(this);
@@ -39,6 +46,26 @@ public class PlayerHudManager : ManagedBehaviour
_instance = this;
InitializeReferences();
}
protected override void OnManagedAwake()
{
if (SceneManagerService.Instance != null)
{
SceneManagerService.Instance.SceneLoadCompleted += NewSceneLoaded;
}
if (SceneManagerService.Instance.CurrentGameplayScene == "AppleHillsOverworld")
{
NewSceneLoaded("AppleHillsOverworld");
}
if (SceneManagerService.Instance.CurrentGameplayScene == "StartingScene")
{
// TODO: Hide all UI until cinematics have played
NewSceneLoaded("AppleHillsOverworld");
}
}
private void InitializeReferences()
@@ -67,4 +94,47 @@ public class PlayerHudManager : ManagedBehaviour
UpateCinematicReferences(landscapeObject);
}
}
public void NewSceneLoaded(string sceneName)
{
switch (sceneName)
{
case "AppleHillsOverworld":
UpdateUIMode(UIMode.Overworld);
break;
case "Quarry":
UpdateUIMode(UIMode.Puzzle);
break;
case "DivingForPictures":
UpdateUIMode(UIMode.Minigame);
break;
}
}
public void UpdateUIMode(UIMode mode)
{
switch (mode)
{
case UIMode.Overworld:
// Show app switcher
appSwitcher.SetActive(true);
// Hide eagle eye
eagleEye.SetActive(false);
break;
case UIMode.Puzzle:
// Hide app switcher
appSwitcher.SetActive(false);
// show eagle eye
eagleEye.SetActive(true);
break;
case UIMode.Minigame:
// Hide app switcher
appSwitcher.SetActive(false);
// Hide birds eye
eagleEye.SetActive(false);
break;
}
}
}