canto/Assets/Scripts/UI/Orchestration/SpawnElementRequest.cs
2025-07-18 20:38:44 -04:00

44 lines
No EOL
1.2 KiB
C#

using System;
using UnityEngine;
namespace KitsuneCafe.UI
{
public readonly struct SpawnElementRequest : IEquatable<SpawnElementRequest>
{
public readonly ElementId Id;
public readonly IUiElement Element;
public readonly Vector3 Position;
public SpawnElementRequest(ElementId id, IUiElement element, Vector3 position)
{
Id = id;
Element = element;
Position = position;
}
public static SpawnElementRequest Create(ElementId id, IUiElement element, Vector3 position) => new(id, element, position);
public override bool Equals(object obj)
{
return obj is SpawnElementRequest req
&& Equals(req);
}
public bool Equals(SpawnElementRequest other)
{
return other.Id == Id
&& other.Element == Element
&& other.Position == Position;
}
public override int GetHashCode()
{
return HashCode.Combine(Id, Element, Position);
}
public override string ToString()
{
return $"SpawnElementRequest {{ Id = {Id}, Element = \"{Element}\", Position = \"{Position}\" }}";
}
}
}