mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Scripting: Implemented Equals and GetHashCode for UUID
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
namespace GlitchyEngine.Core;
|
namespace GlitchyEngine.Core;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a universally unique identifier (UUID).
|
||||||
|
/// </summary>
|
||||||
public struct UUID
|
public struct UUID
|
||||||
{
|
{
|
||||||
private ulong _uuid;
|
private ulong _uuid;
|
||||||
@@ -15,6 +18,21 @@ public struct UUID
|
|||||||
|
|
||||||
public static bool operator !=(UUID left, UUID right) => left._uuid != right._uuid;
|
public static bool operator !=(UUID left, UUID right) => left._uuid != right._uuid;
|
||||||
|
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
if (obj is UUID other)
|
||||||
|
{
|
||||||
|
return this == other;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return _uuid.GetHashCode();
|
||||||
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return _uuid.ToString();
|
return _uuid.ToString();
|
||||||
|
|||||||
Reference in New Issue
Block a user