UI/Tutorials/TutorialHint.razor.cs
namespace Opium;

public partial class TutorialHint
{
	[ActionGraphNode( "opium.tutorialpopup" ), Category( "Opium" ), Title( "Create Tutorial Popup" ), Icon( "directions_walk" )]
	[ConCmd( "op_dev_ui_tutorial" )]
	public static void StaticShow( string text, string inputAction = null, float duration = 5f, bool freeze = false )
	{
		PlayerController.Local.GetComponentInChildren<TutorialHint>().Show( text, inputAction, duration, freeze );
	}

	public void Show( string text, string inputAction = null, float duration = 5f, bool freeze = false )
	{
		Message = text;
		InputAction = inputAction;
		TimeUntilRemoval = duration;
		Freeze = freeze;

		if ( Freeze )
		{
			Scene.TimeScale = 0f;
		}
	}

	public async void LerpTimescaleTo( float target )
	{
		while ( !Scene.TimeScale.AlmostEqual( target, 0.1f ) )
		{
			Scene.TimeScale = Scene.TimeScale.LerpTo( target, Time.Delta * 5f );
			await GameTask.Delay( 1 );
		}

		Scene.TimeScale = target;
	}

	public void Dismiss()
	{
		if ( Freeze )
		{
			Freeze = false;
			Scene.TimeScale = 1.0f;
			LerpTimescaleTo( 1f );
			TimeUntilRemoval = 0;
		}
	}
}