mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 00:42:55 +08:00
Merge branch 'master' into fix-taiko-whistle
This commit is contained in:
commit
b691511737
@ -156,8 +156,8 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
var manager = osu.Dependencies.Get<BeatmapManager>();
|
var manager = osu.Dependencies.Get<BeatmapManager>();
|
||||||
|
|
||||||
// ReSharper disable once AccessToModifiedClosure
|
// ReSharper disable once AccessToModifiedClosure
|
||||||
manager.ItemAdded += _ => Interlocked.Increment(ref itemAddRemoveFireCount);
|
manager.ItemAdded.BindValueChanged(_ => Interlocked.Increment(ref itemAddRemoveFireCount));
|
||||||
manager.ItemRemoved += _ => Interlocked.Increment(ref itemAddRemoveFireCount);
|
manager.ItemRemoved.BindValueChanged(_ => Interlocked.Increment(ref itemAddRemoveFireCount));
|
||||||
|
|
||||||
var imported = await LoadOszIntoOsu(osu);
|
var imported = await LoadOszIntoOsu(osu);
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ using System.Threading.Tasks;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Lists;
|
using osu.Framework.Lists;
|
||||||
@ -38,12 +39,16 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fired when a single difficulty has been hidden.
|
/// Fired when a single difficulty has been hidden.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<BeatmapInfo> BeatmapHidden;
|
public IBindable<WeakReference<BeatmapInfo>> BeatmapHidden => beatmapHidden;
|
||||||
|
|
||||||
|
private readonly Bindable<WeakReference<BeatmapInfo>> beatmapHidden = new Bindable<WeakReference<BeatmapInfo>>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fired when a single difficulty has been restored.
|
/// Fired when a single difficulty has been restored.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<BeatmapInfo> BeatmapRestored;
|
public IBindable<WeakReference<BeatmapInfo>> BeatmapRestored => beatmapRestored;
|
||||||
|
|
||||||
|
private readonly Bindable<WeakReference<BeatmapInfo>> beatmapRestored = new Bindable<WeakReference<BeatmapInfo>>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A default representation of a WorkingBeatmap to use when no beatmap is available.
|
/// A default representation of a WorkingBeatmap to use when no beatmap is available.
|
||||||
@ -74,8 +79,8 @@ namespace osu.Game.Beatmaps
|
|||||||
DefaultBeatmap = defaultBeatmap;
|
DefaultBeatmap = defaultBeatmap;
|
||||||
|
|
||||||
beatmaps = (BeatmapStore)ModelStore;
|
beatmaps = (BeatmapStore)ModelStore;
|
||||||
beatmaps.BeatmapHidden += b => BeatmapHidden?.Invoke(b);
|
beatmaps.BeatmapHidden += b => beatmapHidden.Value = new WeakReference<BeatmapInfo>(b);
|
||||||
beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b);
|
beatmaps.BeatmapRestored += b => beatmapRestored.Value = new WeakReference<BeatmapInfo>(b);
|
||||||
|
|
||||||
onlineLookupQueue = new BeatmapOnlineLookupQueue(api, storage);
|
onlineLookupQueue = new BeatmapOnlineLookupQueue(api, storage);
|
||||||
exportStorage = storage.GetStorageForDirectory("exports");
|
exportStorage = storage.GetStorageForDirectory("exports");
|
||||||
|
@ -11,6 +11,7 @@ using Humanizer;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
@ -56,13 +57,17 @@ namespace osu.Game.Database
|
|||||||
/// Fired when a new <typeparamref name="TModel"/> becomes available in the database.
|
/// Fired when a new <typeparamref name="TModel"/> becomes available in the database.
|
||||||
/// This is not guaranteed to run on the update thread.
|
/// This is not guaranteed to run on the update thread.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<TModel> ItemAdded;
|
public IBindable<WeakReference<TModel>> ItemAdded => itemAdded;
|
||||||
|
|
||||||
|
private readonly Bindable<WeakReference<TModel>> itemAdded = new Bindable<WeakReference<TModel>>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fired when a <typeparamref name="TModel"/> is removed from the database.
|
/// Fired when a <typeparamref name="TModel"/> is removed from the database.
|
||||||
/// This is not guaranteed to run on the update thread.
|
/// This is not guaranteed to run on the update thread.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<TModel> ItemRemoved;
|
public IBindable<WeakReference<TModel>> ItemRemoved => itemRemoved;
|
||||||
|
|
||||||
|
private readonly Bindable<WeakReference<TModel>> itemRemoved = new Bindable<WeakReference<TModel>>();
|
||||||
|
|
||||||
public virtual string[] HandledExtensions => new[] { ".zip" };
|
public virtual string[] HandledExtensions => new[] { ".zip" };
|
||||||
|
|
||||||
@ -82,8 +87,8 @@ namespace osu.Game.Database
|
|||||||
ContextFactory = contextFactory;
|
ContextFactory = contextFactory;
|
||||||
|
|
||||||
ModelStore = modelStore;
|
ModelStore = modelStore;
|
||||||
ModelStore.ItemAdded += item => handleEvent(() => ItemAdded?.Invoke(item));
|
ModelStore.ItemAdded += item => handleEvent(() => itemAdded.Value = new WeakReference<TModel>(item));
|
||||||
ModelStore.ItemRemoved += s => handleEvent(() => ItemRemoved?.Invoke(s));
|
ModelStore.ItemRemoved += item => handleEvent(() => itemRemoved.Value = new WeakReference<TModel>(item));
|
||||||
|
|
||||||
Files = new FileStore(contextFactory, storage);
|
Files = new FileStore(contextFactory, storage);
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
|
||||||
namespace osu.Game.Database
|
namespace osu.Game.Database
|
||||||
{
|
{
|
||||||
@ -23,9 +24,13 @@ namespace osu.Game.Database
|
|||||||
where TModel : class, IHasFiles<TFileModel>, IHasPrimaryKey, ISoftDelete, IEquatable<TModel>
|
where TModel : class, IHasFiles<TFileModel>, IHasPrimaryKey, ISoftDelete, IEquatable<TModel>
|
||||||
where TFileModel : class, INamedFileInfo, new()
|
where TFileModel : class, INamedFileInfo, new()
|
||||||
{
|
{
|
||||||
public event Action<ArchiveDownloadRequest<TModel>> DownloadBegan;
|
public IBindable<WeakReference<ArchiveDownloadRequest<TModel>>> DownloadBegan => downloadBegan;
|
||||||
|
|
||||||
public event Action<ArchiveDownloadRequest<TModel>> DownloadFailed;
|
private readonly Bindable<WeakReference<ArchiveDownloadRequest<TModel>>> downloadBegan = new Bindable<WeakReference<ArchiveDownloadRequest<TModel>>>();
|
||||||
|
|
||||||
|
public IBindable<WeakReference<ArchiveDownloadRequest<TModel>>> DownloadFailed => downloadFailed;
|
||||||
|
|
||||||
|
private readonly Bindable<WeakReference<ArchiveDownloadRequest<TModel>>> downloadFailed = new Bindable<WeakReference<ArchiveDownloadRequest<TModel>>>();
|
||||||
|
|
||||||
private readonly IAPIProvider api;
|
private readonly IAPIProvider api;
|
||||||
|
|
||||||
@ -81,7 +86,7 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
// for now a failed import will be marked as a failed download for simplicity.
|
// for now a failed import will be marked as a failed download for simplicity.
|
||||||
if (!imported.Any())
|
if (!imported.Any())
|
||||||
DownloadFailed?.Invoke(request);
|
downloadFailed.Value = new WeakReference<ArchiveDownloadRequest<TModel>>(request);
|
||||||
|
|
||||||
currentDownloads.Remove(request);
|
currentDownloads.Remove(request);
|
||||||
}, TaskCreationOptions.LongRunning);
|
}, TaskCreationOptions.LongRunning);
|
||||||
@ -100,14 +105,14 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
api.PerformAsync(request);
|
api.PerformAsync(request);
|
||||||
|
|
||||||
DownloadBegan?.Invoke(request);
|
downloadBegan.Value = new WeakReference<ArchiveDownloadRequest<TModel>>(request);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
void triggerFailure(Exception error)
|
void triggerFailure(Exception error)
|
||||||
{
|
{
|
||||||
currentDownloads.Remove(request);
|
currentDownloads.Remove(request);
|
||||||
|
|
||||||
DownloadFailed?.Invoke(request);
|
downloadFailed.Value = new WeakReference<ArchiveDownloadRequest<TModel>>(request);
|
||||||
|
|
||||||
notification.State = ProgressNotificationState.Cancelled;
|
notification.State = ProgressNotificationState.Cancelled;
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
// 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.Game.Online.API;
|
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
|
||||||
namespace osu.Game.Database
|
namespace osu.Game.Database
|
||||||
{
|
{
|
||||||
@ -17,13 +18,13 @@ namespace osu.Game.Database
|
|||||||
/// Fired when a <typeparamref name="TModel"/> download begins.
|
/// Fired when a <typeparamref name="TModel"/> download begins.
|
||||||
/// This is NOT run on the update thread and should be scheduled.
|
/// This is NOT run on the update thread and should be scheduled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event Action<ArchiveDownloadRequest<TModel>> DownloadBegan;
|
IBindable<WeakReference<ArchiveDownloadRequest<TModel>>> DownloadBegan { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fired when a <typeparamref name="TModel"/> download is interrupted, either due to user cancellation or failure.
|
/// Fired when a <typeparamref name="TModel"/> download is interrupted, either due to user cancellation or failure.
|
||||||
/// This is NOT run on the update thread and should be scheduled.
|
/// This is NOT run on the update thread and should be scheduled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event Action<ArchiveDownloadRequest<TModel>> DownloadFailed;
|
IBindable<WeakReference<ArchiveDownloadRequest<TModel>>> DownloadFailed { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks whether a given <typeparamref name="TModel"/> is already available in the local store.
|
/// Checks whether a given <typeparamref name="TModel"/> is already available in the local store.
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// 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;
|
using System;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
|
||||||
namespace osu.Game.Database
|
namespace osu.Game.Database
|
||||||
{
|
{
|
||||||
@ -9,11 +10,11 @@ namespace osu.Game.Database
|
|||||||
/// Represents a model manager that publishes events when <typeparamref name="TModel"/>s are added or removed.
|
/// Represents a model manager that publishes events when <typeparamref name="TModel"/>s are added or removed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TModel">The model type.</typeparam>
|
/// <typeparam name="TModel">The model type.</typeparam>
|
||||||
public interface IModelManager<out TModel>
|
public interface IModelManager<TModel>
|
||||||
where TModel : class
|
where TModel : class
|
||||||
{
|
{
|
||||||
event Action<TModel> ItemAdded;
|
IBindable<WeakReference<TModel>> ItemAdded { get; }
|
||||||
|
|
||||||
event Action<TModel> ItemRemoved;
|
IBindable<WeakReference<TModel>> ItemRemoved { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,11 @@ namespace osu.Game.Online
|
|||||||
Model.Value = model;
|
Model.Value = model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IBindable<WeakReference<TModel>> managerAdded;
|
||||||
|
private IBindable<WeakReference<TModel>> managerRemoved;
|
||||||
|
private IBindable<WeakReference<ArchiveDownloadRequest<TModel>>> managerDownloadBegan;
|
||||||
|
private IBindable<WeakReference<ArchiveDownloadRequest<TModel>>> managerDownloadFailed;
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -47,23 +52,39 @@ namespace osu.Game.Online
|
|||||||
attachDownload(manager.GetExistingDownload(modelInfo.NewValue));
|
attachDownload(manager.GetExistingDownload(modelInfo.NewValue));
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
manager.DownloadBegan += downloadBegan;
|
managerDownloadBegan = manager.DownloadBegan.GetBoundCopy();
|
||||||
manager.DownloadFailed += downloadFailed;
|
managerDownloadBegan.BindValueChanged(downloadBegan);
|
||||||
manager.ItemAdded += itemAdded;
|
managerDownloadFailed = manager.DownloadFailed.GetBoundCopy();
|
||||||
manager.ItemRemoved += itemRemoved;
|
managerDownloadFailed.BindValueChanged(downloadFailed);
|
||||||
|
managerAdded = manager.ItemAdded.GetBoundCopy();
|
||||||
|
managerAdded.BindValueChanged(itemAdded);
|
||||||
|
managerRemoved = manager.ItemRemoved.GetBoundCopy();
|
||||||
|
managerRemoved.BindValueChanged(itemRemoved);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void downloadBegan(ArchiveDownloadRequest<TModel> request) => Schedule(() =>
|
private void downloadBegan(ValueChangedEvent<WeakReference<ArchiveDownloadRequest<TModel>>> weakRequest)
|
||||||
{
|
{
|
||||||
if (request.Model.Equals(Model.Value))
|
if (weakRequest.NewValue.TryGetTarget(out var request))
|
||||||
attachDownload(request);
|
{
|
||||||
});
|
Schedule(() =>
|
||||||
|
{
|
||||||
|
if (request.Model.Equals(Model.Value))
|
||||||
|
attachDownload(request);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void downloadFailed(ArchiveDownloadRequest<TModel> request) => Schedule(() =>
|
private void downloadFailed(ValueChangedEvent<WeakReference<ArchiveDownloadRequest<TModel>>> weakRequest)
|
||||||
{
|
{
|
||||||
if (request.Model.Equals(Model.Value))
|
if (weakRequest.NewValue.TryGetTarget(out var request))
|
||||||
attachDownload(null);
|
{
|
||||||
});
|
Schedule(() =>
|
||||||
|
{
|
||||||
|
if (request.Model.Equals(Model.Value))
|
||||||
|
attachDownload(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ArchiveDownloadRequest<TModel> attachedRequest;
|
private ArchiveDownloadRequest<TModel> attachedRequest;
|
||||||
|
|
||||||
@ -107,9 +128,17 @@ namespace osu.Game.Online
|
|||||||
|
|
||||||
private void onRequestFailure(Exception e) => Schedule(() => attachDownload(null));
|
private void onRequestFailure(Exception e) => Schedule(() => attachDownload(null));
|
||||||
|
|
||||||
private void itemAdded(TModel s) => setDownloadStateFromManager(s, DownloadState.LocallyAvailable);
|
private void itemAdded(ValueChangedEvent<WeakReference<TModel>> weakItem)
|
||||||
|
{
|
||||||
|
if (weakItem.NewValue.TryGetTarget(out var item))
|
||||||
|
setDownloadStateFromManager(item, DownloadState.LocallyAvailable);
|
||||||
|
}
|
||||||
|
|
||||||
private void itemRemoved(TModel s) => setDownloadStateFromManager(s, DownloadState.NotDownloaded);
|
private void itemRemoved(ValueChangedEvent<WeakReference<TModel>> weakItem)
|
||||||
|
{
|
||||||
|
if (weakItem.NewValue.TryGetTarget(out var item))
|
||||||
|
setDownloadStateFromManager(item, DownloadState.NotDownloaded);
|
||||||
|
}
|
||||||
|
|
||||||
private void setDownloadStateFromManager(TModel s, DownloadState state) => Schedule(() =>
|
private void setDownloadStateFromManager(TModel s, DownloadState state) => Schedule(() =>
|
||||||
{
|
{
|
||||||
@ -125,14 +154,6 @@ namespace osu.Game.Online
|
|||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
if (manager != null)
|
|
||||||
{
|
|
||||||
manager.DownloadBegan -= downloadBegan;
|
|
||||||
manager.DownloadFailed -= downloadFailed;
|
|
||||||
manager.ItemAdded -= itemAdded;
|
|
||||||
manager.ItemRemoved -= itemRemoved;
|
|
||||||
}
|
|
||||||
|
|
||||||
State.UnbindAll();
|
State.UnbindAll();
|
||||||
|
|
||||||
attachDownload(null);
|
attachDownload(null);
|
||||||
|
@ -186,8 +186,17 @@ namespace osu.Game
|
|||||||
return ScoreManager.QueryScores(s => beatmapIds.Contains(s.Beatmap.ID)).ToList();
|
return ScoreManager.QueryScores(s => beatmapIds.Contains(s.Beatmap.ID)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
BeatmapManager.ItemRemoved += i => ScoreManager.Delete(getBeatmapScores(i), true);
|
BeatmapManager.ItemRemoved.BindValueChanged(i =>
|
||||||
BeatmapManager.ItemAdded += i => ScoreManager.Undelete(getBeatmapScores(i), true);
|
{
|
||||||
|
if (i.NewValue.TryGetTarget(out var item))
|
||||||
|
ScoreManager.Delete(getBeatmapScores(item), true);
|
||||||
|
});
|
||||||
|
|
||||||
|
BeatmapManager.ItemAdded.BindValueChanged(i =>
|
||||||
|
{
|
||||||
|
if (i.NewValue.TryGetTarget(out var item))
|
||||||
|
ScoreManager.Undelete(getBeatmapScores(item), true);
|
||||||
|
});
|
||||||
|
|
||||||
dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore));
|
dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore));
|
||||||
dependencies.Cache(SettingsStore = new SettingsStore(contextFactory));
|
dependencies.Cache(SettingsStore = new SettingsStore(contextFactory));
|
||||||
|
@ -60,11 +60,16 @@ namespace osu.Game.Overlays
|
|||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
private OnScreenDisplay onScreenDisplay { get; set; }
|
private OnScreenDisplay onScreenDisplay { get; set; }
|
||||||
|
|
||||||
|
private IBindable<WeakReference<BeatmapSetInfo>> managerAdded;
|
||||||
|
private IBindable<WeakReference<BeatmapSetInfo>> managerRemoved;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
beatmaps.ItemAdded += handleBeatmapAdded;
|
managerAdded = beatmaps.ItemAdded.GetBoundCopy();
|
||||||
beatmaps.ItemRemoved += handleBeatmapRemoved;
|
managerAdded.BindValueChanged(beatmapAdded);
|
||||||
|
managerRemoved = beatmaps.ItemRemoved.GetBoundCopy();
|
||||||
|
managerRemoved.BindValueChanged(beatmapRemoved);
|
||||||
|
|
||||||
beatmapSets.AddRange(beatmaps.GetAllUsableBeatmapSets(IncludedDetails.Minimal).OrderBy(_ => RNG.Next()));
|
beatmapSets.AddRange(beatmaps.GetAllUsableBeatmapSets(IncludedDetails.Minimal).OrderBy(_ => RNG.Next()));
|
||||||
}
|
}
|
||||||
@ -93,16 +98,28 @@ namespace osu.Game.Overlays
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsPlaying => current?.Track.IsRunning ?? false;
|
public bool IsPlaying => current?.Track.IsRunning ?? false;
|
||||||
|
|
||||||
private void handleBeatmapAdded(BeatmapSetInfo set) => Schedule(() =>
|
private void beatmapAdded(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakSet)
|
||||||
{
|
{
|
||||||
if (!beatmapSets.Contains(set))
|
if (weakSet.NewValue.TryGetTarget(out var set))
|
||||||
beatmapSets.Add(set);
|
{
|
||||||
});
|
Schedule(() =>
|
||||||
|
{
|
||||||
|
if (!beatmapSets.Contains(set))
|
||||||
|
beatmapSets.Add(set);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void handleBeatmapRemoved(BeatmapSetInfo set) => Schedule(() =>
|
private void beatmapRemoved(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakSet)
|
||||||
{
|
{
|
||||||
beatmapSets.RemoveAll(s => s.ID == set.ID);
|
if (weakSet.NewValue.TryGetTarget(out var set))
|
||||||
});
|
{
|
||||||
|
Schedule(() =>
|
||||||
|
{
|
||||||
|
beatmapSets.RemoveAll(s => s.ID == set.ID);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ScheduledDelegate seekDelegate;
|
private ScheduledDelegate seekDelegate;
|
||||||
|
|
||||||
@ -299,17 +316,6 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
|
|
||||||
if (beatmaps != null)
|
|
||||||
{
|
|
||||||
beatmaps.ItemAdded -= handleBeatmapAdded;
|
|
||||||
beatmaps.ItemRemoved -= handleBeatmapRemoved;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool OnPressed(GlobalAction action)
|
public bool OnPressed(GlobalAction action)
|
||||||
{
|
{
|
||||||
if (beatmap.Disabled)
|
if (beatmap.Disabled)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -30,6 +31,9 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private SkinManager skins { get; set; }
|
private SkinManager skins { get; set; }
|
||||||
|
|
||||||
|
private IBindable<WeakReference<SkinInfo>> managerAdded;
|
||||||
|
private IBindable<WeakReference<SkinInfo>> managerRemoved;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
@ -66,8 +70,11 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
skins.ItemAdded += itemAdded;
|
managerAdded = skins.ItemAdded.GetBoundCopy();
|
||||||
skins.ItemRemoved += itemRemoved;
|
managerAdded.BindValueChanged(itemAdded);
|
||||||
|
|
||||||
|
managerRemoved = skins.ItemRemoved.GetBoundCopy();
|
||||||
|
managerRemoved.BindValueChanged(itemRemoved);
|
||||||
|
|
||||||
config.BindWith(OsuSetting.Skin, configBindable);
|
config.BindWith(OsuSetting.Skin, configBindable);
|
||||||
|
|
||||||
@ -82,19 +89,16 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
dropdownBindable.BindValueChanged(skin => configBindable.Value = skin.NewValue.ID);
|
dropdownBindable.BindValueChanged(skin => configBindable.Value = skin.NewValue.ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void itemRemoved(SkinInfo s) => Schedule(() => skinDropdown.Items = skinDropdown.Items.Where(i => i.ID != s.ID).ToArray());
|
private void itemAdded(ValueChangedEvent<WeakReference<SkinInfo>> weakItem)
|
||||||
|
|
||||||
private void itemAdded(SkinInfo s) => Schedule(() => skinDropdown.Items = skinDropdown.Items.Append(s).ToArray());
|
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
if (weakItem.NewValue.TryGetTarget(out var item))
|
||||||
|
Schedule(() => skinDropdown.Items = skinDropdown.Items.Append(item).ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
if (skins != null)
|
private void itemRemoved(ValueChangedEvent<WeakReference<SkinInfo>> weakItem)
|
||||||
{
|
{
|
||||||
skins.ItemAdded -= itemAdded;
|
if (weakItem.NewValue.TryGetTarget(out var item))
|
||||||
skins.ItemRemoved -= itemRemoved;
|
Schedule(() => skinDropdown.Items = skinDropdown.Items.Where(i => i.ID != item.ID).ToArray());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SizeSlider : OsuSliderBar<float>
|
private class SizeSlider : OsuSliderBar<float>
|
||||||
|
@ -32,11 +32,16 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
Text = "Start";
|
Text = "Start";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IBindable<WeakReference<BeatmapSetInfo>> managerAdded;
|
||||||
|
private IBindable<WeakReference<BeatmapSetInfo>> managerRemoved;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
beatmaps.ItemAdded += beatmapAdded;
|
managerAdded = beatmaps.ItemAdded.GetBoundCopy();
|
||||||
beatmaps.ItemRemoved += beatmapRemoved;
|
managerAdded.BindValueChanged(beatmapAdded);
|
||||||
|
managerRemoved = beatmaps.ItemRemoved.GetBoundCopy();
|
||||||
|
managerRemoved.BindValueChanged(beatmapRemoved);
|
||||||
|
|
||||||
SelectedItem.BindValueChanged(item => updateSelectedItem(item.NewValue), true);
|
SelectedItem.BindValueChanged(item => updateSelectedItem(item.NewValue), true);
|
||||||
|
|
||||||
@ -56,24 +61,30 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
hasBeatmap = beatmaps.QueryBeatmap(b => b.OnlineBeatmapID == beatmapId) != null;
|
hasBeatmap = beatmaps.QueryBeatmap(b => b.OnlineBeatmapID == beatmapId) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void beatmapAdded(BeatmapSetInfo model)
|
private void beatmapAdded(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakSet)
|
||||||
{
|
{
|
||||||
int? beatmapId = SelectedItem.Value?.Beatmap.Value?.OnlineBeatmapID;
|
if (weakSet.NewValue.TryGetTarget(out var set))
|
||||||
if (beatmapId == null)
|
{
|
||||||
return;
|
int? beatmapId = SelectedItem.Value?.Beatmap.Value?.OnlineBeatmapID;
|
||||||
|
if (beatmapId == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (model.Beatmaps.Any(b => b.OnlineBeatmapID == beatmapId))
|
if (set.Beatmaps.Any(b => b.OnlineBeatmapID == beatmapId))
|
||||||
Schedule(() => hasBeatmap = true);
|
Schedule(() => hasBeatmap = true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void beatmapRemoved(BeatmapSetInfo model)
|
private void beatmapRemoved(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakSet)
|
||||||
{
|
{
|
||||||
int? beatmapId = SelectedItem.Value?.Beatmap.Value?.OnlineBeatmapID;
|
if (weakSet.NewValue.TryGetTarget(out var set))
|
||||||
if (beatmapId == null)
|
{
|
||||||
return;
|
int? beatmapId = SelectedItem.Value?.Beatmap.Value?.OnlineBeatmapID;
|
||||||
|
if (beatmapId == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (model.Beatmaps.Any(b => b.OnlineBeatmapID == beatmapId))
|
if (set.Beatmaps.Any(b => b.OnlineBeatmapID == beatmapId))
|
||||||
Schedule(() => hasBeatmap = false);
|
Schedule(() => hasBeatmap = false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
@ -95,16 +106,5 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
|
|
||||||
Enabled.Value = hasBeatmap && hasEnoughTime;
|
Enabled.Value = hasBeatmap && hasEnoughTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
|
|
||||||
if (beatmaps != null)
|
|
||||||
{
|
|
||||||
beatmaps.ItemAdded -= beatmapAdded;
|
|
||||||
beatmaps.ItemRemoved -= beatmapRemoved;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,8 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
private LeaderboardChatDisplay leaderboardChatDisplay;
|
private LeaderboardChatDisplay leaderboardChatDisplay;
|
||||||
private MatchSettingsOverlay settingsOverlay;
|
private MatchSettingsOverlay settingsOverlay;
|
||||||
|
|
||||||
|
private IBindable<WeakReference<BeatmapSetInfo>> managerAdded;
|
||||||
|
|
||||||
public MatchSubScreen(Room room)
|
public MatchSubScreen(Room room)
|
||||||
{
|
{
|
||||||
Title = room.RoomID.Value == null ? "New room" : room.Name.Value;
|
Title = room.RoomID.Value == null ? "New room" : room.Name.Value;
|
||||||
@ -181,7 +183,8 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
SelectedItem.BindValueChanged(_ => Scheduler.AddOnce(selectedItemChanged));
|
SelectedItem.BindValueChanged(_ => Scheduler.AddOnce(selectedItemChanged));
|
||||||
SelectedItem.Value = playlist.FirstOrDefault();
|
SelectedItem.Value = playlist.FirstOrDefault();
|
||||||
|
|
||||||
beatmapManager.ItemAdded += beatmapAdded;
|
managerAdded = beatmapManager.ItemAdded.GetBoundCopy();
|
||||||
|
managerAdded.BindValueChanged(beatmapAdded);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnExiting(IScreen next)
|
public override bool OnExiting(IScreen next)
|
||||||
@ -214,13 +217,16 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
Beatmap.Value = beatmapManager.GetWorkingBeatmap(localBeatmap);
|
Beatmap.Value = beatmapManager.GetWorkingBeatmap(localBeatmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void beatmapAdded(BeatmapSetInfo model) => Schedule(() =>
|
private void beatmapAdded(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakSet)
|
||||||
{
|
{
|
||||||
if (Beatmap.Value != beatmapManager.DefaultBeatmap)
|
Schedule(() =>
|
||||||
return;
|
{
|
||||||
|
if (Beatmap.Value != beatmapManager.DefaultBeatmap)
|
||||||
|
return;
|
||||||
|
|
||||||
updateWorkingBeatmap();
|
updateWorkingBeatmap();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void onStart()
|
private void onStart()
|
||||||
{
|
{
|
||||||
@ -235,13 +241,5 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
|
|
||||||
if (beatmapManager != null)
|
|
||||||
beatmapManager.ItemAdded -= beatmapAdded;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,6 +131,11 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private CarouselRoot root;
|
private CarouselRoot root;
|
||||||
|
|
||||||
|
private IBindable<WeakReference<BeatmapSetInfo>> itemAdded;
|
||||||
|
private IBindable<WeakReference<BeatmapSetInfo>> itemRemoved;
|
||||||
|
private IBindable<WeakReference<BeatmapInfo>> itemHidden;
|
||||||
|
private IBindable<WeakReference<BeatmapInfo>> itemRestored;
|
||||||
|
|
||||||
public BeatmapCarousel()
|
public BeatmapCarousel()
|
||||||
{
|
{
|
||||||
root = new CarouselRoot(this);
|
root = new CarouselRoot(this);
|
||||||
@ -161,10 +166,14 @@ namespace osu.Game.Screens.Select
|
|||||||
RightClickScrollingEnabled.ValueChanged += enabled => scroll.RightMouseScrollbar = enabled.NewValue;
|
RightClickScrollingEnabled.ValueChanged += enabled => scroll.RightMouseScrollbar = enabled.NewValue;
|
||||||
RightClickScrollingEnabled.TriggerChange();
|
RightClickScrollingEnabled.TriggerChange();
|
||||||
|
|
||||||
beatmaps.ItemAdded += beatmapAdded;
|
itemAdded = beatmaps.ItemAdded.GetBoundCopy();
|
||||||
beatmaps.ItemRemoved += beatmapRemoved;
|
itemAdded.BindValueChanged(beatmapAdded);
|
||||||
beatmaps.BeatmapHidden += beatmapHidden;
|
itemRemoved = beatmaps.ItemRemoved.GetBoundCopy();
|
||||||
beatmaps.BeatmapRestored += beatmapRestored;
|
itemRemoved.BindValueChanged(beatmapRemoved);
|
||||||
|
itemHidden = beatmaps.BeatmapHidden.GetBoundCopy();
|
||||||
|
itemHidden.BindValueChanged(beatmapHidden);
|
||||||
|
itemRestored = beatmaps.BeatmapRestored.GetBoundCopy();
|
||||||
|
itemRestored.BindValueChanged(beatmapRestored);
|
||||||
|
|
||||||
loadBeatmapSets(GetLoadableBeatmaps());
|
loadBeatmapSets(GetLoadableBeatmaps());
|
||||||
}
|
}
|
||||||
@ -562,26 +571,34 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
if (beatmaps != null)
|
|
||||||
{
|
|
||||||
beatmaps.ItemAdded -= beatmapAdded;
|
|
||||||
beatmaps.ItemRemoved -= beatmapRemoved;
|
|
||||||
beatmaps.BeatmapHidden -= beatmapHidden;
|
|
||||||
beatmaps.BeatmapRestored -= beatmapRestored;
|
|
||||||
}
|
|
||||||
|
|
||||||
// aggressively dispose "off-screen" items to reduce GC pressure.
|
// aggressively dispose "off-screen" items to reduce GC pressure.
|
||||||
foreach (var i in Items)
|
foreach (var i in Items)
|
||||||
i.Dispose();
|
i.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void beatmapRemoved(BeatmapSetInfo item) => RemoveBeatmapSet(item);
|
private void beatmapRemoved(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakItem)
|
||||||
|
{
|
||||||
|
if (weakItem.NewValue.TryGetTarget(out var item))
|
||||||
|
RemoveBeatmapSet(item);
|
||||||
|
}
|
||||||
|
|
||||||
private void beatmapAdded(BeatmapSetInfo item) => UpdateBeatmapSet(item);
|
private void beatmapAdded(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakItem)
|
||||||
|
{
|
||||||
|
if (weakItem.NewValue.TryGetTarget(out var item))
|
||||||
|
UpdateBeatmapSet(item);
|
||||||
|
}
|
||||||
|
|
||||||
private void beatmapRestored(BeatmapInfo b) => UpdateBeatmapSet(beatmaps.QueryBeatmapSet(s => s.ID == b.BeatmapSetInfoID));
|
private void beatmapRestored(ValueChangedEvent<WeakReference<BeatmapInfo>> weakItem)
|
||||||
|
{
|
||||||
|
if (weakItem.NewValue.TryGetTarget(out var b))
|
||||||
|
UpdateBeatmapSet(beatmaps.QueryBeatmapSet(s => s.ID == b.BeatmapSetInfoID));
|
||||||
|
}
|
||||||
|
|
||||||
private void beatmapHidden(BeatmapInfo b) => UpdateBeatmapSet(beatmaps.QueryBeatmapSet(s => s.ID == b.BeatmapSetInfoID));
|
private void beatmapHidden(ValueChangedEvent<WeakReference<BeatmapInfo>> weakItem)
|
||||||
|
{
|
||||||
|
if (weakItem.NewValue.TryGetTarget(out var b))
|
||||||
|
UpdateBeatmapSet(beatmaps.QueryBeatmapSet(s => s.ID == b.BeatmapSetInfoID));
|
||||||
|
}
|
||||||
|
|
||||||
private CarouselBeatmapSet createCarouselSet(BeatmapSetInfo beatmapSet)
|
private CarouselBeatmapSet createCarouselSet(BeatmapSetInfo beatmapSet)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -27,6 +28,9 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; }
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
|
private IBindable<WeakReference<ScoreInfo>> itemAdded;
|
||||||
|
private IBindable<WeakReference<ScoreInfo>> itemRemoved;
|
||||||
|
|
||||||
public TopLocalRank(BeatmapInfo beatmap)
|
public TopLocalRank(BeatmapInfo beatmap)
|
||||||
: base(null)
|
: base(null)
|
||||||
{
|
{
|
||||||
@ -36,17 +40,24 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
scores.ItemAdded += scoreChanged;
|
itemAdded = scores.ItemAdded.GetBoundCopy();
|
||||||
scores.ItemRemoved += scoreChanged;
|
itemAdded.BindValueChanged(scoreChanged);
|
||||||
|
|
||||||
|
itemRemoved = scores.ItemRemoved.GetBoundCopy();
|
||||||
|
itemRemoved.BindValueChanged(scoreChanged);
|
||||||
|
|
||||||
ruleset.ValueChanged += _ => fetchAndLoadTopScore();
|
ruleset.ValueChanged += _ => fetchAndLoadTopScore();
|
||||||
|
|
||||||
fetchAndLoadTopScore();
|
fetchAndLoadTopScore();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scoreChanged(ScoreInfo score)
|
private void scoreChanged(ValueChangedEvent<WeakReference<ScoreInfo>> weakScore)
|
||||||
{
|
{
|
||||||
if (score.BeatmapInfoID == beatmap.ID)
|
if (weakScore.NewValue.TryGetTarget(out var score))
|
||||||
fetchAndLoadTopScore();
|
{
|
||||||
|
if (score.BeatmapInfoID == beatmap.ID)
|
||||||
|
fetchAndLoadTopScore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScheduledDelegate scheduledRankUpdate;
|
private ScheduledDelegate scheduledRankUpdate;
|
||||||
@ -75,16 +86,5 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
.OrderByDescending(s => s.TotalScore)
|
.OrderByDescending(s => s.TotalScore)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
|
|
||||||
if (scores != null)
|
|
||||||
{
|
|
||||||
scores.ItemAdded -= scoreChanged;
|
|
||||||
scores.ItemRemoved -= scoreChanged;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,8 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
|
|
||||||
private UserTopScoreContainer topScoreContainer;
|
private UserTopScoreContainer topScoreContainer;
|
||||||
|
|
||||||
|
private IBindable<WeakReference<ScoreInfo>> itemRemoved;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to apply the game's currently selected mods as a filter when retrieving scores.
|
/// Whether to apply the game's currently selected mods as a filter when retrieving scores.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -104,7 +106,8 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
ScoreSelected = s => ScoreSelected?.Invoke(s)
|
ScoreSelected = s => ScoreSelected?.Invoke(s)
|
||||||
});
|
});
|
||||||
|
|
||||||
scoreManager.ItemRemoved += onScoreRemoved;
|
itemRemoved = scoreManager.ItemRemoved.GetBoundCopy();
|
||||||
|
itemRemoved.BindValueChanged(onScoreRemoved);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Reset()
|
protected override void Reset()
|
||||||
@ -113,7 +116,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
TopScore = null;
|
TopScore = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onScoreRemoved(ScoreInfo score) => Schedule(RefreshScores);
|
private void onScoreRemoved(ValueChangedEvent<WeakReference<ScoreInfo>> score) => Schedule(RefreshScores);
|
||||||
|
|
||||||
protected override bool IsOnlineScope => Scope != BeatmapLeaderboardScope.Local;
|
protected override bool IsOnlineScope => Scope != BeatmapLeaderboardScope.Local;
|
||||||
|
|
||||||
@ -190,13 +193,5 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
{
|
{
|
||||||
Action = () => ScoreSelected?.Invoke(model)
|
Action = () => ScoreSelected?.Invoke(model)
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
|
|
||||||
if (scoreManager != null)
|
|
||||||
scoreManager.ItemRemoved -= onScoreRemoved;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,12 +43,15 @@ namespace osu.Game.Skinning
|
|||||||
this.audio = audio;
|
this.audio = audio;
|
||||||
this.legacyDefaultResources = legacyDefaultResources;
|
this.legacyDefaultResources = legacyDefaultResources;
|
||||||
|
|
||||||
ItemRemoved += removedInfo =>
|
ItemRemoved.BindValueChanged(weakRemovedInfo =>
|
||||||
{
|
{
|
||||||
// check the removed skin is not the current user choice. if it is, switch back to default.
|
if (weakRemovedInfo.NewValue.TryGetTarget(out var removedInfo))
|
||||||
if (removedInfo.ID == CurrentSkinInfo.Value.ID)
|
{
|
||||||
CurrentSkinInfo.Value = SkinInfo.Default;
|
// check the removed skin is not the current user choice. if it is, switch back to default.
|
||||||
};
|
if (removedInfo.ID == CurrentSkinInfo.Value.ID)
|
||||||
|
CurrentSkinInfo.Value = SkinInfo.Default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
CurrentSkinInfo.ValueChanged += skin => CurrentSkin.Value = GetSkin(skin.NewValue);
|
CurrentSkinInfo.ValueChanged += skin => CurrentSkin.Value = GetSkin(skin.NewValue);
|
||||||
CurrentSkin.ValueChanged += skin =>
|
CurrentSkin.ValueChanged += skin =>
|
||||||
|
Loading…
Reference in New Issue
Block a user