mirror of
https://github.com/osukey/osukey.git
synced 2025-06-06 20:15:29 +09:00
Merge pull request #7663 from peppy/fix-import-different-ruleset
Fix presenting a beatmap from a different ruleset not working
This commit is contained in:
commit
dfd0b1b88c
@ -30,7 +30,6 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Ignore("will be fixed soon")]
|
|
||||||
public void TestFromMainMenuDifferentRuleset()
|
public void TestFromMainMenuDifferentRuleset()
|
||||||
{
|
{
|
||||||
var firstImport = importBeatmap(1);
|
var firstImport = importBeatmap(1);
|
||||||
|
@ -286,7 +286,7 @@ namespace osu.Game.Screens.Select
|
|||||||
// if not the current screen, we want to get carousel in a good presentation state before displaying (resume or enter).
|
// if not the current screen, we want to get carousel in a good presentation state before displaying (resume or enter).
|
||||||
bool shouldDebounce = this.IsCurrentScreen();
|
bool shouldDebounce = this.IsCurrentScreen();
|
||||||
|
|
||||||
Schedule(() => Carousel.Filter(criteria, shouldDebounce));
|
Carousel.Filter(criteria, shouldDebounce);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DependencyContainer dependencies;
|
private DependencyContainer dependencies;
|
||||||
@ -325,8 +325,10 @@ namespace osu.Game.Screens.Select
|
|||||||
if (!Carousel.BeatmapSetsLoaded)
|
if (!Carousel.BeatmapSetsLoaded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// if we have a pending filter operation, we want to run it now.
|
transferRulesetValue();
|
||||||
// it could change selection (ie. if the ruleset has been changed).
|
|
||||||
|
// while transferRulesetValue will flush, it only does so if the ruleset changes.
|
||||||
|
// the user could have changed a filter, and we want to ensure we are 100% up-to-date and consistent here.
|
||||||
Carousel.FlushPendingFilterOperations();
|
Carousel.FlushPendingFilterOperations();
|
||||||
|
|
||||||
// avoid attempting to continue before a selection has been obtained.
|
// avoid attempting to continue before a selection has been obtained.
|
||||||
@ -412,20 +414,10 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
Logger.Log($"updating selection with beatmap:{beatmap?.ID.ToString() ?? "null"} ruleset:{ruleset?.ID.ToString() ?? "null"}");
|
Logger.Log($"updating selection with beatmap:{beatmap?.ID.ToString() ?? "null"} ruleset:{ruleset?.ID.ToString() ?? "null"}");
|
||||||
|
|
||||||
if (ruleset?.Equals(decoupledRuleset.Value) == false)
|
if (transferRulesetValue())
|
||||||
{
|
{
|
||||||
Logger.Log($"ruleset changed from \"{decoupledRuleset.Value}\" to \"{ruleset}\"");
|
// if the ruleset changed, the rest of the selection update will happen via updateSelectedRuleset.
|
||||||
|
|
||||||
Mods.Value = Array.Empty<Mod>();
|
Mods.Value = Array.Empty<Mod>();
|
||||||
decoupledRuleset.Value = ruleset;
|
|
||||||
|
|
||||||
// force a filter before attempting to change the beatmap.
|
|
||||||
// we may still be in the wrong ruleset as there is a debounce delay on ruleset changes.
|
|
||||||
Carousel.Filter(null, false);
|
|
||||||
|
|
||||||
// Filtering only completes after the carousel runs Update.
|
|
||||||
// If we also have a pending beatmap change we should delay it one frame.
|
|
||||||
selectionChangedDebounce = Schedule(run);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -649,6 +641,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
// manual binding to parent ruleset to allow for delayed load in the incoming direction.
|
// manual binding to parent ruleset to allow for delayed load in the incoming direction.
|
||||||
transferRulesetValue();
|
transferRulesetValue();
|
||||||
|
|
||||||
Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue);
|
Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue);
|
||||||
|
|
||||||
decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue;
|
decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue;
|
||||||
@ -660,9 +653,23 @@ namespace osu.Game.Screens.Select
|
|||||||
boundLocalBindables = true;
|
boundLocalBindables = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void transferRulesetValue()
|
/// <summary>
|
||||||
|
/// Transfer the game-wide ruleset to the local decoupled ruleset.
|
||||||
|
/// Will immediately run filter operations if required.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Whether a transfer occurred.</returns>
|
||||||
|
private bool transferRulesetValue()
|
||||||
{
|
{
|
||||||
|
if (decoupledRuleset.Value?.Equals(Ruleset.Value) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Logger.Log($"decoupled ruleset transferred (\"{decoupledRuleset.Value}\" -> \"{Ruleset.Value}\"");
|
||||||
rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value;
|
rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value;
|
||||||
|
|
||||||
|
// if we have a pending filter operation, we want to run it now.
|
||||||
|
// it could change selection (ie. if the ruleset has been changed).
|
||||||
|
Carousel?.FlushPendingFilterOperations();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void delete(BeatmapSetInfo beatmap)
|
private void delete(BeatmapSetInfo beatmap)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user