ui/StatsTab.razor

A UI Razor component for the Stats tab. It renders an InputHint control and sets Manager.Instance flags on mouse over/out and click to indicate hovering and to open the stats for the local player.

@namespace Sandbox
@using Sandbox;
@using Sandbox.UI;
@using System;
@inherits Panel
@attribute [StyleSheet("StatsTab.razor.scss")]

<root>
	@* <label class="title">@("bar_chart")</label> *@
	<InputHint class="ctrl" Button="tab" AspectRatio=@(1.55f)></InputHint>
</root>

@code {
	protected override void OnMouseOver( MousePanelEvent e )
	{
		Manager.Instance.IsHoveringStatsTab = true;
	}

	protected override void OnMouseOut( MousePanelEvent e )
	{
		Manager.Instance.IsHoveringStatsTab = false;
	}

	protected override void OnClick(MousePanelEvent e)
	{
		base.OnClick(e);

		e.StopPropagation();

		if ( !Manager.Instance.LocalPlayer.IsValid() )
			return;

		Manager.Instance.LocalPlayer.ShouldShowStats = true;
	}
}