Sboku/UI/EndMenu.razor
@using SWB.Base
@using SWB.Demo
@using SWB.HUD
@using SWB.Player
@using Sandbox;
@using Sandbox.Events
@using Sandbox.Sboku.Arena
@using Sandbox.UI;
@using System;
@using System.Linq;
@using System.Collections.Generic;
@inherits PanelComponent
@namespace Sandbox.Sboku.UI

<root>
	<div class="menu">
		<p class="title">@(!WinVariant ? "You lost" : "You won!")</p>
		<div class="divider"/>
		<div class="list">
			@if (!WinVariant)
			{
				<div onclick=@Retry class="but">Retry</div>
			}
			<div onclick=@NewGame class ="but">New Game</div>
			<div onclick=@Exit class="but">Exit</div>
		</div>
	</div>
</root>

@code
{
	public bool WinVariant { get; set; } = false;
	protected override int BuildHash() => System.HashCode.Combine(WinVariant);

	private RoundManager manager;
	protected override void OnAwake()
	{
		manager = Scene.GetComponentInChildren<RoundManager>();
	}

	private void Retry()
		=> Close();

	private void NewGame()
	{
		manager.RoundNumber = 1;
		this.GameObject.Parent.GetComponent<UpgradeHolder>().Clear();
		Close();
	}

	private void Close()
	{
		//this.GameObject.Parent.GetComponent<DemoPlayer>().ArenaUI.AddComponent<UpgradeMenu>();
		Destroy();
	}

	private void Exit()
		=> Game.Close();
}