using System; using System.Collections; using System.Collections.Generic; using UnityEngine; // 通知数据结构 [Serializable] public class NoticeData:IEquatable { public string createTime; // 创建时间 public string noticeTitle; // 通知标题 public string noticeContent; // 通知内容 // 实现IEquatable接口的Equals方法以及重写GetHashCode方法以及ToString方法 public bool Equals(NoticeData other) { if (other is null) return false; if (ReferenceEquals(this, other)) return true; return createTime == other.createTime && noticeTitle == other.noticeTitle && noticeContent == other.noticeContent; } public override int GetHashCode() { return HashCode.Combine(createTime, noticeTitle, noticeContent); } public override string ToString() { return $"创建时间: {createTime}, 通知标题: {noticeTitle}, 通知内容: {noticeContent}"; } }