Ui/MainUi.razor
@using System
@using Clover.Carriable
@using Clover.Components
@using Clover.Player
@using Clover.WorldBuilder
@using Sandbox;
@using Sandbox.UI;
@using Clover.Ui;
@inherits PanelComponent
@namespace Clover

<root>
	@if ( PlayerCharacter.Local.IsValid() )
	{
		<div class="is-saving" @ref=" IsSavingPanel">
			<i class="icon">save</i>
		</div>

		<div class="status @( ShouldShowUi ? "active" : "" )">
			<div class="weather">
				<Image [email protected]()/>
			</div>
			<div class="time">@TimeManager.Time.ToString( "HH:mm" )</div>
		</div>

		<div class="cutscene-bars @( PlayerCharacter.Local.InCutscene ? "active" : "" )">
			<div class="bar top"></div>
			<div class="bar bottom"></div>
		</div>

		@if ( ShowInputs )
		{
			<div class="inputs @( ShouldShowUi ? "active" : "" )">
				@{
					var group = "";
					var actionPairsPrinted = new List<string>();
				}
				@foreach ( var input in GetCurrentInputs().OrderBy( x => x.Group ).ThenBy( x => x.ActionPair ) )
				{
					if ( input.Group != group )
					{
						group = input.Group;
						<div class="input-group">@group</div>
					}

					if ( !string.IsNullOrEmpty( input.ActionPair ) && actionPairsPrinted.Contains( input.ActionPair ) )
					{
						continue;
					}

					if ( !string.IsNullOrEmpty( input.ActionPair ) && !actionPairsPrinted.Contains( input.ActionPair ) )
					{
						actionPairsPrinted.Add( input.ActionPair );

						var allPairs = GetCurrentInputs().Where( x => x.ActionPair == input.ActionPair ).ToList();

						<div class="input-entry">
							<div class="input-glyphs">
								@foreach ( var pair in allPairs )
								{
									<Image [email protected]( pair.Action, InputGlyphSize.Small, GlyphStyle.Dark )/>
								}
							</div>
							<div class="input-name">@input.Name</div>
						</div>
					}
					else
					{
						<div class="input-entry">
							<div class="input-glyphs">
								<Image [email protected]( input.Action, InputGlyphSize.Small, GlyphStyle.Dark )/>
							</div>
							<div class="input-name">@input.Name</div>
						</div>
					}
				}
			</div>
		}

		@if ( PlayerCharacter.Local.Components.TryGet<HideAndSeek>( out var hideAndSeek ) && HideAndSeek.Leader.IsValid() && HideAndSeek.Leader.IsRoundActive )
		{
			if ( hideAndSeek.IsBlind )
			{
				<div class="hide-and-seek-blind">
					<h1>Hiding...</h1>
					<div class="sub">
						<div class="blind-icon">
							<i class="icon">visibility_off</i>
						</div>
						<div class="blind-text">@Math.Round( HideAndSeek.Leader.BlindSecondsLeft )</div>
					</div>
				</div>
			}
			else
			{
				<div class="hide-and-seek">
					@if ( hideAndSeek.IsSeeker )
					{
						<h1>Seeking...</h1>
					}
					else
					{
						<h1>Hiding...</h1>
					}
					@if ( hideAndSeek.BlindSecondsLeft > 0 )
					{
						<div class="time">
							<i class="icon">visibility_off</i>
							<span>@Math.Round( hideAndSeek.BlindSecondsLeft )</span>
						</div>
					}
					else
					{
						<div class="time">
							<i class="icon">timer</i>
							<span>@Math.Round( hideAndSeek.RoundSecondsLeft )</span>
						</div>
					}
				</div>
			}
		}

		@if ( PlayerCharacter.Local.Equips.TryGetEquippedItem<BaseInstrument>( Equips.EquipSlot.Tool, out var instrument ) && instrument.IsPlaying )
		{
			<InstrumentUi/>
		}
	}
	else if ( string.IsNullOrEmpty( PlayerCharacter.SpawnPlayerId ) )
	{
		<PlayerSelect/>
	}
</root>