mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:37:28 +08:00
Move and rename nomination response model to singular
This commit is contained in:
parent
7f970f3cd8
commit
0f6735564e
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace osu.Game.Online.API.Requests.Responses
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
public struct BeatmapSetOnlineNominations
|
public struct BeatmapSetOnlineNomination
|
||||||
{
|
{
|
||||||
[JsonProperty(@"beatmapset_id")]
|
[JsonProperty(@"beatmapset_id")]
|
||||||
public int BeatmapsetId { get; set; }
|
public int BeatmapsetId { get; set; }
|
@ -112,7 +112,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
public BeatmapSetOnlineLanguage Language { get; set; }
|
public BeatmapSetOnlineLanguage Language { get; set; }
|
||||||
|
|
||||||
[JsonProperty(@"current_nominations")]
|
[JsonProperty(@"current_nominations")]
|
||||||
public BeatmapSetOnlineNominations[] CurrentNominations { get; set; } = Array.Empty<BeatmapSetOnlineNominations>();
|
public BeatmapSetOnlineNomination[] CurrentNominations { get; set; } = Array.Empty<BeatmapSetOnlineNomination>();
|
||||||
|
|
||||||
[JsonProperty(@"related_users")]
|
[JsonProperty(@"related_users")]
|
||||||
public APIUser[] RelatedUsers { get; set; } = Array.Empty<APIUser>();
|
public APIUser[] RelatedUsers { get; set; } = Array.Empty<APIUser>();
|
||||||
|
@ -125,7 +125,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
BeatmapSet.ValueChanged += b =>
|
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;
|
source.Metadata = b.NewValue?.Source ?? string.Empty;
|
||||||
tags.Metadata = b.NewValue?.Tags ?? string.Empty;
|
tags.Metadata = b.NewValue?.Tags ?? string.Empty;
|
||||||
genre.Metadata = b.NewValue?.Genre ?? new BeatmapSetOnlineGenre { Id = (int)SearchGenre.Unspecified };
|
genre.Metadata = b.NewValue?.Genre ?? new BeatmapSetOnlineGenre { Id = (int)SearchGenre.Unspecified };
|
||||||
|
@ -4,15 +4,16 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet
|
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
|
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)
|
: 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();
|
int[] nominatorIds = metadata.CurrentNominations.Select(n => n.UserId).ToArray();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user