UI/FloatingTextManager/FloatingTextManager.razor
@using Sandbox;
@using Sandbox.UI;
@namespace Milaine.UI
@inherits Panel
<root></root>
@code {
public static FloatingTextManager Instance { get; set; }
public FloatingTextManager()
{
Instance = this;
}
public override void OnDeleted()
{
base.OnDeleted();
if (Instance == this)
{
Instance = null;
}
}
public void Spawn(string text, float screenX, float screenY)
{
var floatingText = AddChild<FloatingText>();
floatingText.Text = text;
floatingText.SpawnX = screenX;
floatingText.SpawnY = screenY;
}
}
<style>
FloatingTextManager {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
}
</style>