mirror of
https://github.com/ppy/osu
synced 2024-12-13 10:28:17 +00:00
Merge branch 'master' into fix-slider-ticks-appearing-too-late
This commit is contained in:
commit
d2669762ab
@ -185,10 +185,15 @@ namespace osu.Game.Online.Leaderboards
|
||||
if (scores != null)
|
||||
this.scores.AddRange(scores);
|
||||
|
||||
// Schedule needs to be non-delayed here for the weird logic in refetchScores to work.
|
||||
// If it is removed, the placeholder will be incorrectly updated to "no scores" rather than "retrieving".
|
||||
// This whole flow should be refactored in the future.
|
||||
Scheduler.Add(applyNewScores, false);
|
||||
// Non-delayed schedule may potentially run inline (due to IsMainThread check passing) after leaderboard is disposed.
|
||||
// This is guarded against in BeatmapLeaderboard via web request cancellation, but let's be extra safe.
|
||||
if (!IsDisposed)
|
||||
{
|
||||
// Schedule needs to be non-delayed here for the weird logic in refetchScores to work.
|
||||
// If it is removed, the placeholder will be incorrectly updated to "no scores" rather than "retrieving".
|
||||
// This whole flow should be refactored in the future.
|
||||
Scheduler.Add(applyNewScores, false);
|
||||
}
|
||||
|
||||
void applyNewScores()
|
||||
{
|
||||
|
@ -123,7 +123,7 @@ namespace osu.Game.Overlays.FirstRunSetup
|
||||
beatmapSubscription?.Dispose();
|
||||
}
|
||||
|
||||
private void beatmapsChanged(IRealmCollection<BeatmapSetInfo> sender, ChangeSet? changes, Exception error)
|
||||
private void beatmapsChanged(IRealmCollection<BeatmapSetInfo> sender, ChangeSet? changes, Exception error) => Schedule(() =>
|
||||
{
|
||||
currentlyLoadedBeatmaps.Text = FirstRunSetupBeatmapScreenStrings.CurrentlyLoadedBeatmaps(sender.Count);
|
||||
|
||||
@ -139,7 +139,7 @@ namespace osu.Game.Overlays.FirstRunSetup
|
||||
currentlyLoadedBeatmaps.ScaleTo(1.1f)
|
||||
.ScaleTo(1, 1500, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
private void downloadTutorial()
|
||||
{
|
||||
|
@ -58,12 +58,11 @@ namespace osu.Game.Overlays
|
||||
[Resolved]
|
||||
private RealmAccess realm { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
// Todo: These binds really shouldn't be here, but are unlikely to cause any issues for now.
|
||||
// They are placed here for now since some tests rely on setting the beatmap _and_ their hierarchies inside their load(), which runs before the MusicController's load().
|
||||
beatmap.BindValueChanged(beatmapChanged, true);
|
||||
base.LoadComplete();
|
||||
|
||||
beatmap.BindValueChanged(b => changeBeatmap(b.NewValue), true);
|
||||
mods.BindValueChanged(_ => ResetTrackAdjustments(), true);
|
||||
}
|
||||
|
||||
@ -263,8 +262,6 @@ namespace osu.Game.Overlays
|
||||
|
||||
private IQueryable<BeatmapSetInfo> getBeatmapSets() => realm.Realm.All<BeatmapSetInfo>().Where(s => !s.DeletePending);
|
||||
|
||||
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> beatmap) => changeBeatmap(beatmap.NewValue);
|
||||
|
||||
private void changeBeatmap(WorkingBeatmap newWorking)
|
||||
{
|
||||
// This method can potentially be triggered multiple times as it is eagerly fired in next() / prev() to ensure correct execution order
|
||||
|
@ -215,21 +215,21 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
rotation.BindTo(tabletHandler.Rotation);
|
||||
|
||||
areaOffset.BindTo(tabletHandler.AreaOffset);
|
||||
areaOffset.BindValueChanged(val =>
|
||||
areaOffset.BindValueChanged(val => Schedule(() =>
|
||||
{
|
||||
offsetX.Value = val.NewValue.X;
|
||||
offsetY.Value = val.NewValue.Y;
|
||||
}, true);
|
||||
}), true);
|
||||
|
||||
offsetX.BindValueChanged(val => areaOffset.Value = new Vector2(val.NewValue, areaOffset.Value.Y));
|
||||
offsetY.BindValueChanged(val => areaOffset.Value = new Vector2(areaOffset.Value.X, val.NewValue));
|
||||
|
||||
areaSize.BindTo(tabletHandler.AreaSize);
|
||||
areaSize.BindValueChanged(val =>
|
||||
areaSize.BindValueChanged(val => Schedule(() =>
|
||||
{
|
||||
sizeX.Value = val.NewValue.X;
|
||||
sizeY.Value = val.NewValue.Y;
|
||||
}, true);
|
||||
}), true);
|
||||
|
||||
sizeX.BindValueChanged(val =>
|
||||
{
|
||||
@ -255,7 +255,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
});
|
||||
|
||||
tablet.BindTo(tabletHandler.Tablet);
|
||||
tablet.BindValueChanged(val =>
|
||||
tablet.BindValueChanged(val => Schedule(() =>
|
||||
{
|
||||
Scheduler.AddOnce(updateVisibility);
|
||||
|
||||
@ -274,7 +274,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
sizeY.Default = sizeY.MaxValue = tab.Size.Y;
|
||||
|
||||
areaSize.Default = new Vector2(sizeX.Default, sizeY.Default);
|
||||
}, true);
|
||||
}), true);
|
||||
}
|
||||
|
||||
private void updateVisibility()
|
||||
|
@ -58,6 +58,9 @@ namespace osu.Game.Rulesets.Configuration
|
||||
pendingWrites.Clear();
|
||||
}
|
||||
|
||||
if (!changed.Any())
|
||||
return true;
|
||||
|
||||
realm?.Write(r =>
|
||||
{
|
||||
foreach (var c in changed)
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
@ -12,6 +10,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
@ -34,19 +33,20 @@ namespace osu.Game.Screens.Play.HUD
|
||||
public readonly SortedDictionary<int, BindableLong> TeamScores = new SortedDictionary<int, BindableLong>();
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
private OsuColour colours { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private SpectatorClient spectatorClient { get; set; }
|
||||
private SpectatorClient spectatorClient { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private MultiplayerClient multiplayerClient { get; set; }
|
||||
private MultiplayerClient multiplayerClient { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private UserLookupCache userLookupCache { get; set; }
|
||||
private UserLookupCache userLookupCache { get; set; } = null!;
|
||||
|
||||
private Bindable<ScoringMode> scoringMode = null!;
|
||||
|
||||
private readonly MultiplayerRoomUser[] playingUsers;
|
||||
private Bindable<ScoringMode> scoringMode;
|
||||
|
||||
private readonly IBindableList<int> playingUserIds = new BindableList<int>();
|
||||
|
||||
@ -126,14 +126,17 @@ namespace osu.Game.Screens.Play.HUD
|
||||
playingUserIds.BindCollectionChanged(playingUsersChanged);
|
||||
}
|
||||
|
||||
protected override GameplayLeaderboardScore CreateLeaderboardScoreDrawable(IUser user, bool isTracked)
|
||||
protected override GameplayLeaderboardScore CreateLeaderboardScoreDrawable(IUser? user, bool isTracked)
|
||||
{
|
||||
var leaderboardScore = base.CreateLeaderboardScoreDrawable(user, isTracked);
|
||||
|
||||
if (UserScores[user.OnlineID].Team is int team)
|
||||
if (user != null)
|
||||
{
|
||||
leaderboardScore.BackgroundColour = getTeamColour(team).Lighten(1.2f);
|
||||
leaderboardScore.TextColour = Color4.White;
|
||||
if (UserScores[user.OnlineID].Team is int team)
|
||||
{
|
||||
leaderboardScore.BackgroundColour = getTeamColour(team).Lighten(1.2f);
|
||||
leaderboardScore.TextColour = Color4.White;
|
||||
}
|
||||
}
|
||||
|
||||
return leaderboardScore;
|
||||
@ -189,7 +192,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (spectatorClient != null)
|
||||
if (spectatorClient.IsNotNull())
|
||||
{
|
||||
foreach (var user in playingUsers)
|
||||
spectatorClient.StopWatchingUser(user.UserID);
|
||||
|
@ -89,6 +89,8 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
|
||||
private IDisposable scoreSubscription;
|
||||
|
||||
private GetScoresRequest scoreRetrievalRequest;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
@ -151,14 +153,14 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
else if (filterMods)
|
||||
requestMods = mods.Value;
|
||||
|
||||
var req = new GetScoresRequest(fetchBeatmapInfo, fetchRuleset, Scope, requestMods);
|
||||
scoreRetrievalRequest = new GetScoresRequest(fetchBeatmapInfo, fetchRuleset, Scope, requestMods);
|
||||
|
||||
req.Success += r => SetScores(
|
||||
scoreManager.OrderByTotalScore(r.Scores.Select(s => s.ToScoreInfo(rulesets, fetchBeatmapInfo))),
|
||||
r.UserScore?.CreateScoreInfo(rulesets, fetchBeatmapInfo)
|
||||
scoreRetrievalRequest.Success += response => SetScores(
|
||||
scoreManager.OrderByTotalScore(response.Scores.Select(s => s.ToScoreInfo(rulesets, fetchBeatmapInfo))),
|
||||
response.UserScore?.CreateScoreInfo(rulesets, fetchBeatmapInfo)
|
||||
);
|
||||
|
||||
return req;
|
||||
return scoreRetrievalRequest;
|
||||
}
|
||||
|
||||
protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) => new LeaderboardScore(model, index, IsOnlineScope)
|
||||
@ -218,7 +220,9 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
scoreSubscription?.Dispose();
|
||||
scoreRetrievalRequest?.Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user