mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
Remove IOnlineComponent and change existing components to use bindable flow
This commit is contained in:
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
@ -22,7 +23,7 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Online.Leaderboards
|
||||
{
|
||||
public abstract class Leaderboard<TScope, TScoreInfo> : Container, IOnlineComponent
|
||||
public abstract class Leaderboard<TScope, TScoreInfo> : Container
|
||||
{
|
||||
private const double fade_duration = 300;
|
||||
|
||||
@ -242,16 +243,13 @@ namespace osu.Game.Online.Leaderboards
|
||||
|
||||
private ScheduledDelegate pendingUpdateScores;
|
||||
|
||||
private readonly IBindable<APIState> apiState = new Bindable<APIState>();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
api?.Register(this);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
api?.Unregister(this);
|
||||
apiState.BindTo(api.State);
|
||||
apiState.BindValueChanged(onlineStateChanged, true);
|
||||
}
|
||||
|
||||
public void RefreshScores() => UpdateScores();
|
||||
@ -260,9 +258,9 @@ namespace osu.Game.Online.Leaderboards
|
||||
|
||||
protected abstract bool IsOnlineScope { get; }
|
||||
|
||||
public void APIStateChanged(IAPIProvider api, APIState state)
|
||||
private void onlineStateChanged(ValueChangedEvent<APIState> state) => Schedule(() =>
|
||||
{
|
||||
switch (state)
|
||||
switch (state.NewValue)
|
||||
{
|
||||
case APIState.Online:
|
||||
case APIState.Offline:
|
||||
@ -271,7 +269,7 @@ namespace osu.Game.Online.Leaderboards
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
protected void UpdateScores()
|
||||
{
|
||||
|
Reference in New Issue
Block a user