UI/PauseScreen.razor
@using Sandbox;
@using Sandbox.UI;
@inherits PanelComponent
@namespace Sandbox

<root>
    <button class="button" onclick=@Close>CONTINUE</button>
    <button class="button" onclick=@ToMenu>MAIN MENU</button>
    <button class="button" onclick=@Quit>QUIT GAME</button>
    <div class="paused">[PAUSED]</div>
</root>

@code
{
    [Property]
    public SceneFile MainMenu { get; set; }

    public static bool Paused { get; set; } = false;
    public static PauseScreen Instance { get; private set; }

    protected override void OnAwake()
    {
        base.OnAwake();
        Instance = this;
    }

    public void Close()
    {
        Enabled = false;
        Paused = false;
        Scene.TimeScale = 1f;
    }

    public void ToMenu()
    {
        Scene.LoadFromFile(MainMenu.ResourcePath);
    }

    public void Quit()
    {
        Game.Close();
    }

    /// <summary>
    /// the hash determines if the system should be rebuilt. If it changes, it will be rebuilt
    /// </summary>
    protected override int BuildHash() => System.HashCode.Combine( Time.Now );
}