UI/SceneVialSelectable.razor

A small UI Razor component for s&box that renders a selectable scene entry. It shows the scene title and description from Scene metadata and invokes an OnSelected callback when clicked.

NetworkingFile Access
@using Sandbox;
@using Sandbox.UI;
@inherits Panel
@namespace Sandbox

<root onClick="@( () => OnSelected( Scene ) )">

    <div class="title">@Scene.GetMetadata("Title", Scene.ResourceName)</div>
    <div class="description">@Scene.GetMetadata("Description")</div>

</root>

@code
{
	// Yoink https://github.com/Facepunch/sbox-scenestaging/blob/main/Code/SceneMenu/SceneButton.razor Facepunch's code!

	[Parameter] public new SceneFile Scene { get; set; }
    [Parameter] public Action<SceneFile> OnSelected { get; set; }

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