1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 03:42:57 +08:00

Move and rename nomination response model to singular

This commit is contained in:
Joseph Madamba 2023-01-07 10:54:48 -08:00
parent 7f970f3cd8
commit 0f6735564e
4 changed files with 9 additions and 8 deletions

View File

@ -3,9 +3,9 @@
using Newtonsoft.Json;
namespace osu.Game.Online.API.Requests.Responses
namespace osu.Game.Beatmaps
{
public struct BeatmapSetOnlineNominations
public struct BeatmapSetOnlineNomination
{
[JsonProperty(@"beatmapset_id")]
public int BeatmapsetId { get; set; }

View File

@ -112,7 +112,7 @@ namespace osu.Game.Online.API.Requests.Responses
public BeatmapSetOnlineLanguage Language { get; set; }
[JsonProperty(@"current_nominations")]
public BeatmapSetOnlineNominations[] CurrentNominations { get; set; } = Array.Empty<BeatmapSetOnlineNominations>();
public BeatmapSetOnlineNomination[] CurrentNominations { get; set; } = Array.Empty<BeatmapSetOnlineNomination>();
[JsonProperty(@"related_users")]
public APIUser[] RelatedUsers { get; set; } = Array.Empty<APIUser>();

View File

@ -125,7 +125,7 @@ namespace osu.Game.Overlays.BeatmapSet
BeatmapSet.ValueChanged += b =>
{
nominators.Metadata = (b.NewValue?.CurrentNominations ?? Array.Empty<BeatmapSetOnlineNominations>(), b.NewValue?.RelatedUsers ?? Array.Empty<APIUser>());
nominators.Metadata = (b.NewValue?.CurrentNominations ?? Array.Empty<BeatmapSetOnlineNomination>(), b.NewValue?.RelatedUsers ?? Array.Empty<APIUser>());
source.Metadata = b.NewValue?.Source ?? string.Empty;
tags.Metadata = b.NewValue?.Tags ?? string.Empty;
genre.Metadata = b.NewValue?.Genre ?? new BeatmapSetOnlineGenre { Id = (int)SearchGenre.Unspecified };

View File

@ -4,15 +4,16 @@
using System;
using System.Linq;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.BeatmapSet
{
public partial class MetadataSectionNominators : MetadataSection<(BeatmapSetOnlineNominations[] CurrentNominations, APIUser[] RelatedUsers)>
public partial class MetadataSectionNominators : MetadataSection<(BeatmapSetOnlineNomination[] CurrentNominations, APIUser[] RelatedUsers)>
{
public override (BeatmapSetOnlineNominations[] CurrentNominations, APIUser[] RelatedUsers) Metadata
public override (BeatmapSetOnlineNomination[] CurrentNominations, APIUser[] RelatedUsers) Metadata
{
set
{
@ -26,12 +27,12 @@ namespace osu.Game.Overlays.BeatmapSet
}
}
public MetadataSectionNominators(Action<(BeatmapSetOnlineNominations[] CurrentNominations, APIUser[] RelatedUsers)>? searchAction = null)
public MetadataSectionNominators(Action<(BeatmapSetOnlineNomination[] CurrentNominations, APIUser[] RelatedUsers)>? searchAction = null)
: base(MetadataType.Nominators, searchAction)
{
}
protected override void AddMetadata((BeatmapSetOnlineNominations[] CurrentNominations, APIUser[] RelatedUsers) metadata, LinkFlowContainer loaded)
protected override void AddMetadata((BeatmapSetOnlineNomination[] CurrentNominations, APIUser[] RelatedUsers) metadata, LinkFlowContainer loaded)
{
int[] nominatorIds = metadata.CurrentNominations.Select(n => n.UserId).ToArray();