44 lines
No EOL
1.2 KiB
C#
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}\" }}";
|
|
}
|
|
}
|
|
} |