mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 10:02:59 +08:00
Update all beatmap overlay views to use APIBeatmap
/APIBeatmapSet
This commit is contained in:
parent
b8ee7e05f4
commit
a16c8f1ebc
@ -21,15 +21,12 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestUndownloadableWithLink()
|
public void TestUndownloadableWithLink()
|
||||||
{
|
{
|
||||||
AddStep("set undownloadable beatmapset with link", () => container.BeatmapSet = new BeatmapSetInfo
|
AddStep("set undownloadable beatmapset with link", () => container.BeatmapSet = new APIBeatmapSet
|
||||||
{
|
{
|
||||||
OnlineInfo = new APIBeatmapSet
|
Availability = new BeatmapSetOnlineAvailability
|
||||||
{
|
{
|
||||||
Availability = new BeatmapSetOnlineAvailability
|
DownloadDisabled = true,
|
||||||
{
|
ExternalLink = @"https://osu.ppy.sh",
|
||||||
DownloadDisabled = true,
|
|
||||||
ExternalLink = @"https://osu.ppy.sh",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -39,14 +36,11 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestUndownloadableNoLink()
|
public void TestUndownloadableNoLink()
|
||||||
{
|
{
|
||||||
AddStep("set undownloadable beatmapset without link", () => container.BeatmapSet = new BeatmapSetInfo
|
AddStep("set undownloadable beatmapset without link", () => container.BeatmapSet = new APIBeatmapSet
|
||||||
{
|
{
|
||||||
OnlineInfo = new APIBeatmapSet
|
Availability = new BeatmapSetOnlineAvailability
|
||||||
{
|
{
|
||||||
Availability = new BeatmapSetOnlineAvailability
|
DownloadDisabled = true,
|
||||||
{
|
|
||||||
DownloadDisabled = true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -56,15 +50,12 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestPartsRemovedWithLink()
|
public void TestPartsRemovedWithLink()
|
||||||
{
|
{
|
||||||
AddStep("set parts-removed beatmapset with link", () => container.BeatmapSet = new BeatmapSetInfo
|
AddStep("set parts-removed beatmapset with link", () => container.BeatmapSet = new APIBeatmapSet
|
||||||
{
|
{
|
||||||
OnlineInfo = new APIBeatmapSet
|
Availability = new BeatmapSetOnlineAvailability
|
||||||
{
|
{
|
||||||
Availability = new BeatmapSetOnlineAvailability
|
DownloadDisabled = false,
|
||||||
{
|
ExternalLink = @"https://osu.ppy.sh",
|
||||||
DownloadDisabled = false,
|
|
||||||
ExternalLink = @"https://osu.ppy.sh",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -74,14 +65,11 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestNormal()
|
public void TestNormal()
|
||||||
{
|
{
|
||||||
AddStep("set normal beatmapset", () => container.BeatmapSet = new BeatmapSetInfo
|
AddStep("set normal beatmapset", () => container.BeatmapSet = new APIBeatmapSet
|
||||||
{
|
{
|
||||||
OnlineInfo = new APIBeatmapSet
|
Availability = new BeatmapSetOnlineAvailability
|
||||||
{
|
{
|
||||||
Availability = new BeatmapSetOnlineAvailability
|
DownloadDisabled = false,
|
||||||
{
|
|
||||||
DownloadDisabled = false,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.BeatmapSet;
|
using osu.Game.Overlays.BeatmapSet;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Online
|
namespace osu.Game.Tests.Visual.Online
|
||||||
{
|
{
|
||||||
@ -35,9 +35,9 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
|
|
||||||
AddStep("load multiple rulesets beatmapset", () =>
|
AddStep("load multiple rulesets beatmapset", () =>
|
||||||
{
|
{
|
||||||
selector.BeatmapSet = new BeatmapSetInfo
|
selector.BeatmapSet = new APIBeatmapSet
|
||||||
{
|
{
|
||||||
Beatmaps = enabledRulesets.Select(r => new BeatmapInfo { Ruleset = r }).ToList()
|
Beatmaps = enabledRulesets.Select(r => new APIBeatmap { RulesetID = r.OnlineID }).ToList()
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -53,13 +53,13 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
|
|
||||||
AddStep("load single ruleset beatmapset", () =>
|
AddStep("load single ruleset beatmapset", () =>
|
||||||
{
|
{
|
||||||
selector.BeatmapSet = new BeatmapSetInfo
|
selector.BeatmapSet = new APIBeatmapSet
|
||||||
{
|
{
|
||||||
Beatmaps = new List<BeatmapInfo>
|
Beatmaps = new List<APIBeatmap>
|
||||||
{
|
{
|
||||||
new BeatmapInfo
|
new APIBeatmap
|
||||||
{
|
{
|
||||||
Ruleset = enabledRuleset
|
RulesetID = enabledRuleset.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -71,9 +71,9 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestEmptyBeatmapSet()
|
public void TestEmptyBeatmapSet()
|
||||||
{
|
{
|
||||||
AddStep("load empty beatmapset", () => selector.BeatmapSet = new BeatmapSetInfo
|
AddStep("load empty beatmapset", () => selector.BeatmapSet = new APIBeatmapSet
|
||||||
{
|
{
|
||||||
Beatmaps = new List<BeatmapInfo>()
|
Beatmaps = new List<APIBeatmap>()
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("no ruleset selected", () => selector.SelectedTab == null);
|
AddAssert("no ruleset selected", () => selector.SelectedTab == null);
|
||||||
|
@ -49,60 +49,48 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
AddStep(@"show first", () =>
|
AddStep(@"show first", () =>
|
||||||
{
|
{
|
||||||
overlay.ShowBeatmapSet(new BeatmapSetInfo
|
overlay.ShowBeatmapSet(new APIBeatmapSet
|
||||||
{
|
{
|
||||||
OnlineBeatmapSetID = 1235,
|
OnlineID = 1235,
|
||||||
Metadata = new BeatmapMetadata
|
Title = @"an awesome beatmap",
|
||||||
|
Artist = @"naru narusegawa",
|
||||||
|
Source = @"hinata sou",
|
||||||
|
Tags = @"test tag tag more tag",
|
||||||
|
Author = new User
|
||||||
{
|
{
|
||||||
Title = @"an awesome beatmap",
|
Username = @"BanchoBot",
|
||||||
Artist = @"naru narusegawa",
|
Id = 3,
|
||||||
Source = @"hinata sou",
|
|
||||||
Tags = @"test tag tag more tag",
|
|
||||||
Author = new User
|
|
||||||
{
|
|
||||||
Username = @"BanchoBot",
|
|
||||||
Id = 3,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
OnlineInfo = new APIBeatmapSet
|
Preview = @"https://b.ppy.sh/preview/12345.mp3",
|
||||||
|
PlayCount = 123,
|
||||||
|
FavouriteCount = 456,
|
||||||
|
Submitted = DateTime.Now,
|
||||||
|
Ranked = DateTime.Now,
|
||||||
|
BPM = 111,
|
||||||
|
HasVideo = true,
|
||||||
|
Ratings = Enumerable.Range(0, 11).ToArray(),
|
||||||
|
HasStoryboard = true,
|
||||||
|
Covers = new BeatmapSetOnlineCovers(),
|
||||||
|
Beatmaps = new List<APIBeatmap>
|
||||||
{
|
{
|
||||||
Preview = @"https://b.ppy.sh/preview/12345.mp3",
|
new APIBeatmap
|
||||||
PlayCount = 123,
|
|
||||||
FavouriteCount = 456,
|
|
||||||
Submitted = DateTime.Now,
|
|
||||||
Ranked = DateTime.Now,
|
|
||||||
BPM = 111,
|
|
||||||
HasVideo = true,
|
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
HasStoryboard = true,
|
|
||||||
Covers = new BeatmapSetOnlineCovers(),
|
|
||||||
},
|
|
||||||
Beatmaps = new List<BeatmapInfo>
|
|
||||||
{
|
|
||||||
new BeatmapInfo
|
|
||||||
{
|
{
|
||||||
StarDifficulty = 9.99,
|
StarRating = 9.99,
|
||||||
Version = @"TEST",
|
DifficultyName = @"TEST",
|
||||||
Length = 456000,
|
Length = 456000,
|
||||||
Ruleset = rulesets.GetRuleset(3),
|
RulesetID = 3,
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
CircleSize = 1,
|
||||||
|
DrainRate = 2.3f,
|
||||||
|
OverallDifficulty = 4.5f,
|
||||||
|
ApproachRate = 6,
|
||||||
|
CircleCount = 111,
|
||||||
|
SliderCount = 12,
|
||||||
|
PlayCount = 222,
|
||||||
|
PassCount = 21,
|
||||||
|
FailTimes = new APIFailTimes
|
||||||
{
|
{
|
||||||
CircleSize = 1,
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
DrainRate = 2.3f,
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
OverallDifficulty = 4.5f,
|
|
||||||
ApproachRate = 6,
|
|
||||||
},
|
|
||||||
OnlineInfo = new APIBeatmap
|
|
||||||
{
|
|
||||||
CircleCount = 111,
|
|
||||||
SliderCount = 12,
|
|
||||||
PlayCount = 222,
|
|
||||||
PassCount = 21,
|
|
||||||
FailTimes = new APIFailTimes
|
|
||||||
{
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -120,71 +108,15 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
AddStep(@"show undownloadable", () =>
|
AddStep(@"show undownloadable", () =>
|
||||||
{
|
{
|
||||||
overlay.ShowBeatmapSet(new BeatmapSetInfo
|
var set = getBeatmapSet();
|
||||||
|
|
||||||
|
set.Availability = new BeatmapSetOnlineAvailability
|
||||||
{
|
{
|
||||||
OnlineBeatmapSetID = 1234,
|
DownloadDisabled = true,
|
||||||
Metadata = new BeatmapMetadata
|
ExternalLink = "https://osu.ppy.sh",
|
||||||
{
|
};
|
||||||
Title = @"undownloadable beatmap",
|
|
||||||
Artist = @"no one",
|
overlay.ShowBeatmapSet(set);
|
||||||
Source = @"some source",
|
|
||||||
Tags = @"another test tag tag more test tags",
|
|
||||||
Author = new User
|
|
||||||
{
|
|
||||||
Username = @"BanchoBot",
|
|
||||||
Id = 3,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
OnlineInfo = new APIBeatmapSet
|
|
||||||
{
|
|
||||||
Availability = new BeatmapSetOnlineAvailability
|
|
||||||
{
|
|
||||||
DownloadDisabled = true,
|
|
||||||
ExternalLink = "https://osu.ppy.sh",
|
|
||||||
},
|
|
||||||
Preview = @"https://b.ppy.sh/preview/1234.mp3",
|
|
||||||
PlayCount = 123,
|
|
||||||
FavouriteCount = 456,
|
|
||||||
Submitted = DateTime.Now,
|
|
||||||
Ranked = DateTime.Now,
|
|
||||||
BPM = 111,
|
|
||||||
HasVideo = true,
|
|
||||||
HasStoryboard = true,
|
|
||||||
Covers = new BeatmapSetOnlineCovers(),
|
|
||||||
Language = new BeatmapSetOnlineLanguage { Id = 3, Name = "English" },
|
|
||||||
Genre = new BeatmapSetOnlineGenre { Id = 4, Name = "Rock" },
|
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
},
|
|
||||||
Beatmaps = new List<BeatmapInfo>
|
|
||||||
{
|
|
||||||
new BeatmapInfo
|
|
||||||
{
|
|
||||||
StarDifficulty = 5.67,
|
|
||||||
Version = @"ANOTHER TEST",
|
|
||||||
Length = 123000,
|
|
||||||
Ruleset = rulesets.GetRuleset(1),
|
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
|
||||||
{
|
|
||||||
CircleSize = 9,
|
|
||||||
DrainRate = 8,
|
|
||||||
OverallDifficulty = 7,
|
|
||||||
ApproachRate = 6,
|
|
||||||
},
|
|
||||||
OnlineInfo = new APIBeatmap
|
|
||||||
{
|
|
||||||
CircleCount = 123,
|
|
||||||
SliderCount = 45,
|
|
||||||
PlayCount = 567,
|
|
||||||
PassCount = 89,
|
|
||||||
FailTimes = new APIFailTimes
|
|
||||||
{
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
downloadAssert(false);
|
downloadAssert(false);
|
||||||
@ -195,48 +127,30 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
AddStep("show multiple rulesets beatmap", () =>
|
AddStep("show multiple rulesets beatmap", () =>
|
||||||
{
|
{
|
||||||
var beatmaps = new List<BeatmapInfo>();
|
var beatmaps = new List<APIBeatmap>();
|
||||||
|
|
||||||
foreach (var ruleset in rulesets.AvailableRulesets.Skip(1))
|
foreach (var ruleset in rulesets.AvailableRulesets.Skip(1))
|
||||||
{
|
{
|
||||||
beatmaps.Add(new BeatmapInfo
|
beatmaps.Add(new APIBeatmap
|
||||||
{
|
{
|
||||||
Version = ruleset.Name,
|
DifficultyName = ruleset.Name,
|
||||||
Ruleset = ruleset,
|
RulesetID = ruleset.OnlineID,
|
||||||
BaseDifficulty = new BeatmapDifficulty(),
|
FailTimes = new APIFailTimes
|
||||||
OnlineInfo = new APIBeatmap
|
|
||||||
{
|
{
|
||||||
FailTimes = new APIFailTimes
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
{
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
},
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay.ShowBeatmapSet(new BeatmapSetInfo
|
var set = getBeatmapSet();
|
||||||
{
|
|
||||||
Metadata = new BeatmapMetadata
|
set.Beatmaps = beatmaps;
|
||||||
{
|
|
||||||
Title = @"multiple rulesets beatmap",
|
overlay.ShowBeatmapSet(set);
|
||||||
Artist = @"none",
|
|
||||||
Author = new User
|
|
||||||
{
|
|
||||||
Username = "BanchoBot",
|
|
||||||
Id = 3,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
OnlineInfo = new APIBeatmapSet
|
|
||||||
{
|
|
||||||
Covers = new BeatmapSetOnlineCovers(),
|
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
},
|
|
||||||
Beatmaps = beatmaps
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("shown beatmaps of current ruleset", () => overlay.Header.HeaderContent.Picker.Difficulties.All(b => b.BeatmapInfo.Ruleset.Equals(overlay.Header.RulesetSelector.Current.Value)));
|
AddAssert("shown beatmaps of current ruleset", () => overlay.Header.HeaderContent.Picker.Difficulties.All(b => b.Beatmap.Ruleset.OnlineID == overlay.Header.RulesetSelector.Current.Value.OnlineID));
|
||||||
AddAssert("left-most beatmap selected", () => overlay.Header.HeaderContent.Picker.Difficulties.First().State == BeatmapPicker.DifficultySelectorState.Selected);
|
AddAssert("left-most beatmap selected", () => overlay.Header.HeaderContent.Picker.Difficulties.First().State == BeatmapPicker.DifficultySelectorState.Selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +160,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddStep("show explicit map", () =>
|
AddStep("show explicit map", () =>
|
||||||
{
|
{
|
||||||
var beatmapSet = getBeatmapSet();
|
var beatmapSet = getBeatmapSet();
|
||||||
beatmapSet.OnlineInfo.HasExplicitContent = true;
|
beatmapSet.HasExplicitContent = true;
|
||||||
overlay.ShowBeatmapSet(beatmapSet);
|
overlay.ShowBeatmapSet(beatmapSet);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -257,7 +171,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddStep("show featured map", () =>
|
AddStep("show featured map", () =>
|
||||||
{
|
{
|
||||||
var beatmapSet = getBeatmapSet();
|
var beatmapSet = getBeatmapSet();
|
||||||
beatmapSet.OnlineInfo.TrackId = 1;
|
beatmapSet.TrackId = 1;
|
||||||
overlay.ShowBeatmapSet(beatmapSet);
|
overlay.ShowBeatmapSet(beatmapSet);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -274,63 +188,41 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddStep(@"show without reload", overlay.Show);
|
AddStep(@"show without reload", overlay.Show);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BeatmapSetInfo createManyDifficultiesBeatmapSet()
|
private APIBeatmapSet createManyDifficultiesBeatmapSet()
|
||||||
{
|
{
|
||||||
var beatmaps = new List<BeatmapInfo>();
|
var set = getBeatmapSet();
|
||||||
|
|
||||||
|
var beatmaps = new List<APIBeatmap>();
|
||||||
|
|
||||||
for (int i = 1; i < 41; i++)
|
for (int i = 1; i < 41; i++)
|
||||||
{
|
{
|
||||||
beatmaps.Add(new BeatmapInfo
|
beatmaps.Add(new APIBeatmap
|
||||||
{
|
{
|
||||||
OnlineBeatmapID = i * 10,
|
OnlineID = i * 10,
|
||||||
Version = $"Test #{i}",
|
DifficultyName = $"Test #{i}",
|
||||||
Ruleset = Ruleset.Value,
|
RulesetID = Ruleset.Value.ID ?? -1,
|
||||||
StarDifficulty = 2 + i * 0.1,
|
StarRating = 2 + i * 0.1,
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
OverallDifficulty = 3.5f,
|
||||||
|
FailTimes = new APIFailTimes
|
||||||
{
|
{
|
||||||
OverallDifficulty = 3.5f,
|
Fails = Enumerable.Range(1, 100).Select(j => j % 12 - 6).ToArray(),
|
||||||
|
Retries = Enumerable.Range(-2, 100).Select(j => j % 12 - 6).ToArray(),
|
||||||
},
|
},
|
||||||
OnlineInfo = new APIBeatmap
|
|
||||||
{
|
|
||||||
FailTimes = new APIFailTimes
|
|
||||||
{
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(j => j % 12 - 6).ToArray(),
|
|
||||||
Retries = Enumerable.Range(-2, 100).Select(j => j % 12 - 6).ToArray(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BeatmapSetInfo
|
set.Beatmaps = beatmaps;
|
||||||
{
|
|
||||||
OnlineBeatmapSetID = 123,
|
return set;
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
Title = @"many difficulties beatmap",
|
|
||||||
Artist = @"none",
|
|
||||||
Author = new User
|
|
||||||
{
|
|
||||||
Username = @"BanchoBot",
|
|
||||||
Id = 3,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
OnlineInfo = new APIBeatmapSet
|
|
||||||
{
|
|
||||||
Preview = @"https://b.ppy.sh/preview/123.mp3",
|
|
||||||
HasVideo = true,
|
|
||||||
HasStoryboard = true,
|
|
||||||
Covers = new BeatmapSetOnlineCovers(),
|
|
||||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
|
||||||
},
|
|
||||||
Beatmaps = beatmaps,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private BeatmapSetInfo getBeatmapSet()
|
private APIBeatmapSet getBeatmapSet()
|
||||||
{
|
{
|
||||||
var beatmapSet = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet;
|
var beatmapSet = CreateAPIBeatmapSet(Ruleset.Value);
|
||||||
|
|
||||||
// Make sure the overlay is reloaded (see `BeatmapSetInfo.Equals`).
|
// Make sure the overlay is reloaded (see `BeatmapSetInfo.Equals`).
|
||||||
beatmapSet.OnlineBeatmapSetID = nextBeatmapSetId++;
|
beatmapSet.OnlineID = nextBeatmapSetId++;
|
||||||
|
|
||||||
return beatmapSet;
|
return beatmapSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,27 +44,21 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddStep("set second set", () => details.BeatmapSet = secondSet);
|
AddStep("set second set", () => details.BeatmapSet = secondSet);
|
||||||
AddAssert("ratings set", () => details.Ratings.Ratings == secondSet.Ratings);
|
AddAssert("ratings set", () => details.Ratings.Ratings == secondSet.Ratings);
|
||||||
|
|
||||||
static BeatmapSetInfo createSet() => new BeatmapSetInfo
|
static APIBeatmapSet createSet() => new APIBeatmapSet
|
||||||
{
|
{
|
||||||
Beatmaps = new List<BeatmapInfo>
|
Beatmaps = new List<APIBeatmap>
|
||||||
{
|
{
|
||||||
new BeatmapInfo
|
new APIBeatmap
|
||||||
{
|
{
|
||||||
OnlineInfo = new APIBeatmap
|
FailTimes = new APIFailTimes
|
||||||
{
|
{
|
||||||
FailTimes = new APIFailTimes
|
Fails = Enumerable.Range(1, 100).Select(_ => RNG.Next(10)).ToArray(),
|
||||||
{
|
Retries = Enumerable.Range(-2, 100).Select(_ => RNG.Next(10)).ToArray(),
|
||||||
Fails = Enumerable.Range(1, 100).Select(_ => RNG.Next(10)).ToArray(),
|
},
|
||||||
Retries = Enumerable.Range(-2, 100).Select(_ => RNG.Next(10)).ToArray(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
OnlineInfo = new APIBeatmapSet
|
Ratings = Enumerable.Range(0, 11).Select(_ => RNG.Next(10)).ToArray(),
|
||||||
{
|
Status = BeatmapSetOnlineStatus.Ranked
|
||||||
Ratings = Enumerable.Range(0, 11).Select(_ => RNG.Next(10)).ToArray(),
|
|
||||||
Status = BeatmapSetOnlineStatus.Ranked
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,21 +59,18 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
var firstBeatmap = createBeatmap();
|
var firstBeatmap = createBeatmap();
|
||||||
var secondBeatmap = createBeatmap();
|
var secondBeatmap = createBeatmap();
|
||||||
|
|
||||||
AddStep("set first set", () => successRate.BeatmapInfo = firstBeatmap);
|
AddStep("set first set", () => successRate.Beatmap = firstBeatmap);
|
||||||
AddAssert("ratings set", () => successRate.Graph.FailTimes == firstBeatmap.FailTimes);
|
AddAssert("ratings set", () => successRate.Graph.FailTimes == firstBeatmap.FailTimes);
|
||||||
|
|
||||||
AddStep("set second set", () => successRate.BeatmapInfo = secondBeatmap);
|
AddStep("set second set", () => successRate.Beatmap = secondBeatmap);
|
||||||
AddAssert("ratings set", () => successRate.Graph.FailTimes == secondBeatmap.FailTimes);
|
AddAssert("ratings set", () => successRate.Graph.FailTimes == secondBeatmap.FailTimes);
|
||||||
|
|
||||||
static BeatmapInfo createBeatmap() => new BeatmapInfo
|
static APIBeatmap createBeatmap() => new APIBeatmap
|
||||||
{
|
{
|
||||||
OnlineInfo = new APIBeatmap
|
FailTimes = new APIFailTimes
|
||||||
{
|
{
|
||||||
FailTimes = new APIFailTimes
|
Fails = Enumerable.Range(1, 100).Select(_ => RNG.Next(10)).ToArray(),
|
||||||
{
|
Retries = Enumerable.Range(-2, 100).Select(_ => RNG.Next(10)).ToArray(),
|
||||||
Fails = Enumerable.Range(1, 100).Select(_ => RNG.Next(10)).ToArray(),
|
|
||||||
Retries = Enumerable.Range(-2, 100).Select(_ => RNG.Next(10)).ToArray(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -81,14 +78,11 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestOnlyFailMetrics()
|
public void TestOnlyFailMetrics()
|
||||||
{
|
{
|
||||||
AddStep("set beatmap", () => successRate.BeatmapInfo = new BeatmapInfo
|
AddStep("set beatmap", () => successRate.Beatmap = new APIBeatmap
|
||||||
{
|
{
|
||||||
OnlineInfo = new APIBeatmap
|
FailTimes = new APIFailTimes
|
||||||
{
|
{
|
||||||
FailTimes = new APIFailTimes
|
Fails = Enumerable.Range(1, 100).ToArray(),
|
||||||
{
|
|
||||||
Fails = Enumerable.Range(1, 100).ToArray(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -98,12 +92,9 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestEmptyMetrics()
|
public void TestEmptyMetrics()
|
||||||
{
|
{
|
||||||
AddStep("set beatmap", () => successRate.BeatmapInfo = new BeatmapInfo
|
AddStep("set beatmap", () => successRate.Beatmap = new APIBeatmap
|
||||||
{
|
{
|
||||||
OnlineInfo = new APIBeatmap
|
FailTimes = new APIFailTimes()
|
||||||
{
|
|
||||||
FailTimes = new APIFailTimes(),
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("graph max values correct", () => successRate.ChildrenOfType<BarGraph>().All(graph => graph.MaxValue == 0));
|
AddAssert("graph max values correct", () => successRate.ChildrenOfType<BarGraph>().All(graph => graph.MaxValue == 0));
|
||||||
|
@ -69,24 +69,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddAssert($"button {(enabled ? "enabled" : "disabled")}", () => downloadButton.DownloadEnabled == enabled);
|
AddAssert($"button {(enabled ? "enabled" : "disabled")}", () => downloadButton.DownloadEnabled == enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BeatmapSetInfo createSoleily()
|
private void createButtonWithBeatmap(IBeatmapSetInfo beatmap)
|
||||||
{
|
|
||||||
return new BeatmapSetInfo
|
|
||||||
{
|
|
||||||
ID = 1,
|
|
||||||
OnlineBeatmapSetID = 241526,
|
|
||||||
OnlineInfo = new APIBeatmapSet
|
|
||||||
{
|
|
||||||
Availability = new BeatmapSetOnlineAvailability
|
|
||||||
{
|
|
||||||
DownloadDisabled = false,
|
|
||||||
ExternalLink = string.Empty,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createButtonWithBeatmap(BeatmapSetInfo beatmap)
|
|
||||||
{
|
{
|
||||||
AddStep("create button", () =>
|
AddStep("create button", () =>
|
||||||
{
|
{
|
||||||
@ -112,32 +95,47 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private BeatmapSetInfo getDownloadableBeatmapSet()
|
private IBeatmapSetInfo createSoleily()
|
||||||
{
|
{
|
||||||
var normal = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo).BeatmapSetInfo;
|
return new APIBeatmapSet
|
||||||
normal.OnlineInfo.HasVideo = true;
|
{
|
||||||
normal.OnlineInfo.HasStoryboard = true;
|
OnlineID = 241526,
|
||||||
|
Availability = new BeatmapSetOnlineAvailability
|
||||||
return normal;
|
{
|
||||||
|
DownloadDisabled = false,
|
||||||
|
ExternalLink = string.Empty,
|
||||||
|
},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private BeatmapSetInfo getUndownloadableBeatmapSet()
|
private IBeatmapSetInfo getDownloadableBeatmapSet()
|
||||||
{
|
{
|
||||||
var beatmap = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo).BeatmapSetInfo;
|
var apiBeatmapSet = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo).BeatmapSetInfo.OnlineInfo;
|
||||||
beatmap.Metadata.Artist = "test";
|
|
||||||
beatmap.Metadata.Title = "undownloadable";
|
|
||||||
beatmap.Metadata.AuthorString = "test";
|
|
||||||
|
|
||||||
beatmap.OnlineInfo.HasVideo = true;
|
apiBeatmapSet.HasVideo = true;
|
||||||
beatmap.OnlineInfo.HasStoryboard = true;
|
apiBeatmapSet.HasStoryboard = true;
|
||||||
|
|
||||||
beatmap.OnlineInfo.Availability = new BeatmapSetOnlineAvailability
|
return apiBeatmapSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IBeatmapSetInfo getUndownloadableBeatmapSet()
|
||||||
|
{
|
||||||
|
var apiBeatmapSet = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo).BeatmapSetInfo.OnlineInfo;
|
||||||
|
|
||||||
|
apiBeatmapSet.Artist = "test";
|
||||||
|
apiBeatmapSet.Title = "undownloadable";
|
||||||
|
apiBeatmapSet.AuthorString = "test";
|
||||||
|
|
||||||
|
apiBeatmapSet.HasVideo = true;
|
||||||
|
apiBeatmapSet.HasStoryboard = true;
|
||||||
|
|
||||||
|
apiBeatmapSet.Availability = new BeatmapSetOnlineAvailability
|
||||||
{
|
{
|
||||||
DownloadDisabled = true,
|
DownloadDisabled = true,
|
||||||
ExternalLink = "http://osu.ppy.sh",
|
ExternalLink = "http://osu.ppy.sh",
|
||||||
};
|
};
|
||||||
|
|
||||||
return beatmap;
|
return apiBeatmapSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestDownloadButton : BeatmapPanelDownloadButton
|
private class TestDownloadButton : BeatmapPanelDownloadButton
|
||||||
@ -146,7 +144,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
|
|
||||||
public DownloadState DownloadState => State.Value;
|
public DownloadState DownloadState => State.Value;
|
||||||
|
|
||||||
public TestDownloadButton(BeatmapSetInfo beatmapSet)
|
public TestDownloadButton(IBeatmapSetInfo beatmapSet)
|
||||||
: base(beatmapSet)
|
: base(beatmapSet)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -18,104 +18,25 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Cached(typeof(IPreviewTrackOwner))]
|
[Cached(typeof(IPreviewTrackOwner))]
|
||||||
public class TestSceneDirectPanel : OsuTestScene, IPreviewTrackOwner
|
public class TestSceneDirectPanel : OsuTestScene, IPreviewTrackOwner
|
||||||
{
|
{
|
||||||
private BeatmapSetInfo getUndownloadableBeatmapSet() => new BeatmapSetInfo
|
|
||||||
{
|
|
||||||
OnlineBeatmapSetID = 123,
|
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
Title = "undownloadable beatmap",
|
|
||||||
Artist = "test",
|
|
||||||
Source = "more tests",
|
|
||||||
Author = new User
|
|
||||||
{
|
|
||||||
Username = "BanchoBot",
|
|
||||||
Id = 3,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
OnlineInfo = new APIBeatmapSet
|
|
||||||
{
|
|
||||||
Availability = new BeatmapSetOnlineAvailability
|
|
||||||
{
|
|
||||||
DownloadDisabled = true,
|
|
||||||
},
|
|
||||||
Preview = @"https://b.ppy.sh/preview/12345.mp3",
|
|
||||||
PlayCount = 123,
|
|
||||||
FavouriteCount = 456,
|
|
||||||
BPM = 111,
|
|
||||||
HasVideo = true,
|
|
||||||
HasStoryboard = true,
|
|
||||||
Covers = new BeatmapSetOnlineCovers(),
|
|
||||||
},
|
|
||||||
Beatmaps = new List<BeatmapInfo>
|
|
||||||
{
|
|
||||||
new BeatmapInfo
|
|
||||||
{
|
|
||||||
Ruleset = Ruleset.Value,
|
|
||||||
Version = "Test",
|
|
||||||
StarDifficulty = 6.42,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private BeatmapSetInfo getManyDifficultiesBeatmapSet(RulesetStore rulesets)
|
|
||||||
{
|
|
||||||
var beatmaps = new List<BeatmapInfo>();
|
|
||||||
|
|
||||||
for (int i = 0; i < 100; i++)
|
|
||||||
{
|
|
||||||
beatmaps.Add(new BeatmapInfo
|
|
||||||
{
|
|
||||||
Ruleset = rulesets.GetRuleset(i % 4),
|
|
||||||
StarDifficulty = 2 + i % 4 * 2,
|
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
|
||||||
{
|
|
||||||
OverallDifficulty = 3.5f,
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return new BeatmapSetInfo
|
|
||||||
{
|
|
||||||
OnlineBeatmapSetID = 1,
|
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
Title = "many difficulties beatmap",
|
|
||||||
Artist = "test",
|
|
||||||
Author = new User
|
|
||||||
{
|
|
||||||
Username = "BanchoBot",
|
|
||||||
Id = 3,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
OnlineInfo = new APIBeatmapSet
|
|
||||||
{
|
|
||||||
HasVideo = true,
|
|
||||||
HasStoryboard = true,
|
|
||||||
Covers = new BeatmapSetOnlineCovers(),
|
|
||||||
},
|
|
||||||
Beatmaps = beatmaps,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(RulesetStore rulesets)
|
private void load(RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
var normal = getBeatmapSet();
|
var normal = getBeatmapSet();
|
||||||
normal.OnlineInfo.HasVideo = true;
|
normal.HasVideo = true;
|
||||||
normal.OnlineInfo.HasStoryboard = true;
|
normal.HasStoryboard = true;
|
||||||
|
|
||||||
var undownloadable = getUndownloadableBeatmapSet();
|
var undownloadable = getUndownloadableBeatmapSet();
|
||||||
var manyDifficulties = getManyDifficultiesBeatmapSet(rulesets);
|
var manyDifficulties = getManyDifficultiesBeatmapSet();
|
||||||
|
|
||||||
var explicitMap = getBeatmapSet();
|
var explicitMap = getBeatmapSet();
|
||||||
explicitMap.OnlineInfo.HasExplicitContent = true;
|
explicitMap.HasExplicitContent = true;
|
||||||
|
|
||||||
var featuredMap = getBeatmapSet();
|
var featuredMap = getBeatmapSet();
|
||||||
featuredMap.OnlineInfo.TrackId = 1;
|
featuredMap.TrackId = 1;
|
||||||
|
|
||||||
var explicitFeaturedMap = getBeatmapSet();
|
var explicitFeaturedMap = getBeatmapSet();
|
||||||
explicitFeaturedMap.OnlineInfo.HasExplicitContent = true;
|
explicitFeaturedMap.HasExplicitContent = true;
|
||||||
explicitFeaturedMap.OnlineInfo.TrackId = 2;
|
explicitFeaturedMap.TrackId = 2;
|
||||||
|
|
||||||
Child = new BasicScrollContainer
|
Child = new BasicScrollContainer
|
||||||
{
|
{
|
||||||
@ -145,7 +66,72 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
BeatmapSetInfo getBeatmapSet() => CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet;
|
APIBeatmapSet getBeatmapSet() => CreateAPIBeatmapSet(Ruleset.Value);
|
||||||
|
|
||||||
|
APIBeatmapSet getUndownloadableBeatmapSet() => new APIBeatmapSet
|
||||||
|
{
|
||||||
|
OnlineID = 123,
|
||||||
|
Title = "undownloadable beatmap",
|
||||||
|
Artist = "test",
|
||||||
|
Source = "more tests",
|
||||||
|
Author = new User
|
||||||
|
{
|
||||||
|
Username = "BanchoBot",
|
||||||
|
Id = 3,
|
||||||
|
},
|
||||||
|
Availability = new BeatmapSetOnlineAvailability
|
||||||
|
{
|
||||||
|
DownloadDisabled = true,
|
||||||
|
},
|
||||||
|
Preview = @"https://b.ppy.sh/preview/12345.mp3",
|
||||||
|
PlayCount = 123,
|
||||||
|
FavouriteCount = 456,
|
||||||
|
BPM = 111,
|
||||||
|
HasVideo = true,
|
||||||
|
HasStoryboard = true,
|
||||||
|
Covers = new BeatmapSetOnlineCovers(),
|
||||||
|
Beatmaps = new List<APIBeatmap>
|
||||||
|
{
|
||||||
|
new APIBeatmap
|
||||||
|
{
|
||||||
|
RulesetID = Ruleset.Value.ID ?? 0,
|
||||||
|
DifficultyName = "Test",
|
||||||
|
StarRating = 6.42,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
APIBeatmapSet getManyDifficultiesBeatmapSet()
|
||||||
|
{
|
||||||
|
var beatmaps = new List<APIBeatmap>();
|
||||||
|
|
||||||
|
for (int i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
beatmaps.Add(new APIBeatmap
|
||||||
|
{
|
||||||
|
RulesetID = i % 4,
|
||||||
|
StarRating = 2 + i % 4 * 2,
|
||||||
|
OverallDifficulty = 3.5f,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return new APIBeatmapSet
|
||||||
|
{
|
||||||
|
OnlineID = 1,
|
||||||
|
Title = "undownloadable beatmap",
|
||||||
|
Artist = "test",
|
||||||
|
Source = "more tests",
|
||||||
|
Author = new User
|
||||||
|
{
|
||||||
|
Username = "BanchoBot",
|
||||||
|
Id = 3,
|
||||||
|
},
|
||||||
|
HasVideo = true,
|
||||||
|
HasStoryboard = true,
|
||||||
|
Covers = new BeatmapSetOnlineCovers(),
|
||||||
|
Beatmaps = beatmaps,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays.BeatmapSet.Buttons;
|
using osu.Game.Overlays.BeatmapSet.Buttons;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestLoggedOutIn()
|
public void TestLoggedOutIn()
|
||||||
{
|
{
|
||||||
AddStep("set valid beatmap", () => favourite.BeatmapSet.Value = new BeatmapSetInfo { OnlineBeatmapSetID = 88 });
|
AddStep("set valid beatmap", () => favourite.BeatmapSet.Value = new APIBeatmapSet { OnlineID = 88 });
|
||||||
AddStep("log out", () => API.Logout());
|
AddStep("log out", () => API.Logout());
|
||||||
checkEnabled(false);
|
checkEnabled(false);
|
||||||
AddStep("log in", () => API.Login("test", "test"));
|
AddStep("log in", () => API.Login("test", "test"));
|
||||||
@ -40,9 +40,9 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
public void TestBeatmapChange()
|
public void TestBeatmapChange()
|
||||||
{
|
{
|
||||||
AddStep("log in", () => API.Login("test", "test"));
|
AddStep("log in", () => API.Login("test", "test"));
|
||||||
AddStep("set valid beatmap", () => favourite.BeatmapSet.Value = new BeatmapSetInfo { OnlineBeatmapSetID = 88 });
|
AddStep("set valid beatmap", () => favourite.BeatmapSet.Value = new APIBeatmapSet { OnlineID = 88 });
|
||||||
checkEnabled(true);
|
checkEnabled(true);
|
||||||
AddStep("set invalid beatmap", () => favourite.BeatmapSet.Value = new BeatmapSetInfo());
|
AddStep("set invalid beatmap", () => favourite.BeatmapSet.Value = new APIBeatmapSet());
|
||||||
checkEnabled(false);
|
checkEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,8 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
LeaderboardModSelector modSelector;
|
LeaderboardModSelector modSelector;
|
||||||
FillFlowContainer<SpriteText> selectedMods;
|
FillFlowContainer<SpriteText> selectedMods;
|
||||||
var ruleset = new Bindable<RulesetInfo>();
|
|
||||||
|
var ruleset = new Bindable<IRulesetInfo>();
|
||||||
|
|
||||||
Add(selectedMods = new FillFlowContainer<SpriteText>
|
Add(selectedMods = new FillFlowContainer<SpriteText>
|
||||||
{
|
{
|
||||||
|
@ -124,7 +124,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
{
|
{
|
||||||
var ruleset = advancedStats.BeatmapInfo.Ruleset.CreateInstance();
|
var ruleset = advancedStats.BeatmapInfo.Ruleset.CreateInstance();
|
||||||
var difficultyAdjustMod = ruleset.CreateMod<ModDifficultyAdjust>();
|
var difficultyAdjustMod = ruleset.CreateMod<ModDifficultyAdjust>();
|
||||||
difficultyAdjustMod.ReadFromDifficulty(advancedStats.BeatmapInfo.BaseDifficulty);
|
difficultyAdjustMod.ReadFromDifficulty(advancedStats.BeatmapInfo.Difficulty);
|
||||||
SelectedMods.Value = new[] { difficultyAdjustMod };
|
SelectedMods.Value = new[] { difficultyAdjustMod };
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
{
|
{
|
||||||
var ruleset = advancedStats.BeatmapInfo.Ruleset.CreateInstance();
|
var ruleset = advancedStats.BeatmapInfo.Ruleset.CreateInstance();
|
||||||
var difficultyAdjustMod = ruleset.CreateMod<OsuModDifficultyAdjust>();
|
var difficultyAdjustMod = ruleset.CreateMod<OsuModDifficultyAdjust>();
|
||||||
var originalDifficulty = advancedStats.BeatmapInfo.BaseDifficulty;
|
var originalDifficulty = advancedStats.BeatmapInfo.Difficulty;
|
||||||
|
|
||||||
difficultyAdjustMod.ReadFromDifficulty(originalDifficulty);
|
difficultyAdjustMod.ReadFromDifficulty(originalDifficulty);
|
||||||
difficultyAdjustMod.DrainRate.Value = originalDifficulty.DrainRate - 0.5f;
|
difficultyAdjustMod.DrainRate.Value = originalDifficulty.DrainRate - 0.5f;
|
||||||
|
@ -110,25 +110,19 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly BeatmapSetInfo beatmap_set = new BeatmapSetInfo
|
private static readonly APIBeatmapSet beatmap_set = new APIBeatmapSet
|
||||||
{
|
{
|
||||||
OnlineInfo = new APIBeatmapSet
|
Covers = new BeatmapSetOnlineCovers
|
||||||
{
|
{
|
||||||
Covers = new BeatmapSetOnlineCovers
|
Cover = "https://assets.ppy.sh/beatmaps/1094296/covers/cover@2x.jpg?1581416305"
|
||||||
{
|
|
||||||
Cover = "https://assets.ppy.sh/beatmaps/1094296/covers/cover@2x.jpg?1581416305"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly BeatmapSetInfo no_cover_beatmap_set = new BeatmapSetInfo
|
private static readonly APIBeatmapSet no_cover_beatmap_set = new APIBeatmapSet
|
||||||
{
|
{
|
||||||
OnlineInfo = new APIBeatmapSet
|
Covers = new BeatmapSetOnlineCovers
|
||||||
{
|
{
|
||||||
Covers = new BeatmapSetOnlineCovers
|
Cover = string.Empty
|
||||||
{
|
|
||||||
Cover = string.Empty
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ using osu.Game.Beatmaps.Drawables;
|
|||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Tests.Beatmaps.IO;
|
using osu.Game.Tests.Beatmaps.IO;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -24,7 +25,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
private BeatmapSetInfo testBeatmap;
|
private BeatmapSetInfo testBeatmap;
|
||||||
private IAPIProvider api;
|
private IAPIProvider api;
|
||||||
private RulesetStore rulesets;
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmaps { get; set; }
|
private BeatmapManager beatmaps { get; set; }
|
||||||
@ -33,7 +33,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
private void load(OsuGameBase osu, IAPIProvider api, RulesetStore rulesets)
|
private void load(OsuGameBase osu, IAPIProvider api, RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
this.rulesets = rulesets;
|
|
||||||
|
|
||||||
testBeatmap = ImportBeatmapTest.LoadOszIntoOsu(osu).Result;
|
testBeatmap = ImportBeatmapTest.LoadOszIntoOsu(osu).Result;
|
||||||
}
|
}
|
||||||
@ -81,7 +80,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
Child = background = new TestUpdateableBeatmapBackgroundSprite
|
Child = background = new TestUpdateableBeatmapBackgroundSprite
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Beatmap = { Value = new BeatmapInfo { BeatmapSet = req.Response?.ToBeatmapSet(rulesets) } }
|
Beatmap = { Value = new APIBeatmap { BeatmapSet = req.Response } }
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -100,10 +100,10 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
MaxCombo = MaxCombo,
|
MaxCombo = MaxCombo,
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
{
|
{
|
||||||
DrainRate = drainRate,
|
DrainRate = DrainRate,
|
||||||
CircleSize = circleSize,
|
CircleSize = CircleSize,
|
||||||
ApproachRate = approachRate,
|
ApproachRate = ApproachRate,
|
||||||
OverallDifficulty = overallDifficulty,
|
OverallDifficulty = OverallDifficulty,
|
||||||
},
|
},
|
||||||
OnlineInfo = this,
|
OnlineInfo = this,
|
||||||
};
|
};
|
||||||
|
@ -12,9 +12,9 @@ using osu.Framework.Graphics.Effects;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -206,7 +206,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
|
|
||||||
getSetsRequest.Success += response =>
|
getSetsRequest.Success += response =>
|
||||||
{
|
{
|
||||||
var sets = response.BeatmapSets.Select(responseJson => responseJson.ToBeatmapSet(rulesets)).ToList();
|
var sets = response.BeatmapSets.ToList();
|
||||||
|
|
||||||
// If the previous request returned a null cursor, the API is indicating we can't paginate further (maybe there are no more beatmaps left).
|
// If the previous request returned a null cursor, the API is indicating we can't paginate further (maybe there are no more beatmaps left).
|
||||||
if (sets.Count == 0 || response.Cursor == null)
|
if (sets.Count == 0 || response.Cursor == null)
|
||||||
@ -289,7 +289,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
/// Contains the beatmap sets returned from API.
|
/// Contains the beatmap sets returned from API.
|
||||||
/// Valid for read if and only if <see cref="Type"/> is <see cref="SearchResultType.ResultsReturned"/>.
|
/// Valid for read if and only if <see cref="Type"/> is <see cref="SearchResultType.ResultsReturned"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<BeatmapSetInfo> Results { get; private set; }
|
public List<APIBeatmapSet> Results { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains the names of supporter-only filters requested by the user.
|
/// Contains the names of supporter-only filters requested by the user.
|
||||||
@ -297,7 +297,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public List<LocalisableString> SupporterOnlyFiltersUsed { get; private set; }
|
public List<LocalisableString> SupporterOnlyFiltersUsed { get; private set; }
|
||||||
|
|
||||||
public static SearchResult ResultsReturned(List<BeatmapSetInfo> results) => new SearchResult
|
public static SearchResult ResultsReturned(List<APIBeatmapSet> results) => new SearchResult
|
||||||
{
|
{
|
||||||
Type = SearchResultType.ResultsReturned,
|
Type = SearchResultType.ResultsReturned,
|
||||||
Results = results
|
Results = results
|
||||||
|
@ -8,12 +8,12 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
@ -49,17 +49,17 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
|
|
||||||
public Bindable<SearchExplicit> ExplicitContent => explicitContentFilter.Current;
|
public Bindable<SearchExplicit> ExplicitContent => explicitContentFilter.Current;
|
||||||
|
|
||||||
public BeatmapSetInfo BeatmapSet
|
public APIBeatmapSet BeatmapSet
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == null || string.IsNullOrEmpty(value.OnlineInfo.Covers.Cover))
|
if (value == null || string.IsNullOrEmpty(value.Covers.Cover))
|
||||||
{
|
{
|
||||||
beatmapCover.FadeOut(600, Easing.OutQuint);
|
beatmapCover.FadeOut(600, Easing.OutQuint);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
beatmapCover.OnlineInfo = value.OnlineInfo;
|
beatmapCover.OnlineInfo = value;
|
||||||
beatmapCover.FadeTo(0.1f, 200, Easing.OutQuint);
|
beatmapCover.FadeTo(0.1f, 200, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
{
|
{
|
||||||
public abstract class BeatmapPanel : OsuClickableContainer, IHasContextMenu
|
public abstract class BeatmapPanel : OsuClickableContainer, IHasContextMenu
|
||||||
{
|
{
|
||||||
public readonly BeatmapSetInfo SetInfo;
|
public readonly APIBeatmapSet SetInfo;
|
||||||
|
|
||||||
private const double hover_transition_time = 400;
|
private const double hover_transition_time = 400;
|
||||||
private const int maximum_difficulty_icons = 10;
|
private const int maximum_difficulty_icons = 10;
|
||||||
@ -49,10 +50,10 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
|
|
||||||
protected Action ViewBeatmap;
|
protected Action ViewBeatmap;
|
||||||
|
|
||||||
protected BeatmapPanel(BeatmapSetInfo setInfo)
|
protected BeatmapPanel(APIBeatmapSet setInfo)
|
||||||
: base(HoverSampleSet.Submit)
|
: base(HoverSampleSet.Submit)
|
||||||
{
|
{
|
||||||
Debug.Assert(setInfo.OnlineBeatmapSetID != null);
|
Debug.Assert(setInfo.OnlineID > 0);
|
||||||
|
|
||||||
SetInfo = setInfo;
|
SetInfo = setInfo;
|
||||||
}
|
}
|
||||||
@ -95,8 +96,8 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
|
|
||||||
Action = ViewBeatmap = () =>
|
Action = ViewBeatmap = () =>
|
||||||
{
|
{
|
||||||
Debug.Assert(SetInfo.OnlineBeatmapSetID != null);
|
Debug.Assert(SetInfo.OnlineID > 0);
|
||||||
beatmapSetOverlay?.FetchAndShowBeatmapSet(SetInfo.OnlineBeatmapSetID.Value);
|
beatmapSetOverlay?.FetchAndShowBeatmapSet(SetInfo.OnlineID);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,14 +147,14 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
{
|
{
|
||||||
var icons = new List<DifficultyIcon>();
|
var icons = new List<DifficultyIcon>();
|
||||||
|
|
||||||
if (SetInfo.Beatmaps.Count > maximum_difficulty_icons)
|
if (SetInfo.Beatmaps.Count() > maximum_difficulty_icons)
|
||||||
{
|
{
|
||||||
foreach (var ruleset in SetInfo.Beatmaps.Select(b => b.Ruleset).Distinct())
|
foreach (var ruleset in SetInfo.Beatmaps.Select(b => b.Ruleset).Distinct())
|
||||||
icons.Add(new GroupedDifficultyIcon(SetInfo.Beatmaps.FindAll(b => b.Ruleset.Equals(ruleset)), ruleset, this is ListBeatmapPanel ? Color4.White : colours.Gray5));
|
icons.Add(new GroupedDifficultyIcon(SetInfo.Beatmaps.Where(b => b.RulesetID == ruleset.OnlineID).ToList(), ruleset, this is ListBeatmapPanel ? Color4.White : colours.Gray5));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (var b in SetInfo.Beatmaps.OrderBy(beatmap => beatmap.Ruleset.ID).ThenBy(beatmap => beatmap.StarDifficulty))
|
foreach (var b in SetInfo.Beatmaps.OrderBy(beatmap => beatmap.RulesetID).ThenBy(beatmap => beatmap.StarRating))
|
||||||
icons.Add(new DifficultyIcon(b));
|
icons.Add(new DifficultyIcon(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +164,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
protected Drawable CreateBackground() => new UpdateableOnlineBeatmapSetCover
|
protected Drawable CreateBackground() => new UpdateableOnlineBeatmapSetCover
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
OnlineInfo = SetInfo.OnlineInfo,
|
OnlineInfo = SetInfo,
|
||||||
};
|
};
|
||||||
|
|
||||||
public class Statistic : FillFlowContainer
|
public class Statistic : FillFlowContainer
|
||||||
|
@ -11,6 +11,7 @@ using osu.Game.Configuration;
|
|||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online;
|
using osu.Game.Online;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapListing.Panels
|
namespace osu.Game.Overlays.BeatmapListing.Panels
|
||||||
{
|
{
|
||||||
@ -21,7 +22,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Currently selected beatmap. Used to present the correct difficulty after completing a download.
|
/// Currently selected beatmap. Used to present the correct difficulty after completing a download.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly IBindable<BeatmapInfo> SelectedBeatmap = new Bindable<BeatmapInfo>();
|
public readonly IBindable<APIBeatmap> SelectedBeatmap = new Bindable<APIBeatmap>();
|
||||||
|
|
||||||
private readonly ShakeContainer shakeContainer;
|
private readonly ShakeContainer shakeContainer;
|
||||||
private readonly DownloadButton button;
|
private readonly DownloadButton button;
|
||||||
@ -31,9 +32,9 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
|
|
||||||
protected readonly Bindable<DownloadState> State = new Bindable<DownloadState>();
|
protected readonly Bindable<DownloadState> State = new Bindable<DownloadState>();
|
||||||
|
|
||||||
private readonly BeatmapSetInfo beatmapSet;
|
private readonly IBeatmapSetInfo beatmapSet;
|
||||||
|
|
||||||
public BeatmapPanelDownloadButton(BeatmapSetInfo beatmapSet)
|
public BeatmapPanelDownloadButton(IBeatmapSetInfo beatmapSet)
|
||||||
{
|
{
|
||||||
this.beatmapSet = beatmapSet;
|
this.beatmapSet = beatmapSet;
|
||||||
|
|
||||||
@ -79,13 +80,13 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
case DownloadState.LocallyAvailable:
|
case DownloadState.LocallyAvailable:
|
||||||
Predicate<BeatmapInfo> findPredicate = null;
|
Predicate<BeatmapInfo> findPredicate = null;
|
||||||
if (SelectedBeatmap.Value != null)
|
if (SelectedBeatmap.Value != null)
|
||||||
findPredicate = b => b.OnlineBeatmapID == SelectedBeatmap.Value.OnlineBeatmapID;
|
findPredicate = b => b.OnlineBeatmapID == SelectedBeatmap.Value.OnlineID;
|
||||||
|
|
||||||
game?.PresentBeatmap(beatmapSet, findPredicate);
|
game?.PresentBeatmap(beatmapSet, findPredicate);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
beatmaps.Download(beatmapSet, noVideoSetting.Value);
|
beatmaps.Download(new BeatmapSetInfo { OnlineBeatmapSetID = beatmapSet.OnlineID }, noVideoSetting.Value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -100,7 +101,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (beatmapSet.OnlineInfo?.Availability.DownloadDisabled ?? false)
|
if ((beatmapSet as IBeatmapSetOnlineInfo)?.Availability.DownloadDisabled == true)
|
||||||
{
|
{
|
||||||
button.Enabled.Value = false;
|
button.Enabled.Value = false;
|
||||||
button.TooltipText = "this beatmap is currently not available for download.";
|
button.TooltipText = "this beatmap is currently not available for download.";
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
private readonly ProgressBar progressBar;
|
private readonly ProgressBar progressBar;
|
||||||
private readonly BeatmapDownloadTracker downloadTracker;
|
private readonly BeatmapDownloadTracker downloadTracker;
|
||||||
|
|
||||||
public DownloadProgressBar(BeatmapSetInfo beatmapSet)
|
public DownloadProgressBar(IBeatmapSetInfo beatmapSet)
|
||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -9,11 +9,11 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays.BeatmapSet;
|
using osu.Game.Overlays.BeatmapSet;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -32,7 +32,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
protected override PlayButton PlayButton => playButton;
|
protected override PlayButton PlayButton => playButton;
|
||||||
protected override Box PreviewBar => progressBar;
|
protected override Box PreviewBar => progressBar;
|
||||||
|
|
||||||
public GridBeatmapPanel(BeatmapSetInfo beatmap)
|
public GridBeatmapPanel(APIBeatmapSet beatmap)
|
||||||
: base(beatmap)
|
: base(beatmap)
|
||||||
{
|
{
|
||||||
Width = 380;
|
Width = 380;
|
||||||
@ -84,7 +84,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = new RomanisableString(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title),
|
Text = new RomanisableString(SetInfo.TitleUnicode, SetInfo.Title),
|
||||||
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true)
|
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = new RomanisableString(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist),
|
Text = new RomanisableString(SetInfo.ArtistUnicode, SetInfo.Artist),
|
||||||
Font = OsuFont.GetFont(weight: FontWeight.Bold, italics: true)
|
Font = OsuFont.GetFont(weight: FontWeight.Bold, italics: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
{
|
{
|
||||||
d.AutoSizeAxes = Axes.Both;
|
d.AutoSizeAxes = Axes.Both;
|
||||||
d.AddText("mapped by ", t => t.Colour = colours.Gray5);
|
d.AddText("mapped by ", t => t.Colour = colours.Gray5);
|
||||||
d.AddUserLink(SetInfo.Metadata.Author);
|
d.AddUserLink(SetInfo.Author);
|
||||||
}),
|
}),
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
@ -155,11 +155,11 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = SetInfo.Metadata.Source,
|
Text = SetInfo.Source,
|
||||||
Font = OsuFont.GetFont(size: 14),
|
Font = OsuFont.GetFont(size: 14),
|
||||||
Shadow = false,
|
Shadow = false,
|
||||||
Colour = colours.Gray5,
|
Colour = colours.Gray5,
|
||||||
Alpha = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f,
|
Alpha = string.IsNullOrEmpty(SetInfo.Source) ? 0f : 1f,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -193,8 +193,8 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
Margin = new MarginPadding { Top = vertical_padding, Right = vertical_padding },
|
Margin = new MarginPadding { Top = vertical_padding, Right = vertical_padding },
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new Statistic(FontAwesome.Solid.PlayCircle, SetInfo.OnlineInfo?.PlayCount ?? 0),
|
new Statistic(FontAwesome.Solid.PlayCircle, SetInfo.PlayCount),
|
||||||
new Statistic(FontAwesome.Solid.Heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0),
|
new Statistic(FontAwesome.Solid.Heart, SetInfo.FavouriteCount),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
statusContainer = new FillFlowContainer
|
statusContainer = new FillFlowContainer
|
||||||
@ -211,7 +211,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (SetInfo.OnlineInfo?.HasExplicitContent ?? false)
|
if (SetInfo.HasExplicitContent)
|
||||||
{
|
{
|
||||||
titleContainer.Add(new ExplicitContentBeatmapPill
|
titleContainer.Add(new ExplicitContentBeatmapPill
|
||||||
{
|
{
|
||||||
@ -221,7 +221,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SetInfo.OnlineInfo?.TrackId != null)
|
if (SetInfo.TrackId != null)
|
||||||
{
|
{
|
||||||
artistContainer.Add(new FeaturedArtistBeatmapPill
|
artistContainer.Add(new FeaturedArtistBeatmapPill
|
||||||
{
|
{
|
||||||
@ -231,12 +231,12 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SetInfo.OnlineInfo?.HasVideo ?? false)
|
if (SetInfo.HasVideo)
|
||||||
{
|
{
|
||||||
statusContainer.Add(new IconPill(FontAwesome.Solid.Film));
|
statusContainer.Add(new IconPill(FontAwesome.Solid.Film));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SetInfo.OnlineInfo?.HasStoryboard ?? false)
|
if (SetInfo.HasStoryboard)
|
||||||
{
|
{
|
||||||
statusContainer.Add(new IconPill(FontAwesome.Solid.Image));
|
statusContainer.Add(new IconPill(FontAwesome.Solid.Image));
|
||||||
}
|
}
|
||||||
@ -246,7 +246,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
TextSize = 12,
|
TextSize = 12,
|
||||||
TextPadding = new MarginPadding { Horizontal = 10, Vertical = 5 },
|
TextPadding = new MarginPadding { Horizontal = 10, Vertical = 5 },
|
||||||
Status = SetInfo.OnlineInfo?.Status ?? BeatmapSetOnlineStatus.None,
|
Status = SetInfo.Status,
|
||||||
});
|
});
|
||||||
|
|
||||||
PreviewPlaying.ValueChanged += _ => updateStatusContainer();
|
PreviewPlaying.ValueChanged += _ => updateStatusContainer();
|
||||||
|
@ -9,11 +9,11 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays.BeatmapSet;
|
using osu.Game.Overlays.BeatmapSet;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -37,7 +37,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
protected override PlayButton PlayButton => playButton;
|
protected override PlayButton PlayButton => playButton;
|
||||||
protected override Box PreviewBar => progressBar;
|
protected override Box PreviewBar => progressBar;
|
||||||
|
|
||||||
public ListBeatmapPanel(BeatmapSetInfo beatmap)
|
public ListBeatmapPanel(APIBeatmapSet beatmap)
|
||||||
: base(beatmap)
|
: base(beatmap)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
@ -107,7 +107,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = new RomanisableString(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title),
|
Text = new RomanisableString(SetInfo.TitleUnicode, SetInfo.Title),
|
||||||
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true)
|
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = new RomanisableString(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist),
|
Text = new RomanisableString(SetInfo.ArtistUnicode, SetInfo.Artist),
|
||||||
Font = OsuFont.GetFont(weight: FontWeight.Bold, italics: true)
|
Font = OsuFont.GetFont(weight: FontWeight.Bold, italics: true)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -182,8 +182,8 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Statistic(FontAwesome.Solid.PlayCircle, SetInfo.OnlineInfo?.PlayCount ?? 0),
|
new Statistic(FontAwesome.Solid.PlayCircle, SetInfo.PlayCount),
|
||||||
new Statistic(FontAwesome.Solid.Heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0),
|
new Statistic(FontAwesome.Solid.Heart, SetInfo.FavouriteCount),
|
||||||
new LinkFlowContainer(s =>
|
new LinkFlowContainer(s =>
|
||||||
{
|
{
|
||||||
s.Shadow = false;
|
s.Shadow = false;
|
||||||
@ -197,15 +197,15 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
{
|
{
|
||||||
d.AutoSizeAxes = Axes.Both;
|
d.AutoSizeAxes = Axes.Both;
|
||||||
d.AddText("mapped by ");
|
d.AddText("mapped by ");
|
||||||
d.AddUserLink(SetInfo.Metadata.Author);
|
d.AddUserLink(SetInfo.Author);
|
||||||
}),
|
}),
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = SetInfo.Metadata.Source,
|
Text = SetInfo.Source,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Font = OsuFont.GetFont(size: 14),
|
Font = OsuFont.GetFont(size: 14),
|
||||||
Alpha = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f,
|
Alpha = string.IsNullOrEmpty(SetInfo.Source) ? 0f : 1f,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -225,7 +225,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (SetInfo.OnlineInfo?.HasExplicitContent ?? false)
|
if (SetInfo.HasExplicitContent)
|
||||||
{
|
{
|
||||||
titleContainer.Add(new ExplicitContentBeatmapPill
|
titleContainer.Add(new ExplicitContentBeatmapPill
|
||||||
{
|
{
|
||||||
@ -235,7 +235,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SetInfo.OnlineInfo?.TrackId != null)
|
if (SetInfo.TrackId != null)
|
||||||
{
|
{
|
||||||
artistContainer.Add(new FeaturedArtistBeatmapPill
|
artistContainer.Add(new FeaturedArtistBeatmapPill
|
||||||
{
|
{
|
||||||
@ -245,12 +245,12 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SetInfo.OnlineInfo?.HasVideo ?? false)
|
if (SetInfo.HasVideo)
|
||||||
{
|
{
|
||||||
statusContainer.Add(new IconPill(FontAwesome.Solid.Film) { IconSize = new Vector2(20) });
|
statusContainer.Add(new IconPill(FontAwesome.Solid.Film) { IconSize = new Vector2(20) });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SetInfo.OnlineInfo?.HasStoryboard ?? false)
|
if (SetInfo.HasStoryboard)
|
||||||
{
|
{
|
||||||
statusContainer.Add(new IconPill(FontAwesome.Solid.Image) { IconSize = new Vector2(20) });
|
statusContainer.Add(new IconPill(FontAwesome.Solid.Image) { IconSize = new Vector2(20) });
|
||||||
}
|
}
|
||||||
@ -260,7 +260,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
TextSize = 12,
|
TextSize = 12,
|
||||||
TextPadding = new MarginPadding { Horizontal = 10, Vertical = 4 },
|
TextPadding = new MarginPadding { Horizontal = 10, Vertical = 4 },
|
||||||
Status = SetInfo.OnlineInfo?.Status ?? BeatmapSetOnlineStatus.None,
|
Status = SetInfo.Status,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,9 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -24,9 +24,9 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
|
|
||||||
public PreviewTrack Preview { get; private set; }
|
public PreviewTrack Preview { get; private set; }
|
||||||
|
|
||||||
private BeatmapSetInfo beatmapSet;
|
private APIBeatmapSet beatmapSet;
|
||||||
|
|
||||||
public BeatmapSetInfo BeatmapSet
|
public APIBeatmapSet BeatmapSet
|
||||||
{
|
{
|
||||||
get => beatmapSet;
|
get => beatmapSet;
|
||||||
set
|
set
|
||||||
@ -66,7 +66,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayButton(BeatmapSetInfo setInfo = null)
|
public PlayButton(APIBeatmapSet setInfo = null)
|
||||||
{
|
{
|
||||||
BeatmapSet = setInfo;
|
BeatmapSet = setInfo;
|
||||||
AddRange(new Drawable[]
|
AddRange(new Drawable[]
|
||||||
|
@ -15,10 +15,10 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays.BeatmapListing;
|
using osu.Game.Overlays.BeatmapListing;
|
||||||
using osu.Game.Overlays.BeatmapListing.Panels;
|
using osu.Game.Overlays.BeatmapListing.Panels;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
@ -136,7 +136,7 @@ namespace osu.Game.Overlays
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var newPanels = searchResult.Results.Select<BeatmapSetInfo, BeatmapPanel>(b => new GridBeatmapPanel(b)
|
var newPanels = searchResult.Results.Select<APIBeatmapSet, BeatmapPanel>(b => new GridBeatmapPanel(b)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
|
@ -6,7 +6,6 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Users.Drawables;
|
using osu.Game.Users.Drawables;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -16,6 +15,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet
|
namespace osu.Game.Overlays.BeatmapSet
|
||||||
{
|
{
|
||||||
@ -26,9 +26,9 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
private UpdateableAvatar avatar;
|
private UpdateableAvatar avatar;
|
||||||
private FillFlowContainer fields;
|
private FillFlowContainer fields;
|
||||||
|
|
||||||
private BeatmapSetInfo beatmapSet;
|
private APIBeatmapSet beatmapSet;
|
||||||
|
|
||||||
public BeatmapSetInfo BeatmapSet
|
public APIBeatmapSet BeatmapSet
|
||||||
{
|
{
|
||||||
get => beatmapSet;
|
get => beatmapSet;
|
||||||
set
|
set
|
||||||
@ -78,30 +78,28 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
private void updateDisplay()
|
private void updateDisplay()
|
||||||
{
|
{
|
||||||
avatar.User = BeatmapSet?.Metadata.Author;
|
avatar.User = BeatmapSet?.Author;
|
||||||
|
|
||||||
fields.Clear();
|
fields.Clear();
|
||||||
if (BeatmapSet == null)
|
if (BeatmapSet == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var online = BeatmapSet.OnlineInfo;
|
|
||||||
|
|
||||||
fields.Children = new Drawable[]
|
fields.Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Field("mapped by", BeatmapSet.Metadata.Author, OsuFont.GetFont(weight: FontWeight.Regular, italics: true)),
|
new Field("mapped by", BeatmapSet.Author, OsuFont.GetFont(weight: FontWeight.Regular, italics: true)),
|
||||||
new Field("submitted", online.Submitted, OsuFont.GetFont(weight: FontWeight.Bold))
|
new Field("submitted", BeatmapSet.Submitted, OsuFont.GetFont(weight: FontWeight.Bold))
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Top = 5 },
|
Margin = new MarginPadding { Top = 5 },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (online.Ranked.HasValue)
|
if (BeatmapSet.Ranked.HasValue)
|
||||||
{
|
{
|
||||||
fields.Add(new Field(online.Status.ToString().ToLowerInvariant(), online.Ranked.Value, OsuFont.GetFont(weight: FontWeight.Bold)));
|
fields.Add(new Field(BeatmapSet.Status.ToString().ToLowerInvariant(), BeatmapSet.Ranked.Value, OsuFont.GetFont(weight: FontWeight.Bold)));
|
||||||
}
|
}
|
||||||
else if (online.LastUpdated.HasValue)
|
else if (BeatmapSet.LastUpdated.HasValue)
|
||||||
{
|
{
|
||||||
fields.Add(new Field("last updated", online.LastUpdated.Value, OsuFont.GetFont(weight: FontWeight.Bold)));
|
fields.Add(new Field("last updated", BeatmapSet.LastUpdated.Value, OsuFont.GetFont(weight: FontWeight.Bold)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Extensions;
|
using osu.Game.Extensions;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -23,9 +24,9 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
{
|
{
|
||||||
private readonly Statistic length, bpm, circleCount, sliderCount;
|
private readonly Statistic length, bpm, circleCount, sliderCount;
|
||||||
|
|
||||||
private BeatmapSetInfo beatmapSet;
|
private APIBeatmapSet beatmapSet;
|
||||||
|
|
||||||
public BeatmapSetInfo BeatmapSet
|
public APIBeatmapSet BeatmapSet
|
||||||
{
|
{
|
||||||
get => beatmapSet;
|
get => beatmapSet;
|
||||||
set
|
set
|
||||||
@ -38,9 +39,9 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private BeatmapInfo beatmapInfo;
|
private IBeatmapInfo beatmapInfo;
|
||||||
|
|
||||||
public BeatmapInfo BeatmapInfo
|
public IBeatmapInfo BeatmapInfo
|
||||||
{
|
{
|
||||||
get => beatmapInfo;
|
get => beatmapInfo;
|
||||||
set
|
set
|
||||||
@ -55,7 +56,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
private void updateDisplay()
|
private void updateDisplay()
|
||||||
{
|
{
|
||||||
bpm.Value = BeatmapSet?.OnlineInfo?.BPM.ToLocalisableString(@"0.##") ?? (LocalisableString)"-";
|
bpm.Value = BeatmapSet?.BPM.ToLocalisableString(@"0.##") ?? (LocalisableString)"-";
|
||||||
|
|
||||||
if (beatmapInfo == null)
|
if (beatmapInfo == null)
|
||||||
{
|
{
|
||||||
@ -68,8 +69,10 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
length.TooltipText = BeatmapsetsStrings.ShowStatsTotalLength(TimeSpan.FromMilliseconds(beatmapInfo.Length).ToFormattedDuration());
|
length.TooltipText = BeatmapsetsStrings.ShowStatsTotalLength(TimeSpan.FromMilliseconds(beatmapInfo.Length).ToFormattedDuration());
|
||||||
length.Value = TimeSpan.FromMilliseconds(beatmapInfo.Length).ToFormattedDuration();
|
length.Value = TimeSpan.FromMilliseconds(beatmapInfo.Length).ToFormattedDuration();
|
||||||
|
|
||||||
circleCount.Value = beatmapInfo.OnlineInfo.CircleCount.ToLocalisableString(@"N0");
|
var onlineInfo = beatmapInfo as IBeatmapOnlineInfo;
|
||||||
sliderCount.Value = beatmapInfo.OnlineInfo.SliderCount.ToLocalisableString(@"N0");
|
|
||||||
|
circleCount.Value = (onlineInfo?.CircleCount ?? 0).ToLocalisableString(@"N0");
|
||||||
|
sliderCount.Value = (onlineInfo?.SliderCount ?? 0).ToLocalisableString(@"N0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,19 +5,19 @@ using osu.Framework.Extensions.Color4Extensions;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet
|
namespace osu.Game.Overlays.BeatmapSet
|
||||||
{
|
{
|
||||||
public class BeatmapAvailability : Container
|
public class BeatmapAvailability : Container
|
||||||
{
|
{
|
||||||
private BeatmapSetInfo beatmapSet;
|
private APIBeatmapSet beatmapSet;
|
||||||
|
|
||||||
private bool downloadDisabled => BeatmapSet?.OnlineInfo.Availability.DownloadDisabled ?? false;
|
private bool downloadDisabled => BeatmapSet?.Availability.DownloadDisabled ?? false;
|
||||||
private bool hasExternalLink => !string.IsNullOrEmpty(BeatmapSet?.OnlineInfo.Availability.ExternalLink);
|
private bool hasExternalLink => !string.IsNullOrEmpty(BeatmapSet?.Availability.ExternalLink);
|
||||||
|
|
||||||
private readonly LinkFlowContainer textContainer;
|
private readonly LinkFlowContainer textContainer;
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public BeatmapSetInfo BeatmapSet
|
public APIBeatmapSet BeatmapSet
|
||||||
{
|
{
|
||||||
get => beatmapSet;
|
get => beatmapSet;
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
{
|
{
|
||||||
textContainer.NewParagraph();
|
textContainer.NewParagraph();
|
||||||
textContainer.NewParagraph();
|
textContainer.NewParagraph();
|
||||||
textContainer.AddLink("Check here for more information.", BeatmapSet.OnlineInfo.Availability.ExternalLink, creationParameters: t => t.Font = OsuFont.GetFont(size: 10));
|
textContainer.AddLink("Check here for more information.", BeatmapSet.Availability.ExternalLink, creationParameters: t => t.Font = OsuFont.GetFont(size: 10));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ using osu.Game.Beatmaps.Drawables;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -34,10 +35,10 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
public readonly DifficultiesContainer Difficulties;
|
public readonly DifficultiesContainer Difficulties;
|
||||||
|
|
||||||
public readonly Bindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
|
public readonly Bindable<APIBeatmap> Beatmap = new Bindable<APIBeatmap>();
|
||||||
private BeatmapSetInfo beatmapSet;
|
private APIBeatmapSet beatmapSet;
|
||||||
|
|
||||||
public BeatmapSetInfo BeatmapSet
|
public APIBeatmapSet BeatmapSet
|
||||||
{
|
{
|
||||||
get => beatmapSet;
|
get => beatmapSet;
|
||||||
set
|
set
|
||||||
@ -164,35 +165,38 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
if (BeatmapSet != null)
|
if (BeatmapSet != null)
|
||||||
{
|
{
|
||||||
Difficulties.ChildrenEnumerable = BeatmapSet.Beatmaps.Where(b => b.Ruleset.Equals(ruleset.Value)).OrderBy(b => b.StarDifficulty).Select(b => new DifficultySelectorButton(b)
|
Difficulties.ChildrenEnumerable = BeatmapSet.Beatmaps
|
||||||
{
|
.Where(b => b.Ruleset?.OnlineID == ruleset.Value?.OnlineID)
|
||||||
State = DifficultySelectorState.NotSelected,
|
.OrderBy(b => b.StarRating)
|
||||||
OnHovered = beatmap =>
|
.Select(b => new DifficultySelectorButton(b)
|
||||||
{
|
{
|
||||||
showBeatmap(beatmap);
|
State = DifficultySelectorState.NotSelected,
|
||||||
starRating.Text = beatmap.StarDifficulty.ToLocalisableString(@"0.##");
|
OnHovered = beatmap =>
|
||||||
starRatingContainer.FadeIn(100);
|
{
|
||||||
},
|
showBeatmap(beatmap);
|
||||||
OnClicked = beatmap => { Beatmap.Value = beatmap; },
|
starRating.Text = beatmap.StarRating.ToLocalisableString(@"0.##");
|
||||||
});
|
starRatingContainer.FadeIn(100);
|
||||||
|
},
|
||||||
|
OnClicked = beatmap => { Beatmap.Value = beatmap; },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
starRatingContainer.FadeOut(100);
|
starRatingContainer.FadeOut(100);
|
||||||
Beatmap.Value = Difficulties.FirstOrDefault()?.BeatmapInfo;
|
Beatmap.Value = Difficulties.FirstOrDefault()?.Beatmap;
|
||||||
plays.Value = BeatmapSet?.OnlineInfo.PlayCount ?? 0;
|
plays.Value = BeatmapSet?.PlayCount ?? 0;
|
||||||
favourites.Value = BeatmapSet?.OnlineInfo.FavouriteCount ?? 0;
|
favourites.Value = BeatmapSet?.FavouriteCount ?? 0;
|
||||||
|
|
||||||
updateDifficultyButtons();
|
updateDifficultyButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showBeatmap(BeatmapInfo beatmapInfo)
|
private void showBeatmap(IBeatmapInfo beatmapInfo)
|
||||||
{
|
{
|
||||||
version.Text = beatmapInfo?.Version;
|
version.Text = beatmapInfo?.DifficultyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDifficultyButtons()
|
private void updateDifficultyButtons()
|
||||||
{
|
{
|
||||||
Difficulties.Children.ToList().ForEach(diff => diff.State = diff.BeatmapInfo == Beatmap.Value ? DifficultySelectorState.Selected : DifficultySelectorState.NotSelected);
|
Difficulties.Children.ToList().ForEach(diff => diff.State = diff.Beatmap == Beatmap.Value ? DifficultySelectorState.Selected : DifficultySelectorState.NotSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DifficultiesContainer : FillFlowContainer<DifficultySelectorButton>
|
public class DifficultiesContainer : FillFlowContainer<DifficultySelectorButton>
|
||||||
@ -216,10 +220,10 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
private readonly Box backgroundBox;
|
private readonly Box backgroundBox;
|
||||||
private readonly DifficultyIcon icon;
|
private readonly DifficultyIcon icon;
|
||||||
|
|
||||||
public readonly BeatmapInfo BeatmapInfo;
|
public readonly APIBeatmap Beatmap;
|
||||||
|
|
||||||
public Action<BeatmapInfo> OnHovered;
|
public Action<APIBeatmap> OnHovered;
|
||||||
public Action<BeatmapInfo> OnClicked;
|
public Action<APIBeatmap> OnClicked;
|
||||||
public event Action<DifficultySelectorState> StateChanged;
|
public event Action<DifficultySelectorState> StateChanged;
|
||||||
|
|
||||||
private DifficultySelectorState state;
|
private DifficultySelectorState state;
|
||||||
@ -241,9 +245,9 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DifficultySelectorButton(BeatmapInfo beatmapInfo)
|
public DifficultySelectorButton(APIBeatmap beatmapInfo)
|
||||||
{
|
{
|
||||||
BeatmapInfo = beatmapInfo;
|
Beatmap = beatmapInfo;
|
||||||
Size = new Vector2(size);
|
Size = new Vector2(size);
|
||||||
Margin = new MarginPadding { Horizontal = tile_spacing / 2 };
|
Margin = new MarginPadding { Horizontal = tile_spacing / 2 };
|
||||||
|
|
||||||
@ -273,7 +277,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
fadeIn();
|
fadeIn();
|
||||||
OnHovered?.Invoke(BeatmapInfo);
|
OnHovered?.Invoke(Beatmap);
|
||||||
return base.OnHover(e);
|
return base.OnHover(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,7 +290,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
OnClicked?.Invoke(BeatmapInfo);
|
OnClicked?.Invoke(Beatmap);
|
||||||
return base.OnClick(e);
|
return base.OnClick(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,17 +3,17 @@
|
|||||||
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet
|
namespace osu.Game.Overlays.BeatmapSet
|
||||||
{
|
{
|
||||||
public class BeatmapRulesetSelector : OverlayRulesetSelector
|
public class BeatmapRulesetSelector : OverlayRulesetSelector
|
||||||
{
|
{
|
||||||
private readonly Bindable<BeatmapSetInfo> beatmapSet = new Bindable<BeatmapSetInfo>();
|
private readonly Bindable<APIBeatmapSet> beatmapSet = new Bindable<APIBeatmapSet>();
|
||||||
|
|
||||||
public BeatmapSetInfo BeatmapSet
|
public APIBeatmapSet BeatmapSet
|
||||||
{
|
{
|
||||||
get => beatmapSet.Value;
|
get => beatmapSet.Value;
|
||||||
set
|
set
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet
|
namespace osu.Game.Overlays.BeatmapSet
|
||||||
{
|
{
|
||||||
public class BeatmapRulesetTabItem : OverlayRulesetTabItem
|
public class BeatmapRulesetTabItem : OverlayRulesetTabItem
|
||||||
{
|
{
|
||||||
public readonly Bindable<BeatmapSetInfo> BeatmapSet = new Bindable<BeatmapSetInfo>();
|
public readonly Bindable<APIBeatmapSet> BeatmapSet = new Bindable<APIBeatmapSet>();
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OverlayColourProvider colourProvider { get; set; }
|
private OverlayColourProvider colourProvider { get; set; }
|
||||||
@ -64,7 +64,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
BeatmapSet.BindValueChanged(setInfo =>
|
BeatmapSet.BindValueChanged(setInfo =>
|
||||||
{
|
{
|
||||||
int beatmapsCount = setInfo.NewValue?.Beatmaps.Count(b => b.Ruleset.Equals(Value)) ?? 0;
|
int beatmapsCount = setInfo.NewValue?.Beatmaps.Count(b => b.Ruleset.OnlineID == Value.OnlineID) ?? 0;
|
||||||
|
|
||||||
count.Text = beatmapsCount.ToString();
|
count.Text = beatmapsCount.ToString();
|
||||||
countContainer.FadeTo(beatmapsCount > 0 ? 1 : 0);
|
countContainer.FadeTo(beatmapsCount > 0 ? 1 : 0);
|
||||||
|
@ -6,7 +6,7 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Effects;
|
using osu.Framework.Graphics.Effects;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -16,7 +16,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
{
|
{
|
||||||
public class BeatmapSetHeader : OverlayHeader
|
public class BeatmapSetHeader : OverlayHeader
|
||||||
{
|
{
|
||||||
public readonly Bindable<BeatmapSetInfo> BeatmapSet = new Bindable<BeatmapSetInfo>();
|
public readonly Bindable<APIBeatmapSet> BeatmapSet = new Bindable<APIBeatmapSet>();
|
||||||
|
|
||||||
public BeatmapSetHeaderContent HeaderContent { get; private set; }
|
public BeatmapSetHeaderContent HeaderContent { get; private set; }
|
||||||
|
|
||||||
|
@ -10,13 +10,13 @@ using osu.Framework.Graphics.Colour;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online;
|
using osu.Game.Online;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays.BeatmapListing.Panels;
|
using osu.Game.Overlays.BeatmapListing.Panels;
|
||||||
using osu.Game.Overlays.BeatmapSet.Buttons;
|
using osu.Game.Overlays.BeatmapSet.Buttons;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -25,7 +25,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
{
|
{
|
||||||
public class BeatmapSetHeaderContent : CompositeDrawable
|
public class BeatmapSetHeaderContent : CompositeDrawable
|
||||||
{
|
{
|
||||||
public readonly Bindable<BeatmapSetInfo> BeatmapSet = new Bindable<BeatmapSetInfo>();
|
public readonly Bindable<APIBeatmapSet> BeatmapSet = new Bindable<APIBeatmapSet>();
|
||||||
|
|
||||||
private const float transition_duration = 200;
|
private const float transition_duration = 200;
|
||||||
private const float buttons_height = 45;
|
private const float buttons_height = 45;
|
||||||
@ -219,7 +219,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
Picker.Beatmap.ValueChanged += b =>
|
Picker.Beatmap.ValueChanged += b =>
|
||||||
{
|
{
|
||||||
Details.BeatmapInfo = b.NewValue;
|
Details.BeatmapInfo = b.NewValue;
|
||||||
externalLink.Link = $@"{api.WebsiteRootUrl}/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{b.NewValue?.Ruleset.ShortName}/{b.NewValue?.OnlineBeatmapID}";
|
externalLink.Link = $@"{api.WebsiteRootUrl}/beatmapsets/{BeatmapSet.Value?.OnlineID}#{b.NewValue?.Ruleset.ShortName}/{b.NewValue?.OnlineID}";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
BeatmapSet.BindValueChanged(setInfo =>
|
BeatmapSet.BindValueChanged(setInfo =>
|
||||||
{
|
{
|
||||||
Picker.BeatmapSet = rulesetSelector.BeatmapSet = author.BeatmapSet = beatmapAvailability.BeatmapSet = Details.BeatmapSet = setInfo.NewValue;
|
Picker.BeatmapSet = rulesetSelector.BeatmapSet = author.BeatmapSet = beatmapAvailability.BeatmapSet = Details.BeatmapSet = setInfo.NewValue;
|
||||||
cover.OnlineInfo = setInfo.NewValue?.OnlineInfo;
|
cover.OnlineInfo = setInfo.NewValue;
|
||||||
|
|
||||||
downloadTracker?.RemoveAndDisposeImmediately();
|
downloadTracker?.RemoveAndDisposeImmediately();
|
||||||
|
|
||||||
@ -254,14 +254,14 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
loading.Hide();
|
loading.Hide();
|
||||||
|
|
||||||
title.Text = new RomanisableString(setInfo.NewValue.Metadata.TitleUnicode, setInfo.NewValue.Metadata.Title);
|
title.Text = new RomanisableString(setInfo.NewValue.TitleUnicode, setInfo.NewValue.Title);
|
||||||
artist.Text = new RomanisableString(setInfo.NewValue.Metadata.ArtistUnicode, setInfo.NewValue.Metadata.Artist);
|
artist.Text = new RomanisableString(setInfo.NewValue.ArtistUnicode, setInfo.NewValue.Artist);
|
||||||
|
|
||||||
explicitContentPill.Alpha = setInfo.NewValue.OnlineInfo.HasExplicitContent ? 1 : 0;
|
explicitContentPill.Alpha = setInfo.NewValue.HasExplicitContent ? 1 : 0;
|
||||||
featuredArtistPill.Alpha = setInfo.NewValue.OnlineInfo.TrackId != null ? 1 : 0;
|
featuredArtistPill.Alpha = setInfo.NewValue.TrackId != null ? 1 : 0;
|
||||||
|
|
||||||
onlineStatusPill.FadeIn(500, Easing.OutQuint);
|
onlineStatusPill.FadeIn(500, Easing.OutQuint);
|
||||||
onlineStatusPill.Status = setInfo.NewValue.OnlineInfo.Status;
|
onlineStatusPill.Status = setInfo.NewValue.Status;
|
||||||
|
|
||||||
downloadButtonsContainer.FadeIn(transition_duration);
|
downloadButtonsContainer.FadeIn(transition_duration);
|
||||||
favouriteButton.FadeIn(transition_duration);
|
favouriteButton.FadeIn(transition_duration);
|
||||||
@ -275,7 +275,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
{
|
{
|
||||||
if (BeatmapSet.Value == null) return;
|
if (BeatmapSet.Value == null) return;
|
||||||
|
|
||||||
if (BeatmapSet.Value.OnlineInfo.Availability.DownloadDisabled && downloadTracker.State.Value != DownloadState.LocallyAvailable)
|
if (BeatmapSet.Value.Availability.DownloadDisabled && downloadTracker.State.Value != DownloadState.LocallyAvailable)
|
||||||
{
|
{
|
||||||
downloadButtonsContainer.Clear();
|
downloadButtonsContainer.Clear();
|
||||||
return;
|
return;
|
||||||
@ -301,7 +301,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
downloadButtonsContainer.Child = new HeaderDownloadButton(BeatmapSet.Value);
|
downloadButtonsContainer.Child = new HeaderDownloadButton(BeatmapSet.Value);
|
||||||
if (BeatmapSet.Value.OnlineInfo.HasVideo)
|
if (BeatmapSet.Value.HasVideo)
|
||||||
downloadButtonsContainer.Add(new HeaderDownloadButton(BeatmapSet.Value, true));
|
downloadButtonsContainer.Add(new HeaderDownloadButton(BeatmapSet.Value, true));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,10 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
@ -21,7 +21,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
|||||||
{
|
{
|
||||||
public class FavouriteButton : HeaderButton, IHasTooltip
|
public class FavouriteButton : HeaderButton, IHasTooltip
|
||||||
{
|
{
|
||||||
public readonly Bindable<BeatmapSetInfo> BeatmapSet = new Bindable<BeatmapSetInfo>();
|
public readonly Bindable<APIBeatmapSet> BeatmapSet = new Bindable<APIBeatmapSet>();
|
||||||
|
|
||||||
private readonly BindableBool favourited = new BindableBool();
|
private readonly BindableBool favourited = new BindableBool();
|
||||||
|
|
||||||
@ -61,13 +61,13 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
|||||||
Action = () =>
|
Action = () =>
|
||||||
{
|
{
|
||||||
// guaranteed by disabled state above.
|
// guaranteed by disabled state above.
|
||||||
Debug.Assert(BeatmapSet.Value.OnlineBeatmapSetID != null);
|
Debug.Assert(BeatmapSet.Value.OnlineID > 0);
|
||||||
|
|
||||||
loading.Show();
|
loading.Show();
|
||||||
|
|
||||||
request?.Cancel();
|
request?.Cancel();
|
||||||
|
|
||||||
request = new PostBeatmapFavouriteRequest(BeatmapSet.Value.OnlineBeatmapSetID.Value, favourited.Value ? BeatmapFavouriteAction.UnFavourite : BeatmapFavouriteAction.Favourite);
|
request = new PostBeatmapFavouriteRequest(BeatmapSet.Value.OnlineID, favourited.Value ? BeatmapFavouriteAction.UnFavourite : BeatmapFavouriteAction.Favourite);
|
||||||
|
|
||||||
request.Success += () =>
|
request.Success += () =>
|
||||||
{
|
{
|
||||||
@ -98,11 +98,11 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
|||||||
BeatmapSet.BindValueChanged(setInfo =>
|
BeatmapSet.BindValueChanged(setInfo =>
|
||||||
{
|
{
|
||||||
updateEnabled();
|
updateEnabled();
|
||||||
favourited.Value = setInfo.NewValue?.OnlineInfo?.HasFavourited ?? false;
|
favourited.Value = setInfo.NewValue?.HasFavourited ?? false;
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateEnabled() => Enabled.Value = !(localUser.Value is GuestUser) && BeatmapSet.Value?.OnlineBeatmapSetID > 0;
|
private void updateEnabled() => Enabled.Value = !(localUser.Value is GuestUser) && BeatmapSet.Value?.OnlineID > 0;
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
{
|
{
|
||||||
|
@ -14,11 +14,13 @@ using osu.Game.Graphics.Containers;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Online;
|
using osu.Game.Online;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays.BeatmapListing.Panels;
|
using osu.Game.Overlays.BeatmapListing.Panels;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
using CommonStrings = osu.Game.Localisation.CommonStrings;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet.Buttons
|
namespace osu.Game.Overlays.BeatmapSet.Buttons
|
||||||
{
|
{
|
||||||
@ -36,9 +38,10 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
|||||||
private HeaderButton button;
|
private HeaderButton button;
|
||||||
|
|
||||||
private BeatmapDownloadTracker downloadTracker;
|
private BeatmapDownloadTracker downloadTracker;
|
||||||
private readonly BeatmapSetInfo beatmapSet;
|
|
||||||
|
|
||||||
public HeaderDownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false)
|
private readonly APIBeatmapSet beatmapSet;
|
||||||
|
|
||||||
|
public HeaderDownloadButton(APIBeatmapSet beatmapSet, bool noVideo = false)
|
||||||
{
|
{
|
||||||
this.beatmapSet = beatmapSet;
|
this.beatmapSet = beatmapSet;
|
||||||
this.noVideo = noVideo;
|
this.noVideo = noVideo;
|
||||||
@ -105,7 +108,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
beatmaps.Download(beatmapSet, noVideo);
|
beatmaps.Download(new BeatmapSetInfo { OnlineBeatmapSetID = beatmapSet.OnlineID }, noVideo);
|
||||||
};
|
};
|
||||||
|
|
||||||
localUser.BindTo(api.LocalUser);
|
localUser.BindTo(api.LocalUser);
|
||||||
@ -121,7 +124,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
|||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = Localisation.CommonStrings.Downloading,
|
Text = CommonStrings.Downloading,
|
||||||
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold)
|
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -132,7 +135,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
|||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = Localisation.CommonStrings.Importing,
|
Text = CommonStrings.Importing,
|
||||||
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold)
|
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -168,7 +171,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
|||||||
|
|
||||||
private LocalisableString getVideoSuffixText()
|
private LocalisableString getVideoSuffixText()
|
||||||
{
|
{
|
||||||
if (!beatmapSet.OnlineInfo.HasVideo)
|
if (!beatmapSet.HasVideo)
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
|
|
||||||
return noVideo ? BeatmapsetsStrings.ShowDetailsDownloadNoVideo : BeatmapsetsStrings.ShowDetailsDownloadVideo;
|
return noVideo ? BeatmapsetsStrings.ShowDetailsDownloadNoVideo : BeatmapsetsStrings.ShowDetailsDownloadVideo;
|
||||||
|
@ -8,9 +8,9 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays.BeatmapListing.Panels;
|
using osu.Game.Overlays.BeatmapListing.Panels;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
|||||||
|
|
||||||
public IBindable<bool> Playing => playButton.Playing;
|
public IBindable<bool> Playing => playButton.Playing;
|
||||||
|
|
||||||
public BeatmapSetInfo BeatmapSet
|
public APIBeatmapSet BeatmapSet
|
||||||
{
|
{
|
||||||
get => playButton.BeatmapSet;
|
get => playButton.BeatmapSet;
|
||||||
set => playButton.BeatmapSet = value;
|
set => playButton.BeatmapSet = value;
|
||||||
|
@ -6,6 +6,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays.BeatmapSet.Buttons;
|
using osu.Game.Overlays.BeatmapSet.Buttons;
|
||||||
using osu.Game.Screens.Select.Details;
|
using osu.Game.Screens.Select.Details;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -21,9 +22,9 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
private readonly AdvancedStats advanced;
|
private readonly AdvancedStats advanced;
|
||||||
private readonly DetailBox ratingBox;
|
private readonly DetailBox ratingBox;
|
||||||
|
|
||||||
private BeatmapSetInfo beatmapSet;
|
private APIBeatmapSet beatmapSet;
|
||||||
|
|
||||||
public BeatmapSetInfo BeatmapSet
|
public APIBeatmapSet BeatmapSet
|
||||||
{
|
{
|
||||||
get => beatmapSet;
|
get => beatmapSet;
|
||||||
set
|
set
|
||||||
@ -37,9 +38,9 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private BeatmapInfo beatmapInfo;
|
private IBeatmapInfo beatmapInfo;
|
||||||
|
|
||||||
public BeatmapInfo BeatmapInfo
|
public IBeatmapInfo BeatmapInfo
|
||||||
{
|
{
|
||||||
get => beatmapInfo;
|
get => beatmapInfo;
|
||||||
set
|
set
|
||||||
@ -53,7 +54,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
private void updateDisplay()
|
private void updateDisplay()
|
||||||
{
|
{
|
||||||
Ratings.Ratings = BeatmapSet?.Ratings;
|
Ratings.Ratings = BeatmapSet?.Ratings;
|
||||||
ratingBox.Alpha = BeatmapSet?.OnlineInfo?.Status > 0 ? 1 : 0;
|
ratingBox.Alpha = BeatmapSet?.Status > 0 ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Details()
|
public Details()
|
||||||
|
@ -6,9 +6,9 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet
|
namespace osu.Game.Overlays.BeatmapSet
|
||||||
{
|
{
|
||||||
@ -22,12 +22,12 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
private readonly SuccessRate successRate;
|
private readonly SuccessRate successRate;
|
||||||
|
|
||||||
public readonly Bindable<BeatmapSetInfo> BeatmapSet = new Bindable<BeatmapSetInfo>();
|
public readonly Bindable<APIBeatmapSet> BeatmapSet = new Bindable<APIBeatmapSet>();
|
||||||
|
|
||||||
public BeatmapInfo BeatmapInfo
|
public APIBeatmap BeatmapInfo
|
||||||
{
|
{
|
||||||
get => successRate.BeatmapInfo;
|
get => successRate.Beatmap;
|
||||||
set => successRate.BeatmapInfo = value;
|
set => successRate.Beatmap = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Info()
|
public Info()
|
||||||
@ -115,11 +115,11 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
BeatmapSet.ValueChanged += b =>
|
BeatmapSet.ValueChanged += b =>
|
||||||
{
|
{
|
||||||
source.Text = b.NewValue?.Metadata.Source ?? string.Empty;
|
source.Text = b.NewValue?.Source ?? string.Empty;
|
||||||
tags.Text = b.NewValue?.Metadata.Tags ?? string.Empty;
|
tags.Text = b.NewValue?.Tags ?? string.Empty;
|
||||||
genre.Text = b.NewValue?.OnlineInfo?.Genre.Name ?? string.Empty;
|
genre.Text = b.NewValue?.Genre.Name ?? string.Empty;
|
||||||
language.Text = b.NewValue?.OnlineInfo?.Language.Name ?? string.Empty;
|
language.Text = b.NewValue?.Language.Name ?? string.Empty;
|
||||||
bool setHasLeaderboard = b.NewValue?.OnlineInfo?.Status > 0;
|
bool setHasLeaderboard = b.NewValue?.Status > 0;
|
||||||
successRate.Alpha = setHasLeaderboard ? 1 : 0;
|
successRate.Alpha = setHasLeaderboard ? 1 : 0;
|
||||||
notRankedPlaceholder.Alpha = setHasLeaderboard ? 0 : 1;
|
notRankedPlaceholder.Alpha = setHasLeaderboard ? 0 : 1;
|
||||||
Height = setHasLeaderboard ? 270 : base_height;
|
Height = setHasLeaderboard ? 270 : base_height;
|
||||||
|
@ -13,6 +13,7 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet
|
namespace osu.Game.Overlays.BeatmapSet
|
||||||
@ -20,7 +21,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
public class LeaderboardModSelector : CompositeDrawable
|
public class LeaderboardModSelector : CompositeDrawable
|
||||||
{
|
{
|
||||||
public readonly BindableList<IMod> SelectedMods = new BindableList<IMod>();
|
public readonly BindableList<IMod> SelectedMods = new BindableList<IMod>();
|
||||||
public readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
public readonly Bindable<IRulesetInfo> Ruleset = new Bindable<IRulesetInfo>();
|
||||||
|
|
||||||
private readonly FillFlowContainer<ModButton> modsContainer;
|
private readonly FillFlowContainer<ModButton> modsContainer;
|
||||||
|
|
||||||
@ -45,7 +46,10 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
Ruleset.BindValueChanged(onRulesetChanged, true);
|
Ruleset.BindValueChanged(onRulesetChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onRulesetChanged(ValueChangedEvent<RulesetInfo> ruleset)
|
[Resolved]
|
||||||
|
private RulesetStore rulesets { get; set; }
|
||||||
|
|
||||||
|
private void onRulesetChanged(ValueChangedEvent<IRulesetInfo> ruleset)
|
||||||
{
|
{
|
||||||
SelectedMods.Clear();
|
SelectedMods.Clear();
|
||||||
modsContainer.Clear();
|
modsContainer.Clear();
|
||||||
@ -54,7 +58,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
modsContainer.Add(new ModButton(new ModNoMod()));
|
modsContainer.Add(new ModButton(new ModNoMod()));
|
||||||
modsContainer.AddRange(ruleset.NewValue.CreateInstance().AllMods.Where(m => m.UserPlayable).Select(m => new ModButton(m)));
|
modsContainer.AddRange(rulesets.GetRuleset(ruleset.NewValue.OnlineID).CreateInstance().AllMods.Where(m => m.UserPlayable).Select(m => new ModButton(m)));
|
||||||
|
|
||||||
modsContainer.ForEach(button =>
|
modsContainer.ForEach(button =>
|
||||||
{
|
{
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osuTK;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Framework.Bindables;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Select.Leaderboards;
|
using osu.Game.Screens.Select.Leaderboards;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet.Scores
|
namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||||
{
|
{
|
||||||
@ -26,8 +26,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
{
|
{
|
||||||
private const int spacing = 15;
|
private const int spacing = 15;
|
||||||
|
|
||||||
public readonly Bindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
|
public readonly Bindable<APIBeatmap> Beatmap = new Bindable<APIBeatmap>();
|
||||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
private readonly Bindable<IRulesetInfo> ruleset = new Bindable<IRulesetInfo>();
|
||||||
private readonly Bindable<BeatmapLeaderboardScope> scope = new Bindable<BeatmapLeaderboardScope>(BeatmapLeaderboardScope.Global);
|
private readonly Bindable<BeatmapLeaderboardScope> scope = new Bindable<BeatmapLeaderboardScope>(BeatmapLeaderboardScope.Global);
|
||||||
private readonly IBindable<User> user = new Bindable<User>();
|
private readonly IBindable<User> user = new Bindable<User>();
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
if (value?.Scores.Any() != true)
|
if (value?.Scores.Any() != true)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
scoreManager.OrderByTotalScoreAsync(value.Scores.Select(s => s.CreateScoreInfo(rulesets, Beatmap.Value)).ToArray(), loadCancellationSource.Token)
|
scoreManager.OrderByTotalScoreAsync(value.Scores.Select(s => s.CreateScoreInfo(rulesets, Beatmap.Value.ToBeatmapInfo(rulesets))).ToArray(), loadCancellationSource.Token)
|
||||||
.ContinueWith(ordered => Schedule(() =>
|
.ContinueWith(ordered => Schedule(() =>
|
||||||
{
|
{
|
||||||
if (loadCancellationSource.IsCancellationRequested)
|
if (loadCancellationSource.IsCancellationRequested)
|
||||||
@ -78,7 +78,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
scoreTable.Show();
|
scoreTable.Show();
|
||||||
|
|
||||||
var userScore = value.UserScore;
|
var userScore = value.UserScore;
|
||||||
var userScoreInfo = userScore?.Score.CreateScoreInfo(rulesets, Beatmap.Value);
|
var userScoreInfo = userScore?.Score.CreateScoreInfo(rulesets, Beatmap.Value.ToBeatmapInfo(rulesets));
|
||||||
|
|
||||||
topScoresContainer.Add(new DrawableTopScore(topScore));
|
topScoresContainer.Add(new DrawableTopScore(topScore));
|
||||||
|
|
||||||
@ -200,11 +200,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
user.BindValueChanged(onUserChanged, true);
|
user.BindValueChanged(onUserChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onBeatmapChanged(ValueChangedEvent<BeatmapInfo> beatmap)
|
private void onBeatmapChanged(ValueChangedEvent<APIBeatmap> beatmap)
|
||||||
{
|
{
|
||||||
var beatmapRuleset = beatmap.NewValue?.Ruleset;
|
var beatmapRuleset = beatmap.NewValue?.Ruleset;
|
||||||
|
|
||||||
if (ruleset.Value?.Equals(beatmapRuleset) ?? false)
|
if (ruleset.Value?.OnlineID == beatmapRuleset?.OnlineID)
|
||||||
{
|
{
|
||||||
modSelector.DeselectAll();
|
modSelector.DeselectAll();
|
||||||
ruleset.TriggerChange();
|
ruleset.TriggerChange();
|
||||||
@ -232,7 +232,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
|
|
||||||
noScoresPlaceholder.Hide();
|
noScoresPlaceholder.Hide();
|
||||||
|
|
||||||
if (Beatmap.Value?.OnlineBeatmapID.HasValue != true || Beatmap.Value.Status <= BeatmapSetOnlineStatus.Pending)
|
if (Beatmap.Value == null || Beatmap.Value.OnlineID <= 0 || (Beatmap.Value?.BeatmapSet as IBeatmapSetOnlineInfo)?.Status <= BeatmapSetOnlineStatus.Pending)
|
||||||
{
|
{
|
||||||
Scores = null;
|
Scores = null;
|
||||||
Hide();
|
Hide();
|
||||||
|
@ -5,10 +5,10 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Extensions.LocalisationExtensions;
|
using osu.Framework.Extensions.LocalisationExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Game.Screens.Select.Details;
|
using osu.Game.Screens.Select.Details;
|
||||||
|
|
||||||
@ -23,16 +23,16 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
private readonly Bar successRate;
|
private readonly Bar successRate;
|
||||||
private readonly Container percentContainer;
|
private readonly Container percentContainer;
|
||||||
|
|
||||||
private BeatmapInfo beatmapInfo;
|
private APIBeatmap beatmap;
|
||||||
|
|
||||||
public BeatmapInfo BeatmapInfo
|
public APIBeatmap Beatmap
|
||||||
{
|
{
|
||||||
get => beatmapInfo;
|
get => beatmap;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == beatmapInfo) return;
|
if (value == beatmap) return;
|
||||||
|
|
||||||
beatmapInfo = value;
|
beatmap = value;
|
||||||
|
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
}
|
}
|
||||||
@ -40,15 +40,15 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
private void updateDisplay()
|
private void updateDisplay()
|
||||||
{
|
{
|
||||||
int passCount = beatmapInfo?.OnlineInfo?.PassCount ?? 0;
|
int passCount = beatmap?.PassCount ?? 0;
|
||||||
int playCount = beatmapInfo?.OnlineInfo?.PlayCount ?? 0;
|
int playCount = beatmap?.PlayCount ?? 0;
|
||||||
|
|
||||||
float rate = playCount != 0 ? (float)passCount / playCount : 0;
|
float rate = playCount != 0 ? (float)passCount / playCount : 0;
|
||||||
successPercent.Text = rate.ToLocalisableString(@"0.#%");
|
successPercent.Text = rate.ToLocalisableString(@"0.#%");
|
||||||
successRate.Length = rate;
|
successRate.Length = rate;
|
||||||
percentContainer.ResizeWidthTo(successRate.Length, 250, Easing.InOutCubic);
|
percentContainer.ResizeWidthTo(successRate.Length, 250, Easing.InOutCubic);
|
||||||
|
|
||||||
Graph.FailTimes = beatmapInfo?.FailTimes;
|
Graph.FailTimes = beatmap?.FailTimes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SuccessRate()
|
public SuccessRate()
|
||||||
|
@ -7,8 +7,8 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays.BeatmapSet;
|
using osu.Game.Overlays.BeatmapSet;
|
||||||
using osu.Game.Overlays.BeatmapSet.Scores;
|
using osu.Game.Overlays.BeatmapSet.Scores;
|
||||||
using osu.Game.Overlays.Comments;
|
using osu.Game.Overlays.Comments;
|
||||||
@ -27,7 +27,7 @@ namespace osu.Game.Overlays
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private RulesetStore rulesets { get; set; }
|
private RulesetStore rulesets { get; set; }
|
||||||
|
|
||||||
private readonly Bindable<BeatmapSetInfo> beatmapSet = new Bindable<BeatmapSetInfo>();
|
private readonly Bindable<APIBeatmapSet> beatmapSet = new Bindable<APIBeatmapSet>();
|
||||||
|
|
||||||
// receive input outside our bounds so we can trigger a close event on ourselves.
|
// receive input outside our bounds so we can trigger a close event on ourselves.
|
||||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
||||||
@ -89,8 +89,8 @@ namespace osu.Game.Overlays
|
|||||||
var req = new GetBeatmapSetRequest(beatmapId, BeatmapSetLookupType.BeatmapId);
|
var req = new GetBeatmapSetRequest(beatmapId, BeatmapSetLookupType.BeatmapId);
|
||||||
req.Success += res =>
|
req.Success += res =>
|
||||||
{
|
{
|
||||||
beatmapSet.Value = res.ToBeatmapSet(rulesets);
|
beatmapSet.Value = res;
|
||||||
Header.HeaderContent.Picker.Beatmap.Value = Header.BeatmapSet.Value.Beatmaps.First(b => b.OnlineBeatmapID == beatmapId);
|
Header.HeaderContent.Picker.Beatmap.Value = Header.BeatmapSet.Value.Beatmaps.First(b => b.OnlineID == beatmapId);
|
||||||
};
|
};
|
||||||
API.Queue(req);
|
API.Queue(req);
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ namespace osu.Game.Overlays
|
|||||||
beatmapSet.Value = null;
|
beatmapSet.Value = null;
|
||||||
|
|
||||||
var req = new GetBeatmapSetRequest(beatmapSetId);
|
var req = new GetBeatmapSetRequest(beatmapSetId);
|
||||||
req.Success += res => beatmapSet.Value = res.ToBeatmapSet(rulesets);
|
req.Success += res => beatmapSet.Value = res;
|
||||||
API.Queue(req);
|
API.Queue(req);
|
||||||
|
|
||||||
Show();
|
Show();
|
||||||
@ -112,7 +112,7 @@ namespace osu.Game.Overlays
|
|||||||
/// Show an already fully-populated beatmap set.
|
/// Show an already fully-populated beatmap set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="set">The set to show.</param>
|
/// <param name="set">The set to show.</param>
|
||||||
public void ShowBeatmapSet(BeatmapSetInfo set)
|
public void ShowBeatmapSet(APIBeatmapSet set)
|
||||||
{
|
{
|
||||||
beatmapSet.Value = set;
|
beatmapSet.Value = set;
|
||||||
Show();
|
Show();
|
||||||
@ -120,7 +120,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private class CommentsSection : BeatmapSetLayoutSection
|
private class CommentsSection : BeatmapSetLayoutSection
|
||||||
{
|
{
|
||||||
public readonly Bindable<BeatmapSetInfo> BeatmapSet = new Bindable<BeatmapSetInfo>();
|
public readonly Bindable<APIBeatmapSet> BeatmapSet = new Bindable<APIBeatmapSet>();
|
||||||
|
|
||||||
public CommentsSection()
|
public CommentsSection()
|
||||||
{
|
{
|
||||||
@ -130,10 +130,10 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
BeatmapSet.BindValueChanged(beatmapSet =>
|
BeatmapSet.BindValueChanged(beatmapSet =>
|
||||||
{
|
{
|
||||||
if (beatmapSet.NewValue?.OnlineBeatmapSetID is int onlineBeatmapSetID)
|
if (beatmapSet.NewValue?.OnlineID > 0)
|
||||||
{
|
{
|
||||||
Show();
|
Show();
|
||||||
comments.ShowComments(CommentableType.Beatmapset, onlineBeatmapSetID);
|
comments.ShowComments(CommentableType.Beatmapset, beatmapSet.NewValue.OnlineID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
|||||||
new GetUserBeatmapsRequest(User.Value.Id, type, VisiblePages++, ItemsPerPage);
|
new GetUserBeatmapsRequest(User.Value.Id, type, VisiblePages++, ItemsPerPage);
|
||||||
|
|
||||||
protected override Drawable CreateDrawableItem(APIBeatmapSet model) => model.OnlineID > 0
|
protected override Drawable CreateDrawableItem(APIBeatmapSet model) => model.OnlineID > 0
|
||||||
? new GridBeatmapPanel(model.ToBeatmapSet(Rulesets))
|
? new GridBeatmapPanel(model)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
|
@ -5,15 +5,15 @@ using System.Diagnostics;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Framework.Graphics.Cursor;
|
|
||||||
using osu.Framework.Localisation;
|
|
||||||
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;
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ namespace osu.Game.Overlays.Rankings
|
|||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Spacing = new Vector2(10),
|
Spacing = new Vector2(10),
|
||||||
Children = response.BeatmapSets.Select(b => new GridBeatmapPanel(b.ToBeatmapSet(rulesets))
|
Children = response.BeatmapSets.Select(b => new GridBeatmapPanel(b)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
|
@ -223,7 +223,7 @@ namespace osu.Game.Screens.Play
|
|||||||
onlineBeatmapRequest.Success += res => Schedule(() =>
|
onlineBeatmapRequest.Success += res => Schedule(() =>
|
||||||
{
|
{
|
||||||
onlineBeatmap = res.ToBeatmapSet(rulesets);
|
onlineBeatmap = res.ToBeatmapSet(rulesets);
|
||||||
beatmapPanelContainer.Child = new GridBeatmapPanel(onlineBeatmap);
|
beatmapPanelContainer.Child = new GridBeatmapPanel(res);
|
||||||
checkForAutomaticDownload();
|
checkForAutomaticDownload();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ namespace osu.Game.Screens.Select
|
|||||||
beatmapInfo = value;
|
beatmapInfo = value;
|
||||||
|
|
||||||
failTimes = beatmapInfo?.OnlineInfo?.FailTimes;
|
failTimes = beatmapInfo?.OnlineInfo?.FailTimes;
|
||||||
ratings = beatmapInfo?.BeatmapSet?.Ratings;
|
ratings = beatmapInfo?.BeatmapSet?.OnlineInfo?.Ratings;
|
||||||
|
|
||||||
Scheduler.AddOnce(updateStatistics);
|
Scheduler.AddOnce(updateStatistics);
|
||||||
}
|
}
|
||||||
@ -182,7 +182,7 @@ namespace osu.Game.Screens.Select
|
|||||||
source.Text = BeatmapInfo?.Metadata?.Source;
|
source.Text = BeatmapInfo?.Metadata?.Source;
|
||||||
tags.Text = BeatmapInfo?.Metadata?.Tags;
|
tags.Text = BeatmapInfo?.Metadata?.Tags;
|
||||||
|
|
||||||
// metrics may have been previously fetched
|
// failTimes may have been previously fetched
|
||||||
if (ratings != null && failTimes != null)
|
if (ratings != null && failTimes != null)
|
||||||
{
|
{
|
||||||
updateMetrics();
|
updateMetrics();
|
||||||
|
@ -38,9 +38,9 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
protected readonly StatisticRow FirstValue, HpDrain, Accuracy, ApproachRate;
|
protected readonly StatisticRow FirstValue, HpDrain, Accuracy, ApproachRate;
|
||||||
private readonly StatisticRow starDifficulty;
|
private readonly StatisticRow starDifficulty;
|
||||||
|
|
||||||
private BeatmapInfo beatmapInfo;
|
private IBeatmapInfo beatmapInfo;
|
||||||
|
|
||||||
public BeatmapInfo BeatmapInfo
|
public IBeatmapInfo BeatmapInfo
|
||||||
{
|
{
|
||||||
get => beatmapInfo;
|
get => beatmapInfo;
|
||||||
set
|
set
|
||||||
@ -106,7 +106,7 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
|
|
||||||
private void updateStatistics()
|
private void updateStatistics()
|
||||||
{
|
{
|
||||||
IBeatmapDifficultyInfo baseDifficulty = BeatmapInfo?.BaseDifficulty;
|
IBeatmapDifficultyInfo baseDifficulty = BeatmapInfo?.Difficulty;
|
||||||
BeatmapDifficulty adjustedDifficulty = null;
|
BeatmapDifficulty adjustedDifficulty = null;
|
||||||
|
|
||||||
if (baseDifficulty != null && mods.Value.Any(m => m is IApplicableToDifficulty))
|
if (baseDifficulty != null && mods.Value.Any(m => m is IApplicableToDifficulty))
|
||||||
@ -117,7 +117,7 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
mod.ApplyToDifficulty(adjustedDifficulty);
|
mod.ApplyToDifficulty(adjustedDifficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (BeatmapInfo?.Ruleset?.ID ?? 0)
|
switch (BeatmapInfo?.Ruleset.OnlineID)
|
||||||
{
|
{
|
||||||
case 3:
|
case 3:
|
||||||
// Account for mania differences locally for now
|
// Account for mania differences locally for now
|
||||||
|
Loading…
Reference in New Issue
Block a user