Я сам не знаю как и что, но оно работает как то
This commit is contained in:
1 parent
af65f22aa9
commit
8f891ff59e
8 files changed
+128
-82
No files matched your search
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
|
||||
namespace mROA.Implementation
|
||||
{
|
||||
#pragma warning disable CS8618, CS9264
|
||||
public struct UniversalObjectIdentifier : IEquatable<UniversalObjectIdentifier>
|
||||
{
|
||||
public int ContextId;
|
||||
public int OwnerId;
|
||||
|
||||
public static UniversalObjectIdentifier Null = new UniversalObjectIdentifier { ContextId = -2, OwnerId = -1 };
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{{ {nameof(ContextId)}: {ContextId}, {nameof(OwnerId)}: {OwnerId} }}";
|
||||
}
|
||||
|
||||
public bool IsStatic => ContextId == -1;
|
||||
|
||||
public ulong Flat
|
||||
{
|
||||
get
|
||||
{
|
||||
return (ulong)OwnerId << 32 | (uint)ContextId;
|
||||
}
|
||||
set
|
||||
{
|
||||
OwnerId = (int)(value >> 32);
|
||||
ContextId = (int)(value & 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Equals(UniversalObjectIdentifier other)
|
||||
{
|
||||
return ContextId == other.ContextId && OwnerId == other.OwnerId;
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is UniversalObjectIdentifier other && Equals(other);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(ContextId, OwnerId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user