1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-19 17:52:58 +08:00
osu-lazer/osu.Game/Online/API/Requests/Responses/APIMenuContent.cs

39 lines
1.1 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
2024-03-23 23:07:31 +08:00
using System.Linq;
using Newtonsoft.Json;
namespace osu.Game.Online.API.Requests.Responses
{
public class APIMenuContent : IEquatable<APIMenuContent>
{
/// <summary>
/// Images which should be displayed in rotation.
/// </summary>
[JsonProperty(@"images")]
public APIMenuImage[] Images { get; init; } = Array.Empty<APIMenuImage>();
public bool Equals(APIMenuContent? other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
2024-03-23 23:07:31 +08:00
return Images.SequenceEqual(other.Images);
}
2024-03-26 20:21:12 +08:00
public override bool Equals(object? other) => other is APIMenuContent content && Equals(content);
public override int GetHashCode()
{
2024-03-23 23:07:31 +08:00
var hash = new HashCode();
foreach (var image in Images)
hash.Add(image.GetHashCode());
return hash.ToHashCode();
}
}
}