mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Merge branch 'master' into score-refactor/isolated-serialisation
This commit is contained in:
@ -248,10 +248,7 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
protected virtual IEnumerable<Drawable> CreateButtons() =>
|
||||
new Drawable[]
|
||||
{
|
||||
new PlaylistDownloadButton(Item)
|
||||
{
|
||||
Size = new Vector2(50, 30)
|
||||
},
|
||||
new PlaylistDownloadButton(Item),
|
||||
new PlaylistRemoveButton
|
||||
{
|
||||
Size = new Vector2(30, 30),
|
||||
@ -282,28 +279,33 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
return true;
|
||||
}
|
||||
|
||||
private class PlaylistDownloadButton : BeatmapPanelDownloadButton
|
||||
private sealed class PlaylistDownloadButton : BeatmapPanelDownloadButton
|
||||
{
|
||||
private readonly PlaylistItem playlistItem;
|
||||
|
||||
[Resolved]
|
||||
private BeatmapManager beatmapManager { get; set; }
|
||||
|
||||
public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks;
|
||||
// required for download tracking, as this button hides itself. can probably be removed with a bit of consideration.
|
||||
public override bool IsPresent => true;
|
||||
|
||||
private const float width = 50;
|
||||
|
||||
public PlaylistDownloadButton(PlaylistItem playlistItem)
|
||||
: base(playlistItem.Beatmap.Value.BeatmapSet)
|
||||
{
|
||||
this.playlistItem = playlistItem;
|
||||
|
||||
Size = new Vector2(width, 30);
|
||||
Alpha = 0;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
State.BindValueChanged(stateChanged, true);
|
||||
FinishTransforms(true);
|
||||
|
||||
// base implementation calls FinishTransforms, so should be run after the above state update.
|
||||
base.LoadComplete();
|
||||
}
|
||||
|
||||
private void stateChanged(ValueChangedEvent<DownloadState> state)
|
||||
@ -315,12 +317,16 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
if (beatmapManager.QueryBeatmap(b => b.MD5Hash == playlistItem.Beatmap.Value.MD5Hash) == null)
|
||||
State.Value = DownloadState.NotDownloaded;
|
||||
else
|
||||
this.FadeTo(0, 500);
|
||||
{
|
||||
this.FadeTo(0, 500)
|
||||
.ResizeWidthTo(0, 500, Easing.OutQuint);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
this.FadeTo(1, 500);
|
||||
this.ResizeWidthTo(width, 500, Easing.OutQuint)
|
||||
.FadeTo(1, 500);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -65,9 +65,9 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
private IBindable<WeakReference<BeatmapSetInfo>> managerUpdated;
|
||||
|
||||
[Cached]
|
||||
protected OnlinePlayBeatmapAvailabilityTracker BeatmapAvailabilityTracker { get; private set; }
|
||||
private OnlinePlayBeatmapAvailabilityTracker beatmapAvailabilityTracker { get; set; }
|
||||
|
||||
protected IBindable<BeatmapAvailability> BeatmapAvailability => BeatmapAvailabilityTracker.Availability;
|
||||
protected IBindable<BeatmapAvailability> BeatmapAvailability => beatmapAvailabilityTracker.Availability;
|
||||
|
||||
public readonly Room Room;
|
||||
private readonly bool allowEdit;
|
||||
@ -88,7 +88,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
|
||||
Padding = new MarginPadding { Top = Header.HEIGHT };
|
||||
|
||||
BeatmapAvailabilityTracker = new OnlinePlayBeatmapAvailabilityTracker
|
||||
beatmapAvailabilityTracker = new OnlinePlayBeatmapAvailabilityTracker
|
||||
{
|
||||
SelectedItem = { BindTarget = SelectedItem }
|
||||
};
|
||||
@ -103,7 +103,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
BeatmapAvailabilityTracker,
|
||||
beatmapAvailabilityTracker,
|
||||
new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
@ -10,6 +10,7 @@ using ManagedBass.Fx;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@ -83,7 +84,7 @@ namespace osu.Game.Screens.Play
|
||||
Content,
|
||||
redFlashLayer = new Box
|
||||
{
|
||||
Colour = Color4.Red,
|
||||
Colour = Color4.Red.Opacity(0.6f),
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Blending = BlendingParameters.Additive,
|
||||
Depth = float.MinValue,
|
||||
|
@ -4,6 +4,7 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online;
|
||||
@ -12,13 +13,17 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
public class ReplayDownloadButton : DownloadTrackingComposite<ScoreInfo, ScoreManager>
|
||||
public class ReplayDownloadButton : CompositeDrawable
|
||||
{
|
||||
public Bindable<ScoreInfo> Score => Model;
|
||||
public readonly Bindable<ScoreInfo> Score = new Bindable<ScoreInfo>();
|
||||
|
||||
protected readonly Bindable<DownloadState> State = new Bindable<DownloadState>();
|
||||
|
||||
private DownloadButton button;
|
||||
private ShakeContainer shakeContainer;
|
||||
|
||||
private ScoreDownloadTracker downloadTracker;
|
||||
|
||||
private ReplayAvailability replayAvailability
|
||||
{
|
||||
get
|
||||
@ -26,7 +31,7 @@ namespace osu.Game.Screens.Ranking
|
||||
if (State.Value == DownloadState.LocallyAvailable)
|
||||
return ReplayAvailability.Local;
|
||||
|
||||
if (!string.IsNullOrEmpty(Model.Value?.Hash))
|
||||
if (!string.IsNullOrEmpty(Score.Value?.Hash))
|
||||
return ReplayAvailability.Online;
|
||||
|
||||
return ReplayAvailability.NotAvailable;
|
||||
@ -34,8 +39,8 @@ namespace osu.Game.Screens.Ranking
|
||||
}
|
||||
|
||||
public ReplayDownloadButton(ScoreInfo score)
|
||||
: base(score)
|
||||
{
|
||||
Score.Value = score;
|
||||
Size = new Vector2(50, 30);
|
||||
}
|
||||
|
||||
@ -56,11 +61,11 @@ namespace osu.Game.Screens.Ranking
|
||||
switch (State.Value)
|
||||
{
|
||||
case DownloadState.LocallyAvailable:
|
||||
game?.PresentScore(Model.Value, ScorePresentType.Gameplay);
|
||||
game?.PresentScore(Score.Value, ScorePresentType.Gameplay);
|
||||
break;
|
||||
|
||||
case DownloadState.NotDownloaded:
|
||||
scores.Download(Model.Value, false);
|
||||
scores.Download(Score.Value, false);
|
||||
break;
|
||||
|
||||
case DownloadState.Importing:
|
||||
@ -70,17 +75,25 @@ namespace osu.Game.Screens.Ranking
|
||||
}
|
||||
};
|
||||
|
||||
State.BindValueChanged(state =>
|
||||
Score.BindValueChanged(score =>
|
||||
{
|
||||
button.State.Value = state.NewValue;
|
||||
downloadTracker?.RemoveAndDisposeImmediately();
|
||||
|
||||
if (score.NewValue != null)
|
||||
{
|
||||
AddInternal(downloadTracker = new ScoreDownloadTracker(score.NewValue)
|
||||
{
|
||||
State = { BindTarget = State }
|
||||
});
|
||||
}
|
||||
|
||||
button.Enabled.Value = replayAvailability != ReplayAvailability.NotAvailable;
|
||||
updateTooltip();
|
||||
}, true);
|
||||
|
||||
Model.BindValueChanged(_ =>
|
||||
State.BindValueChanged(state =>
|
||||
{
|
||||
button.Enabled.Value = replayAvailability != ReplayAvailability.NotAvailable;
|
||||
|
||||
button.State.Value = state.NewValue;
|
||||
updateTooltip();
|
||||
}, true);
|
||||
}
|
||||
|
@ -94,9 +94,6 @@ namespace osu.Game.Screens.Select.Details
|
||||
modSettingChangeTracker = new ModSettingChangeTracker(mods.NewValue);
|
||||
modSettingChangeTracker.SettingChanged += m =>
|
||||
{
|
||||
if (!(m is IApplicableToDifficulty))
|
||||
return;
|
||||
|
||||
debouncedStatisticsUpdate?.Cancel();
|
||||
debouncedStatisticsUpdate = Scheduler.AddDelayed(updateStatistics, 100);
|
||||
};
|
||||
|
Reference in New Issue
Block a user