Merge branch 'ui-overhaul'
This commit is contained in:
84
Assets/Scripts/UI/PlayerHudManager.cs
Normal file
84
Assets/Scripts/UI/PlayerHudManager.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using Bootstrap;
|
||||
using Cinematics;
|
||||
using UnityEngine;
|
||||
using Core;
|
||||
using System;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
public class PlayerHudManager : MonoBehaviour
|
||||
{
|
||||
private AppSwitcher _appSwitcher;
|
||||
public GameObject landscapeObject;
|
||||
public GameObject portraitObject;
|
||||
public GameObject cinematicsParentObject;
|
||||
public GameObject CinematicBackground;
|
||||
|
||||
[HideInInspector] public Image cinematicSprites;
|
||||
[HideInInspector] public Image cinematicBackgroundSprites;
|
||||
|
||||
[HideInInspector] public GameObject currentCinematicPlayer;
|
||||
|
||||
[HideInInspector] public PlayableDirector playableDirector;
|
||||
|
||||
|
||||
|
||||
private static PlayerHudManager _instance;
|
||||
|
||||
|
||||
public static PlayerHudManager Instance => _instance;
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance != null)
|
||||
{
|
||||
Destroy(this);
|
||||
return;
|
||||
}
|
||||
|
||||
_instance = this;
|
||||
|
||||
// Register for post-boot initialization
|
||||
BootCompletionService.RegisterInitAction(InitializePostBoot);
|
||||
}
|
||||
|
||||
private void InitializeReferences()
|
||||
{
|
||||
cinematicSprites = currentCinematicPlayer.GetComponent<Image>();
|
||||
cinematicBackgroundSprites = CinematicBackground.GetComponent<Image>();
|
||||
playableDirector = cinematicsParentObject.GetComponent<PlayableDirector>();
|
||||
}
|
||||
|
||||
private void InitializePostBoot()
|
||||
{
|
||||
// Initialize any dependencies that require other services to be ready
|
||||
// For example, subscribe to SceneManagerService events if needed
|
||||
|
||||
|
||||
Logging.Debug("[PlayerHudManager] Post-boot initialization complete");
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
// Subscribe to application quit event to ensure cleanup
|
||||
Application.quitting += OnApplicationQuit;
|
||||
}
|
||||
|
||||
private void OnApplicationQuit()
|
||||
{
|
||||
}
|
||||
|
||||
public void SetPortraitMode(bool portraitModeEnable)
|
||||
{
|
||||
if (portraitModeEnable)
|
||||
{
|
||||
currentCinematicPlayer = portraitObject;
|
||||
InitializeReferences();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
currentCinematicPlayer = landscapeObject;
|
||||
InitializeReferences();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/PlayerHudManager.cs.meta
Normal file
2
Assets/Scripts/UI/PlayerHudManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f97ef53b4012e4149b61bbd63c298b6f
|
||||
Reference in New Issue
Block a user