31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
[System.Serializable]
|
|
public class UserData:IEquatable<UserData>
|
|
{
|
|
public string nickName; // 用户名
|
|
public DeptData dept; // 空间信息
|
|
public List<PostDeptData> postDept; // 岗位信息
|
|
public List<RoleData> roles; // 角色信息
|
|
public List<ResearchesData> researches; // 课题组信息
|
|
|
|
// 实现IEquatable接口的Equals方法以及重写GetHashCode方法以及ToString方法
|
|
public bool Equals(UserData other)
|
|
{
|
|
if (other is null) return false;
|
|
if (ReferenceEquals(this, other)) return true;
|
|
return nickName == other.nickName && Equals(dept, other.dept) && Equals(postDept, other.postDept) && Equals(roles, other.roles) && Equals(researches, other.researches);
|
|
}
|
|
public override int GetHashCode()
|
|
{
|
|
return HashCode.Combine(nickName, dept, postDept, roles, researches);
|
|
}
|
|
public override string ToString()
|
|
{
|
|
return $"用户名: {nickName}, 空间信息: {dept}, 岗位信息: {postDept}, 角色信息: {roles}, 课题组信息: {researches}";
|
|
}
|
|
}
|