using System.Runtime.InteropServices.JavaScript;
namespace Foundations
{
///
/// Drives the splash a page shows while its modules download and .NET starts. The page's markup and
/// Foundations.BootSplash.js put it up, so it appears before any C# runs.
///
public static partial class BootSplash
{
[JSImport("globalThis.foundationsBoot.setStatus")]
private static partial void SetStatusInPage(string text);
[JSImport("globalThis.foundationsBoot.remove")]
private static partial void RemoveFromPage();
///
/// Gets whether the splash is gone.
///
public static bool IsRemoved { get; private set; }
///
/// Replaces the splash's status text. Does nothing once the splash is gone.
///
public static void SetStatus(string text)
{
if (!IsRemoved)
{
SetStatusInPage(text);
}
}
///
/// Takes the splash off the page. Call it once the game has drawn a frame. Later calls do nothing.
///
public static void Remove()
{
if (IsRemoved)
{
return;
}
IsRemoved = true;
RemoveFromPage();
}
}
}