mirror of
https://github.com/ppy/osu.git
synced 2025-03-14 05:47:20 +08:00
Merge branch 'master' into restore-default-button-hit-area
This commit is contained in:
commit
28fc2f34b5
@ -134,6 +134,9 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
// must happen before children are disposed in base call to prevent illegal accesses to the hit explosion pool.
|
||||
NewResult -= OnNewResult;
|
||||
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (skin != null)
|
||||
|
@ -156,6 +156,9 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
// must happen before children are disposed in base call to prevent illegal accesses to the judgement pool.
|
||||
NewResult -= OnNewResult;
|
||||
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (currentSkin != null)
|
||||
|
@ -32,5 +32,12 @@ namespace osu.Game.Online.Spectator
|
||||
/// <param name="userId">The user.</param>
|
||||
/// <param name="data">The frame data.</param>
|
||||
Task UserSentFrames(int userId, FrameDataBundle data);
|
||||
|
||||
/// <summary>
|
||||
/// Signals that a user's submitted score was fully processed.
|
||||
/// </summary>
|
||||
/// <param name="userId">The ID of the user who achieved the score.</param>
|
||||
/// <param name="scoreId">The ID of the score.</param>
|
||||
Task UserScoreProcessed(int userId, long scoreId);
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ namespace osu.Game.Online.Spectator
|
||||
connection.On<int, SpectatorState>(nameof(ISpectatorClient.UserBeganPlaying), ((ISpectatorClient)this).UserBeganPlaying);
|
||||
connection.On<int, FrameDataBundle>(nameof(ISpectatorClient.UserSentFrames), ((ISpectatorClient)this).UserSentFrames);
|
||||
connection.On<int, SpectatorState>(nameof(ISpectatorClient.UserFinishedPlaying), ((ISpectatorClient)this).UserFinishedPlaying);
|
||||
connection.On<int, long>(nameof(ISpectatorClient.UserScoreProcessed), ((ISpectatorClient)this).UserScoreProcessed);
|
||||
};
|
||||
|
||||
IsConnected.BindTo(connector.IsConnected);
|
||||
|
@ -64,6 +64,11 @@ namespace osu.Game.Online.Spectator
|
||||
/// </summary>
|
||||
public virtual event Action<int, SpectatorState>? OnUserFinishedPlaying;
|
||||
|
||||
/// <summary>
|
||||
/// Called whenever a user-submitted score has been fully processed.
|
||||
/// </summary>
|
||||
public virtual event Action<int, long>? OnUserScoreProcessed;
|
||||
|
||||
/// <summary>
|
||||
/// A dictionary containing all users currently being watched, with the number of watching components for each user.
|
||||
/// </summary>
|
||||
@ -160,6 +165,13 @@ namespace osu.Game.Online.Spectator
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
Task ISpectatorClient.UserScoreProcessed(int userId, long scoreId)
|
||||
{
|
||||
Schedule(() => OnUserScoreProcessed?.Invoke(userId, scoreId));
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void BeginPlaying(long? scoreToken, GameplayState state, Score score)
|
||||
{
|
||||
// This schedule is only here to match the one below in `EndPlaying`.
|
||||
|
@ -87,18 +87,21 @@ namespace osu.Game.Overlays.FirstRunSetup
|
||||
});
|
||||
|
||||
frameworkLocale = frameworkConfig.GetBindable<string>(FrameworkSetting.Locale);
|
||||
frameworkLocale.BindValueChanged(_ => onLanguageChange());
|
||||
|
||||
localisationParameters = localisation.CurrentParameters.GetBoundCopy();
|
||||
localisationParameters.BindValueChanged(p =>
|
||||
{
|
||||
var language = LanguageExtensions.GetLanguageFor(frameworkLocale.Value, p.NewValue);
|
||||
localisationParameters.BindValueChanged(_ => onLanguageChange(), true);
|
||||
}
|
||||
|
||||
// Changing language may cause a short period of blocking the UI thread while the new glyphs are loaded.
|
||||
// Scheduling ensures the button animation plays smoothly after any blocking operation completes.
|
||||
// Note that a delay is required (the alternative would be a double-schedule; delay feels better).
|
||||
updateSelectedDelegate?.Cancel();
|
||||
updateSelectedDelegate = Scheduler.AddDelayed(() => updateSelectedStates(language), 50);
|
||||
}, true);
|
||||
private void onLanguageChange()
|
||||
{
|
||||
var language = LanguageExtensions.GetLanguageFor(frameworkLocale.Value, localisationParameters.Value);
|
||||
|
||||
// Changing language may cause a short period of blocking the UI thread while the new glyphs are loaded.
|
||||
// Scheduling ensures the button animation plays smoothly after any blocking operation completes.
|
||||
// Note that a delay is required (the alternative would be a double-schedule; delay feels better).
|
||||
updateSelectedDelegate?.Cancel();
|
||||
updateSelectedDelegate = Scheduler.AddDelayed(() => updateSelectedStates(language), 50);
|
||||
}
|
||||
|
||||
private void updateSelectedStates(Language language)
|
||||
|
@ -44,10 +44,13 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
},
|
||||
};
|
||||
|
||||
localisationParameters.BindValueChanged(p
|
||||
=> languageSelection.Current.Value = LanguageExtensions.GetLanguageFor(frameworkLocale.Value, p.NewValue), true);
|
||||
frameworkLocale.BindValueChanged(_ => updateSelection());
|
||||
localisationParameters.BindValueChanged(_ => updateSelection(), true);
|
||||
|
||||
languageSelection.Current.BindValueChanged(val => frameworkLocale.Value = val.NewValue.ToCultureCode());
|
||||
}
|
||||
|
||||
private void updateSelection() =>
|
||||
languageSelection.Current.Value = LanguageExtensions.GetLanguageFor(frameworkLocale.Value, localisationParameters.Value);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Online.Spectator;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
@ -158,8 +159,11 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
if (LoadedBeatmapSuccessfully)
|
||||
{
|
||||
submitScore(Score.DeepClone());
|
||||
spectatorClient.EndPlaying(GameplayState);
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await submitScore(Score.DeepClone()).ConfigureAwait(false);
|
||||
spectatorClient.EndPlaying(GameplayState);
|
||||
}).FireAndForget();
|
||||
}
|
||||
|
||||
return exiting;
|
||||
|
Loading…
x
Reference in New Issue
Block a user