NG_/Assets/Scripts/Data/Entity/ChemicalStorageData.cs
2024-12-13 19:40:05 +08:00

36 lines
1.2 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// 危化品管理
[Serializable]
public class ChemicalStorageData:IEquatable<ChemicalStorageData>
{
public string chemicalName; // 危化品名称
public string createTime; // 创建时间
public string nickName; // 操作人
public string weight; // 重量
public string operationType; // 操作类型
// 实现IEquatable接口的Equals方法
public bool Equals(ChemicalStorageData other)
{
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
return chemicalName == other.chemicalName && createTime == other.createTime && nickName == other.nickName && weight == other.weight && operationType == other.operationType;
}
// 重写GetHashCode方法以及ToString方法
public override int GetHashCode()
{
return HashCode.Combine(chemicalName, createTime, nickName, weight, operationType);
}
public override string ToString()
{
return $"危化品名称: {chemicalName}, 创建时间: {createTime}, 操作人: {nickName}, 重量: {weight}, 操作类型: {operationType}";
}
}