mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 19:10:32 +00:00
54 lines
1.2 KiB
C#
54 lines
1.2 KiB
C#
#if ENABLE_UNET
|
|
using System;
|
|
|
|
namespace UnityEngine.Networking
|
|
{
|
|
[Serializable]
|
|
public struct NetworkInstanceId
|
|
{
|
|
public NetworkInstanceId(uint value)
|
|
{
|
|
m_Value = value;
|
|
}
|
|
|
|
[SerializeField]
|
|
readonly uint m_Value;
|
|
|
|
public bool IsEmpty()
|
|
{
|
|
return m_Value == 0;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return (int)m_Value;
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
return obj is NetworkInstanceId && this == (NetworkInstanceId)obj;
|
|
}
|
|
|
|
public static bool operator==(NetworkInstanceId c1, NetworkInstanceId c2)
|
|
{
|
|
return c1.m_Value == c2.m_Value;
|
|
}
|
|
|
|
public static bool operator!=(NetworkInstanceId c1, NetworkInstanceId c2)
|
|
{
|
|
return c1.m_Value != c2.m_Value;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return m_Value.ToString();
|
|
}
|
|
|
|
public uint Value { get { return m_Value; } }
|
|
|
|
public static NetworkInstanceId Invalid = new NetworkInstanceId(uint.MaxValue);
|
|
internal static NetworkInstanceId Zero = new NetworkInstanceId(0);
|
|
}
|
|
}
|
|
#endif
|