UI/IntroScreen.razor
@using System;
@using Sandbox;
@using Sandbox.UI;

@* The start of a new career: you wake up chained in the arena's dungeon (the 3D dungeon, World3D hangs
   the chains). Click to go on. *@
<root class="screen" onclick=@Next>
	@if ( Slide < Slides.Length )
	{
		<div class="sas-banner">@Slides[Slide].Text</div>
	}
	else
	{
		<div class="day">
			<div class="day-title">Day 1</div>
			<div class="day-sub">In Chains</div>
		</div>
	}
	<div class="hint">click to continue</div>
</root>

@code
{
	record Line( string Text, Mood Mood );

	static readonly Line[] Slides =
	{
		new( "Darkness. The clink of chains. You have long since lost count of the days since they dragged you down here.", Mood.Upset ),
		new( "Taken on the road and sold for a handful of coins, you now belong to the master of the arena.", Mood.Hurt ),
		new( "He has no use for a weak slave. Win your duels down here in the dungeon, and one day the crowd above may chant your name.", Mood.Upset ),
		new( "And so, in chains and with an empty stomach, your days as an arena slave begin.", Mood.Grin ),
	};

	int Slide;
	RealTimeSince sinceClick;

	Look Chained
	{
		get
		{
			var l = Profile.Current?.Look ?? Look.Default;
			l.Weapon = 0;
			foreach ( var s in Catalog.Slots ) l.Set( s, -1 );
			return l;
		}
	}

	void Next()
	{
		if ( sinceClick < 0.25f ) return;
		sinceClick = 0;
		Slide++;
		if ( Slide > Slides.Length ) GameManager.Instance?.FinishIntro();
		StateHasChanged();
	}

	public override void Tick()
	{
		base.Tick();
		var w = World3D.Instance;
		if ( w.IsValid() )
		{
			w.HeroLook = Chained;
			w.HeroAnim = "chained";
			w.HeroMood = Slide < Slides.Length ? Slides[Slide].Mood : Mood.Upset;
		}
	}

	protected override int BuildHash() => HashCode.Combine( Slide );
}