ui/time.razor

A UI panel Razor component that displays the game time at the top center of the screen. It reads Game.Time each update, formats minutes and seconds into a string like "M:SS", and exposes that string in the rendered div.

File Access
@inherits PanelComponent

<root>
<div style="position: absolute; left: 50%; transform: translate(-50%, 0%);
font-family: courier; font-size: 24px; color: #fff; background: #000; border-radius: 15%;">
@This </div>
</root>

@code
{
[Property] public game Game {get;set;}
string This = "0:00";

protected override void OnUpdate()
{if (!Game.IsActive) return;

var m = (int)Game.Time / 60;
var s = (int)Game.Time % 60;

if (s < 10) {This = $"{m}:0{s}";
return;} This = $"{m}:{s}";
}
protected override int BuildHash() => System.HashCode.Combine(This);
}