using System; using System.Collections; using System.Collections.Generic; using UnityEngine; // 空间 [System.Serializable] public class DeptData:IEquatable { public string deptName; // 空间ID public string labName; // 实验室名称 // 实现IEquatable接口的Equals方法以及重写GetHashCode方法以及ToString方法 public bool Equals(DeptData other) { if (other is null) return false; if (ReferenceEquals(this, other)) return true; return deptName == other.deptName && labName == other.labName; } public override int GetHashCode() { return HashCode.Combine(deptName, labName); } public override string ToString() { return $"空间ID: {deptName}, 实验室名称: {labName}"; } }