Add KV comparer for stats
This commit is contained in:
parent
3176f6b736
commit
746d14681b
@ -36,11 +36,24 @@ public sealed record EquipmentStats(Dictionary<EBaseParam, StatInfo> Stats, byte
|
|||||||
{
|
{
|
||||||
return other != null &&
|
return other != null &&
|
||||||
MateriaCount == other.MateriaCount &&
|
MateriaCount == other.MateriaCount &&
|
||||||
Stats.SequenceEqual(other.Stats);
|
Stats.SequenceEqual(other.Stats, new KeyValuePairComparer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
{
|
{
|
||||||
return HashCode.Combine(MateriaCount, Stats);
|
return HashCode.Combine(MateriaCount, Stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private sealed class KeyValuePairComparer : IEqualityComparer<KeyValuePair<EBaseParam, StatInfo>>
|
||||||
|
{
|
||||||
|
public bool Equals(KeyValuePair<EBaseParam, StatInfo> x, KeyValuePair<EBaseParam, StatInfo> y)
|
||||||
|
{
|
||||||
|
return x.Key == y.Key && Equals(x.Value, y.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetHashCode(KeyValuePair<EBaseParam, StatInfo> obj)
|
||||||
|
{
|
||||||
|
return HashCode.Combine((int)obj.Key, obj.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user