using System; using UnityEngine; namespace RPGCore.GlobalModules.ProfileManagerGlobalModule { [Serializable] public sealed class Profile : Profile where T : class { public new T data { set => base.data = value; get => base.data as T; } public Profile() : this(Environment.MachineName) { } public Profile(string profileName) { name = profileName; } } public abstract class Profile { private protected Profile() { } public readonly string guid = Guid.NewGuid().ToString(); public readonly string version = Application.version; public string name; public object data; public static bool operator ==(Profile obj1, Profile obj2) => obj1?.guid == obj2?.guid; public static bool operator !=(Profile obj1, Profile obj2) => !(obj1 == obj2); public override bool Equals(object obj) => obj is Profile other && guid == other.guid; public override int GetHashCode() => guid.GetHashCode(); } }