Files
BlockSpace-v1.5.0b/Assets/Scripts/Assembly-CSharp/BSValueUtility.cs
T
2026-06-01 17:19:55 +02:00

24 lines
572 B
C#

using System;
internal static class BSValueUtility
{
public static bool Equals(BSValue a, BSValue b)
{
a = a.Normalize();
b = b.Normalize();
if (a.Kind != b.Kind)
{
return false;
}
return a.Kind switch
{
BSValueKind.Number => Math.Abs(a.Number - b.Number) <= 0.0001,
BSValueKind.Text => string.Equals(a.Text ?? string.Empty, b.Text ?? string.Empty, StringComparison.Ordinal),
BSValueKind.Bool => a.Bool == b.Bool,
BSValueKind.Player => a.PlayerId == b.PlayerId,
BSValueKind.Group => a.GroupId == b.GroupId,
_ => true,
};
}
}