1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 04:03:22 +08:00

Rename {Solo -> User}StatisticsWatcher et al.

The "solo" prefix is a bit unbecoming now. The updates are not only
for solo.
This commit is contained in:
Bartłomiej Dach 2024-02-22 19:50:46 +01:00
parent 1e53503608
commit eac4c5f69d
No known key found for this signature in database
12 changed files with 37 additions and 37 deletions

View File

@ -100,7 +100,7 @@ namespace osu.Game.Tests.Visual.Menus
AddStep("Gain", () =>
{
var transientUpdateDisplay = this.ChildrenOfType<TransientUserStatisticsUpdateDisplay>().Single();
transientUpdateDisplay.LatestUpdate.Value = new SoloStatisticsUpdate(
transientUpdateDisplay.LatestUpdate.Value = new UserStatisticsUpdate(
new ScoreInfo(),
new UserStatistics
{
@ -116,7 +116,7 @@ namespace osu.Game.Tests.Visual.Menus
AddStep("Loss", () =>
{
var transientUpdateDisplay = this.ChildrenOfType<TransientUserStatisticsUpdateDisplay>().Single();
transientUpdateDisplay.LatestUpdate.Value = new SoloStatisticsUpdate(
transientUpdateDisplay.LatestUpdate.Value = new UserStatisticsUpdate(
new ScoreInfo(),
new UserStatistics
{
@ -132,7 +132,7 @@ namespace osu.Game.Tests.Visual.Menus
AddStep("No change", () =>
{
var transientUpdateDisplay = this.ChildrenOfType<TransientUserStatisticsUpdateDisplay>().Single();
transientUpdateDisplay.LatestUpdate.Value = new SoloStatisticsUpdate(
transientUpdateDisplay.LatestUpdate.Value = new UserStatisticsUpdate(
new ScoreInfo(),
new UserStatistics
{
@ -148,7 +148,7 @@ namespace osu.Game.Tests.Visual.Menus
AddStep("Was null", () =>
{
var transientUpdateDisplay = this.ChildrenOfType<TransientUserStatisticsUpdateDisplay>().Single();
transientUpdateDisplay.LatestUpdate.Value = new SoloStatisticsUpdate(
transientUpdateDisplay.LatestUpdate.Value = new UserStatisticsUpdate(
new ScoreInfo(),
new UserStatistics
{
@ -164,7 +164,7 @@ namespace osu.Game.Tests.Visual.Menus
AddStep("Became null", () =>
{
var transientUpdateDisplay = this.ChildrenOfType<TransientUserStatisticsUpdateDisplay>().Single();
transientUpdateDisplay.LatestUpdate.Value = new SoloStatisticsUpdate(
transientUpdateDisplay.LatestUpdate.Value = new UserStatisticsUpdate(
new ScoreInfo(),
new UserStatistics
{

View File

@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.Online
{
protected override bool UseOnlineAPI => false;
private SoloStatisticsWatcher watcher = null!;
private UserStatisticsWatcher watcher = null!;
[Resolved]
private SpectatorClient spectatorClient { get; set; } = null!;
@ -107,7 +107,7 @@ namespace osu.Game.Tests.Visual.Online
AddStep("create watcher", () =>
{
Child = watcher = new SoloStatisticsWatcher();
Child = watcher = new UserStatisticsWatcher();
});
}
@ -123,7 +123,7 @@ namespace osu.Game.Tests.Visual.Online
var ruleset = new OsuRuleset().RulesetInfo;
SoloStatisticsUpdate? update = null;
UserStatisticsUpdate? update = null;
registerForUpdates(scoreId, ruleset, receivedUpdate => update = receivedUpdate);
feignScoreProcessing(userId, ruleset, 5_000_000);
@ -146,7 +146,7 @@ namespace osu.Game.Tests.Visual.Online
// note ordering - in this test processing completes *before* the registration is added.
feignScoreProcessing(userId, ruleset, 5_000_000);
SoloStatisticsUpdate? update = null;
UserStatisticsUpdate? update = null;
registerForUpdates(scoreId, ruleset, receivedUpdate => update = receivedUpdate);
AddStep("signal score processed", () => ((ISpectatorClient)spectatorClient).UserScoreProcessed(userId, scoreId));
@ -164,7 +164,7 @@ namespace osu.Game.Tests.Visual.Online
long scoreId = getScoreId();
var ruleset = new OsuRuleset().RulesetInfo;
SoloStatisticsUpdate? update = null;
UserStatisticsUpdate? update = null;
registerForUpdates(scoreId, ruleset, receivedUpdate => update = receivedUpdate);
feignScoreProcessing(userId, ruleset, 5_000_000);
@ -191,7 +191,7 @@ namespace osu.Game.Tests.Visual.Online
long scoreId = getScoreId();
var ruleset = new OsuRuleset().RulesetInfo;
SoloStatisticsUpdate? update = null;
UserStatisticsUpdate? update = null;
registerForUpdates(scoreId, ruleset, receivedUpdate => update = receivedUpdate);
feignScoreProcessing(userId, ruleset, 5_000_000);
@ -212,7 +212,7 @@ namespace osu.Game.Tests.Visual.Online
long scoreId = getScoreId();
var ruleset = new OsuRuleset().RulesetInfo;
SoloStatisticsUpdate? update = null;
UserStatisticsUpdate? update = null;
registerForUpdates(scoreId, ruleset, receivedUpdate => update = receivedUpdate);
feignScoreProcessing(userId, ruleset, 5_000_000);
@ -241,7 +241,7 @@ namespace osu.Game.Tests.Visual.Online
feignScoreProcessing(userId, ruleset, 6_000_000);
SoloStatisticsUpdate? update = null;
UserStatisticsUpdate? update = null;
registerForUpdates(secondScoreId, ruleset, receivedUpdate => update = receivedUpdate);
AddStep("signal score processed", () => ((ISpectatorClient)spectatorClient).UserScoreProcessed(userId, secondScoreId));
@ -259,7 +259,7 @@ namespace osu.Game.Tests.Visual.Online
var ruleset = new OsuRuleset().RulesetInfo;
SoloStatisticsUpdate? update = null;
UserStatisticsUpdate? update = null;
registerForUpdates(scoreId, ruleset, receivedUpdate => update = receivedUpdate);
feignScoreProcessing(userId, ruleset, 5_000_000);
@ -289,7 +289,7 @@ namespace osu.Game.Tests.Visual.Online
});
}
private void registerForUpdates(long scoreId, RulesetInfo rulesetInfo, Action<SoloStatisticsUpdate> onUpdateReady) =>
private void registerForUpdates(long scoreId, RulesetInfo rulesetInfo, Action<UserStatisticsUpdate> onUpdateReady) =>
AddStep("register for updates", () =>
{
watcher.RegisterForStatisticsUpdateAfter(

View File

@ -112,6 +112,6 @@ namespace osu.Game.Tests.Visual.Ranking
});
private void displayUpdate(UserStatistics before, UserStatistics after) =>
AddStep("display update", () => overallRanking.StatisticsUpdate.Value = new SoloStatisticsUpdate(new ScoreInfo(), before, after));
AddStep("display update", () => overallRanking.StatisticsUpdate.Value = new UserStatisticsUpdate(new ScoreInfo(), before, after));
}
}

View File

@ -89,7 +89,7 @@ namespace osu.Game.Tests.Visual.Ranking
Score = { Value = score },
DisplayedUserStatisticsUpdate =
{
Value = new SoloStatisticsUpdate(score, new UserStatistics
Value = new UserStatisticsUpdate(score, new UserStatistics
{
Level = new UserStatistics.LevelInfo
{

View File

@ -9,7 +9,7 @@ namespace osu.Game.Online.Solo
/// <summary>
/// Contains data about the change in a user's profile statistics after completing a score.
/// </summary>
public class SoloStatisticsUpdate
public class UserStatisticsUpdate
{
/// <summary>
/// The score set by the user that triggered the update.
@ -27,12 +27,12 @@ namespace osu.Game.Online.Solo
public UserStatistics After { get; }
/// <summary>
/// Creates a new <see cref="SoloStatisticsUpdate"/>.
/// Creates a new <see cref="UserStatisticsUpdate"/>.
/// </summary>
/// <param name="score">The score set by the user that triggered the update.</param>
/// <param name="before">The user's profile statistics prior to the score being set.</param>
/// <param name="after">The user's profile statistics after the score was set.</param>
public SoloStatisticsUpdate(ScoreInfo score, UserStatistics before, UserStatistics after)
public UserStatisticsUpdate(ScoreInfo score, UserStatistics before, UserStatistics after)
{
Score = score;
Before = before;

View File

@ -20,10 +20,10 @@ namespace osu.Game.Online.Solo
/// <summary>
/// A persistent component that binds to the spectator server and API in order to deliver updates about the logged in user's gameplay statistics.
/// </summary>
public partial class SoloStatisticsWatcher : Component
public partial class UserStatisticsWatcher : Component
{
public IBindable<SoloStatisticsUpdate?> LatestUpdate => latestUpdate;
private readonly Bindable<SoloStatisticsUpdate?> latestUpdate = new Bindable<SoloStatisticsUpdate?>();
public IBindable<UserStatisticsUpdate?> LatestUpdate => latestUpdate;
private readonly Bindable<UserStatisticsUpdate?> latestUpdate = new Bindable<UserStatisticsUpdate?>();
[Resolved]
private SpectatorClient spectatorClient { get; set; } = null!;
@ -120,7 +120,7 @@ namespace osu.Game.Online.Solo
latestStatistics.TryGetValue(rulesetName, out UserStatistics? latestRulesetStatistics);
latestRulesetStatistics ??= new UserStatistics();
latestUpdate.Value = new SoloStatisticsUpdate(scoreInfo, latestRulesetStatistics, updatedStatistics);
latestUpdate.Value = new UserStatisticsUpdate(scoreInfo, latestRulesetStatistics, updatedStatistics);
latestStatistics[rulesetName] = updatedStatistics;
}

View File

@ -1022,7 +1022,7 @@ namespace osu.Game
ScreenStack.Push(CreateLoader().With(l => l.RelativeSizeAxes = Axes.Both));
});
loadComponentSingleFile(new SoloStatisticsWatcher(), Add, true);
loadComponentSingleFile(new UserStatisticsWatcher(), Add, true);
loadComponentSingleFile(Toolbar = new Toolbar
{
OnHome = delegate

View File

@ -21,13 +21,13 @@ namespace osu.Game.Overlays.Toolbar
{
public partial class TransientUserStatisticsUpdateDisplay : CompositeDrawable
{
public Bindable<SoloStatisticsUpdate?> LatestUpdate { get; } = new Bindable<SoloStatisticsUpdate?>();
public Bindable<UserStatisticsUpdate?> LatestUpdate { get; } = new Bindable<UserStatisticsUpdate?>();
private Statistic<int> globalRank = null!;
private Statistic<decimal> pp = null!;
[BackgroundDependencyLoader]
private void load(SoloStatisticsWatcher? soloStatisticsWatcher)
private void load(UserStatisticsWatcher? soloStatisticsWatcher)
{
RelativeSizeAxes = Axes.Y;
AutoSizeAxes = Axes.X;
@ -48,7 +48,7 @@ namespace osu.Game.Overlays.Toolbar
};
if (soloStatisticsWatcher != null)
((IBindable<SoloStatisticsUpdate?>)LatestUpdate).BindTo(soloStatisticsWatcher.LatestUpdate);
((IBindable<UserStatisticsUpdate?>)LatestUpdate).BindTo(soloStatisticsWatcher.LatestUpdate);
}
protected override void LoadComplete()

View File

@ -45,7 +45,7 @@ namespace osu.Game.Screens.Play
[Resolved(canBeNull: true)]
[CanBeNull]
private SoloStatisticsWatcher soloStatisticsWatcher { get; set; }
private UserStatisticsWatcher userStatisticsWatcher { get; set; }
private readonly object scoreSubmissionLock = new object();
private TaskCompletionSource<bool> scoreSubmissionSource;
@ -189,7 +189,7 @@ namespace osu.Game.Screens.Play
await submitScore(score).ConfigureAwait(false);
spectatorClient.EndPlaying(GameplayState);
soloStatisticsWatcher?.RegisterForStatisticsUpdateAfter(score.ScoreInfo);
userStatisticsWatcher?.RegisterForStatisticsUpdateAfter(score.ScoreInfo);
}
[Resolved]

View File

@ -14,7 +14,7 @@ namespace osu.Game.Screens.Ranking.Statistics.User
{
private const float transition_duration = 300;
public Bindable<SoloStatisticsUpdate?> StatisticsUpdate { get; } = new Bindable<SoloStatisticsUpdate?>();
public Bindable<UserStatisticsUpdate?> StatisticsUpdate { get; } = new Bindable<UserStatisticsUpdate?>();
private LoadingLayer loadingLayer = null!;
private GridContainer content = null!;
@ -86,7 +86,7 @@ namespace osu.Game.Screens.Ranking.Statistics.User
FinishTransforms(true);
}
private void onUpdateReceived(ValueChangedEvent<SoloStatisticsUpdate?> update)
private void onUpdateReceived(ValueChangedEvent<UserStatisticsUpdate?> update)
{
if (update.NewValue == null)
{

View File

@ -19,7 +19,7 @@ namespace osu.Game.Screens.Ranking.Statistics.User
{
public abstract partial class RankingChangeRow<T> : CompositeDrawable
{
public Bindable<SoloStatisticsUpdate?> StatisticsUpdate { get; } = new Bindable<SoloStatisticsUpdate?>();
public Bindable<UserStatisticsUpdate?> StatisticsUpdate { get; } = new Bindable<UserStatisticsUpdate?>();
private readonly Func<UserStatistics, T> accessor;
@ -113,7 +113,7 @@ namespace osu.Game.Screens.Ranking.Statistics.User
StatisticsUpdate.BindValueChanged(onStatisticsUpdate, true);
}
private void onStatisticsUpdate(ValueChangedEvent<SoloStatisticsUpdate?> statisticsUpdate)
private void onStatisticsUpdate(ValueChangedEvent<UserStatisticsUpdate?> statisticsUpdate)
{
var update = statisticsUpdate.NewValue;

View File

@ -18,9 +18,9 @@ namespace osu.Game.Screens.Ranking.Statistics
{
private readonly ScoreInfo achievedScore;
internal readonly Bindable<SoloStatisticsUpdate?> DisplayedUserStatisticsUpdate = new Bindable<SoloStatisticsUpdate?>();
internal readonly Bindable<UserStatisticsUpdate?> DisplayedUserStatisticsUpdate = new Bindable<UserStatisticsUpdate?>();
private IBindable<SoloStatisticsUpdate?> latestGlobalStatisticsUpdate = null!;
private IBindable<UserStatisticsUpdate?> latestGlobalStatisticsUpdate = null!;
public UserStatisticsPanel(ScoreInfo achievedScore)
{
@ -28,7 +28,7 @@ namespace osu.Game.Screens.Ranking.Statistics
}
[BackgroundDependencyLoader]
private void load(SoloStatisticsWatcher? soloStatisticsWatcher)
private void load(UserStatisticsWatcher? soloStatisticsWatcher)
{
if (soloStatisticsWatcher != null)
{