27 lines
878 B
C#
27 lines
878 B
C#
using System;using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
// 设备状态数据
|
|
[System.Serializable]
|
|
public class DeviceStateData:IEquatable<DeviceStateData>
|
|
{
|
|
public string deviceStatus; // 设备状态
|
|
public int statusCount; // 状态数量
|
|
|
|
// 实现IEquatable接口的Equals方法以及重写GetHashCode方法以及ToString方法
|
|
public bool Equals(DeviceStateData other)
|
|
{
|
|
if (other is null) return false;
|
|
if (ReferenceEquals(this, other)) return true;
|
|
return deviceStatus == other.deviceStatus && statusCount == other.statusCount;
|
|
}
|
|
public override int GetHashCode()
|
|
{
|
|
return HashCode.Combine(deviceStatus, statusCount);
|
|
}
|
|
public override string ToString()
|
|
{
|
|
return $"设备状态: {deviceStatus}, 状态数量: {statusCount}";
|
|
}
|
|
}
|