UI/SpawnMenu/Spawnlists/SpawnlistFooter.razor.cs

A UI panel class for the spawnlist footer in the spawn menu. It provides creation and refresh actions and participates in the UI hashing system.

using Sandbox.UI;
namespace Sandbox;

public partial class SpawnlistFooter : Panel
{
	protected override int BuildHash() => HashCode.Combine( CanCreate() );

	bool CanCreate()
	{
		return true;
	}

	void CreateSpawnlist()
	{
		SpawnlistData.PromptCreate( this, onCreated: () => Ancestors.OfType<SpawnlistsPage>().FirstOrDefault()?.RefreshList() );
	}

	void Refresh()
	{
		Ancestors.OfType<SpawnlistsPage>().FirstOrDefault()?.RefreshList();
	}
}