using System; using System.Collections.Generic; using UnityEngine.SceneManagement; namespace FishNet.Serializing.Helping { public class GeneratedComparer { /// /// Compare if T is default. /// public static Func IsDefault { internal get; set; } /// /// Compare if T is the same as T2. /// public static Func Compare { internal get; set; } } public class Comparers { /// /// Returns if A equals B using EqualityCompare. /// /// /// /// /// public static bool EqualityCompare(T a, T b) { return EqualityComparer.Default.Equals(a, b); } public static bool IsDefault(T t) { return t.Equals(default(T)); } public static bool IsEqualityCompareDefault(T a) { return EqualityComparer.Default.Equals(a, default(T)); } } internal class SceneComparer : IEqualityComparer { public bool Equals(Scene a, Scene b) { if (!a.IsValid() || !b.IsValid()) return false; if (a.handle != 0 || b.handle != 0) return (a.handle == b.handle); return (a.name == b.name); } public int GetHashCode(Scene obj) { return obj.GetHashCode(); } } }