Revamp the prompt system, the bootstrapper system, the starting cinematic
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
@@ -14,9 +15,24 @@ namespace Bootstrap
|
||||
/// Current initialisation status
|
||||
/// </summary>
|
||||
public static bool Initialised { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Event triggered when boot progress changes
|
||||
/// </summary>
|
||||
public static event Action<float> OnBootProgressChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Event triggered when boot process completes
|
||||
/// </summary>
|
||||
public static event Action OnBootCompleted;
|
||||
|
||||
/// <summary>
|
||||
/// Current progress of the boot process (0-1)
|
||||
/// </summary>
|
||||
public static float CurrentProgress { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
// Called as soon as the game begins
|
||||
/// Called as soon as the game begins
|
||||
/// </summary>
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
|
||||
private static void Initialise()
|
||||
@@ -32,6 +48,9 @@ namespace Bootstrap
|
||||
/// </summary>
|
||||
public static void PerformInitialisation()
|
||||
{
|
||||
//Reset progress
|
||||
CurrentProgress = 0f;
|
||||
|
||||
//In editor, perform initialisation synchronously
|
||||
if (Application.isEditor)
|
||||
{
|
||||
@@ -72,6 +91,17 @@ namespace Bootstrap
|
||||
{
|
||||
await LoadCustomBootSettings();
|
||||
Initialised = true;
|
||||
CurrentProgress = 1f;
|
||||
OnBootProgressChanged?.Invoke(1f);
|
||||
OnBootCompleted?.Invoke();
|
||||
|
||||
// Notify the BootCompletionService that boot is complete
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
// Direct call to boot completion service
|
||||
Debug.Log("[CustomBoot] Calling BootCompletionService.HandleBootCompleted()");
|
||||
BootCompletionService.HandleBootCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -81,6 +111,17 @@ namespace Bootstrap
|
||||
{
|
||||
LoadCustomBootSettingsSync();
|
||||
Initialised = true;
|
||||
CurrentProgress = 1f;
|
||||
OnBootProgressChanged?.Invoke(1f);
|
||||
OnBootCompleted?.Invoke();
|
||||
|
||||
// Notify the BootCompletionService that boot is complete
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
// Direct call to boot completion service
|
||||
Debug.Log("[CustomBoot] Calling BootCompletionService.HandleBootCompleted()");
|
||||
BootCompletionService.HandleBootCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -177,5 +218,16 @@ namespace Bootstrap
|
||||
result.InitialiseSync();
|
||||
return handle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current progress value and triggers the progress event
|
||||
/// </summary>
|
||||
/// <param name="progress">Progress value between 0-1</param>
|
||||
internal static void UpdateProgress(float progress)
|
||||
{
|
||||
CurrentProgress = Mathf.Clamp01(progress);
|
||||
OnBootProgressChanged?.Invoke(CurrentProgress);
|
||||
Debug.Log($"[CustomBoot] Progress: {CurrentProgress:P0}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user