UI/Inspector/GuestInspector.razor
@using Sandbox.UI
@using HC3.Inventory

@namespace HC3.UI
@inherits PinnableWindow<GuestInspector>

@if ( !Guest.IsValid() )
{
	Close();
	return;
}

<root>
    <ActionDisplay Agent=@Guest />

	<tabview>
        <tab Icon="status_online" Title="Needs">
			@foreach( var need in Guest.Needs.GetNeeds().OrderBy( x => x.Template.DisplayName ) )
			{
				<NeedsBar Need=@need/>
			}
		</tab>
		<tab Icon="briefcase" Title="Items">
            <label>In Wallet: @(Guest.Money.Comma())</label>
			<InventoryPanel Inventory=@(Guest.Inventory) />
		</tab>
        <tab Icon="chart_curve" Title="Thoughts">
            <AgentThoughtPanel Agent=@Guest />
        </tab>
		@if ( DebugMode.Enabled )
		{
			<tab Icon="bug" Title="Debug">
				<div class="row">Delinquency: @Guest.Delinquency.ToString( "0.00" )</div>
				<div class="row">Suspicion Level: @Guest.SuspicionLevel.ToString( "0.00" )</div>
				<div class="row">Is Arrested: @Guest.IsArrested</div>
				<button onclick=@(() => MakeGuestWanted( Guest ))>Make Suspicious</button>
			</tab>
		}
	</tabview>

	<div class="footer">
		@if ( GuestCamera.Instance.IsValid() )
		{
			<div class="button @(isViewing ? "selected" : "")" onclick=@(() => GuestCamera.Instance.ToggleViewing(Guest)) tooltip="POV"><i>visibility</i></div>
		}
		<div class="button @(isFollowing ? "selected" : "")" onclick=@(() => CameraPanning.Instance.ToggleFollow( Guest.GameObject )) tooltip="Follow"><i>filter_center_focus</i></div>
	</div>
</root>

@code
{
	public Guest Guest { get; set; }

	public override string Title => Guest?.FullName;
	public override string Icon => "user";
	public override object Key => Guest;

	bool isViewing => GuestCamera.Instance.Guest == Guest;
	bool isFollowing => CameraPanning.Instance.FollowTarget == Guest.GameObject;

	protected override int BuildHash() => System.HashCode.Combine( Time.Now );

	public override void OnDeleted()
	{
		base.OnDeleted();

		if ( GuestCamera.Instance.IsValid() && GuestCamera.Instance.Guest == Guest )
		{
			GuestCamera.Instance.StopViewing();
		}

		CameraPanning.Instance.StopFollowing( Guest.GameObject );
	}

	void MakeGuestWanted( Guest guest )
	{
		guest.SuspicionLevel = 1f;
	}
}