UI/Player/MatchTimer.razor
@using Sandbox.UI
@inherits Panel

<style>
    MatchTimer {
        position: absolute;
        top: 40px;
        left: 50%;
        transform: translateX(-50%);
        min-width: 230px;
        padding: 7px 16px;
        justify-content: center;
        align-items: center;
        background-color: rgba(78, 75, 66, 0.1);
        border-left: 5px solid rgba(0, 0, 0, 0.2);
        border-right: 5px solid rgba(0, 0, 0, 0.2);
        font-family: "Wallpoet";
        font-size: 30px;
        color: rgba(0, 255, 255, 0.78);
        text-shadow: 0px 0px 20px rgba(0, 255, 255, 1);
    }
</style>

<root>
    @if ( _show )
    {
        <label>@_timeText</label>
    }
</root>

@code
{
    private bool _show => !PilotGame.MatchEnded && GameSettings.MatchTimeLimitMinutes > 0;

    private string _timeText
    {
        get
        {
            var t = MathF.Max( 0f, PilotGame.MatchTimeRemaining );
            int mins = (int)(t / 60f);
            int secs = (int)(t % 60f);
            return $"{mins:00}:{secs:00}";
        }
    }

    protected override int BuildHash()
        => HashCode.Combine( _show, (int)PilotGame.MatchTimeRemaining, PilotGame.MatchEnded );
}