mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 18:12:56 +08:00
Extend Beatmap Set Response
This commit is contained in:
parent
4175f52f0b
commit
c2f3971188
@ -53,6 +53,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
Submitted = new DateTime(2016, 2, 10),
|
Submitted = new DateTime(2016, 2, 10),
|
||||||
Ranked = new DateTime(2016, 6, 19),
|
Ranked = new DateTime(2016, 6, 19),
|
||||||
BPM = 236,
|
BPM = 236,
|
||||||
|
HasVideo = true,
|
||||||
Covers = new BeatmapSetOnlineCovers
|
Covers = new BeatmapSetOnlineCovers
|
||||||
{
|
{
|
||||||
Cover = @"https://assets.ppy.sh/beatmaps/415886/covers/cover.jpg?1465651778",
|
Cover = @"https://assets.ppy.sh/beatmaps/415886/covers/cover.jpg?1465651778",
|
||||||
@ -75,7 +76,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
OnlineInfo = new BeatmapOnlineInfo
|
OnlineInfo = new BeatmapOnlineInfo
|
||||||
{
|
{
|
||||||
Length = 115000,
|
Length = 115000,
|
||||||
HasVideo = false,
|
|
||||||
CircleCount = 265,
|
CircleCount = 265,
|
||||||
SliderCount = 71,
|
SliderCount = 71,
|
||||||
PlayCount = 47906,
|
PlayCount = 47906,
|
||||||
@ -103,7 +103,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
OnlineInfo = new BeatmapOnlineInfo
|
OnlineInfo = new BeatmapOnlineInfo
|
||||||
{
|
{
|
||||||
Length = 118000,
|
Length = 118000,
|
||||||
HasVideo = true,
|
|
||||||
CircleCount = 592,
|
CircleCount = 592,
|
||||||
SliderCount = 62,
|
SliderCount = 62,
|
||||||
PlayCount = 162021,
|
PlayCount = 162021,
|
||||||
@ -131,7 +130,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
OnlineInfo = new BeatmapOnlineInfo
|
OnlineInfo = new BeatmapOnlineInfo
|
||||||
{
|
{
|
||||||
Length = 118000,
|
Length = 118000,
|
||||||
HasVideo = false,
|
|
||||||
CircleCount = 1042,
|
CircleCount = 1042,
|
||||||
SliderCount = 79,
|
SliderCount = 79,
|
||||||
PlayCount = 225178,
|
PlayCount = 225178,
|
||||||
@ -159,7 +157,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
OnlineInfo = new BeatmapOnlineInfo
|
OnlineInfo = new BeatmapOnlineInfo
|
||||||
{
|
{
|
||||||
Length = 118000,
|
Length = 118000,
|
||||||
HasVideo = false,
|
|
||||||
CircleCount = 1352,
|
CircleCount = 1352,
|
||||||
SliderCount = 69,
|
SliderCount = 69,
|
||||||
PlayCount = 131545,
|
PlayCount = 131545,
|
||||||
@ -187,7 +184,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
OnlineInfo = new BeatmapOnlineInfo
|
OnlineInfo = new BeatmapOnlineInfo
|
||||||
{
|
{
|
||||||
Length = 118000,
|
Length = 118000,
|
||||||
HasVideo = false,
|
|
||||||
CircleCount = 1730,
|
CircleCount = 1730,
|
||||||
SliderCount = 115,
|
SliderCount = 115,
|
||||||
PlayCount = 117673,
|
PlayCount = 117673,
|
||||||
@ -227,6 +223,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
Submitted = new DateTime(2016, 6, 11),
|
Submitted = new DateTime(2016, 6, 11),
|
||||||
Ranked = new DateTime(2016, 7, 12),
|
Ranked = new DateTime(2016, 7, 12),
|
||||||
BPM = 160,
|
BPM = 160,
|
||||||
|
HasVideo = false,
|
||||||
Covers = new BeatmapSetOnlineCovers
|
Covers = new BeatmapSetOnlineCovers
|
||||||
{
|
{
|
||||||
Cover = @"https://assets.ppy.sh/beatmaps/625493/covers/cover.jpg?1499167472",
|
Cover = @"https://assets.ppy.sh/beatmaps/625493/covers/cover.jpg?1499167472",
|
||||||
@ -249,7 +246,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
OnlineInfo = new BeatmapOnlineInfo
|
OnlineInfo = new BeatmapOnlineInfo
|
||||||
{
|
{
|
||||||
Length = 193000,
|
Length = 193000,
|
||||||
HasVideo = false,
|
|
||||||
CircleCount = 262,
|
CircleCount = 262,
|
||||||
SliderCount = 0,
|
SliderCount = 0,
|
||||||
PlayCount = 3952,
|
PlayCount = 3952,
|
||||||
@ -277,7 +273,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
OnlineInfo = new BeatmapOnlineInfo
|
OnlineInfo = new BeatmapOnlineInfo
|
||||||
{
|
{
|
||||||
Length = 193000,
|
Length = 193000,
|
||||||
HasVideo = false,
|
|
||||||
CircleCount = 464,
|
CircleCount = 464,
|
||||||
SliderCount = 0,
|
SliderCount = 0,
|
||||||
PlayCount = 4833,
|
PlayCount = 4833,
|
||||||
@ -305,7 +300,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
OnlineInfo = new BeatmapOnlineInfo
|
OnlineInfo = new BeatmapOnlineInfo
|
||||||
{
|
{
|
||||||
Length = 193000,
|
Length = 193000,
|
||||||
HasVideo = false,
|
|
||||||
CircleCount = 712,
|
CircleCount = 712,
|
||||||
SliderCount = 0,
|
SliderCount = 0,
|
||||||
PlayCount = 4405,
|
PlayCount = 4405,
|
||||||
@ -333,7 +327,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
OnlineInfo = new BeatmapOnlineInfo
|
OnlineInfo = new BeatmapOnlineInfo
|
||||||
{
|
{
|
||||||
Length = 193000,
|
Length = 193000,
|
||||||
HasVideo = false,
|
|
||||||
CircleCount = 943,
|
CircleCount = 943,
|
||||||
SliderCount = 0,
|
SliderCount = 0,
|
||||||
PlayCount = 3950,
|
PlayCount = 3950,
|
||||||
@ -361,7 +354,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
OnlineInfo = new BeatmapOnlineInfo
|
OnlineInfo = new BeatmapOnlineInfo
|
||||||
{
|
{
|
||||||
Length = 193000,
|
Length = 193000,
|
||||||
HasVideo = false,
|
|
||||||
CircleCount = 1068,
|
CircleCount = 1068,
|
||||||
SliderCount = 0,
|
SliderCount = 0,
|
||||||
PlayCount = 5856,
|
PlayCount = 5856,
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -15,33 +13,24 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double Length { get; set; }
|
public double Length { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether or not this beatmap has a background video.
|
|
||||||
/// </summary>
|
|
||||||
public bool HasVideo { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The amount of circles in this beatmap.
|
/// The amount of circles in this beatmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty(@"count_circles")]
|
|
||||||
public int CircleCount { get; set; }
|
public int CircleCount { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The amount of sliders in this beatmap.
|
/// The amount of sliders in this beatmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty(@"count_sliders")]
|
|
||||||
public int SliderCount { get; set; }
|
public int SliderCount { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The amount of plays this beatmap has.
|
/// The amount of plays this beatmap has.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty(@"playcount")]
|
|
||||||
public int PlayCount { get; set; }
|
public int PlayCount { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The amount of passes this beatmap has.
|
/// The amount of passes this beatmap has.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty(@"passcount")]
|
|
||||||
public int PassCount { get; set; }
|
public int PassCount { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
@ -25,17 +24,20 @@ namespace osu.Game.Beatmaps
|
|||||||
/// The date this beatmap set was last updated.
|
/// The date this beatmap set was last updated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTimeOffset? LastUpdated { get; set; }
|
public DateTimeOffset? LastUpdated { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether or not this beatmap set has a background video.
|
||||||
|
/// </summary>
|
||||||
|
public bool HasVideo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The different sizes of cover art for this beatmap set.
|
/// The different sizes of cover art for this beatmap set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty(@"covers")]
|
|
||||||
public BeatmapSetOnlineCovers Covers { get; set; }
|
public BeatmapSetOnlineCovers Covers { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A small sample clip of this beatmap set's song.
|
/// A small sample clip of this beatmap set's song.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty(@"previewUrl")]
|
|
||||||
public string Preview { get; set; }
|
public string Preview { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -46,13 +48,11 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The amount of plays this beatmap set has.
|
/// The amount of plays this beatmap set has.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty(@"play_count")]
|
|
||||||
public int PlayCount { get; set; }
|
public int PlayCount { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The amount of people who have favourited this beatmap set.
|
/// The amount of people who have favourited this beatmap set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty(@"favourite_count")]
|
|
||||||
public int FavouriteCount { get; set; }
|
public int FavouriteCount { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,17 +60,14 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
public string CoverLowRes { get; set; }
|
public string CoverLowRes { get; set; }
|
||||||
|
|
||||||
[JsonProperty(@"cover@2x")]
|
|
||||||
public string Cover { get; set; }
|
public string Cover { get; set; }
|
||||||
|
|
||||||
public string CardLowRes { get; set; }
|
public string CardLowRes { get; set; }
|
||||||
|
|
||||||
[JsonProperty(@"card@2x")]
|
|
||||||
public string Card { get; set; }
|
public string Card { get; set; }
|
||||||
|
|
||||||
public string ListLowRes { get; set; }
|
public string ListLowRes { get; set; }
|
||||||
|
|
||||||
[JsonProperty(@"list@2x")]
|
|
||||||
public string List { get; set; }
|
public string List { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace osu.Game.Online.API.Requests
|
namespace osu.Game.Online.API.Requests
|
||||||
{
|
{
|
||||||
@ -23,6 +24,21 @@ namespace osu.Game.Online.API.Requests
|
|||||||
[JsonProperty(@"favourite_count")]
|
[JsonProperty(@"favourite_count")]
|
||||||
private int favouriteCount { get; set; }
|
private int favouriteCount { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(@"bpm")]
|
||||||
|
private double bpm { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(@"video")]
|
||||||
|
private bool hasVideo { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(@"submitted_date")]
|
||||||
|
private DateTimeOffset submitted { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(@"ranked_date")]
|
||||||
|
private DateTimeOffset ranked { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(@"last_updated")]
|
||||||
|
private DateTimeOffset lastUpdated { get; set; }
|
||||||
|
|
||||||
[JsonProperty(@"user_id")]
|
[JsonProperty(@"user_id")]
|
||||||
private long creatorId {
|
private long creatorId {
|
||||||
set { Author.Id = value; }
|
set { Author.Id = value; }
|
||||||
@ -43,6 +59,11 @@ namespace osu.Game.Online.API.Requests
|
|||||||
Preview = preview,
|
Preview = preview,
|
||||||
PlayCount = playCount,
|
PlayCount = playCount,
|
||||||
FavouriteCount = favouriteCount,
|
FavouriteCount = favouriteCount,
|
||||||
|
BPM = bpm,
|
||||||
|
HasVideo = hasVideo,
|
||||||
|
Submitted = submitted,
|
||||||
|
Ranked = ranked,
|
||||||
|
LastUpdated = lastUpdated,
|
||||||
},
|
},
|
||||||
Beatmaps = beatmaps.Select(b => b.ToBeatmap(rulesets)).ToList(),
|
Beatmaps = beatmaps.Select(b => b.ToBeatmap(rulesets)).ToList(),
|
||||||
};
|
};
|
||||||
@ -62,6 +83,30 @@ namespace osu.Game.Online.API.Requests
|
|||||||
[JsonProperty(@"difficulty_rating")]
|
[JsonProperty(@"difficulty_rating")]
|
||||||
private double starDifficulty { get; set; }
|
private double starDifficulty { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(@"drain")]
|
||||||
|
private float drainRate { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(@"cs")]
|
||||||
|
private float circleSize { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(@"ar")]
|
||||||
|
private float approachRate { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(@"accuracy")]
|
||||||
|
private float overallDifficulty { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(@"total_length")]
|
||||||
|
private double length { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(@"count_circles")]
|
||||||
|
private int circleCount { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(@"count_sliders")]
|
||||||
|
private int sliderCount { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(@"version")]
|
||||||
|
private string version { get; set; }
|
||||||
|
|
||||||
public BeatmapInfo ToBeatmap(RulesetStore rulesets)
|
public BeatmapInfo ToBeatmap(RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
return new BeatmapInfo
|
return new BeatmapInfo
|
||||||
@ -69,10 +114,21 @@ namespace osu.Game.Online.API.Requests
|
|||||||
Metadata = this,
|
Metadata = this,
|
||||||
Ruleset = rulesets.GetRuleset(ruleset),
|
Ruleset = rulesets.GetRuleset(ruleset),
|
||||||
StarDifficulty = starDifficulty,
|
StarDifficulty = starDifficulty,
|
||||||
|
Version = version,
|
||||||
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
|
{
|
||||||
|
DrainRate = drainRate,
|
||||||
|
CircleSize = circleSize,
|
||||||
|
ApproachRate = approachRate,
|
||||||
|
OverallDifficulty = overallDifficulty,
|
||||||
|
},
|
||||||
OnlineInfo = new BeatmapOnlineInfo
|
OnlineInfo = new BeatmapOnlineInfo
|
||||||
{
|
{
|
||||||
PlayCount = playCount,
|
PlayCount = playCount,
|
||||||
PassCount = passCount,
|
PassCount = passCount,
|
||||||
|
Length = length,
|
||||||
|
CircleCount = circleCount,
|
||||||
|
SliderCount = sliderCount,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,9 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
if (value == beatmap) return;
|
if (value == beatmap) return;
|
||||||
beatmap = value;
|
beatmap = value;
|
||||||
|
|
||||||
length.Value = TimeSpan.FromMilliseconds(beatmap.OnlineInfo.Length).ToString(@"m\:ss");
|
length.Value = TimeSpan.FromSeconds(beatmap.OnlineInfo.Length).ToString(@"m\:ss");
|
||||||
circleCount.Value = beatmap.OnlineInfo.CircleCount.ToString("N0");
|
circleCount.Value = beatmap.OnlineInfo.CircleCount.ToString();
|
||||||
sliderCount.Value = beatmap.OnlineInfo.SliderCount.ToString("N0");
|
sliderCount.Value = beatmap.OnlineInfo.SliderCount.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
private readonly Box tabsBg;
|
private readonly Box tabsBg;
|
||||||
private readonly Container coverContainer;
|
private readonly Container coverContainer;
|
||||||
private readonly OsuSpriteText title, artist;
|
private readonly OsuSpriteText title, artist;
|
||||||
|
private readonly Container noVideoButtons;
|
||||||
|
private readonly FillFlowContainer videoButtons;
|
||||||
private readonly AuthorInfo author;
|
private readonly AuthorInfo author;
|
||||||
public Details Details;
|
public Details Details;
|
||||||
|
|
||||||
@ -46,6 +48,9 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
title.Text = BeatmapSet.Metadata.Title;
|
title.Text = BeatmapSet.Metadata.Title;
|
||||||
artist.Text = BeatmapSet.Metadata.Artist;
|
artist.Text = BeatmapSet.Metadata.Artist;
|
||||||
|
|
||||||
|
noVideoButtons.FadeTo(BeatmapSet.OnlineInfo.HasVideo ? 0 : 1, transition_duration);
|
||||||
|
videoButtons.FadeTo(BeatmapSet.OnlineInfo.HasVideo ? 1 : 0, transition_duration);
|
||||||
|
|
||||||
cover?.FadeOut(400, Easing.Out);
|
cover?.FadeOut(400, Easing.Out);
|
||||||
coverContainer.Add(cover = new DelayedLoadWrapper(new BeatmapSetCover(BeatmapSet)
|
coverContainer.Add(cover = new DelayedLoadWrapper(new BeatmapSetCover(BeatmapSet)
|
||||||
{
|
{
|
||||||
@ -77,9 +82,6 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
Radius = 3,
|
Radius = 3,
|
||||||
Offset = new Vector2(0f, 1f),
|
Offset = new Vector2(0f, 1f),
|
||||||
};
|
};
|
||||||
|
|
||||||
Container noVideoButtons;
|
|
||||||
FillFlowContainer videoButtons;
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
@ -202,21 +204,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Picker.Beatmap.ValueChanged += b =>
|
Picker.Beatmap.ValueChanged += b => Details.Beatmap = b;
|
||||||
{
|
|
||||||
Details.Beatmap = b;
|
|
||||||
|
|
||||||
if (b.OnlineInfo.HasVideo)
|
|
||||||
{
|
|
||||||
noVideoButtons.FadeOut(transition_duration);
|
|
||||||
videoButtons.FadeIn(transition_duration);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
noVideoButtons.FadeIn(transition_duration);
|
|
||||||
videoButtons.FadeOut(transition_duration);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
Loading…
Reference in New Issue
Block a user