mirror of
https://github.com/ppy/osu
synced 2025-04-11 03:31:46 +00:00
Merge branch 'master' into fix-threaded-context-issues
This commit is contained in:
commit
e2ee76332f
@ -17,6 +17,7 @@ namespace osu.Game.Beatmaps
|
|||||||
private int? onlineBeatmapSetID;
|
private int? onlineBeatmapSetID;
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
|
[JsonProperty(@"id")]
|
||||||
public int? OnlineBeatmapSetID
|
public int? OnlineBeatmapSetID
|
||||||
{
|
{
|
||||||
get { return onlineBeatmapSetID; }
|
get { return onlineBeatmapSetID; }
|
||||||
|
@ -9,7 +9,7 @@ using osu.Game.Rulesets;
|
|||||||
|
|
||||||
namespace osu.Game.Online.API.Requests
|
namespace osu.Game.Online.API.Requests
|
||||||
{
|
{
|
||||||
public class GetBeatmapSetsResponse : BeatmapMetadata
|
public class GetBeatmapSetsResponse : BeatmapMetadata // todo: this is a bit wrong...
|
||||||
{
|
{
|
||||||
[JsonProperty(@"covers")]
|
[JsonProperty(@"covers")]
|
||||||
private BeatmapSetOnlineCovers covers { get; set; }
|
private BeatmapSetOnlineCovers covers { get; set; }
|
||||||
@ -23,9 +23,6 @@ namespace osu.Game.Online.API.Requests
|
|||||||
[JsonProperty(@"favourite_count")]
|
[JsonProperty(@"favourite_count")]
|
||||||
private int favouriteCount { get; set; }
|
private int favouriteCount { get; set; }
|
||||||
|
|
||||||
[JsonProperty(@"id")]
|
|
||||||
private int onlineId { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty(@"user_id")]
|
[JsonProperty(@"user_id")]
|
||||||
private long creatorId {
|
private long creatorId {
|
||||||
set { Author.Id = value; }
|
set { Author.Id = value; }
|
||||||
@ -38,7 +35,7 @@ namespace osu.Game.Online.API.Requests
|
|||||||
{
|
{
|
||||||
return new BeatmapSetInfo
|
return new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
OnlineBeatmapSetID = onlineId,
|
OnlineBeatmapSetID = OnlineBeatmapSetID,
|
||||||
Metadata = this,
|
Metadata = this,
|
||||||
OnlineInfo = new BeatmapSetOnlineInfo
|
OnlineInfo = new BeatmapSetOnlineInfo
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
@ -65,8 +66,6 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
ResultAmounts = new ResultCounts(distinctCount(artists), distinctCount(songs), distinctCount(tags));
|
ResultAmounts = new ResultCounts(distinctCount(artists), distinctCount(songs), distinctCount(tags));
|
||||||
|
|
||||||
if (beatmapSets.Any() && panels == null)
|
|
||||||
// real use case? currently only seems to be for test case
|
|
||||||
recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value);
|
recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -274,13 +273,17 @@ namespace osu.Game.Overlays
|
|||||||
Filter.DisplayStyleControl.Dropdown.Current.Value,
|
Filter.DisplayStyleControl.Dropdown.Current.Value,
|
||||||
Filter.Tabs.Current.Value); //todo: sort direction (?)
|
Filter.Tabs.Current.Value); //todo: sort direction (?)
|
||||||
|
|
||||||
getSetsRequest.Success += r =>
|
getSetsRequest.Success += response =>
|
||||||
{
|
{
|
||||||
BeatmapSets = r?.
|
Task.Run(() =>
|
||||||
Select(response => response.ToBeatmapSet(rulesets)).
|
{
|
||||||
Where(b => beatmaps.QueryBeatmapSet(q => q.OnlineBeatmapSetID == b.OnlineBeatmapSetID) == null);
|
var onlineIds = response.Select(r => r.OnlineBeatmapSetID).ToList();
|
||||||
|
var presentOnlineIds = beatmaps.QueryBeatmapSets(s => onlineIds.Contains(s.OnlineBeatmapSetID)).Select(r => r.OnlineBeatmapSetID).ToList();
|
||||||
|
var sets = response.Select(r => r.ToBeatmapSet(rulesets)).Where(b => !presentOnlineIds.Contains(b.OnlineBeatmapSetID)).ToList();
|
||||||
|
|
||||||
recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value);
|
// may not need scheduling; loads async internally.
|
||||||
|
Schedule(() => BeatmapSets = sets);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
api.Queue(getSetsRequest);
|
api.Queue(getSetsRequest);
|
||||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Rulesets
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// All available rulesets.
|
/// All available rulesets.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<RulesetInfo> AvailableRulesets => GetContext().RulesetInfo.Where(r => r.Available);
|
public IEnumerable<RulesetInfo> AvailableRulesets;
|
||||||
|
|
||||||
private static Assembly currentDomain_AssemblyResolve(object sender, ResolveEventArgs args) => loaded_assemblies.Keys.FirstOrDefault(a => a.FullName == args.Name);
|
private static Assembly currentDomain_AssemblyResolve(object sender, ResolveEventArgs args) => loaded_assemblies.Keys.FirstOrDefault(a => a.FullName == args.Name);
|
||||||
|
|
||||||
@ -93,6 +93,8 @@ namespace osu.Game.Rulesets
|
|||||||
}
|
}
|
||||||
|
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
|
||||||
|
AvailableRulesets = context.RulesetInfo.Where(r => r.Available).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadRulesetFromFile(string file)
|
private static void loadRulesetFromFile(string file)
|
||||||
|
Loading…
Reference in New Issue
Block a user