mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 02:42:54 +08: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)
|
if (scores != null)
|
||||||
this.scores.AddRange(scores);
|
this.scores.AddRange(scores);
|
||||||
|
|
||||||
|
// 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.
|
// 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".
|
// 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.
|
// This whole flow should be refactored in the future.
|
||||||
Scheduler.Add(applyNewScores, false);
|
Scheduler.Add(applyNewScores, false);
|
||||||
|
}
|
||||||
|
|
||||||
void applyNewScores()
|
void applyNewScores()
|
||||||
{
|
{
|
||||||
|
@ -123,7 +123,7 @@ namespace osu.Game.Overlays.FirstRunSetup
|
|||||||
beatmapSubscription?.Dispose();
|
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);
|
currentlyLoadedBeatmaps.Text = FirstRunSetupBeatmapScreenStrings.CurrentlyLoadedBeatmaps(sender.Count);
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ namespace osu.Game.Overlays.FirstRunSetup
|
|||||||
currentlyLoadedBeatmaps.ScaleTo(1.1f)
|
currentlyLoadedBeatmaps.ScaleTo(1.1f)
|
||||||
.ScaleTo(1, 1500, Easing.OutQuint);
|
.ScaleTo(1, 1500, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
private void downloadTutorial()
|
private void downloadTutorial()
|
||||||
{
|
{
|
||||||
|
@ -58,12 +58,11 @@ namespace osu.Game.Overlays
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private RealmAccess realm { get; set; }
|
private RealmAccess realm { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
protected override void LoadComplete()
|
||||||
private void load()
|
|
||||||
{
|
{
|
||||||
// Todo: These binds really shouldn't be here, but are unlikely to cause any issues for now.
|
base.LoadComplete();
|
||||||
// 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);
|
beatmap.BindValueChanged(b => changeBeatmap(b.NewValue), true);
|
||||||
mods.BindValueChanged(_ => ResetTrackAdjustments(), 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 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)
|
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
|
// 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);
|
rotation.BindTo(tabletHandler.Rotation);
|
||||||
|
|
||||||
areaOffset.BindTo(tabletHandler.AreaOffset);
|
areaOffset.BindTo(tabletHandler.AreaOffset);
|
||||||
areaOffset.BindValueChanged(val =>
|
areaOffset.BindValueChanged(val => Schedule(() =>
|
||||||
{
|
{
|
||||||
offsetX.Value = val.NewValue.X;
|
offsetX.Value = val.NewValue.X;
|
||||||
offsetY.Value = val.NewValue.Y;
|
offsetY.Value = val.NewValue.Y;
|
||||||
}, true);
|
}), true);
|
||||||
|
|
||||||
offsetX.BindValueChanged(val => areaOffset.Value = new Vector2(val.NewValue, areaOffset.Value.Y));
|
offsetX.BindValueChanged(val => areaOffset.Value = new Vector2(val.NewValue, areaOffset.Value.Y));
|
||||||
offsetY.BindValueChanged(val => areaOffset.Value = new Vector2(areaOffset.Value.X, val.NewValue));
|
offsetY.BindValueChanged(val => areaOffset.Value = new Vector2(areaOffset.Value.X, val.NewValue));
|
||||||
|
|
||||||
areaSize.BindTo(tabletHandler.AreaSize);
|
areaSize.BindTo(tabletHandler.AreaSize);
|
||||||
areaSize.BindValueChanged(val =>
|
areaSize.BindValueChanged(val => Schedule(() =>
|
||||||
{
|
{
|
||||||
sizeX.Value = val.NewValue.X;
|
sizeX.Value = val.NewValue.X;
|
||||||
sizeY.Value = val.NewValue.Y;
|
sizeY.Value = val.NewValue.Y;
|
||||||
}, true);
|
}), true);
|
||||||
|
|
||||||
sizeX.BindValueChanged(val =>
|
sizeX.BindValueChanged(val =>
|
||||||
{
|
{
|
||||||
@ -255,7 +255,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
});
|
});
|
||||||
|
|
||||||
tablet.BindTo(tabletHandler.Tablet);
|
tablet.BindTo(tabletHandler.Tablet);
|
||||||
tablet.BindValueChanged(val =>
|
tablet.BindValueChanged(val => Schedule(() =>
|
||||||
{
|
{
|
||||||
Scheduler.AddOnce(updateVisibility);
|
Scheduler.AddOnce(updateVisibility);
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
sizeY.Default = sizeY.MaxValue = tab.Size.Y;
|
sizeY.Default = sizeY.MaxValue = tab.Size.Y;
|
||||||
|
|
||||||
areaSize.Default = new Vector2(sizeX.Default, sizeY.Default);
|
areaSize.Default = new Vector2(sizeX.Default, sizeY.Default);
|
||||||
}, true);
|
}), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateVisibility()
|
private void updateVisibility()
|
||||||
|
@ -58,6 +58,9 @@ namespace osu.Game.Rulesets.Configuration
|
|||||||
pendingWrites.Clear();
|
pendingWrites.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!changed.Any())
|
||||||
|
return true;
|
||||||
|
|
||||||
realm?.Write(r =>
|
realm?.Write(r =>
|
||||||
{
|
{
|
||||||
foreach (var c in changed)
|
foreach (var c in changed)
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
@ -12,6 +10,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
|
using osu.Framework.Extensions.ObjectExtensions;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -34,19 +33,20 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
public readonly SortedDictionary<int, BindableLong> TeamScores = new SortedDictionary<int, BindableLong>();
|
public readonly SortedDictionary<int, BindableLong> TeamScores = new SortedDictionary<int, BindableLong>();
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuColour colours { get; set; }
|
private OsuColour colours { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private SpectatorClient spectatorClient { get; set; }
|
private SpectatorClient spectatorClient { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private MultiplayerClient multiplayerClient { get; set; }
|
private MultiplayerClient multiplayerClient { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private UserLookupCache userLookupCache { get; set; }
|
private UserLookupCache userLookupCache { get; set; } = null!;
|
||||||
|
|
||||||
|
private Bindable<ScoringMode> scoringMode = null!;
|
||||||
|
|
||||||
private readonly MultiplayerRoomUser[] playingUsers;
|
private readonly MultiplayerRoomUser[] playingUsers;
|
||||||
private Bindable<ScoringMode> scoringMode;
|
|
||||||
|
|
||||||
private readonly IBindableList<int> playingUserIds = new BindableList<int>();
|
private readonly IBindableList<int> playingUserIds = new BindableList<int>();
|
||||||
|
|
||||||
@ -126,15 +126,18 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
playingUserIds.BindCollectionChanged(playingUsersChanged);
|
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);
|
var leaderboardScore = base.CreateLeaderboardScoreDrawable(user, isTracked);
|
||||||
|
|
||||||
|
if (user != null)
|
||||||
|
{
|
||||||
if (UserScores[user.OnlineID].Team is int team)
|
if (UserScores[user.OnlineID].Team is int team)
|
||||||
{
|
{
|
||||||
leaderboardScore.BackgroundColour = getTeamColour(team).Lighten(1.2f);
|
leaderboardScore.BackgroundColour = getTeamColour(team).Lighten(1.2f);
|
||||||
leaderboardScore.TextColour = Color4.White;
|
leaderboardScore.TextColour = Color4.White;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return leaderboardScore;
|
return leaderboardScore;
|
||||||
}
|
}
|
||||||
@ -189,7 +192,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
if (spectatorClient != null)
|
if (spectatorClient.IsNotNull())
|
||||||
{
|
{
|
||||||
foreach (var user in playingUsers)
|
foreach (var user in playingUsers)
|
||||||
spectatorClient.StopWatchingUser(user.UserID);
|
spectatorClient.StopWatchingUser(user.UserID);
|
||||||
|
@ -89,6 +89,8 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
|
|
||||||
private IDisposable scoreSubscription;
|
private IDisposable scoreSubscription;
|
||||||
|
|
||||||
|
private GetScoresRequest scoreRetrievalRequest;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -151,14 +153,14 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
else if (filterMods)
|
else if (filterMods)
|
||||||
requestMods = mods.Value;
|
requestMods = mods.Value;
|
||||||
|
|
||||||
var req = new GetScoresRequest(fetchBeatmapInfo, fetchRuleset, Scope, requestMods);
|
scoreRetrievalRequest = new GetScoresRequest(fetchBeatmapInfo, fetchRuleset, Scope, requestMods);
|
||||||
|
|
||||||
req.Success += r => SetScores(
|
scoreRetrievalRequest.Success += response => SetScores(
|
||||||
scoreManager.OrderByTotalScore(r.Scores.Select(s => s.ToScoreInfo(rulesets, fetchBeatmapInfo))),
|
scoreManager.OrderByTotalScore(response.Scores.Select(s => s.ToScoreInfo(rulesets, fetchBeatmapInfo))),
|
||||||
r.UserScore?.CreateScoreInfo(rulesets, fetchBeatmapInfo)
|
response.UserScore?.CreateScoreInfo(rulesets, fetchBeatmapInfo)
|
||||||
);
|
);
|
||||||
|
|
||||||
return req;
|
return scoreRetrievalRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) => new LeaderboardScore(model, index, IsOnlineScope)
|
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)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
scoreSubscription?.Dispose();
|
scoreSubscription?.Dispose();
|
||||||
|
scoreRetrievalRequest?.Cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user