mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 07:22:55 +08:00
Merge branch 'master' into master
This commit is contained in:
commit
0eae8d078b
@ -16,9 +16,9 @@
|
||||
<EmbeddedResource Include="Resources\**\*.*" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Code Analysis">
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="2.9.8" PrivateAssets="All" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.0.0" PrivateAssets="All" />
|
||||
<AdditionalFiles Include="$(MSBuildThisFileDirectory)CodeAnalysis\BannedSymbols.txt" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8" PrivateAssets="All" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Code Analysis">
|
||||
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)CodeAnalysis\osu.ruleset</CodeAnalysisRuleSet>
|
||||
|
@ -24,10 +24,12 @@ using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.Taiko;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Select;
|
||||
using osu.Game.Screens.Select.Carousel;
|
||||
using osu.Game.Screens.Select.Filter;
|
||||
using osu.Game.Users;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.SongSelect
|
||||
@ -110,7 +112,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
createSongSelect();
|
||||
|
||||
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
|
||||
waitForInitialSelection();
|
||||
|
||||
WorkingBeatmap selected = null;
|
||||
|
||||
@ -135,7 +137,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
createSongSelect();
|
||||
|
||||
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
|
||||
waitForInitialSelection();
|
||||
|
||||
WorkingBeatmap selected = null;
|
||||
|
||||
@ -189,7 +191,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
createSongSelect();
|
||||
|
||||
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
|
||||
waitForInitialSelection();
|
||||
|
||||
WorkingBeatmap selected = null;
|
||||
|
||||
@ -769,6 +771,76 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddAssert("Check first item in group selected", () => Beatmap.Value.BeatmapInfo == groupIcon.Items.First().Beatmap);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestChangeRulesetWhilePresentingScore()
|
||||
{
|
||||
BeatmapInfo getPresentBeatmap() => manager.QueryBeatmap(b => !b.BeatmapSet.DeletePending && b.RulesetID == 0);
|
||||
BeatmapInfo getSwitchBeatmap() => manager.QueryBeatmap(b => !b.BeatmapSet.DeletePending && b.RulesetID == 1);
|
||||
|
||||
changeRuleset(0);
|
||||
|
||||
createSongSelect();
|
||||
|
||||
addRulesetImportStep(0);
|
||||
addRulesetImportStep(1);
|
||||
|
||||
AddStep("present score", () =>
|
||||
{
|
||||
// this ruleset change should be overridden by the present.
|
||||
Ruleset.Value = getSwitchBeatmap().Ruleset;
|
||||
|
||||
songSelect.PresentScore(new ScoreInfo
|
||||
{
|
||||
User = new User { Username = "woo" },
|
||||
Beatmap = getPresentBeatmap(),
|
||||
Ruleset = getPresentBeatmap().Ruleset
|
||||
});
|
||||
});
|
||||
|
||||
AddUntilStep("wait for results screen presented", () => !songSelect.IsCurrentScreen());
|
||||
|
||||
AddAssert("check beatmap is correct for score", () => Beatmap.Value.BeatmapInfo.Equals(getPresentBeatmap()));
|
||||
AddAssert("check ruleset is correct for score", () => Ruleset.Value.ID == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestChangeBeatmapWhilePresentingScore()
|
||||
{
|
||||
BeatmapInfo getPresentBeatmap() => manager.QueryBeatmap(b => !b.BeatmapSet.DeletePending && b.RulesetID == 0);
|
||||
BeatmapInfo getSwitchBeatmap() => manager.QueryBeatmap(b => !b.BeatmapSet.DeletePending && b.RulesetID == 1);
|
||||
|
||||
changeRuleset(0);
|
||||
|
||||
addRulesetImportStep(0);
|
||||
addRulesetImportStep(1);
|
||||
|
||||
createSongSelect();
|
||||
|
||||
AddStep("present score", () =>
|
||||
{
|
||||
// this beatmap change should be overridden by the present.
|
||||
Beatmap.Value = manager.GetWorkingBeatmap(getSwitchBeatmap());
|
||||
|
||||
songSelect.PresentScore(new ScoreInfo
|
||||
{
|
||||
User = new User { Username = "woo" },
|
||||
Beatmap = getPresentBeatmap(),
|
||||
Ruleset = getPresentBeatmap().Ruleset
|
||||
});
|
||||
});
|
||||
|
||||
AddUntilStep("wait for results screen presented", () => !songSelect.IsCurrentScreen());
|
||||
|
||||
AddAssert("check beatmap is correct for score", () => Beatmap.Value.BeatmapInfo.Equals(getPresentBeatmap()));
|
||||
AddAssert("check ruleset is correct for score", () => Ruleset.Value.ID == 0);
|
||||
}
|
||||
|
||||
private void waitForInitialSelection()
|
||||
{
|
||||
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
|
||||
AddUntilStep("wait for difficulty panels visible", () => songSelect.Carousel.ChildrenOfType<DrawableCarouselBeatmap>().Any());
|
||||
}
|
||||
|
||||
private int getBeatmapIndex(BeatmapSetInfo set, BeatmapInfo info) => set.Beatmaps.FindIndex(b => b == info);
|
||||
|
||||
private int getCurrentBeatmapIndex() => getBeatmapIndex(songSelect.Carousel.SelectedBeatmapSet, songSelect.Carousel.SelectedBeatmap);
|
||||
@ -876,6 +948,8 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
public WorkingBeatmap CurrentBeatmapDetailsBeatmap => BeatmapDetails.Beatmap;
|
||||
public new BeatmapCarousel Carousel => base.Carousel;
|
||||
|
||||
public new void PresentScore(ScoreInfo score) => base.PresentScore(score);
|
||||
|
||||
protected override bool OnStart()
|
||||
{
|
||||
StartRequested?.Invoke();
|
||||
|
@ -140,7 +140,7 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
var beatmapIds = beatmapSet.Beatmaps.Where(b => b.OnlineBeatmapID.HasValue).Select(b => b.OnlineBeatmapID).ToList();
|
||||
|
||||
LogForModel(beatmapSet, "Validating online IDs...");
|
||||
LogForModel(beatmapSet, $"Validating online IDs for {beatmapSet.Beatmaps.Count} beatmaps...");
|
||||
|
||||
// ensure all IDs are unique
|
||||
if (beatmapIds.GroupBy(b => b).Any(g => g.Count() > 1))
|
||||
|
@ -91,6 +91,8 @@ namespace osu.Game.Overlays.SearchableList
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
bindable.ValueChanged -= Bindable_ValueChanged;
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Users;
|
||||
@ -32,9 +33,12 @@ namespace osu.Game.Screens.Select
|
||||
Edit();
|
||||
}, Key.Number4);
|
||||
|
||||
((PlayBeatmapDetailArea)BeatmapDetails).Leaderboard.ScoreSelected += score => this.Push(new ResultsScreen(score));
|
||||
((PlayBeatmapDetailArea)BeatmapDetails).Leaderboard.ScoreSelected += PresentScore;
|
||||
}
|
||||
|
||||
protected void PresentScore(ScoreInfo score) =>
|
||||
FinaliseSelection(score.Beatmap, score.Ruleset, () => this.Push(new ResultsScreen(score)));
|
||||
|
||||
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea();
|
||||
|
||||
public override void OnResuming(IScreen last)
|
||||
|
@ -342,13 +342,17 @@ namespace osu.Game.Screens.Select
|
||||
/// Call to make a selection and perform the default action for this SongSelect.
|
||||
/// </summary>
|
||||
/// <param name="beatmap">An optional beatmap to override the current carousel selection.</param>
|
||||
/// <param name="performStartAction">Whether to trigger <see cref="OnStart"/>.</param>
|
||||
public void FinaliseSelection(BeatmapInfo beatmap = null, bool performStartAction = true)
|
||||
/// <param name="ruleset">An optional ruleset to override the current carousel selection.</param>
|
||||
/// <param name="customStartAction">An optional custom action to perform instead of <see cref="OnStart"/>.</param>
|
||||
public void FinaliseSelection(BeatmapInfo beatmap = null, RulesetInfo ruleset = null, Action customStartAction = null)
|
||||
{
|
||||
// This is very important as we have not yet bound to screen-level bindables before the carousel load is completed.
|
||||
if (!Carousel.BeatmapSetsLoaded)
|
||||
return;
|
||||
|
||||
if (ruleset != null)
|
||||
Ruleset.Value = ruleset;
|
||||
|
||||
transferRulesetValue();
|
||||
|
||||
// while transferRulesetValue will flush, it only does so if the ruleset changes.
|
||||
@ -369,7 +373,12 @@ namespace osu.Game.Screens.Select
|
||||
selectionChangedDebounce = null;
|
||||
}
|
||||
|
||||
if (performStartAction && OnStart())
|
||||
if (customStartAction != null)
|
||||
{
|
||||
customStartAction();
|
||||
Carousel.AllowSelection = false;
|
||||
}
|
||||
else if (OnStart())
|
||||
Carousel.AllowSelection = false;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="Dapper" Version="2.0.35" />
|
||||
<PackageReference Include="DiffPlex" Version="1.6.1" />
|
||||
<PackageReference Include="Humanizer" Version="2.8.2" />
|
||||
<PackageReference Include="Humanizer" Version="2.8.11" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
|
@ -76,7 +76,7 @@
|
||||
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
||||
<ItemGroup Label="Transitive Dependencies">
|
||||
<PackageReference Include="DiffPlex" Version="1.6.1" />
|
||||
<PackageReference Include="Humanizer" Version="2.8.2" />
|
||||
<PackageReference Include="Humanizer" Version="2.8.11" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
|
Loading…
Reference in New Issue
Block a user