mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Replace allowTrackAdjustmentsStack
with a Dictionary
This commit is contained in:
@ -1094,21 +1094,13 @@ namespace osu.Game
|
||||
|
||||
// set AllowTrackAdjustments if new screen defines it, inherit otherwise
|
||||
if (newScreen is IOsuScreen newOsuScreen && newOsuScreen.AllowTrackAdjustments.HasValue)
|
||||
{
|
||||
allowTrackAdjustmentsStack.Push(newOsuScreen.AllowTrackAdjustments.Value);
|
||||
Logger.Log($"Screen's AllowTrackAdjustments explicit → {allowTrackAdjustmentsStack.First()}");
|
||||
}
|
||||
else if (allowTrackAdjustmentsStack.Any())
|
||||
{
|
||||
allowTrackAdjustmentsStack.Push(allowTrackAdjustmentsStack.First());
|
||||
Logger.Log($"Screen's AllowTrackAdjustments inherit → {allowTrackAdjustmentsStack.First()}");
|
||||
}
|
||||
allowTrackAdjustmentsDict[newScreen] = newOsuScreen.AllowTrackAdjustments.Value;
|
||||
else if (allowTrackAdjustmentsDict.ContainsKey(lastScreen))
|
||||
allowTrackAdjustmentsDict[newScreen] = allowTrackAdjustmentsDict[lastScreen];
|
||||
else
|
||||
{
|
||||
allowTrackAdjustmentsStack.Push(false);
|
||||
}
|
||||
allowTrackAdjustmentsDict[newScreen] = true;
|
||||
|
||||
MusicController.AllowTrackAdjustments = allowTrackAdjustmentsStack.First();
|
||||
MusicController.AllowTrackAdjustments = allowTrackAdjustmentsDict[newScreen];
|
||||
}
|
||||
|
||||
private void screenExited(IScreen lastScreen, IScreen newScreen)
|
||||
@ -1116,18 +1108,15 @@ namespace osu.Game
|
||||
ScreenChanged(lastScreen, newScreen);
|
||||
Logger.Log($"Screen changed ← {newScreen}");
|
||||
|
||||
allowTrackAdjustmentsDict.Remove(lastScreen);
|
||||
|
||||
if (newScreen == null)
|
||||
Exit();
|
||||
|
||||
if (allowTrackAdjustmentsStack.Count > 1)
|
||||
{
|
||||
allowTrackAdjustmentsStack.Pop();
|
||||
MusicController.AllowTrackAdjustments = allowTrackAdjustmentsStack.First();
|
||||
Logger.Log($"Screen's AllowTrackAdjustments return ← {allowTrackAdjustmentsStack.First()}");
|
||||
}
|
||||
else
|
||||
MusicController.AllowTrackAdjustments = allowTrackAdjustmentsDict[newScreen];
|
||||
}
|
||||
|
||||
private readonly Stack<bool> allowTrackAdjustmentsStack = new Stack<bool>();
|
||||
private readonly Dictionary<IScreen, bool> allowTrackAdjustmentsDict = new Dictionary<IScreen, bool>();
|
||||
|
||||
IBindable<bool> ILocalUserPlayInfo.IsPlaying => LocalUserPlaying;
|
||||
}
|
||||
|
Reference in New Issue
Block a user