mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Merge branch 'master' into remove-model-file-list-inits
This commit is contained in:
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -38,7 +38,7 @@ jobs:
|
|||||||
run: dotnet build -c Debug -warnaserror osu.Desktop.slnf
|
run: dotnet build -c Debug -warnaserror osu.Desktop.slnf
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: dotnet test $pwd/*.Tests/bin/Debug/*/*.Tests.dll --blame-crash --blame-hang --blame-hang-timeout 5m --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx"
|
run: dotnet test $pwd/*.Tests/bin/Debug/*/*.Tests.dll --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx"
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|
||||||
# Attempt to upload results even if test fails.
|
# Attempt to upload results even if test fails.
|
||||||
@ -48,7 +48,7 @@ jobs:
|
|||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
with:
|
with:
|
||||||
name: osu-test-results-${{matrix.os.prettyname}}-${{matrix.threadingMode}}
|
name: osu-test-results-${{matrix.os.prettyname}}-${{matrix.threadingMode}}
|
||||||
path: ${{github.workspace}}/TestResults/**/*
|
path: ${{github.workspace}}/TestResults/TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx
|
||||||
|
|
||||||
build-only-android:
|
build-only-android:
|
||||||
name: Build only (Android)
|
name: Build only (Android)
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.1112.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.1112.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.1119.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.1124.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Transitive Dependencies">
|
<ItemGroup Label="Transitive Dependencies">
|
||||||
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->
|
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->
|
||||||
|
@ -108,7 +108,10 @@ namespace osu.Desktop
|
|||||||
presence.Assets.LargeImageText = $"{user.Value.Username}" + (user.Value.Statistics?.GlobalRank > 0 ? $" (rank #{user.Value.Statistics.GlobalRank:N0})" : string.Empty);
|
presence.Assets.LargeImageText = $"{user.Value.Username}" + (user.Value.Statistics?.GlobalRank > 0 ? $" (rank #{user.Value.Statistics.GlobalRank:N0})" : string.Empty);
|
||||||
|
|
||||||
// update ruleset
|
// update ruleset
|
||||||
presence.Assets.SmallImageKey = ruleset.Value.ID <= 3 ? $"mode_{ruleset.Value.ID}" : "mode_custom";
|
int onlineID = ruleset.Value.OnlineID;
|
||||||
|
bool isLegacyRuleset = onlineID >= 0 && onlineID <= ILegacyRuleset.MAX_LEGACY_RULESET_ID;
|
||||||
|
|
||||||
|
presence.Assets.SmallImageKey = isLegacyRuleset ? $"mode_{onlineID}" : "mode_custom";
|
||||||
presence.Assets.SmallImageText = ruleset.Value.Name;
|
presence.Assets.SmallImageText = ruleset.Value.Name;
|
||||||
|
|
||||||
client.SetPresence(presence);
|
client.SetPresence(presence);
|
||||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
var score = decoder.Parse(resourceStream);
|
var score = decoder.Parse(resourceStream);
|
||||||
|
|
||||||
Assert.AreEqual(3, score.ScoreInfo.Ruleset.ID);
|
Assert.AreEqual(3, score.ScoreInfo.Ruleset.OnlineID);
|
||||||
|
|
||||||
Assert.AreEqual(2, score.ScoreInfo.Statistics[HitResult.Great]);
|
Assert.AreEqual(2, score.ScoreInfo.Statistics[HitResult.Great]);
|
||||||
Assert.AreEqual(1, score.ScoreInfo.Statistics[HitResult.Good]);
|
Assert.AreEqual(1, score.ScoreInfo.Statistics[HitResult.Good]);
|
||||||
|
@ -584,7 +584,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
{
|
{
|
||||||
OnlineID = 1,
|
OnlineID = 1,
|
||||||
Metadata = metadata,
|
Metadata = metadata,
|
||||||
Beatmaps = new List<BeatmapInfo>
|
Beatmaps =
|
||||||
{
|
{
|
||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
{
|
{
|
||||||
|
@ -100,8 +100,8 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestKeyEqualsWithDifferentModInstances()
|
public void TestKeyEqualsWithDifferentModInstances()
|
||||||
{
|
{
|
||||||
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { ID = 0 }, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
||||||
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { ID = 0 }, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
||||||
|
|
||||||
Assert.That(key1, Is.EqualTo(key2));
|
Assert.That(key1, Is.EqualTo(key2));
|
||||||
Assert.That(key1.GetHashCode(), Is.EqualTo(key2.GetHashCode()));
|
Assert.That(key1.GetHashCode(), Is.EqualTo(key2.GetHashCode()));
|
||||||
@ -110,8 +110,8 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestKeyEqualsWithDifferentModOrder()
|
public void TestKeyEqualsWithDifferentModOrder()
|
||||||
{
|
{
|
||||||
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { ID = 0 }, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
||||||
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { ID = 0 }, new Mod[] { new OsuModHidden(), new OsuModHardRock() });
|
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModHidden(), new OsuModHardRock() });
|
||||||
|
|
||||||
Assert.That(key1, Is.EqualTo(key2));
|
Assert.That(key1, Is.EqualTo(key2));
|
||||||
Assert.That(key1.GetHashCode(), Is.EqualTo(key2.GetHashCode()));
|
Assert.That(key1.GetHashCode(), Is.EqualTo(key2.GetHashCode()));
|
||||||
@ -120,8 +120,8 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestKeyDoesntEqualWithDifferentModSettings()
|
public void TestKeyDoesntEqualWithDifferentModSettings()
|
||||||
{
|
{
|
||||||
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { ID = 0 }, new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 1.1 } } });
|
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 1.1 } } });
|
||||||
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { ID = 0 }, new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 1.9 } } });
|
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 1.9 } } });
|
||||||
|
|
||||||
Assert.That(key1, Is.Not.EqualTo(key2));
|
Assert.That(key1, Is.Not.EqualTo(key2));
|
||||||
Assert.That(key1.GetHashCode(), Is.Not.EqualTo(key2.GetHashCode()));
|
Assert.That(key1.GetHashCode(), Is.Not.EqualTo(key2.GetHashCode()));
|
||||||
@ -130,8 +130,8 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestKeyEqualWithMatchingModSettings()
|
public void TestKeyEqualWithMatchingModSettings()
|
||||||
{
|
{
|
||||||
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { ID = 0 }, new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 1.25 } } });
|
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 1.25 } } });
|
||||||
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { ID = 0 }, new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 1.25 } } });
|
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { OnlineID = 0 }, new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 1.25 } } });
|
||||||
|
|
||||||
Assert.That(key1, Is.EqualTo(key2));
|
Assert.That(key1, Is.EqualTo(key2));
|
||||||
Assert.That(key1.GetHashCode(), Is.EqualTo(key2.GetHashCode()));
|
Assert.That(key1.GetHashCode(), Is.EqualTo(key2.GetHashCode()));
|
||||||
|
@ -29,9 +29,9 @@ namespace osu.Game.Tests.Models
|
|||||||
{
|
{
|
||||||
var mock = new Mock<IBeatmapSetInfo>();
|
var mock = new Mock<IBeatmapSetInfo>();
|
||||||
|
|
||||||
mock.Setup(m => m.Metadata!.Artist).Returns("artist");
|
mock.Setup(m => m.Metadata.Artist).Returns("artist");
|
||||||
mock.Setup(m => m.Metadata!.Title).Returns("title");
|
mock.Setup(m => m.Metadata.Title).Returns("title");
|
||||||
mock.Setup(m => m.Metadata!.Author.Username).Returns("author");
|
mock.Setup(m => m.Metadata.Author.Username).Returns("author");
|
||||||
|
|
||||||
Assert.That(mock.Object.GetDisplayString(), Is.EqualTo("artist - title (author)"));
|
Assert.That(mock.Object.GetDisplayString(), Is.EqualTo("artist - title (author)"));
|
||||||
}
|
}
|
||||||
@ -41,9 +41,9 @@ namespace osu.Game.Tests.Models
|
|||||||
{
|
{
|
||||||
var mock = new Mock<IBeatmapSetInfo>();
|
var mock = new Mock<IBeatmapSetInfo>();
|
||||||
|
|
||||||
mock.Setup(m => m.Metadata!.Artist).Returns("artist");
|
mock.Setup(m => m.Metadata.Artist).Returns("artist");
|
||||||
mock.Setup(m => m.Metadata!.Title).Returns("title");
|
mock.Setup(m => m.Metadata.Title).Returns("title");
|
||||||
mock.Setup(m => m.Metadata!.Author.Username).Returns(string.Empty);
|
mock.Setup(m => m.Metadata.Author.Username).Returns(string.Empty);
|
||||||
|
|
||||||
Assert.That(mock.Object.GetDisplayString(), Is.EqualTo("artist - title"));
|
Assert.That(mock.Object.GetDisplayString(), Is.EqualTo("artist - title"));
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
|||||||
{
|
{
|
||||||
private BeatmapInfo getExampleBeatmap() => new BeatmapInfo
|
private BeatmapInfo getExampleBeatmap() => new BeatmapInfo
|
||||||
{
|
{
|
||||||
Ruleset = new RulesetInfo { ID = 5 },
|
Ruleset = new RulesetInfo { OnlineID = 5 },
|
||||||
StarRating = 4.0d,
|
StarRating = 4.0d,
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
{
|
{
|
||||||
@ -57,7 +57,7 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
|||||||
var exampleBeatmapInfo = getExampleBeatmap();
|
var exampleBeatmapInfo = getExampleBeatmap();
|
||||||
var criteria = new FilterCriteria
|
var criteria = new FilterCriteria
|
||||||
{
|
{
|
||||||
Ruleset = new RulesetInfo { ID = 6 }
|
Ruleset = new RulesetInfo { OnlineID = 6 }
|
||||||
};
|
};
|
||||||
var carouselItem = new CarouselBeatmap(exampleBeatmapInfo);
|
var carouselItem = new CarouselBeatmap(exampleBeatmapInfo);
|
||||||
carouselItem.Filter(criteria);
|
carouselItem.Filter(criteria);
|
||||||
@ -70,7 +70,7 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
|||||||
var exampleBeatmapInfo = getExampleBeatmap();
|
var exampleBeatmapInfo = getExampleBeatmap();
|
||||||
var criteria = new FilterCriteria
|
var criteria = new FilterCriteria
|
||||||
{
|
{
|
||||||
Ruleset = new RulesetInfo { ID = 6 },
|
Ruleset = new RulesetInfo { OnlineID = 6 },
|
||||||
AllowConvertedBeatmaps = true
|
AllowConvertedBeatmaps = true
|
||||||
};
|
};
|
||||||
var carouselItem = new CarouselBeatmap(exampleBeatmapInfo);
|
var carouselItem = new CarouselBeatmap(exampleBeatmapInfo);
|
||||||
@ -86,7 +86,7 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
|||||||
var exampleBeatmapInfo = getExampleBeatmap();
|
var exampleBeatmapInfo = getExampleBeatmap();
|
||||||
var criteria = new FilterCriteria
|
var criteria = new FilterCriteria
|
||||||
{
|
{
|
||||||
Ruleset = new RulesetInfo { ID = 6 },
|
Ruleset = new RulesetInfo { OnlineID = 6 },
|
||||||
AllowConvertedBeatmaps = true,
|
AllowConvertedBeatmaps = true,
|
||||||
ApproachRate = new FilterCriteria.OptionalRange<float>
|
ApproachRate = new FilterCriteria.OptionalRange<float>
|
||||||
{
|
{
|
||||||
@ -107,7 +107,7 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
|||||||
var exampleBeatmapInfo = getExampleBeatmap();
|
var exampleBeatmapInfo = getExampleBeatmap();
|
||||||
var criteria = new FilterCriteria
|
var criteria = new FilterCriteria
|
||||||
{
|
{
|
||||||
Ruleset = new RulesetInfo { ID = 6 },
|
Ruleset = new RulesetInfo { OnlineID = 6 },
|
||||||
AllowConvertedBeatmaps = true,
|
AllowConvertedBeatmaps = true,
|
||||||
BPM = new FilterCriteria.OptionalRange<double>
|
BPM = new FilterCriteria.OptionalRange<double>
|
||||||
{
|
{
|
||||||
@ -132,7 +132,7 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
|||||||
var exampleBeatmapInfo = getExampleBeatmap();
|
var exampleBeatmapInfo = getExampleBeatmap();
|
||||||
var criteria = new FilterCriteria
|
var criteria = new FilterCriteria
|
||||||
{
|
{
|
||||||
Ruleset = new RulesetInfo { ID = 6 },
|
Ruleset = new RulesetInfo { OnlineID = 6 },
|
||||||
AllowConvertedBeatmaps = true,
|
AllowConvertedBeatmaps = true,
|
||||||
SearchText = terms
|
SearchText = terms
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -143,7 +143,10 @@ namespace osu.Game.Tests.Online
|
|||||||
var beatmap = decoder.Decode(reader);
|
var beatmap = decoder.Decode(reader);
|
||||||
|
|
||||||
info = beatmap.BeatmapInfo;
|
info = beatmap.BeatmapInfo;
|
||||||
info.BeatmapSet.Beatmaps = new List<BeatmapInfo> { info };
|
|
||||||
|
Debug.Assert(info.BeatmapSet != null);
|
||||||
|
|
||||||
|
info.BeatmapSet.Beatmaps.Add(info);
|
||||||
info.BeatmapSet.Metadata = info.Metadata;
|
info.BeatmapSet.Metadata = info.Metadata;
|
||||||
info.MD5Hash = stream.ComputeMD5Hash();
|
info.MD5Hash = stream.ComputeMD5Hash();
|
||||||
info.Hash = stream.ComputeSHA2Hash();
|
info.Hash = stream.ComputeSHA2Hash();
|
||||||
|
@ -142,7 +142,7 @@ namespace osu.Game.Tests.Scores.IO
|
|||||||
var scoreManager = osu.Dependencies.Get<ScoreManager>();
|
var scoreManager = osu.Dependencies.Get<ScoreManager>();
|
||||||
|
|
||||||
beatmapManager.Delete(beatmapManager.QueryBeatmapSet(s => s.Beatmaps.Any(b => b.ID == imported.BeatmapInfo.ID)));
|
beatmapManager.Delete(beatmapManager.QueryBeatmapSet(s => s.Beatmaps.Any(b => b.ID == imported.BeatmapInfo.ID)));
|
||||||
Assert.That(scoreManager.Query(s => s.ID == imported.ID).DeletePending, Is.EqualTo(true));
|
Assert.That(scoreManager.Query(s => s.Equals(imported)).DeletePending, Is.EqualTo(true));
|
||||||
|
|
||||||
var secondImport = await LoadScoreIntoOsu(osu, imported);
|
var secondImport = await LoadScoreIntoOsu(osu, imported);
|
||||||
Assert.That(secondImport, Is.Null);
|
Assert.That(secondImport, Is.Null);
|
||||||
|
@ -70,7 +70,7 @@ namespace osu.Game.Tests.Testing
|
|||||||
{
|
{
|
||||||
// temporary ID to let RulesetConfigCache pass our
|
// temporary ID to let RulesetConfigCache pass our
|
||||||
// config manager to the ruleset dependencies.
|
// config manager to the ruleset dependencies.
|
||||||
RulesetInfo.ID = -1;
|
RulesetInfo.OnlineID = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IResourceStore<byte[]> CreateResourceStore() => new NamespacedResourceStore<byte[]>(TestResources.GetStore(), @"Resources");
|
public override IResourceStore<byte[]> CreateResourceStore() => new NamespacedResourceStore<byte[]>(TestResources.GetStore(), @"Resources");
|
||||||
|
@ -233,7 +233,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
prepareTokenResponse(true);
|
prepareTokenResponse(true);
|
||||||
|
|
||||||
createPlayerTest(false, createRuleset: () => new OsuRuleset { RulesetInfo = { ID = rulesetId } });
|
createPlayerTest(false, createRuleset: () => new OsuRuleset { RulesetInfo = { OnlineID = rulesetId ?? -1 } });
|
||||||
|
|
||||||
AddUntilStep("wait for token request", () => Player.TokenCreationRequested);
|
AddUntilStep("wait for token request", () => Player.TokenCreationRequested);
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
public void TestClientSendsCorrectRuleset()
|
public void TestClientSendsCorrectRuleset()
|
||||||
{
|
{
|
||||||
AddUntilStep("spectator client sending frames", () => spectatorClient.PlayingUserStates.ContainsKey(dummy_user_id));
|
AddUntilStep("spectator client sending frames", () => spectatorClient.PlayingUserStates.ContainsKey(dummy_user_id));
|
||||||
AddAssert("spectator client sent correct ruleset", () => spectatorClient.PlayingUserStates[dummy_user_id].RulesetID == Ruleset.Value.ID);
|
AddAssert("spectator client sent correct ruleset", () => spectatorClient.PlayingUserStates[dummy_user_id].RulesetID == Ruleset.Value.OnlineID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void TearDownSteps()
|
public override void TearDownSteps()
|
||||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
// ensure we have at least two beatmaps available to identify the direction the music controller navigated to.
|
// ensure we have at least two beatmaps available to identify the direction the music controller navigated to.
|
||||||
AddRepeatStep("import beatmap", () => Game.BeatmapManager.Import(new BeatmapSetInfo
|
AddRepeatStep("import beatmap", () => Game.BeatmapManager.Import(new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
Beatmaps = new List<BeatmapInfo>
|
Beatmaps =
|
||||||
{
|
{
|
||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
{
|
{
|
||||||
|
@ -47,6 +47,21 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
beatmaps = new List<BeatmapInfo>();
|
beatmaps = new List<BeatmapInfo>();
|
||||||
|
|
||||||
|
var metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Artist = "Some Artist",
|
||||||
|
Title = "Some Beatmap",
|
||||||
|
AuthorString = "Some Author"
|
||||||
|
};
|
||||||
|
|
||||||
|
var beatmapSetInfo = new BeatmapSetInfo
|
||||||
|
{
|
||||||
|
OnlineID = 10,
|
||||||
|
Hash = Guid.NewGuid().ToString().ComputeMD5Hash(),
|
||||||
|
Metadata = metadata,
|
||||||
|
DateAdded = DateTimeOffset.UtcNow
|
||||||
|
};
|
||||||
|
|
||||||
for (int i = 0; i < 8; ++i)
|
for (int i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
int beatmapId = 10 * 10 + i;
|
int beatmapId = 10 * 10 + i;
|
||||||
@ -54,29 +69,21 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
int length = RNG.Next(30000, 200000);
|
int length = RNG.Next(30000, 200000);
|
||||||
double bpm = RNG.NextSingle(80, 200);
|
double bpm = RNG.NextSingle(80, 200);
|
||||||
|
|
||||||
beatmaps.Add(new BeatmapInfo
|
var beatmap = new BeatmapInfo
|
||||||
{
|
{
|
||||||
Ruleset = rulesets.GetRuleset(i % 4),
|
Ruleset = rulesets.GetRuleset(i % 4),
|
||||||
OnlineID = beatmapId,
|
OnlineID = beatmapId,
|
||||||
Length = length,
|
Length = length,
|
||||||
BPM = bpm,
|
BPM = bpm,
|
||||||
|
Metadata = metadata,
|
||||||
BaseDifficulty = new BeatmapDifficulty()
|
BaseDifficulty = new BeatmapDifficulty()
|
||||||
});
|
};
|
||||||
|
|
||||||
|
beatmaps.Add(beatmap);
|
||||||
|
beatmapSetInfo.Beatmaps.Add(beatmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
manager.Import(new BeatmapSetInfo
|
manager.Import(beatmapSetInfo).Wait();
|
||||||
{
|
|
||||||
OnlineID = 10,
|
|
||||||
Hash = Guid.NewGuid().ToString().ComputeMD5Hash(),
|
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
Artist = "Some Artist",
|
|
||||||
Title = "Some Beatmap",
|
|
||||||
AuthorString = "Some Author"
|
|
||||||
},
|
|
||||||
Beatmaps = beatmaps,
|
|
||||||
DateAdded = DateTimeOffset.UtcNow
|
|
||||||
}).Wait();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetUpSteps()
|
public override void SetUpSteps()
|
||||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
PlaylistItem playlistItem = new PlaylistItem
|
PlaylistItem playlistItem = new PlaylistItem
|
||||||
{
|
{
|
||||||
BeatmapID = beatmapInfo.ID,
|
BeatmapID = beatmapInfo.OnlineID ?? -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
Stack.Push(screen = new MultiplayerResultsScreen(score, 1, playlistItem));
|
Stack.Push(screen = new MultiplayerResultsScreen(score, 1, playlistItem));
|
||||||
|
@ -43,7 +43,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
PlaylistItem playlistItem = new PlaylistItem
|
PlaylistItem playlistItem = new PlaylistItem
|
||||||
{
|
{
|
||||||
BeatmapID = beatmapInfo.ID,
|
BeatmapID = beatmapInfo.OnlineID ?? -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
SortedDictionary<int, BindableInt> teamScores = new SortedDictionary<int, BindableInt>
|
SortedDictionary<int, BindableInt> teamScores = new SortedDictionary<int, BindableInt>
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -42,7 +41,21 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Dependencies.Cache(rulesets = new RulesetStore(ContextFactory));
|
Dependencies.Cache(rulesets = new RulesetStore(ContextFactory));
|
||||||
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, Resources, host, Beatmap.Default));
|
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, Resources, host, Beatmap.Default));
|
||||||
|
|
||||||
var beatmaps = new List<BeatmapInfo>();
|
var metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
// Create random metadata, then we can check if sorting works based on these
|
||||||
|
Artist = "Some Artist " + RNG.Next(0, 9),
|
||||||
|
Title = "Some Song (set id 10)",
|
||||||
|
AuthorString = "Some Guy " + RNG.Next(0, 9),
|
||||||
|
};
|
||||||
|
|
||||||
|
var beatmapSet = new BeatmapSetInfo
|
||||||
|
{
|
||||||
|
OnlineID = 10,
|
||||||
|
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
||||||
|
Metadata = metadata,
|
||||||
|
DateAdded = DateTimeOffset.UtcNow,
|
||||||
|
};
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
@ -51,12 +64,13 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
int length = RNG.Next(30000, 200000);
|
int length = RNG.Next(30000, 200000);
|
||||||
double bpm = RNG.NextSingle(80, 200);
|
double bpm = RNG.NextSingle(80, 200);
|
||||||
|
|
||||||
beatmaps.Add(new BeatmapInfo
|
beatmapSet.Beatmaps.Add(new BeatmapInfo
|
||||||
{
|
{
|
||||||
Ruleset = new OsuRuleset().RulesetInfo,
|
Ruleset = new OsuRuleset().RulesetInfo,
|
||||||
OnlineID = beatmapId,
|
OnlineID = beatmapId,
|
||||||
DifficultyName = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss}, bpm {bpm:0.#})",
|
DifficultyName = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss}, bpm {bpm:0.#})",
|
||||||
Length = length,
|
Length = length,
|
||||||
|
Metadata = metadata,
|
||||||
BPM = bpm,
|
BPM = bpm,
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
{
|
{
|
||||||
@ -65,20 +79,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
manager.Import(new BeatmapSetInfo
|
manager.Import(beatmapSet).Wait();
|
||||||
{
|
|
||||||
OnlineID = 10,
|
|
||||||
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
// Create random metadata, then we can check if sorting works based on these
|
|
||||||
Artist = "Some Artist " + RNG.Next(0, 9),
|
|
||||||
Title = $"Some Song (set id 10), max bpm {beatmaps.Max(b => b.BPM):0.#})",
|
|
||||||
AuthorString = "Some Guy " + RNG.Next(0, 9),
|
|
||||||
},
|
|
||||||
Beatmaps = beatmaps,
|
|
||||||
DateAdded = DateTimeOffset.UtcNow,
|
|
||||||
}).Wait();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetUpSteps()
|
public override void SetUpSteps()
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
@ -110,7 +109,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
Hash = Guid.NewGuid().ToString(),
|
Hash = Guid.NewGuid().ToString(),
|
||||||
OnlineID = i,
|
OnlineID = i,
|
||||||
Metadata = metadata,
|
Metadata = metadata,
|
||||||
Beatmaps = new List<BeatmapInfo>
|
Beatmaps =
|
||||||
{
|
{
|
||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
{
|
{
|
||||||
@ -141,7 +140,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
|
|
||||||
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect);
|
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect);
|
||||||
AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapSetInfo.MatchesOnlineID(getImport()));
|
AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapSetInfo.MatchesOnlineID(getImport()));
|
||||||
AddAssert("correct ruleset selected", () => Game.Ruleset.Value.ID == getImport().Beatmaps.First().Ruleset.ID);
|
AddAssert("correct ruleset selected", () => Game.Ruleset.Value.Equals(getImport().Beatmaps.First().Ruleset));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void presentSecondDifficultyAndConfirm(Func<BeatmapSetInfo> getImport, int importedID)
|
private void presentSecondDifficultyAndConfirm(Func<BeatmapSetInfo> getImport, int importedID)
|
||||||
@ -151,7 +150,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
|
|
||||||
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect);
|
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect);
|
||||||
AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapInfo.OnlineID == importedID * 2048);
|
AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapInfo.OnlineID == importedID * 2048);
|
||||||
AddAssert("correct ruleset selected", () => Game.Ruleset.Value.ID == getImport().Beatmaps.First().Ruleset.ID);
|
AddAssert("correct ruleset selected", () => Game.Ruleset.Value.Equals(getImport().Beatmaps.First().Ruleset));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
@ -41,7 +40,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
Hash = Guid.NewGuid().ToString(),
|
Hash = Guid.NewGuid().ToString(),
|
||||||
OnlineID = 1,
|
OnlineID = 1,
|
||||||
Metadata = metadata,
|
Metadata = metadata,
|
||||||
Beatmaps = new List<BeatmapInfo>
|
Beatmaps =
|
||||||
{
|
{
|
||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
{
|
{
|
||||||
@ -155,15 +154,15 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
case ScorePresentType.Results:
|
case ScorePresentType.Results:
|
||||||
AddUntilStep("wait for results", () => lastWaitedScreen != Game.ScreenStack.CurrentScreen && Game.ScreenStack.CurrentScreen is ResultsScreen);
|
AddUntilStep("wait for results", () => lastWaitedScreen != Game.ScreenStack.CurrentScreen && Game.ScreenStack.CurrentScreen is ResultsScreen);
|
||||||
AddStep("store last waited screen", () => lastWaitedScreen = Game.ScreenStack.CurrentScreen);
|
AddStep("store last waited screen", () => lastWaitedScreen = Game.ScreenStack.CurrentScreen);
|
||||||
AddUntilStep("correct score displayed", () => ((ResultsScreen)Game.ScreenStack.CurrentScreen).Score.ID == getImport().ID);
|
AddUntilStep("correct score displayed", () => ((ResultsScreen)Game.ScreenStack.CurrentScreen).Score.Equals(getImport()));
|
||||||
AddAssert("correct ruleset selected", () => Game.Ruleset.Value.ID == getImport().Ruleset.ID);
|
AddAssert("correct ruleset selected", () => Game.Ruleset.Value.Equals(getImport().Ruleset));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ScorePresentType.Gameplay:
|
case ScorePresentType.Gameplay:
|
||||||
AddUntilStep("wait for player loader", () => lastWaitedScreen != Game.ScreenStack.CurrentScreen && Game.ScreenStack.CurrentScreen is ReplayPlayerLoader);
|
AddUntilStep("wait for player loader", () => lastWaitedScreen != Game.ScreenStack.CurrentScreen && Game.ScreenStack.CurrentScreen is ReplayPlayerLoader);
|
||||||
AddStep("store last waited screen", () => lastWaitedScreen = Game.ScreenStack.CurrentScreen);
|
AddStep("store last waited screen", () => lastWaitedScreen = Game.ScreenStack.CurrentScreen);
|
||||||
AddUntilStep("correct score displayed", () => ((ReplayPlayerLoader)Game.ScreenStack.CurrentScreen).Score.ID == getImport().ID);
|
AddUntilStep("correct score displayed", () => ((ReplayPlayerLoader)Game.ScreenStack.CurrentScreen).Score.Equals(getImport()));
|
||||||
AddAssert("correct ruleset selected", () => Game.Ruleset.Value.ID == getImport().Ruleset.ID);
|
AddAssert("correct ruleset selected", () => Game.Ruleset.Value.Equals(getImport().Ruleset));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
InputManager.ReleaseKey(Key.ControlLeft);
|
InputManager.ReleaseKey(Key.ControlLeft);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("Ruleset changed to osu!taiko", () => Game.Toolbar.ChildrenOfType<ToolbarRulesetSelector>().Single().Current.Value.ID == 1);
|
AddAssert("Ruleset changed to osu!taiko", () => Game.Toolbar.ChildrenOfType<ToolbarRulesetSelector>().Single().Current.Value.OnlineID == 1);
|
||||||
|
|
||||||
AddAssert("Mods overlay still visible", () => songSelect.ModSelectOverlay.State.Value == Visibility.Visible);
|
AddAssert("Mods overlay still visible", () => songSelect.ModSelectOverlay.State.Value == Visibility.Visible);
|
||||||
}
|
}
|
||||||
@ -278,7 +278,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
InputManager.ReleaseKey(Key.ControlLeft);
|
InputManager.ReleaseKey(Key.ControlLeft);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("Ruleset changed to osu!taiko", () => Game.Toolbar.ChildrenOfType<ToolbarRulesetSelector>().Single().Current.Value.ID == 1);
|
AddAssert("Ruleset changed to osu!taiko", () => Game.Toolbar.ChildrenOfType<ToolbarRulesetSelector>().Single().Current.Value.OnlineID == 1);
|
||||||
|
|
||||||
AddAssert("Options overlay still visible", () => songSelect.BeatmapOptionsOverlay.State.Value == Visibility.Visible);
|
AddAssert("Options overlay still visible", () => songSelect.BeatmapOptionsOverlay.State.Value == Visibility.Visible);
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
OnlineID = i * 10,
|
OnlineID = i * 10,
|
||||||
DifficultyName = $"Test #{i}",
|
DifficultyName = $"Test #{i}",
|
||||||
RulesetID = Ruleset.Value.ID ?? -1,
|
RulesetID = Ruleset.Value.OnlineID,
|
||||||
StarRating = 2 + i * 0.1,
|
StarRating = 2 + i * 0.1,
|
||||||
OverallDifficulty = 3.5f,
|
OverallDifficulty = 3.5f,
|
||||||
FailTimes = new APIFailTimes
|
FailTimes = new APIFailTimes
|
||||||
|
@ -94,7 +94,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
new APIBeatmap
|
new APIBeatmap
|
||||||
{
|
{
|
||||||
RulesetID = Ruleset.Value.ID ?? 0,
|
RulesetID = Ruleset.Value.OnlineID,
|
||||||
DifficultyName = "Test",
|
DifficultyName = "Test",
|
||||||
StarRating = 6.42,
|
StarRating = 6.42,
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
|
|
||||||
AddStep("Set beatmap", () => Beatmap.Value = new DummyWorkingBeatmap(Audio, null)
|
AddStep("Set beatmap", () => Beatmap.Value = new DummyWorkingBeatmap(Audio, null)
|
||||||
{
|
{
|
||||||
BeatmapInfo = { OnlineID = hasOnlineId ? 1234 : (int?)null }
|
BeatmapInfo = { OnlineID = hasOnlineId ? 1234 : -1 }
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("Run command", () => Add(new NowPlayingCommand()));
|
AddStep("Run command", () => Add(new NowPlayingCommand()));
|
||||||
|
@ -836,23 +836,29 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
private BeatmapSetInfo createTestBeatmapSet(int id, bool randomDifficultyCount = false)
|
private BeatmapSetInfo createTestBeatmapSet(int id, bool randomDifficultyCount = false)
|
||||||
{
|
{
|
||||||
return new BeatmapSetInfo
|
var metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
// Create random metadata, then we can check if sorting works based on these
|
||||||
|
Artist = $"peppy{id.ToString().PadLeft(6, '0')}",
|
||||||
|
Title = $"test set #{id}!",
|
||||||
|
AuthorString = string.Concat(Enumerable.Repeat((char)('z' - Math.Min(25, id - 1)), 5))
|
||||||
|
};
|
||||||
|
|
||||||
|
var beatmapSet = new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
ID = id,
|
ID = id,
|
||||||
OnlineID = id,
|
OnlineID = id,
|
||||||
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
||||||
Metadata = new BeatmapMetadata
|
Metadata = metadata,
|
||||||
{
|
|
||||||
// Create random metadata, then we can check if sorting works based on these
|
|
||||||
Artist = $"peppy{id.ToString().PadLeft(6, '0')}",
|
|
||||||
Title = $"test set #{id}!",
|
|
||||||
AuthorString = string.Concat(Enumerable.Repeat((char)('z' - Math.Min(25, id - 1)), 5))
|
|
||||||
},
|
|
||||||
Beatmaps = getBeatmaps(randomDifficultyCount ? RNG.Next(1, 20) : 3).ToList()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
foreach (var b in getBeatmaps(randomDifficultyCount ? RNG.Next(1, 20) : 3, metadata))
|
||||||
|
beatmapSet.Beatmaps.Add(b);
|
||||||
|
|
||||||
|
return beatmapSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<BeatmapInfo> getBeatmaps(int count)
|
private IEnumerable<BeatmapInfo> getBeatmaps(int count, BeatmapMetadata metadata)
|
||||||
{
|
{
|
||||||
int id = 0;
|
int id = 0;
|
||||||
|
|
||||||
@ -872,6 +878,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
DifficultyName = version,
|
DifficultyName = version,
|
||||||
StarRating = diff,
|
StarRating = diff,
|
||||||
Ruleset = new OsuRuleset().RulesetInfo,
|
Ruleset = new OsuRuleset().RulesetInfo,
|
||||||
|
Metadata = metadata,
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
{
|
{
|
||||||
OverallDifficulty = diff,
|
OverallDifficulty = diff,
|
||||||
@ -882,19 +889,19 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
private BeatmapSetInfo createTestBeatmapSetWithManyDifficulties(int id)
|
private BeatmapSetInfo createTestBeatmapSetWithManyDifficulties(int id)
|
||||||
{
|
{
|
||||||
|
var metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
// Create random metadata, then we can check if sorting works based on these
|
||||||
|
Artist = $"peppy{id.ToString().PadLeft(6, '0')}",
|
||||||
|
Title = $"test set #{id}!",
|
||||||
|
AuthorString = string.Concat(Enumerable.Repeat((char)('z' - Math.Min(25, id - 1)), 5))
|
||||||
|
};
|
||||||
|
|
||||||
var toReturn = new BeatmapSetInfo
|
var toReturn = new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
ID = id,
|
|
||||||
OnlineID = id,
|
OnlineID = id,
|
||||||
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
||||||
Metadata = new BeatmapMetadata
|
Metadata = metadata,
|
||||||
{
|
|
||||||
// Create random metadata, then we can check if sorting works based on these
|
|
||||||
Artist = $"peppy{id.ToString().PadLeft(6, '0')}",
|
|
||||||
Title = $"test set #{id}!",
|
|
||||||
AuthorString = string.Concat(Enumerable.Repeat((char)('z' - Math.Min(25, id - 1)), 5))
|
|
||||||
},
|
|
||||||
Beatmaps = new List<BeatmapInfo>(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int b = 1; b < 101; b++)
|
for (int b = 1; b < 101; b++)
|
||||||
@ -902,10 +909,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
toReturn.Beatmaps.Add(new BeatmapInfo
|
toReturn.Beatmaps.Add(new BeatmapInfo
|
||||||
{
|
{
|
||||||
OnlineID = b * 10,
|
OnlineID = b * 10,
|
||||||
Path = $"extra{b}.osu",
|
|
||||||
DifficultyName = $"Extra {b}",
|
DifficultyName = $"Extra {b}",
|
||||||
Ruleset = rulesets.GetRuleset((b - 1) % 4),
|
Ruleset = rulesets.GetRuleset((b - 1) % 4),
|
||||||
StarRating = 2,
|
StarRating = 2,
|
||||||
|
Metadata = metadata,
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
{
|
{
|
||||||
OverallDifficulty = 3.5f,
|
OverallDifficulty = 3.5f,
|
||||||
|
@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
switch (req)
|
switch (req)
|
||||||
{
|
{
|
||||||
case GetUserRequest userRequest:
|
case GetUserRequest userRequest:
|
||||||
userRequest.TriggerSuccess(getUser(userRequest.Ruleset.ID));
|
userRequest.TriggerSuccess(getUser(userRequest.Ruleset.OnlineID));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,17 +183,18 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
Hash = Guid.NewGuid().ToString(),
|
Hash = Guid.NewGuid().ToString(),
|
||||||
OnlineID = importID,
|
OnlineID = importID,
|
||||||
Metadata = metadata,
|
Metadata = metadata,
|
||||||
Beatmaps = difficultyRulesets.Select((ruleset, difficultyIndex) => new BeatmapInfo
|
|
||||||
{
|
|
||||||
OnlineID = importID * 1024 + difficultyIndex,
|
|
||||||
Metadata = metadata,
|
|
||||||
BaseDifficulty = new BeatmapDifficulty(),
|
|
||||||
Ruleset = ruleset,
|
|
||||||
StarRating = difficultyIndex + 1,
|
|
||||||
DifficultyName = $"SR{difficultyIndex + 1}"
|
|
||||||
}).ToList()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
beatmapSet.Beatmaps.AddRange(difficultyRulesets.Select((ruleset, difficultyIndex) => new BeatmapInfo
|
||||||
|
{
|
||||||
|
OnlineID = importID * 1024 + difficultyIndex,
|
||||||
|
Metadata = metadata,
|
||||||
|
BaseDifficulty = new BeatmapDifficulty(),
|
||||||
|
Ruleset = ruleset,
|
||||||
|
StarRating = difficultyIndex + 1,
|
||||||
|
DifficultyName = $"SR{difficultyIndex + 1}"
|
||||||
|
}));
|
||||||
|
|
||||||
return Game.BeatmapManager.Import(beatmapSet).Result.Value;
|
return Game.BeatmapManager.Import(beatmapSet).Result.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
{
|
{
|
||||||
AddStep("import multi-ruleset map", () =>
|
AddStep("import multi-ruleset map", () =>
|
||||||
{
|
{
|
||||||
var usableRulesets = rulesets.AvailableRulesets.Where(r => r.ID != 2).ToArray();
|
var usableRulesets = rulesets.AvailableRulesets.Where(r => r.OnlineID != 2).ToArray();
|
||||||
manager.Import(createTestBeatmapSet(usableRulesets)).Wait();
|
manager.Import(createTestBeatmapSet(usableRulesets)).Wait();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -354,7 +354,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
target = manager.GetAllUsableBeatmapSets()
|
target = manager.GetAllUsableBeatmapSets()
|
||||||
.Last(b => b.Beatmaps.Any(bi => bi.RulesetID == 0)).Beatmaps.Last();
|
.Last(b => b.Beatmaps.Any(bi => bi.RulesetID == 0)).Beatmaps.Last();
|
||||||
|
|
||||||
Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == 0);
|
Ruleset.Value = rulesets.AvailableRulesets.First(r => r.OnlineID == 0);
|
||||||
Beatmap.Value = manager.GetWorkingBeatmap(target);
|
Beatmap.Value = manager.GetWorkingBeatmap(target);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -385,12 +385,12 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
.Last(b => b.Beatmaps.Any(bi => bi.RulesetID == 0)).Beatmaps.Last();
|
.Last(b => b.Beatmaps.Any(bi => bi.RulesetID == 0)).Beatmaps.Last();
|
||||||
|
|
||||||
Beatmap.Value = manager.GetWorkingBeatmap(target);
|
Beatmap.Value = manager.GetWorkingBeatmap(target);
|
||||||
Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == 0);
|
Ruleset.Value = rulesets.AvailableRulesets.First(r => r.OnlineID == 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmapInfo.Equals(target));
|
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmapInfo.Equals(target));
|
||||||
|
|
||||||
AddUntilStep("has correct ruleset", () => Ruleset.Value.ID == 0);
|
AddUntilStep("has correct ruleset", () => Ruleset.Value.OnlineID == 0);
|
||||||
|
|
||||||
// this is an important check, to make sure updateComponentFromBeatmap() was actually run
|
// this is an important check, to make sure updateComponentFromBeatmap() was actually run
|
||||||
AddUntilStep("selection shown on wedge", () => songSelect.CurrentBeatmapDetailsBeatmap.BeatmapInfo.MatchesOnlineID(target));
|
AddUntilStep("selection shown on wedge", () => songSelect.CurrentBeatmapDetailsBeatmap.BeatmapInfo.MatchesOnlineID(target));
|
||||||
@ -505,7 +505,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
// special case for converts checked here.
|
// special case for converts checked here.
|
||||||
return selectedPanel.ChildrenOfType<FilterableDifficultyIcon>().All(i =>
|
return selectedPanel.ChildrenOfType<FilterableDifficultyIcon>().All(i =>
|
||||||
i.IsFiltered || i.Item.BeatmapInfo.Ruleset.ID == targetRuleset || i.Item.BeatmapInfo.Ruleset.ID == 0);
|
i.IsFiltered || i.Item.BeatmapInfo.Ruleset.OnlineID == targetRuleset || i.Item.BeatmapInfo.Ruleset.OnlineID == 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("carousel has correct", () => songSelect.Carousel.SelectedBeatmapInfo?.MatchesOnlineID(target) == true);
|
AddUntilStep("carousel has correct", () => songSelect.Carousel.SelectedBeatmapInfo?.MatchesOnlineID(target) == true);
|
||||||
@ -665,7 +665,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
AddStep("import multi-ruleset map", () =>
|
AddStep("import multi-ruleset map", () =>
|
||||||
{
|
{
|
||||||
var usableRulesets = rulesets.AvailableRulesets.Where(r => r.ID != 2).ToArray();
|
var usableRulesets = rulesets.AvailableRulesets.Where(r => r.OnlineID != 2).ToArray();
|
||||||
manager.Import(createTestBeatmapSet(usableRulesets)).Wait();
|
manager.Import(createTestBeatmapSet(usableRulesets)).Wait();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -676,11 +676,11 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddStep("record set ID", () => previousSetID = ((IBeatmapSetInfo)Beatmap.Value.BeatmapSetInfo).OnlineID);
|
AddStep("record set ID", () => previousSetID = ((IBeatmapSetInfo)Beatmap.Value.BeatmapSetInfo).OnlineID);
|
||||||
AddAssert("selection changed once", () => changeCount == 1);
|
AddAssert("selection changed once", () => changeCount == 1);
|
||||||
|
|
||||||
AddAssert("Check ruleset is osu!", () => Ruleset.Value.ID == 0);
|
AddAssert("Check ruleset is osu!", () => Ruleset.Value.OnlineID == 0);
|
||||||
|
|
||||||
changeRuleset(3);
|
changeRuleset(3);
|
||||||
|
|
||||||
AddUntilStep("Check ruleset changed to mania", () => Ruleset.Value.ID == 3);
|
AddUntilStep("Check ruleset changed to mania", () => Ruleset.Value.OnlineID == 3);
|
||||||
|
|
||||||
AddUntilStep("selection changed", () => changeCount > 1);
|
AddUntilStep("selection changed", () => changeCount > 1);
|
||||||
|
|
||||||
@ -705,7 +705,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
AddStep("import multi-ruleset map", () =>
|
AddStep("import multi-ruleset map", () =>
|
||||||
{
|
{
|
||||||
var usableRulesets = rulesets.AvailableRulesets.Where(r => r.ID != 2).ToArray();
|
var usableRulesets = rulesets.AvailableRulesets.Where(r => r.OnlineID != 2).ToArray();
|
||||||
manager.Import(createTestBeatmapSet(usableRulesets)).Wait();
|
manager.Import(createTestBeatmapSet(usableRulesets)).Wait();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -720,11 +720,11 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddUntilStep("Find an icon for different ruleset", () =>
|
AddUntilStep("Find an icon for different ruleset", () =>
|
||||||
{
|
{
|
||||||
difficultyIcon = set.ChildrenOfType<FilterableDifficultyIcon>()
|
difficultyIcon = set.ChildrenOfType<FilterableDifficultyIcon>()
|
||||||
.FirstOrDefault(icon => icon.Item.BeatmapInfo.Ruleset.ID == 3);
|
.FirstOrDefault(icon => icon.Item.BeatmapInfo.Ruleset.OnlineID == 3);
|
||||||
return difficultyIcon != null;
|
return difficultyIcon != null;
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("Check ruleset is osu!", () => Ruleset.Value.ID == 0);
|
AddAssert("Check ruleset is osu!", () => Ruleset.Value.OnlineID == 0);
|
||||||
|
|
||||||
int previousSetID = 0;
|
int previousSetID = 0;
|
||||||
|
|
||||||
@ -737,7 +737,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
InputManager.Click(MouseButton.Left);
|
InputManager.Click(MouseButton.Left);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("Check ruleset changed to mania", () => Ruleset.Value.ID == 3);
|
AddUntilStep("Check ruleset changed to mania", () => Ruleset.Value.OnlineID == 3);
|
||||||
|
|
||||||
AddAssert("Selected beatmap still same set", () => songSelect.Carousel.SelectedBeatmapInfo.BeatmapSet.OnlineID == previousSetID);
|
AddAssert("Selected beatmap still same set", () => songSelect.Carousel.SelectedBeatmapInfo.BeatmapSet.OnlineID == previousSetID);
|
||||||
AddAssert("Selected beatmap is mania", () => Beatmap.Value.BeatmapInfo.Ruleset.OnlineID == 3);
|
AddAssert("Selected beatmap is mania", () => Beatmap.Value.BeatmapInfo.Ruleset.OnlineID == 3);
|
||||||
@ -754,7 +754,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
AddStep("import huge difficulty count map", () =>
|
AddStep("import huge difficulty count map", () =>
|
||||||
{
|
{
|
||||||
var usableRulesets = rulesets.AvailableRulesets.Where(r => r.ID != 2).ToArray();
|
var usableRulesets = rulesets.AvailableRulesets.Where(r => r.OnlineID != 2).ToArray();
|
||||||
imported = manager.Import(createTestBeatmapSet(usableRulesets, 50)).Result.Value;
|
imported = manager.Import(createTestBeatmapSet(usableRulesets, 50)).Result.Value;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -771,10 +771,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddUntilStep("Find group icon for different ruleset", () =>
|
AddUntilStep("Find group icon for different ruleset", () =>
|
||||||
{
|
{
|
||||||
return (groupIcon = set.ChildrenOfType<FilterableGroupedDifficultyIcon>()
|
return (groupIcon = set.ChildrenOfType<FilterableGroupedDifficultyIcon>()
|
||||||
.FirstOrDefault(icon => icon.Items.First().BeatmapInfo.Ruleset.ID == 3)) != null;
|
.FirstOrDefault(icon => icon.Items.First().BeatmapInfo.Ruleset.OnlineID == 3)) != null;
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("Check ruleset is osu!", () => Ruleset.Value.ID == 0);
|
AddAssert("Check ruleset is osu!", () => Ruleset.Value.OnlineID == 0);
|
||||||
|
|
||||||
AddStep("Click on group", () =>
|
AddStep("Click on group", () =>
|
||||||
{
|
{
|
||||||
@ -783,7 +783,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
InputManager.Click(MouseButton.Left);
|
InputManager.Click(MouseButton.Left);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("Check ruleset changed to mania", () => Ruleset.Value.ID == 3);
|
AddUntilStep("Check ruleset changed to mania", () => Ruleset.Value.OnlineID == 3);
|
||||||
|
|
||||||
AddAssert("Check first item in group selected", () => Beatmap.Value.BeatmapInfo.MatchesOnlineID(groupIcon.Items.First().BeatmapInfo));
|
AddAssert("Check first item in group selected", () => Beatmap.Value.BeatmapInfo.MatchesOnlineID(groupIcon.Items.First().BeatmapInfo));
|
||||||
}
|
}
|
||||||
@ -817,7 +817,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddUntilStep("wait for results screen presented", () => !songSelect.IsCurrentScreen());
|
AddUntilStep("wait for results screen presented", () => !songSelect.IsCurrentScreen());
|
||||||
|
|
||||||
AddAssert("check beatmap is correct for score", () => Beatmap.Value.BeatmapInfo.MatchesOnlineID(getPresentBeatmap()));
|
AddAssert("check beatmap is correct for score", () => Beatmap.Value.BeatmapInfo.MatchesOnlineID(getPresentBeatmap()));
|
||||||
AddAssert("check ruleset is correct for score", () => Ruleset.Value.ID == 0);
|
AddAssert("check ruleset is correct for score", () => Ruleset.Value.OnlineID == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -849,7 +849,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddUntilStep("wait for results screen presented", () => !songSelect.IsCurrentScreen());
|
AddUntilStep("wait for results screen presented", () => !songSelect.IsCurrentScreen());
|
||||||
|
|
||||||
AddAssert("check beatmap is correct for score", () => Beatmap.Value.BeatmapInfo.MatchesOnlineID(getPresentBeatmap()));
|
AddAssert("check beatmap is correct for score", () => Beatmap.Value.BeatmapInfo.MatchesOnlineID(getPresentBeatmap()));
|
||||||
AddAssert("check ruleset is correct for score", () => Ruleset.Value.ID == 0);
|
AddAssert("check ruleset is correct for score", () => Ruleset.Value.OnlineID == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitForInitialSelection()
|
private void waitForInitialSelection()
|
||||||
@ -869,7 +869,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
private void addRulesetImportStep(int id) => AddStep($"import test map for ruleset {id}", () => importForRuleset(id));
|
private void addRulesetImportStep(int id) => AddStep($"import test map for ruleset {id}", () => importForRuleset(id));
|
||||||
|
|
||||||
private void importForRuleset(int id) => manager.Import(createTestBeatmapSet(rulesets.AvailableRulesets.Where(r => r.ID == id).ToArray())).Wait();
|
private void importForRuleset(int id) => manager.Import(createTestBeatmapSet(rulesets.AvailableRulesets.Where(r => r.OnlineID == id).ToArray())).Wait();
|
||||||
|
|
||||||
private static int importId;
|
private static int importId;
|
||||||
|
|
||||||
@ -880,7 +880,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
private void changeMods(params Mod[] mods) => AddStep($"change mods to {string.Join(", ", mods.Select(m => m.Acronym))}", () => SelectedMods.Value = mods);
|
private void changeMods(params Mod[] mods) => AddStep($"change mods to {string.Join(", ", mods.Select(m => m.Acronym))}", () => SelectedMods.Value = mods);
|
||||||
|
|
||||||
private void changeRuleset(int id) => AddStep($"change ruleset to {id}", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == id));
|
private void changeRuleset(int id) => AddStep($"change ruleset to {id}", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.OnlineID == id));
|
||||||
|
|
||||||
private void createSongSelect()
|
private void createSongSelect()
|
||||||
{
|
{
|
||||||
@ -893,7 +893,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
{
|
{
|
||||||
AddStep("import test maps", () =>
|
AddStep("import test maps", () =>
|
||||||
{
|
{
|
||||||
var usableRulesets = rulesets.AvailableRulesets.Where(r => r.ID != 2).ToArray();
|
var usableRulesets = rulesets.AvailableRulesets.Where(r => r.OnlineID != 2).ToArray();
|
||||||
|
|
||||||
for (int i = 0; i < 100; i += 10)
|
for (int i = 0; i < 100; i += 10)
|
||||||
manager.Import(createTestBeatmapSet(usableRulesets)).Wait();
|
manager.Import(createTestBeatmapSet(usableRulesets)).Wait();
|
||||||
@ -907,7 +907,21 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
int setId = getImportId();
|
int setId = getImportId();
|
||||||
|
|
||||||
var beatmaps = new List<BeatmapInfo>();
|
var metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
// Create random metadata, then we can check if sorting works based on these
|
||||||
|
Artist = "Some Artist " + RNG.Next(0, 9),
|
||||||
|
Title = $"Some Song (set id {setId})",
|
||||||
|
AuthorString = "Some Guy " + RNG.Next(0, 9),
|
||||||
|
};
|
||||||
|
|
||||||
|
var beatmapSet = new BeatmapSetInfo
|
||||||
|
{
|
||||||
|
OnlineID = setId,
|
||||||
|
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
||||||
|
DateAdded = DateTimeOffset.UtcNow,
|
||||||
|
Metadata = metadata
|
||||||
|
};
|
||||||
|
|
||||||
for (int i = 0; i < countPerRuleset; i++)
|
for (int i = 0; i < countPerRuleset; i++)
|
||||||
{
|
{
|
||||||
@ -916,12 +930,13 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
int length = RNG.Next(30000, 200000);
|
int length = RNG.Next(30000, 200000);
|
||||||
double bpm = RNG.NextSingle(80, 200);
|
double bpm = RNG.NextSingle(80, 200);
|
||||||
|
|
||||||
beatmaps.Add(new BeatmapInfo
|
beatmapSet.Beatmaps.Add(new BeatmapInfo
|
||||||
{
|
{
|
||||||
Ruleset = getRuleset(),
|
Ruleset = getRuleset(),
|
||||||
OnlineID = beatmapId,
|
OnlineID = beatmapId,
|
||||||
DifficultyName = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss}, bpm {bpm:0.#})",
|
DifficultyName = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss}, bpm {bpm:0.#})",
|
||||||
Length = length,
|
Length = length,
|
||||||
|
Metadata = metadata,
|
||||||
BPM = bpm,
|
BPM = bpm,
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
{
|
{
|
||||||
@ -930,20 +945,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BeatmapSetInfo
|
return beatmapSet;
|
||||||
{
|
|
||||||
OnlineID = setId,
|
|
||||||
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
// Create random metadata, then we can check if sorting works based on these
|
|
||||||
Artist = "Some Artist " + RNG.Next(0, 9),
|
|
||||||
Title = $"Some Song (set id {setId}, max bpm {beatmaps.Max(b => b.BPM):0.#})",
|
|
||||||
AuthorString = "Some Guy " + RNG.Next(0, 9),
|
|
||||||
},
|
|
||||||
Beatmaps = beatmaps,
|
|
||||||
DateAdded = DateTimeOffset.UtcNow,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
@ -378,9 +378,9 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeRuleset(int? id)
|
private void changeRuleset(int? onlineId)
|
||||||
{
|
{
|
||||||
AddStep($"change ruleset to {(id?.ToString() ?? "none")}", () => { Ruleset.Value = rulesets.AvailableRulesets.FirstOrDefault(r => r.ID == id); });
|
AddStep($"change ruleset to {(onlineId?.ToString() ?? "none")}", () => { Ruleset.Value = rulesets.AvailableRulesets.FirstOrDefault(r => r.OnlineID == onlineId); });
|
||||||
waitForLoad();
|
waitForLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,12 @@ namespace osu.Game.Tournament.Tests.Components
|
|||||||
|
|
||||||
private void success(APIBeatmap beatmap)
|
private void success(APIBeatmap beatmap)
|
||||||
{
|
{
|
||||||
var mods = rulesets.GetRuleset(Ladder.Ruleset.Value.ID ?? 0).CreateInstance().AllMods;
|
var ruleset = rulesets.GetRuleset(Ladder.Ruleset.Value.OnlineID);
|
||||||
|
|
||||||
|
if (ruleset == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var mods = ruleset.CreateInstance().AllMods;
|
||||||
|
|
||||||
foreach (var mod in mods)
|
foreach (var mod in mods)
|
||||||
{
|
{
|
||||||
|
@ -127,7 +127,7 @@ namespace osu.Game.Tournament.Components
|
|||||||
|
|
||||||
(string heading, string content)[] stats;
|
(string heading, string content)[] stats;
|
||||||
|
|
||||||
switch (ruleset.Value.ID)
|
switch (ruleset.Value.OnlineID)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
stats = new (string heading, string content)[]
|
stats = new (string heading, string content)[]
|
||||||
|
@ -340,8 +340,8 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(DifficultyCacheLookup other)
|
public bool Equals(DifficultyCacheLookup other)
|
||||||
=> BeatmapInfo.ID == other.BeatmapInfo.ID
|
=> BeatmapInfo.Equals(other.BeatmapInfo)
|
||||||
&& Ruleset.ID == other.Ruleset.ID
|
&& Ruleset.Equals(other.Ruleset)
|
||||||
&& OrderedMods.SequenceEqual(other.OrderedMods);
|
&& OrderedMods.SequenceEqual(other.OrderedMods);
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
@ -349,7 +349,7 @@ namespace osu.Game.Beatmaps
|
|||||||
var hashCode = new HashCode();
|
var hashCode = new HashCode();
|
||||||
|
|
||||||
hashCode.Add(BeatmapInfo.ID);
|
hashCode.Add(BeatmapInfo.ID);
|
||||||
hashCode.Add(Ruleset.ID);
|
hashCode.Add(Ruleset.ShortName);
|
||||||
|
|
||||||
foreach (var mod in OrderedMods)
|
foreach (var mod in OrderedMods)
|
||||||
hashCode.Add(mod);
|
hashCode.Add(mod);
|
||||||
|
@ -5,7 +5,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
@ -104,28 +103,6 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int CountdownOffset { get; set; }
|
public int CountdownOffset { get; set; }
|
||||||
|
|
||||||
// Editor
|
|
||||||
// This bookmarks stuff is necessary because DB doesn't know how to store int[]
|
|
||||||
[JsonIgnore]
|
|
||||||
public string StoredBookmarks
|
|
||||||
{
|
|
||||||
get => string.Join(',', Bookmarks);
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(value))
|
|
||||||
{
|
|
||||||
Bookmarks = Array.Empty<int>();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bookmarks = value.Split(',').Select(v =>
|
|
||||||
{
|
|
||||||
bool result = int.TryParse(v, out int val);
|
|
||||||
return new { result, val };
|
|
||||||
}).Where(p => p.result).Select(p => p.val).ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public int[] Bookmarks { get; set; } = Array.Empty<int>();
|
public int[] Bookmarks { get; set; } = Array.Empty<int>();
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Mixing;
|
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
@ -40,7 +39,7 @@ namespace osu.Game.Beatmaps
|
|||||||
private readonly WorkingBeatmapCache workingBeatmapCache;
|
private readonly WorkingBeatmapCache workingBeatmapCache;
|
||||||
private readonly BeatmapOnlineLookupQueue onlineBeatmapLookupQueue;
|
private readonly BeatmapOnlineLookupQueue onlineBeatmapLookupQueue;
|
||||||
|
|
||||||
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, [NotNull] AudioManager audioManager, IResourceStore<byte[]> gameResources, GameHost host = null, WorkingBeatmap defaultBeatmap = null, bool performOnlineLookups = false, AudioMixer mainTrackMixer = null)
|
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, [NotNull] AudioManager audioManager, IResourceStore<byte[]> gameResources, GameHost host = null, WorkingBeatmap defaultBeatmap = null, bool performOnlineLookups = false)
|
||||||
{
|
{
|
||||||
var userResources = new FileStore(contextFactory, storage).Store;
|
var userResources = new FileStore(contextFactory, storage).Store;
|
||||||
|
|
||||||
@ -86,7 +85,7 @@ namespace osu.Game.Beatmaps
|
|||||||
var set = new BeatmapSetInfo
|
var set = new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
Metadata = metadata,
|
Metadata = metadata,
|
||||||
Beatmaps = new List<BeatmapInfo>
|
Beatmaps =
|
||||||
{
|
{
|
||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
{
|
{
|
||||||
|
@ -82,7 +82,7 @@ namespace osu.Game.Beatmaps
|
|||||||
protected override async Task Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive, CancellationToken cancellationToken = default)
|
protected override async Task Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
if (archive != null)
|
if (archive != null)
|
||||||
beatmapSet.Beatmaps = createBeatmapDifficulties(beatmapSet.Files);
|
beatmapSet.Beatmaps.AddRange(createBeatmapDifficulties(beatmapSet.Files));
|
||||||
|
|
||||||
foreach (BeatmapInfo b in beatmapSet.Beatmaps)
|
foreach (BeatmapInfo b in beatmapSet.Beatmaps)
|
||||||
{
|
{
|
||||||
@ -208,7 +208,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
using (ContextFactory.GetForWrite())
|
using (ContextFactory.GetForWrite())
|
||||||
{
|
{
|
||||||
beatmapInfo = setInfo.Beatmaps.Single(b => b.ID == beatmapInfo.ID);
|
beatmapInfo = setInfo.Beatmaps.Single(b => b.Equals(beatmapInfo));
|
||||||
|
|
||||||
var metadata = beatmapInfo.Metadata ?? setInfo.Metadata;
|
var metadata = beatmapInfo.Metadata ?? setInfo.Metadata;
|
||||||
|
|
||||||
@ -370,7 +370,6 @@ namespace osu.Game.Beatmaps
|
|||||||
return new BeatmapSetInfo
|
return new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
OnlineID = beatmap.BeatmapInfo.BeatmapSet?.OnlineID,
|
OnlineID = beatmap.BeatmapInfo.BeatmapSet?.OnlineID,
|
||||||
Beatmaps = new List<BeatmapInfo>(),
|
|
||||||
Metadata = beatmap.Metadata,
|
Metadata = beatmap.Metadata,
|
||||||
DateAdded = DateTimeOffset.UtcNow
|
DateAdded = DateTimeOffset.UtcNow
|
||||||
};
|
};
|
||||||
|
@ -5,6 +5,8 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Extensions;
|
using osu.Game.Extensions;
|
||||||
@ -29,7 +31,8 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public BeatmapMetadata Metadata { get; set; }
|
public BeatmapMetadata Metadata { get; set; }
|
||||||
|
|
||||||
public List<BeatmapInfo> Beatmaps { get; set; }
|
[NotNull]
|
||||||
|
public List<BeatmapInfo> Beatmaps { get; } = new List<BeatmapInfo>();
|
||||||
|
|
||||||
public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None;
|
public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None;
|
||||||
|
|
||||||
@ -38,17 +41,20 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The maximum star difficulty of all beatmaps in this set.
|
/// The maximum star difficulty of all beatmaps in this set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double MaxStarDifficulty => Beatmaps?.Max(b => b.StarRating) ?? 0;
|
[JsonIgnore]
|
||||||
|
public double MaxStarDifficulty => Beatmaps.Count == 0 ? 0 : Beatmaps.Max(b => b.StarRating);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The maximum playable length in milliseconds of all beatmaps in this set.
|
/// The maximum playable length in milliseconds of all beatmaps in this set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double MaxLength => Beatmaps?.Max(b => b.Length) ?? 0;
|
[JsonIgnore]
|
||||||
|
public double MaxLength => Beatmaps.Count == 0 ? 0 : Beatmaps.Max(b => b.Length);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The maximum BPM of all beatmaps in this set.
|
/// The maximum BPM of all beatmaps in this set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double MaxBPM => Beatmaps?.Max(b => b.BPM) ?? 0;
|
[JsonIgnore]
|
||||||
|
public double MaxBPM => Beatmaps.Count == 0 ? 0 : Beatmaps.Max(b => b.BPM);
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public bool DeletePending { get; set; }
|
public bool DeletePending { get; set; }
|
||||||
@ -87,7 +93,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
#region Implementation of IBeatmapSetInfo
|
#region Implementation of IBeatmapSetInfo
|
||||||
|
|
||||||
IBeatmapMetadataInfo IBeatmapSetInfo.Metadata => Metadata;
|
IBeatmapMetadataInfo IBeatmapSetInfo.Metadata => Metadata ?? Beatmaps.FirstOrDefault()?.Metadata ?? new BeatmapMetadata();
|
||||||
IEnumerable<IBeatmapInfo> IBeatmapSetInfo.Beatmaps => Beatmaps;
|
IEnumerable<IBeatmapInfo> IBeatmapSetInfo.Beatmaps => Beatmaps;
|
||||||
IEnumerable<INamedFileUsage> IBeatmapSetInfo.Files => Files;
|
IEnumerable<INamedFileUsage> IBeatmapSetInfo.Files => Files;
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ namespace osu.Game.Beatmaps
|
|||||||
requestedUserId = api.LocalUser.Value.Id;
|
requestedUserId = api.LocalUser.Value.Id;
|
||||||
|
|
||||||
// only query API for built-in rulesets
|
// only query API for built-in rulesets
|
||||||
rulesets.AvailableRulesets.Where(ruleset => ruleset.ID <= ILegacyRuleset.MAX_LEGACY_RULESET_ID).ForEach(rulesetInfo =>
|
rulesets.AvailableRulesets.Where(ruleset => ruleset.OnlineID >= 0 && ruleset.OnlineID <= ILegacyRuleset.MAX_LEGACY_RULESET_ID).ForEach(rulesetInfo =>
|
||||||
{
|
{
|
||||||
var req = new GetUserRequest(api.LocalUser.Value.Id, rulesetInfo);
|
var req = new GetUserRequest(api.LocalUser.Value.Id, rulesetInfo);
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
Spacing = new Vector2(1, 0);
|
Spacing = new Vector2(1, 0);
|
||||||
Direction = FillDirection.Horizontal;
|
Direction = FillDirection.Horizontal;
|
||||||
|
|
||||||
var icon = rulesets.GetRuleset(rulesetId)?.CreateInstance()?.CreateIcon() ?? new SpriteIcon { Icon = FontAwesome.Regular.QuestionCircle };
|
var icon = rulesets.GetRuleset(rulesetId)?.CreateInstance().CreateIcon() ?? new SpriteIcon { Icon = FontAwesome.Regular.QuestionCircle };
|
||||||
Add(icon.With(i =>
|
Add(icon.With(i =>
|
||||||
{
|
{
|
||||||
i.Size = new Vector2(14);
|
i.Size = new Vector2(14);
|
||||||
|
@ -201,7 +201,11 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
switch (pair.Key)
|
switch (pair.Key)
|
||||||
{
|
{
|
||||||
case @"Bookmarks":
|
case @"Bookmarks":
|
||||||
beatmap.BeatmapInfo.StoredBookmarks = pair.Value;
|
beatmap.BeatmapInfo.Bookmarks = pair.Value.Split(',').Select(v =>
|
||||||
|
{
|
||||||
|
bool result = int.TryParse(v, out int val);
|
||||||
|
return new { result, val };
|
||||||
|
}).Where(p => p.result).Select(p => p.val).ToArray();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case @"DistanceSpacing":
|
case @"DistanceSpacing":
|
||||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The best-effort metadata representing this set. In the case metadata differs between contained beatmaps, one is arbitrarily chosen.
|
/// The best-effort metadata representing this set. In the case metadata differs between contained beatmaps, one is arbitrarily chosen.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IBeatmapMetadataInfo? Metadata { get; }
|
IBeatmapMetadataInfo Metadata { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All beatmaps contained in this set.
|
/// All beatmaps contained in this set.
|
||||||
|
@ -55,8 +55,6 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public void Invalidate(BeatmapSetInfo info)
|
public void Invalidate(BeatmapSetInfo info)
|
||||||
{
|
{
|
||||||
if (info.Beatmaps == null) return;
|
|
||||||
|
|
||||||
foreach (var b in info.Beatmaps)
|
foreach (var b in info.Beatmaps)
|
||||||
Invalidate(b);
|
Invalidate(b);
|
||||||
}
|
}
|
||||||
@ -65,7 +63,7 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
lock (workingCache)
|
lock (workingCache)
|
||||||
{
|
{
|
||||||
var working = workingCache.FirstOrDefault(w => w.BeatmapInfo?.ID == info.ID);
|
var working = workingCache.FirstOrDefault(w => info.Equals(w.BeatmapInfo));
|
||||||
|
|
||||||
if (working != null)
|
if (working != null)
|
||||||
{
|
{
|
||||||
@ -89,7 +87,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
lock (workingCache)
|
lock (workingCache)
|
||||||
{
|
{
|
||||||
var working = workingCache.FirstOrDefault(w => w.BeatmapInfo?.ID == beatmapInfo.ID);
|
var working = workingCache.FirstOrDefault(w => beatmapInfo.Equals(w.BeatmapInfo));
|
||||||
|
|
||||||
if (working != null)
|
if (working != null)
|
||||||
return working;
|
return working;
|
||||||
|
@ -41,8 +41,9 @@ namespace osu.Game.Database
|
|||||||
/// 8 2021-10-29 Rebind scroll adjust keys to not have control modifier.
|
/// 8 2021-10-29 Rebind scroll adjust keys to not have control modifier.
|
||||||
/// 9 2021-11-04 Converted BeatmapMetadata.Author from string to RealmUser.
|
/// 9 2021-11-04 Converted BeatmapMetadata.Author from string to RealmUser.
|
||||||
/// 10 2021-11-22 Use ShortName instead of RulesetID for ruleset settings.
|
/// 10 2021-11-22 Use ShortName instead of RulesetID for ruleset settings.
|
||||||
|
/// 11 2021-11-22 Use ShortName instead of RulesetID for ruleset key bindings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const int schema_version = 10;
|
private const int schema_version = 11;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking context creation during blocking periods.
|
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking context creation during blocking periods.
|
||||||
@ -94,7 +95,12 @@ namespace osu.Game.Database
|
|||||||
if (!Filename.EndsWith(realm_extension, StringComparison.Ordinal))
|
if (!Filename.EndsWith(realm_extension, StringComparison.Ordinal))
|
||||||
Filename += realm_extension;
|
Filename += realm_extension;
|
||||||
|
|
||||||
|
// This method triggers the first `CreateContext` call, which will implicitly run realm migrations and bring the schema up-to-date.
|
||||||
cleanupPendingDeletions();
|
cleanupPendingDeletions();
|
||||||
|
|
||||||
|
// Data migration is handled separately from schema migrations.
|
||||||
|
// This is required as the user may be initialising realm for the first time ever, which would result in no schema migrations running.
|
||||||
|
migrateDataFromEF();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cleanupPendingDeletions()
|
private void cleanupPendingDeletions()
|
||||||
@ -162,6 +168,53 @@ namespace osu.Game.Database
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void migrateDataFromEF()
|
||||||
|
{
|
||||||
|
if (efContextFactory == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
using (var db = efContextFactory.GetForWrite())
|
||||||
|
{
|
||||||
|
// migrate ruleset settings. can be removed 20220315.
|
||||||
|
var existingSettings = db.Context.DatabasedSetting;
|
||||||
|
|
||||||
|
// previous entries in EF are removed post migration.
|
||||||
|
if (!existingSettings.Any())
|
||||||
|
return;
|
||||||
|
|
||||||
|
using (var realm = CreateContext())
|
||||||
|
using (var transaction = realm.BeginWrite())
|
||||||
|
{
|
||||||
|
// only migrate data if the realm database is empty.
|
||||||
|
if (!realm.All<RealmRulesetSetting>().Any())
|
||||||
|
{
|
||||||
|
foreach (var dkb in existingSettings)
|
||||||
|
{
|
||||||
|
if (dkb.RulesetID == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
string? shortName = getRulesetShortNameFromLegacyID(dkb.RulesetID.Value);
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(shortName))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
realm.Add(new RealmRulesetSetting
|
||||||
|
{
|
||||||
|
Key = dkb.Key,
|
||||||
|
Value = dkb.StringValue,
|
||||||
|
RulesetName = shortName,
|
||||||
|
Variant = dkb.Variant ?? 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
db.Context.RemoveRange(existingSettings);
|
||||||
|
|
||||||
|
transaction.Commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void onMigration(Migration migration, ulong lastSchemaVersion)
|
private void onMigration(Migration migration, ulong lastSchemaVersion)
|
||||||
{
|
{
|
||||||
for (ulong i = lastSchemaVersion + 1; i <= schema_version; i++)
|
for (ulong i = lastSchemaVersion + 1; i <= schema_version; i++)
|
||||||
@ -265,6 +318,31 @@ namespace osu.Game.Database
|
|||||||
newItem.RulesetName = rulesetName;
|
newItem.RulesetName = rulesetName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 11:
|
||||||
|
string keyBindingClassName = getMappedOrOriginalName(typeof(RealmKeyBinding));
|
||||||
|
|
||||||
|
var oldKeyBindings = migration.OldRealm.DynamicApi.All(keyBindingClassName);
|
||||||
|
var newKeyBindings = migration.NewRealm.All<RealmKeyBinding>().ToList();
|
||||||
|
|
||||||
|
for (int i = 0; i < newKeyBindings.Count; i++)
|
||||||
|
{
|
||||||
|
dynamic? oldItem = oldKeyBindings.ElementAt(i);
|
||||||
|
var newItem = newKeyBindings.ElementAt(i);
|
||||||
|
|
||||||
|
if (oldItem.RulesetID == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
long rulesetId = oldItem.RulesetID;
|
||||||
|
string? rulesetName = getRulesetShortNameFromLegacyID(rulesetId);
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(rulesetName))
|
||||||
|
migration.NewRealm.Remove(newItem);
|
||||||
|
else
|
||||||
|
newItem.RulesetName = rulesetName;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Extensions
|
|||||||
switch (model)
|
switch (model)
|
||||||
{
|
{
|
||||||
case IBeatmapSetInfo beatmapSetInfo:
|
case IBeatmapSetInfo beatmapSetInfo:
|
||||||
result = beatmapSetInfo.Metadata?.GetDisplayTitle();
|
result = beatmapSetInfo.Metadata.GetDisplayTitle();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IBeatmapInfo beatmapInfo:
|
case IBeatmapInfo beatmapInfo:
|
||||||
|
@ -50,23 +50,20 @@ namespace osu.Game.Input.Bindings
|
|||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
if (ruleset == null || ruleset.ID.HasValue)
|
string rulesetName = ruleset?.ShortName;
|
||||||
{
|
|
||||||
int? rulesetId = ruleset?.ID;
|
|
||||||
|
|
||||||
realmKeyBindings = realmFactory.Context.All<RealmKeyBinding>()
|
realmKeyBindings = realmFactory.Context.All<RealmKeyBinding>()
|
||||||
.Where(b => b.RulesetID == rulesetId && b.Variant == variant);
|
.Where(b => b.RulesetName == rulesetName && b.Variant == variant);
|
||||||
|
|
||||||
realmSubscription = realmKeyBindings
|
realmSubscription = realmKeyBindings
|
||||||
.SubscribeForNotifications((sender, changes, error) =>
|
.SubscribeForNotifications((sender, changes, error) =>
|
||||||
{
|
{
|
||||||
// first subscription ignored as we are handling this in LoadComplete.
|
// first subscription ignored as we are handling this in LoadComplete.
|
||||||
if (changes == null)
|
if (changes == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ReloadMappings();
|
ReloadMappings();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ using osu.Framework.Input.Bindings;
|
|||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using Realms;
|
using Realms;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
namespace osu.Game.Input.Bindings
|
namespace osu.Game.Input.Bindings
|
||||||
{
|
{
|
||||||
[MapTo(nameof(KeyBinding))]
|
[MapTo(nameof(KeyBinding))]
|
||||||
@ -14,7 +16,7 @@ namespace osu.Game.Input.Bindings
|
|||||||
[PrimaryKey]
|
[PrimaryKey]
|
||||||
public Guid ID { get; set; } = Guid.NewGuid();
|
public Guid ID { get; set; } = Guid.NewGuid();
|
||||||
|
|
||||||
public int? RulesetID { get; set; }
|
public string? RulesetName { get; set; }
|
||||||
|
|
||||||
public int? Variant { get; set; }
|
public int? Variant { get; set; }
|
||||||
|
|
||||||
@ -34,6 +36,6 @@ namespace osu.Game.Input.Bindings
|
|||||||
public int ActionInt { get; set; }
|
public int ActionInt { get; set; }
|
||||||
|
|
||||||
[MapTo(nameof(KeyCombination))]
|
[MapTo(nameof(KeyCombination))]
|
||||||
public string KeyCombinationString { get; set; }
|
public string KeyCombinationString { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Input
|
|||||||
|
|
||||||
using (var context = realmFactory.CreateContext())
|
using (var context = realmFactory.CreateContext())
|
||||||
{
|
{
|
||||||
foreach (var action in context.All<RealmKeyBinding>().Where(b => b.RulesetID == null && (GlobalAction)b.ActionInt == globalAction))
|
foreach (var action in context.All<RealmKeyBinding>().Where(b => string.IsNullOrEmpty(b.RulesetName) && (GlobalAction)b.ActionInt == globalAction))
|
||||||
{
|
{
|
||||||
string str = keyCombinationProvider.GetReadableString(action.KeyCombination);
|
string str = keyCombinationProvider.GetReadableString(action.KeyCombination);
|
||||||
|
|
||||||
@ -69,20 +69,20 @@ namespace osu.Game.Input
|
|||||||
{
|
{
|
||||||
var instance = ruleset.CreateInstance();
|
var instance = ruleset.CreateInstance();
|
||||||
foreach (int variant in instance.AvailableVariants)
|
foreach (int variant in instance.AvailableVariants)
|
||||||
insertDefaults(realm, existingBindings, instance.GetDefaultKeyBindings(variant), ruleset.ID, variant);
|
insertDefaults(realm, existingBindings, instance.GetDefaultKeyBindings(variant), ruleset.ShortName, variant);
|
||||||
}
|
}
|
||||||
|
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void insertDefaults(Realm realm, List<RealmKeyBinding> existingBindings, IEnumerable<IKeyBinding> defaults, int? rulesetId = null, int? variant = null)
|
private void insertDefaults(Realm realm, List<RealmKeyBinding> existingBindings, IEnumerable<IKeyBinding> defaults, string? rulesetName = null, int? variant = null)
|
||||||
{
|
{
|
||||||
// compare counts in database vs defaults for each action type.
|
// compare counts in database vs defaults for each action type.
|
||||||
foreach (var defaultsForAction in defaults.GroupBy(k => k.Action))
|
foreach (var defaultsForAction in defaults.GroupBy(k => k.Action))
|
||||||
{
|
{
|
||||||
// avoid performing redundant queries when the database is empty and needs to be re-filled.
|
// avoid performing redundant queries when the database is empty and needs to be re-filled.
|
||||||
int existingCount = existingBindings.Count(k => k.RulesetID == rulesetId && k.Variant == variant && k.ActionInt == (int)defaultsForAction.Key);
|
int existingCount = existingBindings.Count(k => k.RulesetName == rulesetName && k.Variant == variant && k.ActionInt == (int)defaultsForAction.Key);
|
||||||
|
|
||||||
if (defaultsForAction.Count() <= existingCount)
|
if (defaultsForAction.Count() <= existingCount)
|
||||||
continue;
|
continue;
|
||||||
@ -92,7 +92,7 @@ namespace osu.Game.Input
|
|||||||
{
|
{
|
||||||
KeyCombinationString = k.KeyCombination.ToString(),
|
KeyCombinationString = k.KeyCombination.ToString(),
|
||||||
ActionInt = (int)k.Action,
|
ActionInt = (int)k.Action,
|
||||||
RulesetID = rulesetId,
|
RulesetName = rulesetName,
|
||||||
Variant = variant
|
Variant = variant
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Models
|
|||||||
|
|
||||||
public DateTimeOffset DateAdded { get; set; }
|
public DateTimeOffset DateAdded { get; set; }
|
||||||
|
|
||||||
public IBeatmapMetadataInfo? Metadata => Beatmaps.FirstOrDefault()?.Metadata;
|
public IBeatmapMetadataInfo Metadata => Beatmaps.FirstOrDefault()?.Metadata ?? new RealmBeatmapMetadata();
|
||||||
|
|
||||||
public IList<RealmBeatmap> Beatmaps { get; } = null!;
|
public IList<RealmBeatmap> Beatmaps { get; } = null!;
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ namespace osu.Game.Models
|
|||||||
return ID == other.ID;
|
return ID == other.ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString() => Metadata?.GetDisplayString() ?? base.ToString();
|
public override string ToString() => Metadata.GetDisplayString();
|
||||||
|
|
||||||
public bool Equals(IBeatmapSetInfo? other) => other is RealmBeatmapSet b && Equals(b);
|
public bool Equals(IBeatmapSetInfo? other) => other is RealmBeatmapSet b && Equals(b);
|
||||||
|
|
||||||
|
@ -25,12 +25,12 @@ namespace osu.Game.Models
|
|||||||
|
|
||||||
public string InstantiationInfo { get; set; } = string.Empty;
|
public string InstantiationInfo { get; set; } = string.Empty;
|
||||||
|
|
||||||
public RealmRuleset(string shortName, string name, string instantiationInfo, int? onlineID = null)
|
public RealmRuleset(string shortName, string name, string instantiationInfo, int onlineID)
|
||||||
{
|
{
|
||||||
ShortName = shortName;
|
ShortName = shortName;
|
||||||
Name = name;
|
Name = name;
|
||||||
InstantiationInfo = instantiationInfo;
|
InstantiationInfo = instantiationInfo;
|
||||||
OnlineID = onlineID ?? -1;
|
OnlineID = onlineID;
|
||||||
}
|
}
|
||||||
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
@ -60,5 +60,27 @@ namespace osu.Game.Models
|
|||||||
InstantiationInfo = InstantiationInfo,
|
InstantiationInfo = InstantiationInfo,
|
||||||
Available = Available
|
Available = Available
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public Ruleset CreateInstance()
|
||||||
|
{
|
||||||
|
if (!Available)
|
||||||
|
throw new RulesetLoadException(@"Ruleset not available");
|
||||||
|
|
||||||
|
var type = Type.GetType(InstantiationInfo);
|
||||||
|
|
||||||
|
if (type == null)
|
||||||
|
throw new RulesetLoadException(@"Type lookup failure");
|
||||||
|
|
||||||
|
var ruleset = Activator.CreateInstance(type) as Ruleset;
|
||||||
|
|
||||||
|
if (ruleset == null)
|
||||||
|
throw new RulesetLoadException(@"Instantiation failure");
|
||||||
|
|
||||||
|
// overwrite the pre-populated RulesetInfo with a potentially database attached copy.
|
||||||
|
// TODO: figure if we still want/need this after switching to realm.
|
||||||
|
// ruleset.RulesetInfo = this;
|
||||||
|
|
||||||
|
return ruleset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
|
|
||||||
public string MD5Hash => Checksum;
|
public string MD5Hash => Checksum;
|
||||||
|
|
||||||
public IRulesetInfo Ruleset => new RulesetInfo { ID = RulesetID };
|
public IRulesetInfo Ruleset => new RulesetInfo { OnlineID = RulesetID };
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string Hash => throw new NotImplementedException();
|
public string Hash => throw new NotImplementedException();
|
||||||
|
@ -146,7 +146,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
return scoreInfo;
|
return scoreInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRulesetInfo Ruleset => new RulesetInfo { ID = RulesetID };
|
public IRulesetInfo Ruleset => new RulesetInfo { OnlineID = RulesetID };
|
||||||
|
|
||||||
IBeatmapInfo IScoreInfo.Beatmap => Beatmap;
|
IBeatmapInfo IScoreInfo.Beatmap => Beatmap;
|
||||||
}
|
}
|
||||||
|
@ -86,8 +86,8 @@ namespace osu.Game.Online.API.Requests
|
|||||||
if (General != null && General.Any())
|
if (General != null && General.Any())
|
||||||
req.AddParameter("c", string.Join('.', General.Select(e => e.ToString().Underscore())));
|
req.AddParameter("c", string.Join('.', General.Select(e => e.ToString().Underscore())));
|
||||||
|
|
||||||
if (ruleset.ID.HasValue)
|
if (ruleset.OnlineID >= 0)
|
||||||
req.AddParameter("m", ruleset.ID.Value.ToString());
|
req.AddParameter("m", ruleset.OnlineID.ToString());
|
||||||
|
|
||||||
req.AddParameter("s", SearchCategory.ToString().ToLowerInvariant());
|
req.AddParameter("s", SearchCategory.ToString().ToLowerInvariant());
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ namespace osu.Game
|
|||||||
SkinManager.ItemRemoved += item => Schedule(() =>
|
SkinManager.ItemRemoved += item => Schedule(() =>
|
||||||
{
|
{
|
||||||
// check the removed skin is not the current user choice. if it is, switch back to default.
|
// check the removed skin is not the current user choice. if it is, switch back to default.
|
||||||
if (item.ID == SkinManager.CurrentSkinInfo.Value.ID)
|
if (item.Equals(SkinManager.CurrentSkinInfo.Value))
|
||||||
SkinManager.CurrentSkinInfo.Value = SkinInfo.Default;
|
SkinManager.CurrentSkinInfo.Value = SkinInfo.Default;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -262,8 +262,6 @@ namespace osu.Game
|
|||||||
dependencies.Cache(scorePerformanceManager);
|
dependencies.Cache(scorePerformanceManager);
|
||||||
AddInternal(scorePerformanceManager);
|
AddInternal(scorePerformanceManager);
|
||||||
|
|
||||||
migrateDataToRealm();
|
|
||||||
|
|
||||||
dependencies.Cache(rulesetConfigCache = new RulesetConfigCache(realmFactory, RulesetStore));
|
dependencies.Cache(rulesetConfigCache = new RulesetConfigCache(realmFactory, RulesetStore));
|
||||||
|
|
||||||
var powerStatus = CreateBatteryInfo();
|
var powerStatus = CreateBatteryInfo();
|
||||||
@ -439,35 +437,6 @@ namespace osu.Game
|
|||||||
|
|
||||||
private void migrateDataToRealm()
|
private void migrateDataToRealm()
|
||||||
{
|
{
|
||||||
using (var db = contextFactory.GetForWrite())
|
|
||||||
using (var realm = realmFactory.CreateContext())
|
|
||||||
using (var transaction = realm.BeginWrite())
|
|
||||||
{
|
|
||||||
// migrate ruleset settings. can be removed 20220315.
|
|
||||||
var existingSettings = db.Context.DatabasedSetting;
|
|
||||||
|
|
||||||
// only migrate data if the realm database is empty.
|
|
||||||
if (!realm.All<RealmRulesetSetting>().Any())
|
|
||||||
{
|
|
||||||
foreach (var dkb in existingSettings)
|
|
||||||
{
|
|
||||||
if (dkb.RulesetID == null) continue;
|
|
||||||
|
|
||||||
realm.Add(new RealmRulesetSetting
|
|
||||||
{
|
|
||||||
Key = dkb.Key,
|
|
||||||
Value = dkb.StringValue,
|
|
||||||
// important: this RulesetStore must be the EF one.
|
|
||||||
RulesetName = RulesetStore.GetRuleset(dkb.RulesetID.Value).ShortName,
|
|
||||||
Variant = dkb.Variant ?? 0,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
db.Context.RemoveRange(existingSettings);
|
|
||||||
|
|
||||||
transaction.Commit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onRulesetChanged(ValueChangedEvent<RulesetInfo> r)
|
private void onRulesetChanged(ValueChangedEvent<RulesetInfo> r)
|
||||||
|
@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Music
|
|||||||
|
|
||||||
filter.Search.OnCommit += (sender, newText) =>
|
filter.Search.OnCommit += (sender, newText) =>
|
||||||
{
|
{
|
||||||
BeatmapInfo toSelect = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault();
|
BeatmapInfo toSelect = list.FirstVisibleSet?.Beatmaps.FirstOrDefault();
|
||||||
|
|
||||||
if (toSelect != null)
|
if (toSelect != null)
|
||||||
{
|
{
|
||||||
@ -114,7 +114,7 @@ namespace osu.Game.Overlays.Music
|
|||||||
|
|
||||||
private void itemSelected(BeatmapSetInfo set)
|
private void itemSelected(BeatmapSetInfo set)
|
||||||
{
|
{
|
||||||
if (set.ID == (beatmap.Value?.BeatmapSetInfo?.ID ?? -1))
|
if (set.Equals((beatmap.Value?.BeatmapSetInfo)))
|
||||||
{
|
{
|
||||||
beatmap.Value?.Track.Seek(0);
|
beatmap.Value?.Track.Seek(0);
|
||||||
return;
|
return;
|
||||||
|
@ -111,7 +111,7 @@ namespace osu.Game.Overlays
|
|||||||
beatmapSets.Add(set);
|
beatmapSets.Add(set);
|
||||||
});
|
});
|
||||||
|
|
||||||
private void beatmapRemoved(BeatmapSetInfo set) => Schedule(() => beatmapSets.RemoveAll(s => s.ID == set.ID));
|
private void beatmapRemoved(BeatmapSetInfo set) => Schedule(() => beatmapSets.RemoveAll(s => s.Equals(set)));
|
||||||
|
|
||||||
private ScheduledDelegate seekDelegate;
|
private ScheduledDelegate seekDelegate;
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
queuedDirection = TrackChangeDirection.Prev;
|
queuedDirection = TrackChangeDirection.Prev;
|
||||||
|
|
||||||
var playable = BeatmapSets.TakeWhile(i => i.ID != current.BeatmapSetInfo.ID).LastOrDefault() ?? BeatmapSets.LastOrDefault();
|
var playable = BeatmapSets.TakeWhile(i => !i.Equals(current.BeatmapSetInfo)).LastOrDefault() ?? BeatmapSets.LastOrDefault();
|
||||||
|
|
||||||
if (playable != null)
|
if (playable != null)
|
||||||
{
|
{
|
||||||
@ -259,7 +259,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
queuedDirection = TrackChangeDirection.Next;
|
queuedDirection = TrackChangeDirection.Next;
|
||||||
|
|
||||||
var playable = BeatmapSets.SkipWhile(i => i.ID != current.BeatmapSetInfo.ID).ElementAtOrDefault(1) ?? BeatmapSets.FirstOrDefault();
|
var playable = BeatmapSets.SkipWhile(i => !i.Equals(current.BeatmapSetInfo)).ElementAtOrDefault(1) ?? BeatmapSets.FirstOrDefault();
|
||||||
|
|
||||||
if (playable != null)
|
if (playable != null)
|
||||||
{
|
{
|
||||||
@ -309,8 +309,8 @@ namespace osu.Game.Overlays
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// figure out the best direction based on order in playlist.
|
// figure out the best direction based on order in playlist.
|
||||||
int last = BeatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count();
|
int last = BeatmapSets.TakeWhile(b => !b.Equals(current.BeatmapSetInfo)).Count();
|
||||||
int next = newWorking == null ? -1 : BeatmapSets.TakeWhile(b => b.ID != newWorking.BeatmapSetInfo?.ID).Count();
|
int next = newWorking == null ? -1 : BeatmapSets.TakeWhile(b => !b.Equals(newWorking.BeatmapSetInfo)).Count();
|
||||||
|
|
||||||
direction = last > next ? TrackChangeDirection.Prev : TrackChangeDirection.Next;
|
direction = last > next ? TrackChangeDirection.Prev : TrackChangeDirection.Next;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
public void SetDefaultRuleset(RulesetInfo ruleset)
|
public void SetDefaultRuleset(RulesetInfo ruleset)
|
||||||
{
|
{
|
||||||
foreach (var tabItem in TabContainer)
|
foreach (var tabItem in TabContainer)
|
||||||
((ProfileRulesetTabItem)tabItem).IsDefault = ((ProfileRulesetTabItem)tabItem).Value.ID == ruleset.ID;
|
((ProfileRulesetTabItem)tabItem).IsDefault = ((ProfileRulesetTabItem)tabItem).Value.Equals(ruleset);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new ProfileRulesetTabItem(value);
|
protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new ProfileRulesetTabItem(value);
|
||||||
|
@ -524,7 +524,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
|
|
||||||
public void UpdateKeyCombination(KeyCombination newCombination)
|
public void UpdateKeyCombination(KeyCombination newCombination)
|
||||||
{
|
{
|
||||||
if (KeyBinding.RulesetID != null && !RealmKeyBindingStore.CheckValidForGameplay(newCombination))
|
if (KeyBinding.RulesetName != null && !RealmKeyBindingStore.CheckValidForGameplay(newCombination))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
KeyBinding.KeyCombination = newCombination;
|
KeyBinding.KeyCombination = newCombination;
|
||||||
|
@ -32,12 +32,12 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(RealmContextFactory realmFactory)
|
private void load(RealmContextFactory realmFactory)
|
||||||
{
|
{
|
||||||
int? rulesetId = Ruleset?.ID;
|
string rulesetName = Ruleset?.ShortName;
|
||||||
|
|
||||||
List<RealmKeyBinding> bindings;
|
List<RealmKeyBinding> bindings;
|
||||||
|
|
||||||
using (var realm = realmFactory.CreateContext())
|
using (var realm = realmFactory.CreateContext())
|
||||||
bindings = realm.All<RealmKeyBinding>().Where(b => b.RulesetID == rulesetId && b.Variant == variant).Detach();
|
bindings = realm.All<RealmKeyBinding>().Where(b => b.RulesetName == rulesetName && b.Variant == variant).Detach();
|
||||||
|
|
||||||
foreach (var defaultGroup in Defaults.GroupBy(d => d.Action))
|
foreach (var defaultGroup in Defaults.GroupBy(d => d.Action))
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
{
|
{
|
||||||
public class RulesetBindingsSection : SettingsSection
|
public class RulesetBindingsSection : SettingsSection
|
||||||
{
|
{
|
||||||
public override Drawable CreateIcon() => ruleset?.CreateInstance()?.CreateIcon() ?? new SpriteIcon
|
public override Drawable CreateIcon() => ruleset?.CreateInstance().CreateIcon() ?? new SpriteIcon
|
||||||
{
|
{
|
||||||
Icon = OsuIcon.Hot
|
Icon = OsuIcon.Hot
|
||||||
};
|
};
|
||||||
|
@ -132,7 +132,7 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
skinDropdown.Items = newDropdownItems;
|
skinDropdown.Items = newDropdownItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void itemRemoved(SkinInfo item) => Schedule(() => skinDropdown.Items = skinDropdown.Items.Where(i => i.ID != item.ID).ToArray());
|
private void itemRemoved(SkinInfo item) => Schedule(() => skinDropdown.Items = skinDropdown.Items.Where(i => !i.Equals(item)).ToArray());
|
||||||
|
|
||||||
private void sortUserSkins(List<SkinInfo> skinsList)
|
private void sortUserSkins(List<SkinInfo> skinsList)
|
||||||
{
|
{
|
||||||
|
@ -207,7 +207,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
{
|
{
|
||||||
if (Hotkey == null) return;
|
if (Hotkey == null) return;
|
||||||
|
|
||||||
var realmKeyBinding = realmFactory.Context.All<RealmKeyBinding>().FirstOrDefault(rkb => rkb.RulesetID == null && rkb.ActionInt == (int)Hotkey.Value);
|
var realmKeyBinding = realmFactory.Context.All<RealmKeyBinding>().FirstOrDefault(rkb => rkb.RulesetName == null && rkb.ActionInt == (int)Hotkey.Value);
|
||||||
|
|
||||||
if (realmKeyBinding != null)
|
if (realmKeyBinding != null)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
@ -28,20 +27,6 @@ namespace osu.Game.Rulesets
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
string InstantiationInfo { get; }
|
string InstantiationInfo { get; }
|
||||||
|
|
||||||
Ruleset? CreateInstance()
|
Ruleset CreateInstance();
|
||||||
{
|
|
||||||
var type = Type.GetType(InstantiationInfo);
|
|
||||||
|
|
||||||
if (type == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
var ruleset = Activator.CreateInstance(type) as Ruleset;
|
|
||||||
|
|
||||||
// overwrite the pre-populated RulesetInfo with a potentially database attached copy.
|
|
||||||
// TODO: figure if we still want/need this after switching to realm.
|
|
||||||
// ruleset.RulesetInfo = this;
|
|
||||||
|
|
||||||
return ruleset;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ namespace osu.Game.Rulesets
|
|||||||
{
|
{
|
||||||
Name = Description,
|
Name = Description,
|
||||||
ShortName = ShortName,
|
ShortName = ShortName,
|
||||||
ID = (this as ILegacyRuleset)?.LegacyID,
|
OnlineID = (this as ILegacyRuleset)?.LegacyID ?? -1,
|
||||||
InstantiationInfo = GetType().GetInvariantInstantiationInfo(),
|
InstantiationInfo = GetType().GetInvariantInstantiationInfo(),
|
||||||
Available = true,
|
Available = true,
|
||||||
};
|
};
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets
|
|||||||
private readonly RealmContextFactory realmFactory;
|
private readonly RealmContextFactory realmFactory;
|
||||||
private readonly RulesetStore rulesets;
|
private readonly RulesetStore rulesets;
|
||||||
|
|
||||||
private readonly Dictionary<int, IRulesetConfigManager> configCache = new Dictionary<int, IRulesetConfigManager>();
|
private readonly Dictionary<string, IRulesetConfigManager> configCache = new Dictionary<string, IRulesetConfigManager>();
|
||||||
|
|
||||||
public RulesetConfigCache(RealmContextFactory realmFactory, RulesetStore rulesets)
|
public RulesetConfigCache(RealmContextFactory realmFactory, RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
@ -36,10 +36,10 @@ namespace osu.Game.Rulesets
|
|||||||
// let's keep things simple for now and just retrieve all the required configs at startup..
|
// let's keep things simple for now and just retrieve all the required configs at startup..
|
||||||
foreach (var ruleset in rulesets.AvailableRulesets)
|
foreach (var ruleset in rulesets.AvailableRulesets)
|
||||||
{
|
{
|
||||||
if (ruleset.ID == null)
|
if (string.IsNullOrEmpty(ruleset.ShortName))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
configCache[ruleset.ID.Value] = ruleset.CreateInstance().CreateConfig(settingsStore);
|
configCache[ruleset.ShortName] = ruleset.CreateInstance().CreateConfig(settingsStore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,10 +51,7 @@ namespace osu.Game.Rulesets
|
|||||||
/// <exception cref="InvalidOperationException">If <paramref name="ruleset"/> doesn't have a valid <see cref="RulesetInfo.ID"/>.</exception>
|
/// <exception cref="InvalidOperationException">If <paramref name="ruleset"/> doesn't have a valid <see cref="RulesetInfo.ID"/>.</exception>
|
||||||
public IRulesetConfigManager GetConfigFor(Ruleset ruleset)
|
public IRulesetConfigManager GetConfigFor(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
if (ruleset.RulesetInfo.ID == null)
|
if (!configCache.TryGetValue(ruleset.RulesetInfo.ShortName, out var config))
|
||||||
return null;
|
|
||||||
|
|
||||||
if (!configCache.TryGetValue(ruleset.RulesetInfo.ID.Value, out var config))
|
|
||||||
// any ruleset request which wasn't initialised on startup should not be stored to realm.
|
// any ruleset request which wasn't initialised on startup should not be stored to realm.
|
||||||
// this should only be used by tests.
|
// this should only be used by tests.
|
||||||
return ruleset.CreateConfig(null);
|
return ruleset.CreateConfig(null);
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Framework.Extensions.ObjectExtensions;
|
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets
|
namespace osu.Game.Rulesets
|
||||||
@ -26,9 +26,18 @@ namespace osu.Game.Rulesets
|
|||||||
// TODO: this should probably be moved to RulesetStore.
|
// TODO: this should probably be moved to RulesetStore.
|
||||||
public Ruleset CreateInstance()
|
public Ruleset CreateInstance()
|
||||||
{
|
{
|
||||||
if (!Available) return null;
|
if (!Available)
|
||||||
|
throw new RulesetLoadException(@"Ruleset not available");
|
||||||
|
|
||||||
var ruleset = (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo).AsNonNull());
|
var type = Type.GetType(InstantiationInfo);
|
||||||
|
|
||||||
|
if (type == null)
|
||||||
|
throw new RulesetLoadException(@"Type lookup failure");
|
||||||
|
|
||||||
|
var ruleset = Activator.CreateInstance(type) as Ruleset;
|
||||||
|
|
||||||
|
if (ruleset == null)
|
||||||
|
throw new RulesetLoadException(@"Instantiation failure");
|
||||||
|
|
||||||
// overwrite the pre-populated RulesetInfo with a potentially database attached copy.
|
// overwrite the pre-populated RulesetInfo with a potentially database attached copy.
|
||||||
ruleset.RulesetInfo = this;
|
ruleset.RulesetInfo = this;
|
||||||
@ -57,7 +66,12 @@ namespace osu.Game.Rulesets
|
|||||||
|
|
||||||
#region Implementation of IHasOnlineID
|
#region Implementation of IHasOnlineID
|
||||||
|
|
||||||
public int OnlineID => ID ?? -1;
|
[NotMapped]
|
||||||
|
public int OnlineID
|
||||||
|
{
|
||||||
|
get => ID ?? -1;
|
||||||
|
set => ID = value >= 0 ? value : (int?)null;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
int countGeki = score.GetCountGeki() ?? 0;
|
int countGeki = score.GetCountGeki() ?? 0;
|
||||||
int countKatu = score.GetCountKatu() ?? 0;
|
int countKatu = score.GetCountKatu() ?? 0;
|
||||||
|
|
||||||
switch (score.Ruleset.ID)
|
switch (score.Ruleset.OnlineID)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
{
|
{
|
||||||
using (SerializationWriter sw = new SerializationWriter(stream))
|
using (SerializationWriter sw = new SerializationWriter(stream))
|
||||||
{
|
{
|
||||||
sw.Write((byte)(score.ScoreInfo.Ruleset.ID ?? 0));
|
sw.Write((byte)(score.ScoreInfo.Ruleset.OnlineID));
|
||||||
sw.Write(LATEST_VERSION);
|
sw.Write(LATEST_VERSION);
|
||||||
sw.Write(score.ScoreInfo.BeatmapInfo.MD5Hash);
|
sw.Write(score.ScoreInfo.BeatmapInfo.MD5Hash);
|
||||||
sw.Write(score.ScoreInfo.UserString);
|
sw.Write(score.ScoreInfo.UserString);
|
||||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
new DesignSection(),
|
new DesignSection(),
|
||||||
};
|
};
|
||||||
|
|
||||||
var rulesetSpecificSection = beatmap.BeatmapInfo.Ruleset?.CreateInstance()?.CreateEditorSetupSection();
|
var rulesetSpecificSection = beatmap.BeatmapInfo.Ruleset?.CreateInstance().CreateEditorSetupSection();
|
||||||
if (rulesetSpecificSection != null)
|
if (rulesetSpecificSection != null)
|
||||||
sectionsEnumerable.Add(rulesetSpecificSection);
|
sectionsEnumerable.Add(rulesetSpecificSection);
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ namespace osu.Game.Screens.Edit.Verify
|
|||||||
private void load(OverlayColourProvider colours)
|
private void load(OverlayColourProvider colours)
|
||||||
{
|
{
|
||||||
generalVerifier = new BeatmapVerifier();
|
generalVerifier = new BeatmapVerifier();
|
||||||
rulesetVerifier = beatmap.BeatmapInfo.Ruleset?.CreateInstance()?.CreateBeatmapVerifier();
|
rulesetVerifier = beatmap.BeatmapInfo.Ruleset?.CreateInstance().CreateBeatmapVerifier();
|
||||||
|
|
||||||
context = new BeatmapVerifierContext(beatmap, workingBeatmap.Value, verify.InterpretedDifficulty.Value);
|
context = new BeatmapVerifierContext(beatmap, workingBeatmap.Value, verify.InterpretedDifficulty.Value);
|
||||||
verify.InterpretedDifficulty.BindValueChanged(difficulty => context.InterpretedDifficulty = difficulty.NewValue);
|
verify.InterpretedDifficulty.BindValueChanged(difficulty => context.InterpretedDifficulty = difficulty.NewValue);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Online.Solo;
|
using osu.Game.Online.Solo;
|
||||||
@ -25,10 +26,13 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected override APIRequest<APIScoreToken> CreateTokenRequest()
|
protected override APIRequest<APIScoreToken> CreateTokenRequest()
|
||||||
{
|
{
|
||||||
if (!(Beatmap.Value.BeatmapInfo.OnlineID is int beatmapId))
|
int beatmapId = Beatmap.Value.BeatmapInfo.OnlineID ?? -1;
|
||||||
|
int rulesetId = Ruleset.Value.OnlineID;
|
||||||
|
|
||||||
|
if (beatmapId <= 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (!(Ruleset.Value.ID is int rulesetId) || Ruleset.Value.ID > ILegacyRuleset.MAX_LEGACY_RULESET_ID)
|
if (rulesetId < 0 || rulesetId > ILegacyRuleset.MAX_LEGACY_RULESET_ID)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return new CreateSoloScoreRequest(beatmapId, rulesetId, Game.VersionHash);
|
return new CreateSoloScoreRequest(beatmapId, rulesetId, Game.VersionHash);
|
||||||
@ -38,13 +42,11 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected override APIRequest<MultiplayerScore> CreateSubmissionRequest(Score score, long token)
|
protected override APIRequest<MultiplayerScore> CreateSubmissionRequest(Score score, long token)
|
||||||
{
|
{
|
||||||
var beatmap = score.ScoreInfo.BeatmapInfo;
|
IBeatmapInfo beatmap = score.ScoreInfo.BeatmapInfo;
|
||||||
|
|
||||||
Debug.Assert(beatmap.OnlineID != null);
|
Debug.Assert(beatmap.OnlineID > 0);
|
||||||
|
|
||||||
int beatmapId = beatmap.OnlineID.Value;
|
return new SubmitSoloScoreRequest(beatmap.OnlineID, token, score.ScoreInfo);
|
||||||
|
|
||||||
return new SubmitSoloScoreRequest(beatmapId, token, score.ScoreInfo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet) => Schedule(() =>
|
public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet) => Schedule(() =>
|
||||||
{
|
{
|
||||||
var existingSet = beatmapSets.FirstOrDefault(b => b.BeatmapSet.ID == beatmapSet.ID);
|
var existingSet = beatmapSets.FirstOrDefault(b => b.BeatmapSet.Equals(beatmapSet));
|
||||||
|
|
||||||
if (existingSet == null)
|
if (existingSet == null)
|
||||||
return;
|
return;
|
||||||
@ -198,7 +198,7 @@ namespace osu.Game.Screens.Select
|
|||||||
public void UpdateBeatmapSet(BeatmapSetInfo beatmapSet) => Schedule(() =>
|
public void UpdateBeatmapSet(BeatmapSetInfo beatmapSet) => Schedule(() =>
|
||||||
{
|
{
|
||||||
int? previouslySelectedID = null;
|
int? previouslySelectedID = null;
|
||||||
CarouselBeatmapSet existingSet = beatmapSets.FirstOrDefault(b => b.BeatmapSet.ID == beatmapSet.ID);
|
CarouselBeatmapSet existingSet = beatmapSets.FirstOrDefault(b => b.BeatmapSet.Equals(beatmapSet));
|
||||||
|
|
||||||
// If the selected beatmap is about to be removed, store its ID so it can be re-selected if required
|
// If the selected beatmap is about to be removed, store its ID so it can be re-selected if required
|
||||||
if (existingSet?.State?.Value == CarouselItemState.Selected)
|
if (existingSet?.State?.Value == CarouselItemState.Selected)
|
||||||
|
@ -146,7 +146,7 @@ namespace osu.Game.Screens.Spectate
|
|||||||
var user = userMap[userId];
|
var user = userMap[userId];
|
||||||
var spectatorState = playingUserStates[userId];
|
var spectatorState = playingUserStates[userId];
|
||||||
|
|
||||||
var resolvedRuleset = rulesets.AvailableRulesets.FirstOrDefault(r => r.ID == spectatorState.RulesetID)?.CreateInstance();
|
var resolvedRuleset = rulesets.AvailableRulesets.FirstOrDefault(r => r.OnlineID == spectatorState.RulesetID)?.CreateInstance();
|
||||||
if (resolvedRuleset == null)
|
if (resolvedRuleset == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -282,9 +282,6 @@ namespace osu.Game.Stores
|
|||||||
{
|
{
|
||||||
var rulesetInstance = ((IRulesetInfo)beatmap.Ruleset).CreateInstance();
|
var rulesetInstance = ((IRulesetInfo)beatmap.Ruleset).CreateInstance();
|
||||||
|
|
||||||
if (rulesetInstance == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
decoded.BeatmapInfo.Ruleset = rulesetInstance.RulesetInfo;
|
decoded.BeatmapInfo.Ruleset = rulesetInstance.RulesetInfo;
|
||||||
|
|
||||||
// TODO: this should be done in a better place once we actually need to dynamically update it.
|
// TODO: this should be done in a better place once we actually need to dynamically update it.
|
||||||
|
@ -117,8 +117,8 @@ namespace osu.Game.Stores
|
|||||||
// add all legacy rulesets first to ensure they have exclusive choice of primary key.
|
// add all legacy rulesets first to ensure they have exclusive choice of primary key.
|
||||||
foreach (var r in instances.Where(r => r is ILegacyRuleset))
|
foreach (var r in instances.Where(r => r is ILegacyRuleset))
|
||||||
{
|
{
|
||||||
if (realm.All<RealmRuleset>().FirstOrDefault(rr => rr.OnlineID == r.RulesetInfo.ID) == null)
|
if (realm.All<RealmRuleset>().FirstOrDefault(rr => rr.OnlineID == r.RulesetInfo.OnlineID) == null)
|
||||||
realm.Add(new RealmRuleset(r.RulesetInfo.ShortName, r.RulesetInfo.Name, r.RulesetInfo.InstantiationInfo, r.RulesetInfo.ID));
|
realm.Add(new RealmRuleset(r.RulesetInfo.ShortName, r.RulesetInfo.Name, r.RulesetInfo.InstantiationInfo, r.RulesetInfo.OnlineID));
|
||||||
}
|
}
|
||||||
|
|
||||||
// add any other rulesets which have assemblies present but are not yet in the database.
|
// add any other rulesets which have assemblies present but are not yet in the database.
|
||||||
@ -136,7 +136,7 @@ namespace osu.Game.Stores
|
|||||||
existingSameShortName.InstantiationInfo = r.RulesetInfo.InstantiationInfo;
|
existingSameShortName.InstantiationInfo = r.RulesetInfo.InstantiationInfo;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
realm.Add(new RealmRuleset(r.RulesetInfo.ShortName, r.RulesetInfo.Name, r.RulesetInfo.InstantiationInfo, r.RulesetInfo.ID));
|
realm.Add(new RealmRuleset(r.RulesetInfo.ShortName, r.RulesetInfo.Name, r.RulesetInfo.InstantiationInfo, r.RulesetInfo.OnlineID));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ using osu.Framework.Timing;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Screens.Ranking;
|
using osu.Game.Screens.Ranking;
|
||||||
@ -39,10 +38,7 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
private readonly BeatmapInfo beatmapInfo = new BeatmapInfo
|
private readonly BeatmapInfo beatmapInfo = new BeatmapInfo
|
||||||
{
|
{
|
||||||
BeatmapSet = new BeatmapSetInfo(),
|
BeatmapSet = new BeatmapSetInfo(),
|
||||||
Metadata = new BeatmapMetadata
|
Metadata = new BeatmapMetadata(),
|
||||||
{
|
|
||||||
Author = APIUser.SYSTEM_USER
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly TestResourceStore userSkinResourceStore = new TestResourceStore();
|
private readonly TestResourceStore userSkinResourceStore = new TestResourceStore();
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -33,12 +33,15 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
|
|
||||||
BeatmapInfo.Ruleset = ruleset;
|
BeatmapInfo.Ruleset = ruleset;
|
||||||
BeatmapInfo.RulesetID = ruleset.ID ?? 0;
|
BeatmapInfo.RulesetID = ruleset.ID ?? 0;
|
||||||
BeatmapInfo.BeatmapSet.Metadata = BeatmapInfo.Metadata;
|
|
||||||
BeatmapInfo.BeatmapSet.Beatmaps = new List<BeatmapInfo> { BeatmapInfo };
|
|
||||||
BeatmapInfo.BeatmapSet.OnlineID = Interlocked.Increment(ref onlineSetID);
|
|
||||||
BeatmapInfo.Length = 75000;
|
BeatmapInfo.Length = 75000;
|
||||||
BeatmapInfo.OnlineInfo = new APIBeatmap();
|
BeatmapInfo.OnlineInfo = new APIBeatmap();
|
||||||
BeatmapInfo.OnlineID = Interlocked.Increment(ref onlineBeatmapID);
|
BeatmapInfo.OnlineID = Interlocked.Increment(ref onlineBeatmapID);
|
||||||
|
|
||||||
|
Debug.Assert(BeatmapInfo.BeatmapSet != null);
|
||||||
|
|
||||||
|
BeatmapInfo.BeatmapSet.Metadata = BeatmapInfo.Metadata;
|
||||||
|
BeatmapInfo.BeatmapSet.Beatmaps.Add(BeatmapInfo);
|
||||||
|
BeatmapInfo.BeatmapSet.OnlineID = Interlocked.Increment(ref onlineSetID);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual Beatmap CreateBeatmap() => createTestBeatmap();
|
protected virtual Beatmap CreateBeatmap() => createTestBeatmap();
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -220,6 +221,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
var beatmap = CreateBeatmap(ruleset ?? Ruleset.Value).BeatmapInfo;
|
var beatmap = CreateBeatmap(ruleset ?? Ruleset.Value).BeatmapInfo;
|
||||||
|
|
||||||
|
Debug.Assert(beatmap.BeatmapSet != null);
|
||||||
|
|
||||||
return new APIBeatmapSet
|
return new APIBeatmapSet
|
||||||
{
|
{
|
||||||
OnlineID = ((IBeatmapSetInfo)beatmap.BeatmapSet).OnlineID,
|
OnlineID = ((IBeatmapSetInfo)beatmap.BeatmapSet).OnlineID,
|
||||||
@ -230,13 +233,17 @@ namespace osu.Game.Tests.Visual
|
|||||||
Card = "https://assets.ppy.sh/beatmaps/163112/covers/card.jpg",
|
Card = "https://assets.ppy.sh/beatmaps/163112/covers/card.jpg",
|
||||||
List = "https://assets.ppy.sh/beatmaps/163112/covers/list.jpg"
|
List = "https://assets.ppy.sh/beatmaps/163112/covers/list.jpg"
|
||||||
},
|
},
|
||||||
Title = beatmap.BeatmapSet.Metadata.Title,
|
Title = beatmap.Metadata.Title,
|
||||||
TitleUnicode = beatmap.BeatmapSet.Metadata.TitleUnicode,
|
TitleUnicode = beatmap.Metadata.TitleUnicode,
|
||||||
Artist = beatmap.BeatmapSet.Metadata.Artist,
|
Artist = beatmap.Metadata.Artist,
|
||||||
ArtistUnicode = beatmap.BeatmapSet.Metadata.ArtistUnicode,
|
ArtistUnicode = beatmap.Metadata.ArtistUnicode,
|
||||||
Author = beatmap.BeatmapSet.Metadata.Author,
|
Author = new APIUser
|
||||||
Source = beatmap.BeatmapSet.Metadata.Source,
|
{
|
||||||
Tags = beatmap.BeatmapSet.Metadata.Tags,
|
Username = beatmap.Metadata.Author.Username,
|
||||||
|
Id = beatmap.Metadata.Author.OnlineID
|
||||||
|
},
|
||||||
|
Source = beatmap.Metadata.Source,
|
||||||
|
Tags = beatmap.Metadata.Tags,
|
||||||
Beatmaps = new[]
|
Beatmaps = new[]
|
||||||
{
|
{
|
||||||
new APIBeatmap
|
new APIBeatmap
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Realm" Version="10.7.1" />
|
<PackageReference Include="Realm" Version="10.7.1" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2021.1119.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2021.1124.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.1112.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.1112.0" />
|
||||||
<PackageReference Include="Sentry" Version="3.11.1" />
|
<PackageReference Include="Sentry" Version="3.11.1" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.30.0" />
|
<PackageReference Include="SharpCompress" Version="0.30.0" />
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.1119.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.1124.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.1112.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.1112.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
||||||
@ -83,7 +83,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2021.1119.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2021.1124.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.30.0" />
|
<PackageReference Include="SharpCompress" Version="0.30.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
@ -311,6 +311,7 @@
|
|||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AABB/@EntryIndexedValue">AABB</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AABB/@EntryIndexedValue">AABB</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=API/@EntryIndexedValue">API</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=API/@EntryIndexedValue">API</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=BPM/@EntryIndexedValue">BPM</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=BPM/@EntryIndexedValue">BPM</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=EF/@EntryIndexedValue">EF</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FPS/@EntryIndexedValue">FPS</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FPS/@EntryIndexedValue">FPS</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GC/@EntryIndexedValue">GC</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GC/@EntryIndexedValue">GC</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GL/@EntryIndexedValue">GL</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GL/@EntryIndexedValue">GL</s:String>
|
||||||
|
Reference in New Issue
Block a user