mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 21:53:22 +08:00
Merge branch 'master' into realm-integration/reinit-on-corrupt
This commit is contained in:
commit
49fcff190a
@ -12,7 +12,7 @@
|
|||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="4.2.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="4.2.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="4.2.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="4.2.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -52,10 +52,10 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.115.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.115.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.111.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.118.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. -->
|
||||||
<PackageReference Include="Realm" Version="10.7.1" />
|
<PackageReference Include="Realm" Version="10.8.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
|
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
|
||||||
<PackageReference Include="nunit" Version="3.13.2" />
|
<PackageReference Include="nunit" Version="3.13.2" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="4.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="4.2.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Project">
|
<PropertyGroup Label="Project">
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="4.2.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Project">
|
<PropertyGroup Label="Project">
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||||
<PackageReference Include="Moq" Version="4.16.1" />
|
<PackageReference Include="Moq" Version="4.16.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="4.2.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Project">
|
<PropertyGroup Label="Project">
|
||||||
|
36
osu.Game.Rulesets.Taiko.Tests/TestSceneDrumRollJudgements.cs
Normal file
36
osu.Game.Rulesets.Taiko.Tests/TestSceneDrumRollJudgements.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Tests
|
||||||
|
{
|
||||||
|
public class TestSceneDrumRollJudgements : TestSceneTaikoPlayer
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestStrongDrumRollFullyJudgedOnKilled()
|
||||||
|
{
|
||||||
|
AddUntilStep("gameplay finished", () => Player.ScoreProcessor.HasCompleted.Value);
|
||||||
|
AddAssert("all judgements are misses", () => Player.Results.All(r => r.Type == r.Judgement.MinResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool Autoplay => false;
|
||||||
|
|
||||||
|
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new Beatmap<TaikoHitObject>
|
||||||
|
{
|
||||||
|
BeatmapInfo = { Ruleset = new TaikoRuleset().RulesetInfo },
|
||||||
|
HitObjects =
|
||||||
|
{
|
||||||
|
new DrumRoll
|
||||||
|
{
|
||||||
|
StartTime = 1000,
|
||||||
|
Duration = 1000,
|
||||||
|
IsStrong = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,7 @@
|
|||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="4.2.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Project">
|
<PropertyGroup Label="Project">
|
||||||
|
@ -197,6 +197,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
ApplyResult(r => r.Type = ParentHitObject.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult);
|
ApplyResult(r => r.Type = ParentHitObject.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnKilled()
|
||||||
|
{
|
||||||
|
base.OnKilled();
|
||||||
|
|
||||||
|
if (Time.Current > ParentHitObject.HitObject.GetEndTime() && !Judged)
|
||||||
|
ApplyResult(r => r.Type = r.Judgement.MinResult);
|
||||||
|
}
|
||||||
|
|
||||||
public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false;
|
public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using System;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Taiko.Skinning.Default;
|
using osu.Game.Rulesets.Taiko.Skinning.Default;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
@ -52,6 +53,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
ApplyResult(r => r.Type = r.Judgement.MaxResult);
|
ApplyResult(r => r.Type = r.Judgement.MaxResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnKilled()
|
||||||
|
{
|
||||||
|
base.OnKilled();
|
||||||
|
|
||||||
|
if (Time.Current > HitObject.GetEndTime() && !Judged)
|
||||||
|
ApplyResult(r => r.Type = r.Judgement.MinResult);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void UpdateHitStateTransforms(ArmedState state)
|
protected override void UpdateHitStateTransforms(ArmedState state)
|
||||||
{
|
{
|
||||||
switch (state)
|
switch (state)
|
||||||
@ -92,6 +101,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
ApplyResult(r => r.Type = ParentHitObject.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult);
|
ApplyResult(r => r.Type = ParentHitObject.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnKilled()
|
||||||
|
{
|
||||||
|
base.OnKilled();
|
||||||
|
|
||||||
|
if (Time.Current > ParentHitObject.HitObject.GetEndTime() && !Judged)
|
||||||
|
ApplyResult(r => r.Type = r.Judgement.MinResult);
|
||||||
|
}
|
||||||
|
|
||||||
public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false;
|
public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,6 +130,7 @@ namespace osu.Game.Tests.Resources
|
|||||||
StarRating = diff,
|
StarRating = diff,
|
||||||
Length = length,
|
Length = length,
|
||||||
BPM = bpm,
|
BPM = bpm,
|
||||||
|
Hash = Guid.NewGuid().ToString().ComputeMD5Hash(),
|
||||||
Ruleset = rulesetInfo,
|
Ruleset = rulesetInfo,
|
||||||
Metadata = metadata,
|
Metadata = metadata,
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
|
@ -0,0 +1,88 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
|
using osu.Game.Overlays.Settings.Sections.Input;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
using osu.Game.Screens.Select;
|
||||||
|
using osu.Game.Tests.Beatmaps.IO;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Navigation
|
||||||
|
{
|
||||||
|
public class TestSceneChangeAndUseGameplayBindings : OsuGameTestScene
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestGameplayKeyBindings()
|
||||||
|
{
|
||||||
|
AddAssert("databased key is default", () => firstOsuRulesetKeyBindings.KeyCombination.Keys.SequenceEqual(new[] { InputKey.Z }));
|
||||||
|
|
||||||
|
AddStep("open settings", () => { Game.Settings.Show(); });
|
||||||
|
|
||||||
|
// Until step requires as settings has a delayed load.
|
||||||
|
AddUntilStep("wait for button", () => configureBindingsButton?.Enabled.Value == true);
|
||||||
|
AddStep("scroll to section", () => Game.Settings.SectionsContainer.ScrollTo(configureBindingsButton));
|
||||||
|
AddStep("press button", () => configureBindingsButton.TriggerClick());
|
||||||
|
AddUntilStep("wait for panel", () => keyBindingPanel?.IsLoaded == true);
|
||||||
|
AddUntilStep("wait for osu subsection", () => osuBindingSubsection?.IsLoaded == true);
|
||||||
|
AddStep("scroll to section", () => keyBindingPanel.SectionsContainer.ScrollTo(osuBindingSubsection));
|
||||||
|
AddWaitStep("wait for scroll to end", 3);
|
||||||
|
AddStep("start rebinding first osu! key", () =>
|
||||||
|
{
|
||||||
|
var button = osuBindingSubsection.ChildrenOfType<KeyBindingRow>().First();
|
||||||
|
|
||||||
|
InputManager.MoveMouseTo(button);
|
||||||
|
InputManager.Click(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("Press 's'", () => InputManager.Key(Key.S));
|
||||||
|
|
||||||
|
AddUntilStep("wait for database updated", () => firstOsuRulesetKeyBindings.KeyCombination.Keys.SequenceEqual(new[] { InputKey.S }));
|
||||||
|
|
||||||
|
AddStep("close settings", () => Game.Settings.Hide());
|
||||||
|
|
||||||
|
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
|
||||||
|
PushAndConfirm(() => new PlaySongSelect());
|
||||||
|
|
||||||
|
AddStep("enter gameplay", () => InputManager.Key(Key.Enter));
|
||||||
|
|
||||||
|
AddUntilStep("wait for gameplay", () => player?.IsBreakTime.Value == false);
|
||||||
|
|
||||||
|
AddStep("press 'z'", () => InputManager.Key(Key.Z));
|
||||||
|
AddAssert("key counter didn't increase", () => keyCounter.CountPresses == 0);
|
||||||
|
|
||||||
|
AddStep("press 's'", () => InputManager.Key(Key.S));
|
||||||
|
AddAssert("key counter did increase", () => keyCounter.CountPresses == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private KeyBindingsSubsection osuBindingSubsection => keyBindingPanel
|
||||||
|
.ChildrenOfType<VariantBindingsSubsection>()
|
||||||
|
.FirstOrDefault(s => s.Ruleset.ShortName == "osu");
|
||||||
|
|
||||||
|
private OsuButton configureBindingsButton => Game.Settings
|
||||||
|
.ChildrenOfType<BindingSettings>().SingleOrDefault()?
|
||||||
|
.ChildrenOfType<OsuButton>()?
|
||||||
|
.First(b => b.Text.ToString() == "Configure");
|
||||||
|
|
||||||
|
private KeyBindingPanel keyBindingPanel => Game.Settings
|
||||||
|
.ChildrenOfType<KeyBindingPanel>().SingleOrDefault();
|
||||||
|
|
||||||
|
private RealmKeyBinding firstOsuRulesetKeyBindings => Game.Dependencies
|
||||||
|
.Get<RealmContextFactory>().Context
|
||||||
|
.All<RealmKeyBinding>()
|
||||||
|
.AsEnumerable()
|
||||||
|
.First(k => k.RulesetName == "osu" && k.ActionInt == 0);
|
||||||
|
|
||||||
|
private Player player => Game.ScreenStack.CurrentScreen as Player;
|
||||||
|
|
||||||
|
private KeyCounter keyCounter => player.ChildrenOfType<KeyCounter>().First();
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,15 @@
|
|||||||
// 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 System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
@ -24,10 +28,11 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Cached]
|
[Cached]
|
||||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
||||||
|
|
||||||
public TestSceneScoresContainer()
|
private TestScoresContainer scoresContainer;
|
||||||
{
|
|
||||||
TestScoresContainer scoresContainer;
|
|
||||||
|
|
||||||
|
[SetUpSteps]
|
||||||
|
public void SetUp() => Schedule(() =>
|
||||||
|
{
|
||||||
Child = new Container
|
Child = new Container
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
@ -41,16 +46,110 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Black,
|
Colour = Color4.Black,
|
||||||
},
|
},
|
||||||
scoresContainer = new TestScoresContainer(),
|
scoresContainer = new TestScoresContainer
|
||||||
|
{
|
||||||
|
Beatmap = { Value = CreateAPIBeatmap() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
});
|
||||||
|
|
||||||
var allScores = new APIScoresCollection
|
[Test]
|
||||||
|
public void TestNoUserBest()
|
||||||
|
{
|
||||||
|
AddStep("Scores with no user best", () =>
|
||||||
|
{
|
||||||
|
var allScores = createScores();
|
||||||
|
|
||||||
|
allScores.UserScore = null;
|
||||||
|
|
||||||
|
scoresContainer.Scores = allScores;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("wait for scores displayed", () => scoresContainer.ChildrenOfType<ScoreTableRowBackground>().Any());
|
||||||
|
AddAssert("no user best displayed", () => scoresContainer.ChildrenOfType<DrawableTopScore>().Count() == 1);
|
||||||
|
|
||||||
|
AddStep("Load null scores", () => scoresContainer.Scores = null);
|
||||||
|
|
||||||
|
AddUntilStep("wait for scores not displayed", () => !scoresContainer.ChildrenOfType<ScoreTableRowBackground>().Any());
|
||||||
|
AddAssert("no best score displayed", () => !scoresContainer.ChildrenOfType<DrawableTopScore>().Any());
|
||||||
|
|
||||||
|
AddStep("Load only one score", () =>
|
||||||
|
{
|
||||||
|
var allScores = createScores();
|
||||||
|
|
||||||
|
allScores.Scores.RemoveRange(1, allScores.Scores.Count - 1);
|
||||||
|
|
||||||
|
scoresContainer.Scores = allScores;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("wait for scores not displayed", () => scoresContainer.ChildrenOfType<ScoreTableRowBackground>().Count() == 1);
|
||||||
|
AddAssert("no best score displayed", () => scoresContainer.ChildrenOfType<DrawableTopScore>().Count() == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestUserBest()
|
||||||
|
{
|
||||||
|
AddStep("Load scores with personal best", () =>
|
||||||
|
{
|
||||||
|
var allScores = createScores();
|
||||||
|
allScores.UserScore = createUserBest();
|
||||||
|
scoresContainer.Scores = allScores;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("wait for scores displayed", () => scoresContainer.ChildrenOfType<ScoreTableRowBackground>().Any());
|
||||||
|
AddAssert("best score displayed", () => scoresContainer.ChildrenOfType<DrawableTopScore>().Count() == 2);
|
||||||
|
|
||||||
|
AddStep("Load scores with personal best (null position)", () =>
|
||||||
|
{
|
||||||
|
var allScores = createScores();
|
||||||
|
var userBest = createUserBest();
|
||||||
|
userBest.Position = null;
|
||||||
|
allScores.UserScore = userBest;
|
||||||
|
scoresContainer.Scores = allScores;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("wait for scores displayed", () => scoresContainer.ChildrenOfType<ScoreTableRowBackground>().Any());
|
||||||
|
AddAssert("best score displayed", () => scoresContainer.ChildrenOfType<DrawableTopScore>().Count() == 2);
|
||||||
|
|
||||||
|
AddStep("Load scores with personal best (first place)", () =>
|
||||||
|
{
|
||||||
|
var allScores = createScores();
|
||||||
|
allScores.UserScore = new APIScoreWithPosition
|
||||||
|
{
|
||||||
|
Score = allScores.Scores.First(),
|
||||||
|
Position = 1,
|
||||||
|
};
|
||||||
|
scoresContainer.Scores = allScores;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("wait for scores displayed", () => scoresContainer.ChildrenOfType<ScoreTableRowBackground>().Any());
|
||||||
|
AddAssert("best score displayed", () => scoresContainer.ChildrenOfType<DrawableTopScore>().Count() == 1);
|
||||||
|
|
||||||
|
AddStep("Scores with no user best", () =>
|
||||||
|
{
|
||||||
|
var allScores = createScores();
|
||||||
|
|
||||||
|
allScores.UserScore = null;
|
||||||
|
|
||||||
|
scoresContainer.Scores = allScores;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("best score not displayed", () => scoresContainer.ChildrenOfType<DrawableTopScore>().Count() == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int onlineID = 1;
|
||||||
|
|
||||||
|
private APIScoresCollection createScores()
|
||||||
|
{
|
||||||
|
var scores = new APIScoresCollection
|
||||||
{
|
{
|
||||||
Scores = new List<APIScore>
|
Scores = new List<APIScore>
|
||||||
{
|
{
|
||||||
new APIScore
|
new APIScore
|
||||||
{
|
{
|
||||||
|
Date = DateTimeOffset.Now,
|
||||||
|
OnlineID = onlineID++,
|
||||||
User = new APIUser
|
User = new APIUser
|
||||||
{
|
{
|
||||||
Id = 6602580,
|
Id = 6602580,
|
||||||
@ -76,6 +175,8 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
new APIScore
|
new APIScore
|
||||||
{
|
{
|
||||||
|
Date = DateTimeOffset.Now,
|
||||||
|
OnlineID = onlineID++,
|
||||||
User = new APIUser
|
User = new APIUser
|
||||||
{
|
{
|
||||||
Id = 4608074,
|
Id = 4608074,
|
||||||
@ -100,6 +201,8 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
new APIScore
|
new APIScore
|
||||||
{
|
{
|
||||||
|
Date = DateTimeOffset.Now,
|
||||||
|
OnlineID = onlineID++,
|
||||||
User = new APIUser
|
User = new APIUser
|
||||||
{
|
{
|
||||||
Id = 1014222,
|
Id = 1014222,
|
||||||
@ -123,6 +226,8 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
new APIScore
|
new APIScore
|
||||||
{
|
{
|
||||||
|
Date = DateTimeOffset.Now,
|
||||||
|
OnlineID = onlineID++,
|
||||||
User = new APIUser
|
User = new APIUser
|
||||||
{
|
{
|
||||||
Id = 1541390,
|
Id = 1541390,
|
||||||
@ -145,6 +250,8 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
new APIScore
|
new APIScore
|
||||||
{
|
{
|
||||||
|
Date = DateTimeOffset.Now,
|
||||||
|
OnlineID = onlineID++,
|
||||||
User = new APIUser
|
User = new APIUser
|
||||||
{
|
{
|
||||||
Id = 7151382,
|
Id = 7151382,
|
||||||
@ -164,85 +271,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var myBestScore = new APIScoreWithPosition
|
foreach (var s in scores.Scores)
|
||||||
{
|
|
||||||
Score = new APIScore
|
|
||||||
{
|
|
||||||
User = new APIUser
|
|
||||||
{
|
|
||||||
Id = 7151382,
|
|
||||||
Username = @"Mayuri Hana",
|
|
||||||
Country = new Country
|
|
||||||
{
|
|
||||||
FullName = @"Thailand",
|
|
||||||
FlagName = @"TH",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Rank = ScoreRank.D,
|
|
||||||
PP = 160,
|
|
||||||
MaxCombo = 1234,
|
|
||||||
TotalScore = 123456,
|
|
||||||
Accuracy = 0.6543,
|
|
||||||
},
|
|
||||||
Position = 1337,
|
|
||||||
};
|
|
||||||
|
|
||||||
var myBestScoreWithNullPosition = new APIScoreWithPosition
|
|
||||||
{
|
|
||||||
Score = new APIScore
|
|
||||||
{
|
|
||||||
User = new APIUser
|
|
||||||
{
|
|
||||||
Id = 7151382,
|
|
||||||
Username = @"Mayuri Hana",
|
|
||||||
Country = new Country
|
|
||||||
{
|
|
||||||
FullName = @"Thailand",
|
|
||||||
FlagName = @"TH",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Rank = ScoreRank.D,
|
|
||||||
PP = 160,
|
|
||||||
MaxCombo = 1234,
|
|
||||||
TotalScore = 123456,
|
|
||||||
Accuracy = 0.6543,
|
|
||||||
},
|
|
||||||
Position = null,
|
|
||||||
};
|
|
||||||
|
|
||||||
var oneScore = new APIScoresCollection
|
|
||||||
{
|
|
||||||
Scores = new List<APIScore>
|
|
||||||
{
|
|
||||||
new APIScore
|
|
||||||
{
|
|
||||||
User = new APIUser
|
|
||||||
{
|
|
||||||
Id = 6602580,
|
|
||||||
Username = @"waaiiru",
|
|
||||||
Country = new Country
|
|
||||||
{
|
|
||||||
FullName = @"Spain",
|
|
||||||
FlagName = @"ES",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Mods = new[]
|
|
||||||
{
|
|
||||||
new APIMod { Acronym = new OsuModDoubleTime().Acronym },
|
|
||||||
new APIMod { Acronym = new OsuModHidden().Acronym },
|
|
||||||
new APIMod { Acronym = new OsuModFlashlight().Acronym },
|
|
||||||
new APIMod { Acronym = new OsuModHardRock().Acronym },
|
|
||||||
},
|
|
||||||
Rank = ScoreRank.XH,
|
|
||||||
PP = 200,
|
|
||||||
MaxCombo = 1234,
|
|
||||||
TotalScore = 1234567890,
|
|
||||||
Accuracy = 1,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (var s in allScores.Scores)
|
|
||||||
{
|
{
|
||||||
s.Statistics = new Dictionary<string, int>
|
s.Statistics = new Dictionary<string, int>
|
||||||
{
|
{
|
||||||
@ -253,26 +282,34 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
AddStep("Load all scores", () =>
|
return scores;
|
||||||
{
|
|
||||||
allScores.UserScore = null;
|
|
||||||
scoresContainer.Scores = allScores;
|
|
||||||
});
|
|
||||||
AddStep("Load null scores", () => scoresContainer.Scores = null);
|
|
||||||
AddStep("Load only one score", () => scoresContainer.Scores = oneScore);
|
|
||||||
AddStep("Load scores with my best", () =>
|
|
||||||
{
|
|
||||||
allScores.UserScore = myBestScore;
|
|
||||||
scoresContainer.Scores = allScores;
|
|
||||||
});
|
|
||||||
|
|
||||||
AddStep("Load scores with null my best position", () =>
|
|
||||||
{
|
|
||||||
allScores.UserScore = myBestScoreWithNullPosition;
|
|
||||||
scoresContainer.Scores = allScores;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private APIScoreWithPosition createUserBest() => new APIScoreWithPosition
|
||||||
|
{
|
||||||
|
Score = new APIScore
|
||||||
|
{
|
||||||
|
Date = DateTimeOffset.Now,
|
||||||
|
OnlineID = onlineID++,
|
||||||
|
User = new APIUser
|
||||||
|
{
|
||||||
|
Id = 7151382,
|
||||||
|
Username = @"Mayuri Hana",
|
||||||
|
Country = new Country
|
||||||
|
{
|
||||||
|
FullName = @"Thailand",
|
||||||
|
FlagName = @"TH",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Rank = ScoreRank.D,
|
||||||
|
PP = 160,
|
||||||
|
MaxCombo = 1234,
|
||||||
|
TotalScore = 123456,
|
||||||
|
Accuracy = 0.6543,
|
||||||
|
},
|
||||||
|
Position = 1337,
|
||||||
|
};
|
||||||
|
|
||||||
private class TestScoresContainer : ScoresContainer
|
private class TestScoresContainer : ScoresContainer
|
||||||
{
|
{
|
||||||
public new APIScoresCollection Scores
|
public new APIScoresCollection Scores
|
||||||
|
@ -44,6 +44,10 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
requestComplete = false;
|
requestComplete = false;
|
||||||
totalCount = 0;
|
totalCount = 0;
|
||||||
bindHandler();
|
bindHandler();
|
||||||
|
|
||||||
|
// beatmap is required to be an actual beatmap so the scores can get their scores correctly calculated for standardised scoring.
|
||||||
|
// else the tests that rely on ordering will fall over.
|
||||||
|
Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value);
|
||||||
});
|
});
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -19,6 +19,7 @@ using osu.Game.Rulesets;
|
|||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Screens.OnlinePlay.Components;
|
using osu.Game.Screens.OnlinePlay.Components;
|
||||||
|
using osu.Game.Screens.OnlinePlay.Match.Components;
|
||||||
using osu.Game.Screens.OnlinePlay.Playlists;
|
using osu.Game.Screens.OnlinePlay.Playlists;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Tests.Beatmaps;
|
using osu.Game.Tests.Beatmaps;
|
||||||
@ -73,6 +74,8 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
|
|
||||||
AddUntilStep("Progress details are hidden", () => match.ChildrenOfType<RoomLocalUserInfo>().FirstOrDefault()?.Parent.Alpha == 0);
|
AddUntilStep("Progress details are hidden", () => match.ChildrenOfType<RoomLocalUserInfo>().FirstOrDefault()?.Parent.Alpha == 0);
|
||||||
|
|
||||||
|
AddUntilStep("Leaderboard shows two aggregate scores", () => match.ChildrenOfType<MatchLeaderboardScore>().Count(s => s.ScoreText.Text != "0") == 2);
|
||||||
|
|
||||||
AddStep("start match", () => match.ChildrenOfType<PlaylistsReadyButton>().First().TriggerClick());
|
AddStep("start match", () => match.ChildrenOfType<PlaylistsReadyButton>().First().TriggerClick());
|
||||||
AddUntilStep("player loader loaded", () => Stack.CurrentScreen is PlayerLoader);
|
AddUntilStep("player loader loaded", () => Stack.CurrentScreen is PlayerLoader);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||||
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />
|
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="4.2.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
<PackageReference Include="Moq" Version="4.16.1" />
|
<PackageReference Include="Moq" Version="4.16.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="4.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Project">
|
<PropertyGroup Label="Project">
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AutoMapper;
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
@ -37,7 +36,6 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public BeatmapMetadata Metadata { get; set; }
|
public BeatmapMetadata Metadata { get; set; }
|
||||||
|
|
||||||
[IgnoreMap]
|
|
||||||
[Backlink(nameof(ScoreInfo.BeatmapInfo))]
|
[Backlink(nameof(ScoreInfo.BeatmapInfo))]
|
||||||
public IQueryable<ScoreInfo> Scores { get; } = null!;
|
public IQueryable<ScoreInfo> Scores { get; } = null!;
|
||||||
|
|
||||||
@ -155,7 +153,6 @@ namespace osu.Game.Beatmaps
|
|||||||
#region Compatibility properties
|
#region Compatibility properties
|
||||||
|
|
||||||
[Ignored]
|
[Ignored]
|
||||||
[IgnoreMap]
|
|
||||||
public int RulesetID
|
public int RulesetID
|
||||||
{
|
{
|
||||||
get => Ruleset.OnlineID;
|
get => Ruleset.OnlineID;
|
||||||
@ -169,7 +166,6 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Ignored]
|
[Ignored]
|
||||||
[IgnoreMap]
|
|
||||||
public BeatmapDifficulty BaseDifficulty
|
public BeatmapDifficulty BaseDifficulty
|
||||||
{
|
{
|
||||||
get => Difficulty;
|
get => Difficulty;
|
||||||
|
@ -218,10 +218,17 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
private RealmConfiguration getConfiguration()
|
private RealmConfiguration getConfiguration()
|
||||||
{
|
{
|
||||||
|
// This is currently the only usage of temporary files at the osu! side.
|
||||||
|
// If we use the temporary folder in more situations in the future, this should be moved to a higher level (helper method or OsuGameBase).
|
||||||
|
string tempPathLocation = Path.Combine(Path.GetTempPath(), @"lazer");
|
||||||
|
if (!Directory.Exists(tempPathLocation))
|
||||||
|
Directory.CreateDirectory(tempPathLocation);
|
||||||
|
|
||||||
return new RealmConfiguration(storage.GetFullPath(Filename, true))
|
return new RealmConfiguration(storage.GetFullPath(Filename, true))
|
||||||
{
|
{
|
||||||
SchemaVersion = schema_version,
|
SchemaVersion = schema_version,
|
||||||
MigrationCallback = onMigration,
|
MigrationCallback = onMigration,
|
||||||
|
FallbackPipePath = tempPathLocation,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
|
using AutoMapper.Internal;
|
||||||
using osu.Framework.Development;
|
using osu.Framework.Development;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
@ -60,7 +62,14 @@ namespace osu.Game.Database
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
c.AddGlobalIgnore(nameof(RealmObjectBase.ObjectSchema));
|
c.Internal().ForAllMaps((typeMap, expression) =>
|
||||||
|
{
|
||||||
|
expression.ForAllMembers(m =>
|
||||||
|
{
|
||||||
|
if (m.DestinationMember.Has<IgnoredAttribute>() || m.DestinationMember.Has<BacklinkAttribute>() || m.DestinationMember.Has<IgnoreDataMemberAttribute>())
|
||||||
|
m.Ignore();
|
||||||
|
});
|
||||||
|
});
|
||||||
}).CreateMapper();
|
}).CreateMapper();
|
||||||
|
|
||||||
private static readonly IMapper mapper = new MapperConfiguration(c =>
|
private static readonly IMapper mapper = new MapperConfiguration(c =>
|
||||||
@ -80,24 +89,35 @@ namespace osu.Game.Database
|
|||||||
c.CreateMap<RealmUser, RealmUser>();
|
c.CreateMap<RealmUser, RealmUser>();
|
||||||
c.CreateMap<RealmFile, RealmFile>();
|
c.CreateMap<RealmFile, RealmFile>();
|
||||||
c.CreateMap<RealmNamedFileUsage, RealmNamedFileUsage>();
|
c.CreateMap<RealmNamedFileUsage, RealmNamedFileUsage>();
|
||||||
c.CreateMap<BeatmapInfo, BeatmapInfo>().MaxDepth(2).AfterMap((s, d) =>
|
c.CreateMap<BeatmapInfo, BeatmapInfo>()
|
||||||
{
|
.MaxDepth(2)
|
||||||
for (int i = 0; i < d.BeatmapSet?.Beatmaps.Count; i++)
|
.AfterMap((s, d) =>
|
||||||
{
|
{
|
||||||
if (d.BeatmapSet.Beatmaps[i].Equals(d))
|
for (int i = 0; i < d.BeatmapSet?.Beatmaps.Count; i++)
|
||||||
{
|
{
|
||||||
d.BeatmapSet.Beatmaps[i] = d;
|
if (d.BeatmapSet.Beatmaps[i].Equals(d))
|
||||||
break;
|
{
|
||||||
}
|
d.BeatmapSet.Beatmaps[i] = d;
|
||||||
}
|
break;
|
||||||
});
|
}
|
||||||
c.CreateMap<BeatmapSetInfo, BeatmapSetInfo>().MaxDepth(2).AfterMap((s, d) =>
|
}
|
||||||
{
|
});
|
||||||
foreach (var beatmap in d.Beatmaps)
|
c.CreateMap<BeatmapSetInfo, BeatmapSetInfo>()
|
||||||
beatmap.BeatmapSet = d;
|
.MaxDepth(2)
|
||||||
});
|
.AfterMap((s, d) =>
|
||||||
|
{
|
||||||
|
foreach (var beatmap in d.Beatmaps)
|
||||||
|
beatmap.BeatmapSet = d;
|
||||||
|
});
|
||||||
|
|
||||||
c.AddGlobalIgnore(nameof(RealmObjectBase.ObjectSchema));
|
c.Internal().ForAllMaps((typeMap, expression) =>
|
||||||
|
{
|
||||||
|
expression.ForAllMembers(m =>
|
||||||
|
{
|
||||||
|
if (m.DestinationMember.Has<IgnoredAttribute>() || m.DestinationMember.Has<BacklinkAttribute>() || m.DestinationMember.Has<IgnoreDataMemberAttribute>())
|
||||||
|
m.Ignore();
|
||||||
|
});
|
||||||
|
});
|
||||||
}).CreateMapper();
|
}).CreateMapper();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -53,7 +53,9 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
private Drawable avatar;
|
private Drawable avatar;
|
||||||
private Drawable scoreRank;
|
private Drawable scoreRank;
|
||||||
private OsuSpriteText nameLabel;
|
private OsuSpriteText nameLabel;
|
||||||
private GlowingSpriteText scoreLabel;
|
|
||||||
|
public GlowingSpriteText ScoreText { get; private set; }
|
||||||
|
|
||||||
private Container flagBadgeContainer;
|
private Container flagBadgeContainer;
|
||||||
private FillFlowContainer<ModIcon> modsContainer;
|
private FillFlowContainer<ModIcon> modsContainer;
|
||||||
|
|
||||||
@ -198,7 +200,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
Spacing = new Vector2(5f, 0f),
|
Spacing = new Vector2(5f, 0f),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
scoreLabel = new GlowingSpriteText
|
ScoreText = new GlowingSpriteText
|
||||||
{
|
{
|
||||||
TextColour = Color4.White,
|
TextColour = Color4.White,
|
||||||
GlowColour = Color4Extensions.FromHex(@"83ccfa"),
|
GlowColour = Color4Extensions.FromHex(@"83ccfa"),
|
||||||
@ -240,7 +242,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
|
|
||||||
public override void Show()
|
public override void Show()
|
||||||
{
|
{
|
||||||
foreach (var d in new[] { avatar, nameLabel, scoreLabel, scoreRank, flagBadgeContainer, modsContainer }.Concat(statisticsLabels))
|
foreach (var d in new[] { avatar, nameLabel, ScoreText, scoreRank, flagBadgeContainer, modsContainer }.Concat(statisticsLabels))
|
||||||
d.FadeOut();
|
d.FadeOut();
|
||||||
|
|
||||||
Alpha = 0;
|
Alpha = 0;
|
||||||
@ -262,7 +264,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
|
|
||||||
using (BeginDelayedSequence(250))
|
using (BeginDelayedSequence(250))
|
||||||
{
|
{
|
||||||
scoreLabel.FadeIn(200);
|
ScoreText.FadeIn(200);
|
||||||
scoreRank.FadeIn(200);
|
scoreRank.FadeIn(200);
|
||||||
|
|
||||||
using (BeginDelayedSequence(50))
|
using (BeginDelayedSequence(50))
|
||||||
|
@ -65,6 +65,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
scoreTable.ClearScores();
|
scoreTable.ClearScores();
|
||||||
scoreTable.Hide();
|
scoreTable.Hide();
|
||||||
|
|
||||||
|
loading.Hide();
|
||||||
|
loading.FinishTransforms();
|
||||||
|
|
||||||
if (value?.Scores.Any() != true)
|
if (value?.Scores.Any() != true)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -258,9 +261,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
{
|
{
|
||||||
Scores = null;
|
Scores = null;
|
||||||
notSupporterPlaceholder.Show();
|
notSupporterPlaceholder.Show();
|
||||||
|
|
||||||
loading.Hide();
|
|
||||||
loading.FinishTransforms();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,9 +272,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
getScoresRequest = new GetScoresRequest(Beatmap.Value, Beatmap.Value.Ruleset, scope.Value, modSelector.SelectedMods);
|
getScoresRequest = new GetScoresRequest(Beatmap.Value, Beatmap.Value.Ruleset, scope.Value, modSelector.SelectedMods);
|
||||||
getScoresRequest.Success += scores =>
|
getScoresRequest.Success += scores =>
|
||||||
{
|
{
|
||||||
loading.Hide();
|
|
||||||
loading.FinishTransforms();
|
|
||||||
|
|
||||||
Scores = scores;
|
Scores = scores;
|
||||||
|
|
||||||
if (!scores.Scores.Any())
|
if (!scores.Scores.Any())
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
{
|
{
|
||||||
protected IEnumerable<Framework.Input.Bindings.KeyBinding> Defaults;
|
protected IEnumerable<Framework.Input.Bindings.KeyBinding> Defaults;
|
||||||
|
|
||||||
protected RulesetInfo Ruleset;
|
public RulesetInfo Ruleset { get; protected set; }
|
||||||
|
|
||||||
private readonly int? variant;
|
private readonly int? variant;
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AutoMapper;
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
@ -85,7 +84,7 @@ namespace osu.Game.Scoring
|
|||||||
// Eventually we should either persist enough information to realm to not require the API lookups, or perform the API lookups locally.
|
// Eventually we should either persist enough information to realm to not require the API lookups, or perform the API lookups locally.
|
||||||
private APIUser? user;
|
private APIUser? user;
|
||||||
|
|
||||||
[IgnoreMap]
|
[Ignored]
|
||||||
public APIUser User
|
public APIUser User
|
||||||
{
|
{
|
||||||
get => user ??= new APIUser
|
get => user ??= new APIUser
|
||||||
@ -187,10 +186,7 @@ namespace osu.Game.Scoring
|
|||||||
if (mods != null)
|
if (mods != null)
|
||||||
return mods;
|
return mods;
|
||||||
|
|
||||||
if (apiMods != null)
|
return APIMods.Select(m => m.ToMod(Ruleset.CreateInstance())).ToArray();
|
||||||
return APIMods.Select(m => m.ToMod(Ruleset.CreateInstance())).ToArray();
|
|
||||||
|
|
||||||
return Array.Empty<Mod>();
|
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
@ -217,7 +213,7 @@ namespace osu.Game.Scoring
|
|||||||
|
|
||||||
// then check mods set via Mods property.
|
// then check mods set via Mods property.
|
||||||
if (mods != null)
|
if (mods != null)
|
||||||
apiMods = mods.Select(m => new APIMod(m)).ToArray();
|
apiMods ??= mods.Select(m => new APIMod(m)).ToArray();
|
||||||
|
|
||||||
return apiMods ?? Array.Empty<APIMod>();
|
return apiMods ?? Array.Empty<APIMod>();
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,29 @@ namespace osu.Game.Tests.Visual.OnlinePlay
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case GetRoomLeaderboardRequest roomLeaderboardRequest:
|
||||||
|
roomLeaderboardRequest.TriggerSuccess(new APILeaderboard
|
||||||
|
{
|
||||||
|
Leaderboard = new List<APIUserScoreAggregate>
|
||||||
|
{
|
||||||
|
new APIUserScoreAggregate
|
||||||
|
{
|
||||||
|
TotalScore = 1000000,
|
||||||
|
TotalAttempts = 5,
|
||||||
|
CompletedBeatmaps = 2,
|
||||||
|
User = new APIUser { Username = "best user" }
|
||||||
|
},
|
||||||
|
new APIUserScoreAggregate
|
||||||
|
{
|
||||||
|
TotalScore = 50,
|
||||||
|
TotalAttempts = 1,
|
||||||
|
CompletedBeatmaps = 1,
|
||||||
|
User = new APIUser { Username = "worst user" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
|
||||||
case PartRoomRequest partRoomRequest:
|
case PartRoomRequest partRoomRequest:
|
||||||
partRoomRequest.TriggerSuccess();
|
partRoomRequest.TriggerSuccess();
|
||||||
return true;
|
return true;
|
||||||
|
@ -294,10 +294,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
if (MusicController?.TrackLoaded == true)
|
if (MusicController?.TrackLoaded == true)
|
||||||
MusicController.Stop();
|
MusicController.Stop();
|
||||||
|
|
||||||
// TODO: what should we do here, if anything? should we use an in-memory realm in this instance?
|
|
||||||
// if (contextFactory?.IsValueCreated == true)
|
|
||||||
// contextFactory.Value.ResetDatabase();
|
|
||||||
|
|
||||||
RecycleLocalStorage(true);
|
RecycleLocalStorage(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ namespace osu.Game.Utils
|
|||||||
{
|
{
|
||||||
private SentryClient sentry;
|
private SentryClient sentry;
|
||||||
private Scope sentryScope;
|
private Scope sentryScope;
|
||||||
|
private Exception lastException;
|
||||||
|
|
||||||
public SentryLogger(OsuGame game)
|
public SentryLogger(OsuGame game)
|
||||||
{
|
{
|
||||||
@ -30,30 +31,27 @@ namespace osu.Game.Utils
|
|||||||
sentry = new SentryClient(options);
|
sentry = new SentryClient(options);
|
||||||
sentryScope = new Scope(options);
|
sentryScope = new Scope(options);
|
||||||
|
|
||||||
Exception lastException = null;
|
Logger.NewEntry += processLogEntry;
|
||||||
|
}
|
||||||
|
|
||||||
Logger.NewEntry += entry =>
|
private void processLogEntry(LogEntry entry)
|
||||||
|
{
|
||||||
|
if (entry.Level < LogLevel.Verbose) return;
|
||||||
|
|
||||||
|
var exception = entry.Exception;
|
||||||
|
|
||||||
|
if (exception != null)
|
||||||
{
|
{
|
||||||
if (entry.Level < LogLevel.Verbose) return;
|
if (!shouldSubmitException(exception)) return;
|
||||||
|
|
||||||
var exception = entry.Exception;
|
// since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports.
|
||||||
|
if (lastException != null && lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace, StringComparison.Ordinal)) return;
|
||||||
|
|
||||||
if (exception != null)
|
lastException = exception;
|
||||||
{
|
sentry.CaptureEvent(new SentryEvent(exception) { Message = entry.Message }, sentryScope);
|
||||||
if (!shouldSubmitException(exception))
|
}
|
||||||
return;
|
else
|
||||||
|
sentryScope.AddBreadcrumb(DateTimeOffset.Now, entry.Message, entry.Target.ToString(), "navigation");
|
||||||
// since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports.
|
|
||||||
if (lastException != null &&
|
|
||||||
lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace, StringComparison.Ordinal))
|
|
||||||
return;
|
|
||||||
|
|
||||||
lastException = exception;
|
|
||||||
sentry.CaptureEvent(new SentryEvent(exception) { Message = entry.Message }, sentryScope);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
sentryScope.AddBreadcrumb(DateTimeOffset.Now, entry.Message, entry.Target.ToString(), "navigation");
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool shouldSubmitException(Exception exception)
|
private bool shouldSubmitException(Exception exception)
|
||||||
@ -92,15 +90,9 @@ namespace osu.Game.Utils
|
|||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool isDisposed;
|
|
||||||
|
|
||||||
protected virtual void Dispose(bool isDisposing)
|
protected virtual void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
if (isDisposed)
|
Logger.NewEntry -= processLogEntry;
|
||||||
return;
|
|
||||||
|
|
||||||
isDisposed = true;
|
|
||||||
sentry?.Dispose();
|
|
||||||
sentry = null;
|
sentry = null;
|
||||||
sentryScope = null;
|
sentryScope = null;
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="AutoMapper" Version="10.1.1" />
|
<PackageReference Include="AutoMapper" Version="11.0.0" />
|
||||||
<PackageReference Include="DiffPlex" Version="1.7.0" />
|
<PackageReference Include="DiffPlex" Version="1.7.0" />
|
||||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.39" />
|
<PackageReference Include="HtmlAgilityPack" Version="1.11.40" />
|
||||||
<PackageReference Include="Humanizer" Version="2.13.14" />
|
<PackageReference Include="Humanizer" Version="2.13.14" />
|
||||||
<PackageReference Include="MessagePack" Version="2.3.85" />
|
<PackageReference Include="MessagePack" Version="2.3.85" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.11" />
|
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.11" />
|
||||||
@ -35,10 +35,10 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<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.8.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2022.111.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2022.118.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.115.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.115.0" />
|
||||||
<PackageReference Include="Sentry" Version="3.12.1" />
|
<PackageReference Include="Sentry" Version="3.13.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.30.1" />
|
<PackageReference Include="SharpCompress" Version="0.30.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.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="2022.111.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2022.118.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.115.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.115.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,11 +83,11 @@
|
|||||||
<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="2022.111.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2022.118.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="System.ComponentModel.Annotations" Version="5.0.0" />
|
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.NativeLibs" Version="2021.805.0" ExcludeAssets="all" />
|
<PackageReference Include="ppy.osu.Framework.NativeLibs" Version="2021.805.0" ExcludeAssets="all" />
|
||||||
<PackageReference Include="Realm" Version="10.7.1" />
|
<PackageReference Include="Realm" Version="10.8.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user