mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
Merge branch 'master' into fix-error-exit-during-results-transition
This commit is contained in:
@ -51,7 +51,7 @@
|
|||||||
<Reference Include="Java.Interop" />
|
<Reference Include="Java.Interop" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1202.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.211.1" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.128.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.215.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -20,7 +20,7 @@ namespace osu.Android
|
|||||||
[Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.FullUser, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = false, LaunchMode = LaunchMode.SingleInstance)]
|
[Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.FullUser, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = false, LaunchMode = LaunchMode.SingleInstance)]
|
||||||
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault }, DataScheme = "content", DataPathPattern = ".*\\\\.osz", DataHost = "*", DataMimeType = "*/*")]
|
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault }, DataScheme = "content", DataPathPattern = ".*\\\\.osz", DataHost = "*", DataMimeType = "*/*")]
|
||||||
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault }, DataScheme = "content", DataPathPattern = ".*\\\\.osk", DataHost = "*", DataMimeType = "*/*")]
|
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault }, DataScheme = "content", DataPathPattern = ".*\\\\.osk", DataHost = "*", DataMimeType = "*/*")]
|
||||||
[IntentFilter(new[] { Intent.ActionSend, Intent.ActionSendMultiple }, Categories = new[] { Intent.CategoryDefault }, DataMimeTypes = new[] { "application/zip", "application/octet-stream" })]
|
[IntentFilter(new[] { Intent.ActionSend, Intent.ActionSendMultiple }, Categories = new[] { Intent.CategoryDefault }, DataMimeTypes = new[] { "application/zip", "application/octet-stream", "application/download", "application/x-zip", "application/x-zip-compressed" })]
|
||||||
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryBrowsable, Intent.CategoryDefault }, DataSchemes = new[] { "osu", "osump" })]
|
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryBrowsable, Intent.CategoryDefault }, DataSchemes = new[] { "osu", "osump" })]
|
||||||
public class OsuGameActivity : AndroidGameActivity
|
public class OsuGameActivity : AndroidGameActivity
|
||||||
{
|
{
|
||||||
|
@ -18,6 +18,7 @@ using osu.Framework.Screens;
|
|||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using osu.Game.Updater;
|
using osu.Game.Updater;
|
||||||
using osu.Desktop.Windows;
|
using osu.Desktop.Windows;
|
||||||
|
using osu.Game.IO;
|
||||||
|
|
||||||
namespace osu.Desktop
|
namespace osu.Desktop
|
||||||
{
|
{
|
||||||
@ -32,7 +33,7 @@ namespace osu.Desktop
|
|||||||
noVersionOverlay = args?.Any(a => a == "--no-version-overlay") ?? false;
|
noVersionOverlay = args?.Any(a => a == "--no-version-overlay") ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Storage GetStorageForStableInstall()
|
public override StableStorage GetStorageForStableInstall()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -40,7 +41,7 @@ namespace osu.Desktop
|
|||||||
{
|
{
|
||||||
string stablePath = getStableInstallPath();
|
string stablePath = getStableInstallPath();
|
||||||
if (!string.IsNullOrEmpty(stablePath))
|
if (!string.IsNullOrEmpty(stablePath))
|
||||||
return new DesktopStorage(stablePath, desktopHost);
|
return new StableStorage(stablePath, desktopHost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
|
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
|
||||||
<PackageReference Include="nunit" Version="3.12.0" />
|
<PackageReference Include="nunit" Version="3.13.1" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.13.1" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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.Collections.Generic;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Catch.Objects;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
using osu.Game.Rulesets.Catch.Replays;
|
using osu.Game.Rulesets.Catch.Replays;
|
||||||
@ -12,7 +13,7 @@ namespace osu.Game.Rulesets.Catch.Mods
|
|||||||
{
|
{
|
||||||
public class CatchModAutoplay : ModAutoplay<CatchHitObject>
|
public class CatchModAutoplay : ModAutoplay<CatchHitObject>
|
||||||
{
|
{
|
||||||
public override Score CreateReplayScore(IBeatmap beatmap) => new Score
|
public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList<Mod> mods) => new Score
|
||||||
{
|
{
|
||||||
ScoreInfo = new ScoreInfo { User = new User { Username = "osu!salad!" } },
|
ScoreInfo = new ScoreInfo { User = new User { Username = "osu!salad!" } },
|
||||||
Replay = new CatchAutoGenerator(beatmap).Generate(),
|
Replay = new CatchAutoGenerator(beatmap).Generate(),
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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.Collections.Generic;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Catch.Objects;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
using osu.Game.Rulesets.Catch.Replays;
|
using osu.Game.Rulesets.Catch.Replays;
|
||||||
@ -12,7 +13,7 @@ namespace osu.Game.Rulesets.Catch.Mods
|
|||||||
{
|
{
|
||||||
public class CatchModCinema : ModCinema<CatchHitObject>
|
public class CatchModCinema : ModCinema<CatchHitObject>
|
||||||
{
|
{
|
||||||
public override Score CreateReplayScore(IBeatmap beatmap) => new Score
|
public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList<Mod> mods) => new Score
|
||||||
{
|
{
|
||||||
ScoreInfo = new ScoreInfo { User = new User { Username = "osu!salad!" } },
|
ScoreInfo = new ScoreInfo { User = new User { Username = "osu!salad!" } },
|
||||||
Replay = new CatchAutoGenerator(beatmap).Generate(),
|
Replay = new CatchAutoGenerator(beatmap).Generate(),
|
||||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Catch.Mods
|
|||||||
public class CatchModDifficultyAdjust : ModDifficultyAdjust
|
public class CatchModDifficultyAdjust : ModDifficultyAdjust
|
||||||
{
|
{
|
||||||
[SettingSource("Circle Size", "Override a beatmap's set CS.", FIRST_SETTING_ORDER - 1)]
|
[SettingSource("Circle Size", "Override a beatmap's set CS.", FIRST_SETTING_ORDER - 1)]
|
||||||
public BindableNumber<float> CircleSize { get; } = new BindableFloat
|
public BindableNumber<float> CircleSize { get; } = new BindableFloatWithLimitExtension
|
||||||
{
|
{
|
||||||
Precision = 0.1f,
|
Precision = 0.1f,
|
||||||
MinValue = 1,
|
MinValue = 1,
|
||||||
@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Catch.Mods
|
|||||||
};
|
};
|
||||||
|
|
||||||
[SettingSource("Approach Rate", "Override a beatmap's set AR.", LAST_SETTING_ORDER + 1)]
|
[SettingSource("Approach Rate", "Override a beatmap's set AR.", LAST_SETTING_ORDER + 1)]
|
||||||
public BindableNumber<float> ApproachRate { get; } = new BindableFloat
|
public BindableNumber<float> ApproachRate { get; } = new BindableFloatWithLimitExtension
|
||||||
{
|
{
|
||||||
Precision = 0.1f,
|
Precision = 0.1f,
|
||||||
MinValue = 1,
|
MinValue = 1,
|
||||||
@ -31,6 +31,14 @@ namespace osu.Game.Rulesets.Catch.Mods
|
|||||||
Value = 5,
|
Value = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected override void ApplyLimits(bool extended)
|
||||||
|
{
|
||||||
|
base.ApplyLimits(extended);
|
||||||
|
|
||||||
|
CircleSize.MaxValue = extended ? 11 : 10;
|
||||||
|
ApproachRate.MaxValue = extended ? 11 : 10;
|
||||||
|
}
|
||||||
|
|
||||||
public override string SettingDescription
|
public override string SettingDescription
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.13.1" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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.Collections.Generic;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
@ -13,7 +14,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
|||||||
{
|
{
|
||||||
public class ManiaModAutoplay : ModAutoplay<ManiaHitObject>
|
public class ManiaModAutoplay : ModAutoplay<ManiaHitObject>
|
||||||
{
|
{
|
||||||
public override Score CreateReplayScore(IBeatmap beatmap) => new Score
|
public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList<Mod> mods) => new Score
|
||||||
{
|
{
|
||||||
ScoreInfo = new ScoreInfo { User = new User { Username = "osu!topus!" } },
|
ScoreInfo = new ScoreInfo { User = new User { Username = "osu!topus!" } },
|
||||||
Replay = new ManiaAutoGenerator((ManiaBeatmap)beatmap).Generate(),
|
Replay = new ManiaAutoGenerator((ManiaBeatmap)beatmap).Generate(),
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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.Collections.Generic;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
@ -13,7 +14,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
|||||||
{
|
{
|
||||||
public class ManiaModCinema : ModCinema<ManiaHitObject>
|
public class ManiaModCinema : ModCinema<ManiaHitObject>
|
||||||
{
|
{
|
||||||
public override Score CreateReplayScore(IBeatmap beatmap) => new Score
|
public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList<Mod> mods) => new Score
|
||||||
{
|
{
|
||||||
ScoreInfo = new ScoreInfo { User = new User { Username = "osu!topus!" } },
|
ScoreInfo = new ScoreInfo { User = new User { Username = "osu!topus!" } },
|
||||||
Replay = new ManiaAutoGenerator((ManiaBeatmap)beatmap).Generate(),
|
Replay = new ManiaAutoGenerator((ManiaBeatmap)beatmap).Generate(),
|
||||||
|
@ -140,11 +140,11 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
|||||||
return animation == null ? null : new LegacyManiaJudgementPiece(result, animation);
|
return animation == null ? null : new LegacyManiaJudgementPiece(result, animation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SampleChannel GetSample(ISampleInfo sampleInfo)
|
public override Sample GetSample(ISampleInfo sampleInfo)
|
||||||
{
|
{
|
||||||
// layered hit sounds never play in mania
|
// layered hit sounds never play in mania
|
||||||
if (sampleInfo is ConvertHitObjectParser.LegacyHitSampleInfo legacySample && legacySample.IsLayered)
|
if (sampleInfo is ConvertHitObjectParser.LegacyHitSampleInfo legacySample && legacySample.IsLayered)
|
||||||
return new SampleChannelVirtual();
|
return new SampleVirtual();
|
||||||
|
|
||||||
return Source.GetSample(sampleInfo);
|
return Source.GetSample(sampleInfo);
|
||||||
}
|
}
|
||||||
|
65
osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAutoplay.cs
Normal file
65
osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAutoplay.cs
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
// 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.Testing;
|
||||||
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Skinning.Default;
|
||||||
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Tests.Mods
|
||||||
|
{
|
||||||
|
public class TestSceneOsuModAutoplay : OsuModTestScene
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestSpmUnaffectedByRateAdjust()
|
||||||
|
=> runSpmTest(new OsuModDaycore
|
||||||
|
{
|
||||||
|
SpeedChange = { Value = 0.88 }
|
||||||
|
});
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSpmUnaffectedByTimeRamp()
|
||||||
|
=> runSpmTest(new ModWindUp
|
||||||
|
{
|
||||||
|
InitialRate = { Value = 0.7 },
|
||||||
|
FinalRate = { Value = 1.3 }
|
||||||
|
});
|
||||||
|
|
||||||
|
private void runSpmTest(Mod mod)
|
||||||
|
{
|
||||||
|
SpinnerSpmCounter spmCounter = null;
|
||||||
|
|
||||||
|
CreateModTest(new ModTestData
|
||||||
|
{
|
||||||
|
Autoplay = true,
|
||||||
|
Mod = mod,
|
||||||
|
Beatmap = new Beatmap
|
||||||
|
{
|
||||||
|
HitObjects =
|
||||||
|
{
|
||||||
|
new Spinner
|
||||||
|
{
|
||||||
|
Duration = 2000,
|
||||||
|
Position = OsuPlayfield.BASE_SIZE / 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
PassCondition = () => Player.ScoreProcessor.JudgedHits >= 1
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("fetch SPM counter", () =>
|
||||||
|
{
|
||||||
|
spmCounter = this.ChildrenOfType<SpinnerSpmCounter>().SingleOrDefault();
|
||||||
|
return spmCounter != null;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("SPM is correct", () => Precision.AlmostEquals(spmCounter.SpinsPerMinute, 477, 5));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SampleChannel GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
|
public Sample GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
|
||||||
|
|
||||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotImplementedException();
|
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
// 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.Collections.Generic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||||
using osu.Game.Rulesets.Osu.Mods;
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
@ -65,10 +67,10 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
private class TestAutoMod : OsuModAutoplay
|
private class TestAutoMod : OsuModAutoplay
|
||||||
{
|
{
|
||||||
public override Score CreateReplayScore(IBeatmap beatmap) => new Score
|
public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList<Mod> mods) => new Score
|
||||||
{
|
{
|
||||||
ScoreInfo = new ScoreInfo { User = new User { Username = "Autoplay" } },
|
ScoreInfo = new ScoreInfo { User = new User { Username = "Autoplay" } },
|
||||||
Replay = new MissingAutoGenerator(beatmap).Generate()
|
Replay = new MissingAutoGenerator(beatmap, mods).Generate()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,8 +78,8 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
{
|
{
|
||||||
public new OsuBeatmap Beatmap => (OsuBeatmap)base.Beatmap;
|
public new OsuBeatmap Beatmap => (OsuBeatmap)base.Beatmap;
|
||||||
|
|
||||||
public MissingAutoGenerator(IBeatmap beatmap)
|
public MissingAutoGenerator(IBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(beatmap)
|
: base(beatmap, mods)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
491
osu.Game.Rulesets.Osu.Tests/TestSceneObjectOrderedHitPolicy.cs
Normal file
491
osu.Game.Rulesets.Osu.Tests/TestSceneObjectOrderedHitPolicy.cs
Normal file
@ -0,0 +1,491 @@
|
|||||||
|
// 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;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Extensions.TypeExtensions;
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Replays;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Replays;
|
||||||
|
using osu.Game.Rulesets.Replays;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
|
{
|
||||||
|
public class TestSceneObjectOrderedHitPolicy : RateAdjustedBeatmapTestScene
|
||||||
|
{
|
||||||
|
private const double early_miss_window = 1000; // time after -1000 to -500 is considered a miss
|
||||||
|
private const double late_miss_window = 500; // time after +500 is considered a miss
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tests clicking a future circle before the first circle's start time, while the first circle HAS NOT been judged.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestClickSecondCircleBeforeFirstCircleTime()
|
||||||
|
{
|
||||||
|
const double time_first_circle = 1500;
|
||||||
|
const double time_second_circle = 1600;
|
||||||
|
Vector2 positionFirstCircle = Vector2.Zero;
|
||||||
|
Vector2 positionSecondCircle = new Vector2(80);
|
||||||
|
|
||||||
|
var hitObjects = new List<OsuHitObject>
|
||||||
|
{
|
||||||
|
new TestHitCircle
|
||||||
|
{
|
||||||
|
StartTime = time_first_circle,
|
||||||
|
Position = positionFirstCircle
|
||||||
|
},
|
||||||
|
new TestHitCircle
|
||||||
|
{
|
||||||
|
StartTime = time_second_circle,
|
||||||
|
Position = positionSecondCircle
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
performTest(hitObjects, new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new OsuReplayFrame { Time = time_first_circle - 100, Position = positionSecondCircle, Actions = { OsuAction.LeftButton } }
|
||||||
|
});
|
||||||
|
|
||||||
|
addJudgementAssert(hitObjects[0], HitResult.Miss);
|
||||||
|
addJudgementAssert(hitObjects[1], HitResult.Miss);
|
||||||
|
addJudgementOffsetAssert(hitObjects[0], late_miss_window);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tests clicking a future circle at the first circle's start time, while the first circle HAS NOT been judged.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestClickSecondCircleAtFirstCircleTime()
|
||||||
|
{
|
||||||
|
const double time_first_circle = 1500;
|
||||||
|
const double time_second_circle = 1600;
|
||||||
|
Vector2 positionFirstCircle = Vector2.Zero;
|
||||||
|
Vector2 positionSecondCircle = new Vector2(80);
|
||||||
|
|
||||||
|
var hitObjects = new List<OsuHitObject>
|
||||||
|
{
|
||||||
|
new TestHitCircle
|
||||||
|
{
|
||||||
|
StartTime = time_first_circle,
|
||||||
|
Position = positionFirstCircle
|
||||||
|
},
|
||||||
|
new TestHitCircle
|
||||||
|
{
|
||||||
|
StartTime = time_second_circle,
|
||||||
|
Position = positionSecondCircle
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
performTest(hitObjects, new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new OsuReplayFrame { Time = time_first_circle, Position = positionSecondCircle, Actions = { OsuAction.LeftButton } }
|
||||||
|
});
|
||||||
|
|
||||||
|
addJudgementAssert(hitObjects[0], HitResult.Miss);
|
||||||
|
addJudgementAssert(hitObjects[1], HitResult.Miss);
|
||||||
|
addJudgementOffsetAssert(hitObjects[0], late_miss_window);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tests clicking a future circle after the first circle's start time, while the first circle HAS NOT been judged.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestClickSecondCircleAfterFirstCircleTime()
|
||||||
|
{
|
||||||
|
const double time_first_circle = 1500;
|
||||||
|
const double time_second_circle = 1600;
|
||||||
|
Vector2 positionFirstCircle = Vector2.Zero;
|
||||||
|
Vector2 positionSecondCircle = new Vector2(80);
|
||||||
|
|
||||||
|
var hitObjects = new List<OsuHitObject>
|
||||||
|
{
|
||||||
|
new TestHitCircle
|
||||||
|
{
|
||||||
|
StartTime = time_first_circle,
|
||||||
|
Position = positionFirstCircle
|
||||||
|
},
|
||||||
|
new TestHitCircle
|
||||||
|
{
|
||||||
|
StartTime = time_second_circle,
|
||||||
|
Position = positionSecondCircle
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
performTest(hitObjects, new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new OsuReplayFrame { Time = time_first_circle + 100, Position = positionSecondCircle, Actions = { OsuAction.LeftButton } }
|
||||||
|
});
|
||||||
|
|
||||||
|
addJudgementAssert(hitObjects[0], HitResult.Miss);
|
||||||
|
addJudgementAssert(hitObjects[1], HitResult.Miss);
|
||||||
|
addJudgementOffsetAssert(hitObjects[0], late_miss_window);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tests clicking a future circle before the first circle's start time, while the first circle HAS been judged.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestClickSecondCircleBeforeFirstCircleTimeWithFirstCircleJudged()
|
||||||
|
{
|
||||||
|
const double time_first_circle = 1500;
|
||||||
|
const double time_second_circle = 1600;
|
||||||
|
Vector2 positionFirstCircle = Vector2.Zero;
|
||||||
|
Vector2 positionSecondCircle = new Vector2(80);
|
||||||
|
|
||||||
|
var hitObjects = new List<OsuHitObject>
|
||||||
|
{
|
||||||
|
new TestHitCircle
|
||||||
|
{
|
||||||
|
StartTime = time_first_circle,
|
||||||
|
Position = positionFirstCircle
|
||||||
|
},
|
||||||
|
new TestHitCircle
|
||||||
|
{
|
||||||
|
StartTime = time_second_circle,
|
||||||
|
Position = positionSecondCircle
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
performTest(hitObjects, new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new OsuReplayFrame { Time = time_first_circle - 200, Position = positionFirstCircle, Actions = { OsuAction.LeftButton } },
|
||||||
|
new OsuReplayFrame { Time = time_first_circle - 100, Position = positionSecondCircle, Actions = { OsuAction.RightButton } }
|
||||||
|
});
|
||||||
|
|
||||||
|
addJudgementAssert(hitObjects[0], HitResult.Great);
|
||||||
|
addJudgementAssert(hitObjects[1], HitResult.Great);
|
||||||
|
addJudgementOffsetAssert(hitObjects[0], -200); // time_first_circle - 200
|
||||||
|
addJudgementOffsetAssert(hitObjects[0], -200); // time_second_circle - first_circle_time - 100
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tests clicking a future circle after the first circle's start time, while the first circle HAS been judged.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestClickSecondCircleAfterFirstCircleTimeWithFirstCircleJudged()
|
||||||
|
{
|
||||||
|
const double time_first_circle = 1500;
|
||||||
|
const double time_second_circle = 1600;
|
||||||
|
Vector2 positionFirstCircle = Vector2.Zero;
|
||||||
|
Vector2 positionSecondCircle = new Vector2(80);
|
||||||
|
|
||||||
|
var hitObjects = new List<OsuHitObject>
|
||||||
|
{
|
||||||
|
new TestHitCircle
|
||||||
|
{
|
||||||
|
StartTime = time_first_circle,
|
||||||
|
Position = positionFirstCircle
|
||||||
|
},
|
||||||
|
new TestHitCircle
|
||||||
|
{
|
||||||
|
StartTime = time_second_circle,
|
||||||
|
Position = positionSecondCircle
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
performTest(hitObjects, new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new OsuReplayFrame { Time = time_first_circle - 200, Position = positionFirstCircle, Actions = { OsuAction.LeftButton } },
|
||||||
|
new OsuReplayFrame { Time = time_first_circle, Position = positionSecondCircle, Actions = { OsuAction.RightButton } }
|
||||||
|
});
|
||||||
|
|
||||||
|
addJudgementAssert(hitObjects[0], HitResult.Great);
|
||||||
|
addJudgementAssert(hitObjects[1], HitResult.Great);
|
||||||
|
addJudgementOffsetAssert(hitObjects[0], -200); // time_first_circle - 200
|
||||||
|
addJudgementOffsetAssert(hitObjects[1], -100); // time_second_circle - first_circle_time
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tests clicking a future circle after a slider's start time, but hitting all slider ticks.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestMissSliderHeadAndHitAllSliderTicks()
|
||||||
|
{
|
||||||
|
const double time_slider = 1500;
|
||||||
|
const double time_circle = 1510;
|
||||||
|
Vector2 positionCircle = Vector2.Zero;
|
||||||
|
Vector2 positionSlider = new Vector2(80);
|
||||||
|
|
||||||
|
var hitObjects = new List<OsuHitObject>
|
||||||
|
{
|
||||||
|
new TestHitCircle
|
||||||
|
{
|
||||||
|
StartTime = time_circle,
|
||||||
|
Position = positionCircle
|
||||||
|
},
|
||||||
|
new TestSlider
|
||||||
|
{
|
||||||
|
StartTime = time_slider,
|
||||||
|
Position = positionSlider,
|
||||||
|
Path = new SliderPath(PathType.Linear, new[]
|
||||||
|
{
|
||||||
|
Vector2.Zero,
|
||||||
|
new Vector2(25, 0),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
performTest(hitObjects, new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new OsuReplayFrame { Time = time_slider, Position = positionCircle, Actions = { OsuAction.LeftButton } },
|
||||||
|
new OsuReplayFrame { Time = time_slider + 10, Position = positionSlider, Actions = { OsuAction.RightButton } }
|
||||||
|
});
|
||||||
|
|
||||||
|
addJudgementAssert(hitObjects[0], HitResult.Miss);
|
||||||
|
addJudgementAssert(hitObjects[1], HitResult.Great);
|
||||||
|
addJudgementAssert("slider head", () => ((Slider)hitObjects[1]).HeadCircle, HitResult.LargeTickHit);
|
||||||
|
addJudgementAssert("slider tick", () => ((Slider)hitObjects[1]).NestedHitObjects[1] as SliderTick, HitResult.LargeTickHit);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tests clicking hitting future slider ticks before a circle.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestHitSliderTicksBeforeCircle()
|
||||||
|
{
|
||||||
|
const double time_slider = 1500;
|
||||||
|
const double time_circle = 1510;
|
||||||
|
Vector2 positionCircle = Vector2.Zero;
|
||||||
|
Vector2 positionSlider = new Vector2(30);
|
||||||
|
|
||||||
|
var hitObjects = new List<OsuHitObject>
|
||||||
|
{
|
||||||
|
new TestHitCircle
|
||||||
|
{
|
||||||
|
StartTime = time_circle,
|
||||||
|
Position = positionCircle
|
||||||
|
},
|
||||||
|
new TestSlider
|
||||||
|
{
|
||||||
|
StartTime = time_slider,
|
||||||
|
Position = positionSlider,
|
||||||
|
Path = new SliderPath(PathType.Linear, new[]
|
||||||
|
{
|
||||||
|
Vector2.Zero,
|
||||||
|
new Vector2(25, 0),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
performTest(hitObjects, new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new OsuReplayFrame { Time = time_slider, Position = positionSlider, Actions = { OsuAction.LeftButton } },
|
||||||
|
new OsuReplayFrame { Time = time_circle + late_miss_window - 100, Position = positionCircle, Actions = { OsuAction.RightButton } },
|
||||||
|
new OsuReplayFrame { Time = time_circle + late_miss_window - 90, Position = positionSlider, Actions = { OsuAction.LeftButton } },
|
||||||
|
});
|
||||||
|
|
||||||
|
addJudgementAssert(hitObjects[0], HitResult.Great);
|
||||||
|
addJudgementAssert(hitObjects[1], HitResult.Great);
|
||||||
|
addJudgementAssert("slider head", () => ((Slider)hitObjects[1]).HeadCircle, HitResult.LargeTickHit);
|
||||||
|
addJudgementAssert("slider tick", () => ((Slider)hitObjects[1]).NestedHitObjects[1] as SliderTick, HitResult.LargeTickHit);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tests clicking a future circle before a spinner.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestHitCircleBeforeSpinner()
|
||||||
|
{
|
||||||
|
const double time_spinner = 1500;
|
||||||
|
const double time_circle = 1800;
|
||||||
|
Vector2 positionCircle = Vector2.Zero;
|
||||||
|
|
||||||
|
var hitObjects = new List<OsuHitObject>
|
||||||
|
{
|
||||||
|
new TestSpinner
|
||||||
|
{
|
||||||
|
StartTime = time_spinner,
|
||||||
|
Position = new Vector2(256, 192),
|
||||||
|
EndTime = time_spinner + 1000,
|
||||||
|
},
|
||||||
|
new TestHitCircle
|
||||||
|
{
|
||||||
|
StartTime = time_circle,
|
||||||
|
Position = positionCircle
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
performTest(hitObjects, new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new OsuReplayFrame { Time = time_spinner - 100, Position = positionCircle, Actions = { OsuAction.LeftButton } },
|
||||||
|
new OsuReplayFrame { Time = time_spinner + 10, Position = new Vector2(236, 192), Actions = { OsuAction.RightButton } },
|
||||||
|
new OsuReplayFrame { Time = time_spinner + 20, Position = new Vector2(256, 172), Actions = { OsuAction.RightButton } },
|
||||||
|
new OsuReplayFrame { Time = time_spinner + 30, Position = new Vector2(276, 192), Actions = { OsuAction.RightButton } },
|
||||||
|
new OsuReplayFrame { Time = time_spinner + 40, Position = new Vector2(256, 212), Actions = { OsuAction.RightButton } },
|
||||||
|
new OsuReplayFrame { Time = time_spinner + 50, Position = new Vector2(236, 192), Actions = { OsuAction.RightButton } },
|
||||||
|
});
|
||||||
|
|
||||||
|
addJudgementAssert(hitObjects[0], HitResult.Great);
|
||||||
|
addJudgementAssert(hitObjects[1], HitResult.Great);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHitSliderHeadBeforeHitCircle()
|
||||||
|
{
|
||||||
|
const double time_circle = 1000;
|
||||||
|
const double time_slider = 1200;
|
||||||
|
Vector2 positionCircle = Vector2.Zero;
|
||||||
|
Vector2 positionSlider = new Vector2(80);
|
||||||
|
|
||||||
|
var hitObjects = new List<OsuHitObject>
|
||||||
|
{
|
||||||
|
new TestHitCircle
|
||||||
|
{
|
||||||
|
StartTime = time_circle,
|
||||||
|
Position = positionCircle
|
||||||
|
},
|
||||||
|
new TestSlider
|
||||||
|
{
|
||||||
|
StartTime = time_slider,
|
||||||
|
Position = positionSlider,
|
||||||
|
Path = new SliderPath(PathType.Linear, new[]
|
||||||
|
{
|
||||||
|
Vector2.Zero,
|
||||||
|
new Vector2(25, 0),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
performTest(hitObjects, new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new OsuReplayFrame { Time = time_circle - 100, Position = positionSlider, Actions = { OsuAction.LeftButton } },
|
||||||
|
new OsuReplayFrame { Time = time_circle, Position = positionCircle, Actions = { OsuAction.RightButton } },
|
||||||
|
new OsuReplayFrame { Time = time_slider, Position = positionSlider, Actions = { OsuAction.LeftButton } },
|
||||||
|
});
|
||||||
|
|
||||||
|
addJudgementAssert(hitObjects[0], HitResult.Great);
|
||||||
|
addJudgementAssert(hitObjects[1], HitResult.Great);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addJudgementAssert(OsuHitObject hitObject, HitResult result)
|
||||||
|
{
|
||||||
|
AddAssert($"({hitObject.GetType().ReadableName()} @ {hitObject.StartTime}) judgement is {result}",
|
||||||
|
() => judgementResults.Single(r => r.HitObject == hitObject).Type == result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addJudgementAssert(string name, Func<OsuHitObject> hitObject, HitResult result)
|
||||||
|
{
|
||||||
|
AddAssert($"{name} judgement is {result}",
|
||||||
|
() => judgementResults.Single(r => r.HitObject == hitObject()).Type == result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addJudgementOffsetAssert(OsuHitObject hitObject, double offset)
|
||||||
|
{
|
||||||
|
AddAssert($"({hitObject.GetType().ReadableName()} @ {hitObject.StartTime}) judged at {offset}",
|
||||||
|
() => Precision.AlmostEquals(judgementResults.Single(r => r.HitObject == hitObject).TimeOffset, offset, 100));
|
||||||
|
}
|
||||||
|
|
||||||
|
private ScoreAccessibleReplayPlayer currentPlayer;
|
||||||
|
private List<JudgementResult> judgementResults;
|
||||||
|
|
||||||
|
private void performTest(List<OsuHitObject> hitObjects, List<ReplayFrame> frames)
|
||||||
|
{
|
||||||
|
AddStep("load player", () =>
|
||||||
|
{
|
||||||
|
Beatmap.Value = CreateWorkingBeatmap(new Beatmap<OsuHitObject>
|
||||||
|
{
|
||||||
|
HitObjects = hitObjects,
|
||||||
|
BeatmapInfo =
|
||||||
|
{
|
||||||
|
BaseDifficulty = new BeatmapDifficulty { SliderTickRate = 3 },
|
||||||
|
Ruleset = new OsuRuleset().RulesetInfo
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Beatmap.Value.Beatmap.ControlPointInfo.Add(0, new DifficultyControlPoint { SpeedMultiplier = 0.1f });
|
||||||
|
|
||||||
|
SelectedMods.Value = new[] { new OsuModClassic() };
|
||||||
|
|
||||||
|
var p = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } });
|
||||||
|
|
||||||
|
p.OnLoadComplete += _ =>
|
||||||
|
{
|
||||||
|
p.ScoreProcessor.NewJudgement += result =>
|
||||||
|
{
|
||||||
|
if (currentPlayer == p) judgementResults.Add(result);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
LoadScreen(currentPlayer = p);
|
||||||
|
judgementResults = new List<JudgementResult>();
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("Beatmap at 0", () => Beatmap.Value.Track.CurrentTime == 0);
|
||||||
|
AddUntilStep("Wait until player is loaded", () => currentPlayer.IsCurrentScreen());
|
||||||
|
AddUntilStep("Wait for completion", () => currentPlayer.ScoreProcessor.HasCompleted.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestHitCircle : HitCircle
|
||||||
|
{
|
||||||
|
protected override HitWindows CreateHitWindows() => new TestHitWindows();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestSlider : Slider
|
||||||
|
{
|
||||||
|
public TestSlider()
|
||||||
|
{
|
||||||
|
DefaultsApplied += _ =>
|
||||||
|
{
|
||||||
|
HeadCircle.HitWindows = new TestHitWindows();
|
||||||
|
TailCircle.HitWindows = new TestHitWindows();
|
||||||
|
|
||||||
|
HeadCircle.HitWindows.SetDifficulty(0);
|
||||||
|
TailCircle.HitWindows.SetDifficulty(0);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestSpinner : Spinner
|
||||||
|
{
|
||||||
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
||||||
|
{
|
||||||
|
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
||||||
|
SpinsRequired = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestHitWindows : HitWindows
|
||||||
|
{
|
||||||
|
private static readonly DifficultyRange[] ranges =
|
||||||
|
{
|
||||||
|
new DifficultyRange(HitResult.Great, 500, 500, 500),
|
||||||
|
new DifficultyRange(HitResult.Miss, early_miss_window, early_miss_window, early_miss_window),
|
||||||
|
};
|
||||||
|
|
||||||
|
public override bool IsHitResultAllowed(HitResult result) => result == HitResult.Great || result == HitResult.Miss;
|
||||||
|
|
||||||
|
protected override DifficultyRange[] GetRanges() => ranges;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ScoreAccessibleReplayPlayer : ReplayPlayer
|
||||||
|
{
|
||||||
|
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
|
||||||
|
|
||||||
|
protected override bool PauseOnFocusLost => false;
|
||||||
|
|
||||||
|
public ScoreAccessibleReplayPlayer(Score score)
|
||||||
|
: base(score, new PlayerConfiguration
|
||||||
|
{
|
||||||
|
AllowPause = false,
|
||||||
|
ShowResults = false,
|
||||||
|
})
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -162,7 +162,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => null;
|
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => null;
|
||||||
|
|
||||||
public SampleChannel GetSample(ISampleInfo sampleInfo) => null;
|
public Sample GetSample(ISampleInfo sampleInfo) => null;
|
||||||
|
|
||||||
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration => default;
|
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration => default;
|
||||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => null;
|
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => null;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.13.1" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
CirclePiece.UpdateFrom(position == SliderPosition.Start ? HitObject.HeadCircle : HitObject.TailCircle);
|
CirclePiece.UpdateFrom(position == SliderPosition.Start ? (HitCircle)HitObject.HeadCircle : HitObject.TailCircle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input.
|
// Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input.
|
||||||
|
12
osu.Game.Rulesets.Osu/Judgements/SliderTickJudgement.cs
Normal file
12
osu.Game.Rulesets.Osu/Judgements/SliderTickJudgement.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// 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 osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Judgements
|
||||||
|
{
|
||||||
|
public class SliderTickJudgement : OsuJudgement
|
||||||
|
{
|
||||||
|
public override HitResult MaxResult => HitResult.LargeTickHit;
|
||||||
|
}
|
||||||
|
}
|
@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
inputManager.AllowUserCursorMovement = false;
|
inputManager.AllowUserCursorMovement = false;
|
||||||
|
|
||||||
// Generate the replay frames the cursor should follow
|
// Generate the replay frames the cursor should follow
|
||||||
replayFrames = new OsuAutoGenerator(drawableRuleset.Beatmap).Generate().Frames.Cast<OsuReplayFrame>().ToList();
|
replayFrames = new OsuAutoGenerator(drawableRuleset.Beatmap, drawableRuleset.Mods).Generate().Frames.Cast<OsuReplayFrame>().ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +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.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
@ -16,10 +17,10 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
{
|
{
|
||||||
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).Append(typeof(OsuModSpunOut)).ToArray();
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).Append(typeof(OsuModSpunOut)).ToArray();
|
||||||
|
|
||||||
public override Score CreateReplayScore(IBeatmap beatmap) => new Score
|
public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList<Mod> mods) => new Score
|
||||||
{
|
{
|
||||||
ScoreInfo = new ScoreInfo { User = new User { Username = "Autoplay" } },
|
ScoreInfo = new ScoreInfo { User = new User { Username = "Autoplay" } },
|
||||||
Replay = new OsuAutoGenerator(beatmap).Generate()
|
Replay = new OsuAutoGenerator(beatmap, mods).Generate()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +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.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
@ -16,10 +17,10 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
{
|
{
|
||||||
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).Append(typeof(OsuModSpunOut)).ToArray();
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).Append(typeof(OsuModSpunOut)).ToArray();
|
||||||
|
|
||||||
public override Score CreateReplayScore(IBeatmap beatmap) => new Score
|
public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList<Mod> mods) => new Score
|
||||||
{
|
{
|
||||||
ScoreInfo = new ScoreInfo { User = new User { Username = "Autoplay" } },
|
ScoreInfo = new ScoreInfo { User = new User { Username = "Autoplay" } },
|
||||||
Replay = new OsuAutoGenerator(beatmap).Generate()
|
Replay = new OsuAutoGenerator(beatmap, mods).Generate()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
86
osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs
Normal file
86
osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
// 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.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
|
{
|
||||||
|
public class OsuModClassic : Mod, IApplicableToHitObject, IApplicableToDrawableHitObjects, IApplicableToDrawableRuleset<OsuHitObject>
|
||||||
|
{
|
||||||
|
public override string Name => "Classic";
|
||||||
|
|
||||||
|
public override string Acronym => "CL";
|
||||||
|
|
||||||
|
public override double ScoreMultiplier => 1;
|
||||||
|
|
||||||
|
public override IconUsage? Icon => FontAwesome.Solid.History;
|
||||||
|
|
||||||
|
public override string Description => "Feeling nostalgic?";
|
||||||
|
|
||||||
|
public override bool Ranked => false;
|
||||||
|
|
||||||
|
public override ModType Type => ModType.Conversion;
|
||||||
|
|
||||||
|
[SettingSource("No slider head accuracy requirement", "Scores sliders proportionally to the number of ticks hit.")]
|
||||||
|
public Bindable<bool> NoSliderHeadAccuracy { get; } = new BindableBool(true);
|
||||||
|
|
||||||
|
[SettingSource("No slider head movement", "Pins slider heads at their starting position, regardless of time.")]
|
||||||
|
public Bindable<bool> NoSliderHeadMovement { get; } = new BindableBool(true);
|
||||||
|
|
||||||
|
[SettingSource("Apply classic note lock", "Applies note lock to the full hit window.")]
|
||||||
|
public Bindable<bool> ClassicNoteLock { get; } = new BindableBool(true);
|
||||||
|
|
||||||
|
[SettingSource("Use fixed slider follow circle hit area", "Makes the slider follow circle track its final size at all times.")]
|
||||||
|
public Bindable<bool> FixedFollowCircleHitArea { get; } = new BindableBool(true);
|
||||||
|
|
||||||
|
public void ApplyToHitObject(HitObject hitObject)
|
||||||
|
{
|
||||||
|
switch (hitObject)
|
||||||
|
{
|
||||||
|
case Slider slider:
|
||||||
|
slider.OnlyJudgeNestedObjects = !NoSliderHeadAccuracy.Value;
|
||||||
|
|
||||||
|
foreach (var head in slider.NestedHitObjects.OfType<SliderHeadCircle>())
|
||||||
|
head.JudgeAsNormalHitCircle = !NoSliderHeadAccuracy.Value;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
|
||||||
|
{
|
||||||
|
var osuRuleset = (DrawableOsuRuleset)drawableRuleset;
|
||||||
|
|
||||||
|
if (ClassicNoteLock.Value)
|
||||||
|
osuRuleset.Playfield.HitPolicy = new ObjectOrderedHitPolicy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
||||||
|
{
|
||||||
|
foreach (var obj in drawables)
|
||||||
|
{
|
||||||
|
switch (obj)
|
||||||
|
{
|
||||||
|
case DrawableSlider slider:
|
||||||
|
slider.Ball.InputTracksVisualSize = !FixedFollowCircleHitArea.Value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DrawableSliderHead head:
|
||||||
|
head.TrackFollowCircle = !NoSliderHeadMovement.Value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
public class OsuModDifficultyAdjust : ModDifficultyAdjust
|
public class OsuModDifficultyAdjust : ModDifficultyAdjust
|
||||||
{
|
{
|
||||||
[SettingSource("Circle Size", "Override a beatmap's set CS.", FIRST_SETTING_ORDER - 1)]
|
[SettingSource("Circle Size", "Override a beatmap's set CS.", FIRST_SETTING_ORDER - 1)]
|
||||||
public BindableNumber<float> CircleSize { get; } = new BindableFloat
|
public BindableNumber<float> CircleSize { get; } = new BindableFloatWithLimitExtension
|
||||||
{
|
{
|
||||||
Precision = 0.1f,
|
Precision = 0.1f,
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
};
|
};
|
||||||
|
|
||||||
[SettingSource("Approach Rate", "Override a beatmap's set AR.", LAST_SETTING_ORDER + 1)]
|
[SettingSource("Approach Rate", "Override a beatmap's set AR.", LAST_SETTING_ORDER + 1)]
|
||||||
public BindableNumber<float> ApproachRate { get; } = new BindableFloat
|
public BindableNumber<float> ApproachRate { get; } = new BindableFloatWithLimitExtension
|
||||||
{
|
{
|
||||||
Precision = 0.1f,
|
Precision = 0.1f,
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
@ -31,6 +31,14 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
Value = 5,
|
Value = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected override void ApplyLimits(bool extended)
|
||||||
|
{
|
||||||
|
base.ApplyLimits(extended);
|
||||||
|
|
||||||
|
CircleSize.MaxValue = extended ? 11 : 10;
|
||||||
|
ApproachRate.MaxValue = extended ? 11 : 10;
|
||||||
|
}
|
||||||
|
|
||||||
public override string SettingDescription
|
public override string SettingDescription
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -110,8 +110,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
|||||||
double startTime = start.GetEndTime();
|
double startTime = start.GetEndTime();
|
||||||
double duration = end.StartTime - startTime;
|
double duration = end.StartTime - startTime;
|
||||||
|
|
||||||
|
// Preempt time can go below 800ms. Normally, this is achieved via the DT mod which uniformly speeds up all animations game wide regardless of AR.
|
||||||
|
// This uniform speedup is hard to match 1:1, however we can at least make AR>10 (via mods) feel good by extending the upper linear preempt function (see: OsuHitObject).
|
||||||
|
// Note that this doesn't exactly match the AR>10 visuals as they're classically known, but it feels good.
|
||||||
|
double preempt = PREEMPT * Math.Min(1, start.TimePreempt / OsuHitObject.PREEMPT_MIN);
|
||||||
|
|
||||||
fadeOutTime = startTime + fraction * duration;
|
fadeOutTime = startTime + fraction * duration;
|
||||||
fadeInTime = fadeOutTime - PREEMPT;
|
fadeInTime = fadeOutTime - preempt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = HitObject.HitWindows.ResultFor(timeOffset);
|
var result = ResultFor(timeOffset);
|
||||||
|
|
||||||
if (result == HitResult.None || CheckHittable?.Invoke(this, Time.Current) == false)
|
if (result == HitResult.None || CheckHittable?.Invoke(this, Time.Current) == false)
|
||||||
{
|
{
|
||||||
@ -146,6 +146,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the <see cref="HitResult"/> for a time offset.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="timeOffset">The time offset.</param>
|
||||||
|
/// <returns>The hit result, or <see cref="HitResult.None"/> if <paramref name="timeOffset"/> doesn't result in a judgement.</returns>
|
||||||
|
protected virtual HitResult ResultFor(double timeOffset) => HitObject.HitWindows.ResultFor(timeOffset);
|
||||||
|
|
||||||
protected override void UpdateInitialTransforms()
|
protected override void UpdateInitialTransforms()
|
||||||
{
|
{
|
||||||
base.UpdateInitialTransforms();
|
base.UpdateInitialTransforms();
|
||||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
if (JudgedObject?.HitObject is OsuHitObject osuObject)
|
if (JudgedObject?.HitObject is OsuHitObject osuObject)
|
||||||
{
|
{
|
||||||
Position = osuObject.StackedPosition;
|
Position = osuObject.StackedEndPosition;
|
||||||
Scale = new Vector2(osuObject.Scale);
|
Scale = new Vector2(osuObject.Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ using osu.Game.Rulesets.Objects;
|
|||||||
using osu.Game.Rulesets.Osu.Skinning;
|
using osu.Game.Rulesets.Osu.Skinning;
|
||||||
using osu.Game.Rulesets.Osu.Skinning.Default;
|
using osu.Game.Rulesets.Osu.Skinning.Default;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
public SliderBall Ball { get; private set; }
|
public SliderBall Ball { get; private set; }
|
||||||
public SkinnableDrawable Body { get; private set; }
|
public SkinnableDrawable Body { get; private set; }
|
||||||
|
|
||||||
public override bool DisplayResult => false;
|
public override bool DisplayResult => !HitObject.OnlyJudgeNestedObjects;
|
||||||
|
|
||||||
private PlaySliderBody sliderBody => Body.Drawable as PlaySliderBody;
|
private PlaySliderBody sliderBody => Body.Drawable as PlaySliderBody;
|
||||||
|
|
||||||
@ -249,7 +250,30 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
if (userTriggered || Time.Current < HitObject.EndTime)
|
if (userTriggered || Time.Current < HitObject.EndTime)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ApplyResult(r => r.Type = NestedHitObjects.Any(h => h.Result.IsHit) ? r.Judgement.MaxResult : r.Judgement.MinResult);
|
// If only the nested hitobjects are judged, then the slider's own judgement is ignored for scoring purposes.
|
||||||
|
// But the slider needs to still be judged with a reasonable hit/miss result for visual purposes (hit/miss transforms, etc).
|
||||||
|
if (HitObject.OnlyJudgeNestedObjects)
|
||||||
|
{
|
||||||
|
ApplyResult(r => r.Type = NestedHitObjects.Any(h => h.Result.IsHit) ? r.Judgement.MaxResult : r.Judgement.MinResult);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, if this slider also needs to be judged, apply judgement proportionally to the number of nested hitobjects hit. This is the classic osu!stable scoring.
|
||||||
|
ApplyResult(r =>
|
||||||
|
{
|
||||||
|
int totalTicks = NestedHitObjects.Count;
|
||||||
|
int hitTicks = NestedHitObjects.Count(h => h.IsHit);
|
||||||
|
|
||||||
|
if (hitTicks == totalTicks)
|
||||||
|
r.Type = HitResult.Great;
|
||||||
|
else if (hitTicks == 0)
|
||||||
|
r.Type = HitResult.Miss;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double hitFraction = (double)hitTicks / totalTicks;
|
||||||
|
r.Type = hitFraction >= 0.5 ? HitResult.Ok : HitResult.Meh;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PlaySamples()
|
public override void PlaySamples()
|
||||||
|
@ -7,16 +7,27 @@ using JetBrains.Annotations;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||||
{
|
{
|
||||||
public class DrawableSliderHead : DrawableHitCircle
|
public class DrawableSliderHead : DrawableHitCircle
|
||||||
{
|
{
|
||||||
|
public new SliderHeadCircle HitObject => (SliderHeadCircle)base.HitObject;
|
||||||
|
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
public Slider Slider => DrawableSlider?.HitObject;
|
public Slider Slider => DrawableSlider?.HitObject;
|
||||||
|
|
||||||
protected DrawableSlider DrawableSlider => (DrawableSlider)ParentHitObject;
|
protected DrawableSlider DrawableSlider => (DrawableSlider)ParentHitObject;
|
||||||
|
|
||||||
|
public override bool DisplayResult => HitObject?.JudgeAsNormalHitCircle ?? base.DisplayResult;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Makes this <see cref="DrawableSliderHead"/> track the follow circle when the start time is reached.
|
||||||
|
/// If <c>false</c>, this <see cref="DrawableSliderHead"/> will be pinned to its initial position in the slider.
|
||||||
|
/// </summary>
|
||||||
|
public bool TrackFollowCircle = true;
|
||||||
|
|
||||||
private readonly IBindable<int> pathVersion = new Bindable<int>();
|
private readonly IBindable<int> pathVersion = new Bindable<int>();
|
||||||
|
|
||||||
protected override OsuSkinComponents CirclePieceComponent => OsuSkinComponents.SliderHeadHitCircle;
|
protected override OsuSkinComponents CirclePieceComponent => OsuSkinComponents.SliderHeadHitCircle;
|
||||||
@ -59,12 +70,28 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
Debug.Assert(Slider != null);
|
Debug.Assert(Slider != null);
|
||||||
|
Debug.Assert(HitObject != null);
|
||||||
|
|
||||||
double completionProgress = Math.Clamp((Time.Current - Slider.StartTime) / Slider.Duration, 0, 1);
|
if (TrackFollowCircle)
|
||||||
|
{
|
||||||
|
double completionProgress = Math.Clamp((Time.Current - Slider.StartTime) / Slider.Duration, 0, 1);
|
||||||
|
|
||||||
//todo: we probably want to reconsider this before adding scoring, but it looks and feels nice.
|
//todo: we probably want to reconsider this before adding scoring, but it looks and feels nice.
|
||||||
if (!IsHit)
|
if (!IsHit)
|
||||||
Position = Slider.CurvePositionAt(completionProgress);
|
Position = Slider.CurvePositionAt(completionProgress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override HitResult ResultFor(double timeOffset)
|
||||||
|
{
|
||||||
|
Debug.Assert(HitObject != null);
|
||||||
|
|
||||||
|
if (HitObject.JudgeAsNormalHitCircle)
|
||||||
|
return base.ResultFor(timeOffset);
|
||||||
|
|
||||||
|
// If not judged as a normal hitcircle, judge as a slider tick instead. This is the classic osu!stable scoring.
|
||||||
|
var result = base.ResultFor(timeOffset);
|
||||||
|
return result.IsHit() ? HitResult.LargeTickHit : HitResult.LargeTickMiss;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action<double> OnShake;
|
public Action<double> OnShake;
|
||||||
|
@ -130,7 +130,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
if (tracking.NewValue)
|
if (tracking.NewValue)
|
||||||
{
|
{
|
||||||
spinningSample?.Play(!spinningSample.IsPlaying);
|
if (!spinningSample.IsPlaying)
|
||||||
|
spinningSample?.Play();
|
||||||
spinningSample?.VolumeTo(1, 300);
|
spinningSample?.VolumeTo(1, 300);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -25,6 +26,11 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal const float BASE_SCORING_DISTANCE = 100;
|
internal const float BASE_SCORING_DISTANCE = 100;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Minimum preempt time at AR=10.
|
||||||
|
/// </summary>
|
||||||
|
public const double PREEMPT_MIN = 450;
|
||||||
|
|
||||||
public double TimePreempt = 600;
|
public double TimePreempt = 600;
|
||||||
public double TimeFadeIn = 400;
|
public double TimeFadeIn = 400;
|
||||||
|
|
||||||
@ -112,8 +118,13 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
{
|
{
|
||||||
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
||||||
|
|
||||||
TimePreempt = (float)BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1800, 1200, 450);
|
TimePreempt = (float)BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1800, 1200, PREEMPT_MIN);
|
||||||
TimeFadeIn = 400; // as per osu-stable
|
|
||||||
|
// Preempt time can go below 450ms. Normally, this is achieved via the DT mod which uniformly speeds up all animations game wide regardless of AR.
|
||||||
|
// This uniform speedup is hard to match 1:1, however we can at least make AR>10 (via mods) feel good by extending the upper linear function above.
|
||||||
|
// Note that this doesn't exactly match the AR>10 visuals as they're classically known, but it feels good.
|
||||||
|
// This adjustment is necessary for AR>10, otherwise TimePreempt can become smaller leading to hitcircles not fully fading in.
|
||||||
|
TimeFadeIn = 400 * Math.Min(1, TimePreempt / PREEMPT_MIN);
|
||||||
|
|
||||||
Scale = (1.0f - 0.7f * (difficulty.CircleSize - 5) / 5) / 2;
|
Scale = (1.0f - 0.7f * (difficulty.CircleSize - 5) / 5) / 2;
|
||||||
}
|
}
|
||||||
|
@ -114,8 +114,14 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double TickDistanceMultiplier = 1;
|
public double TickDistanceMultiplier = 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this <see cref="Slider"/>'s judgement is fully handled by its nested <see cref="HitObject"/>s.
|
||||||
|
/// If <c>false</c>, this <see cref="Slider"/> will be judged proportionally to the number of nested <see cref="HitObject"/>s hit.
|
||||||
|
/// </summary>
|
||||||
|
public bool OnlyJudgeNestedObjects = true;
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public HitCircle HeadCircle { get; protected set; }
|
public SliderHeadCircle HeadCircle { get; protected set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public SliderTailCircle TailCircle { get; protected set; }
|
public SliderTailCircle TailCircle { get; protected set; }
|
||||||
@ -140,7 +146,8 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
|
|
||||||
// The samples should be attached to the slider tail, however this can only be done after LegacyLastTick is removed otherwise they would play earlier than they're intended to.
|
// The samples should be attached to the slider tail, however this can only be done after LegacyLastTick is removed otherwise they would play earlier than they're intended to.
|
||||||
// For now, the samples are attached to and played by the slider itself at the correct end time.
|
// For now, the samples are attached to and played by the slider itself at the correct end time.
|
||||||
Samples = this.GetNodeSamples(repeatCount + 1);
|
// ToArray call is required as GetNodeSamples may fallback to Samples itself (without it it will get cleared due to the list reference being live).
|
||||||
|
Samples = this.GetNodeSamples(repeatCount + 1).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
|
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
|
||||||
@ -233,7 +240,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
HeadCircle.Samples = this.GetNodeSamples(0);
|
HeadCircle.Samples = this.GetNodeSamples(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Judgement CreateJudgement() => new OsuIgnoreJudgement();
|
public override Judgement CreateJudgement() => OnlyJudgeNestedObjects ? new OsuIgnoreJudgement() : new OsuJudgement();
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,19 @@
|
|||||||
// 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 osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Osu.Judgements;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects
|
namespace osu.Game.Rulesets.Osu.Objects
|
||||||
{
|
{
|
||||||
public class SliderHeadCircle : HitCircle
|
public class SliderHeadCircle : HitCircle
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Whether to treat this <see cref="SliderHeadCircle"/> as a normal <see cref="HitCircle"/> for judgement purposes.
|
||||||
|
/// If <c>false</c>, this <see cref="SliderHeadCircle"/> will be judged as a <see cref="SliderTick"/> instead.
|
||||||
|
/// </summary>
|
||||||
|
public bool JudgeAsNormalHitCircle = true;
|
||||||
|
|
||||||
|
public override Judgement CreateJudgement() => JudgeAsNormalHitCircle ? base.CreateJudgement() : new SliderTickJudgement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,5 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
||||||
|
|
||||||
public override Judgement CreateJudgement() => new SliderTickJudgement();
|
public override Judgement CreateJudgement() => new SliderTickJudgement();
|
||||||
|
|
||||||
public class SliderTickJudgement : OsuJudgement
|
|
||||||
{
|
|
||||||
public override HitResult MaxResult => HitResult.LargeTickHit;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
|
|
||||||
protected override bool Handle(UIEvent e)
|
protected override bool Handle(UIEvent e)
|
||||||
{
|
{
|
||||||
if (e is MouseMoveEvent && !AllowUserCursorMovement) return false;
|
if ((e is MouseMoveEvent || e is TouchMoveEvent) && !AllowUserCursorMovement) return false;
|
||||||
|
|
||||||
return base.Handle(e);
|
return base.Handle(e);
|
||||||
}
|
}
|
||||||
|
@ -163,6 +163,7 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
{
|
{
|
||||||
new OsuModTarget(),
|
new OsuModTarget(),
|
||||||
new OsuModDifficultyAdjust(),
|
new OsuModDifficultyAdjust(),
|
||||||
|
new OsuModClassic()
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.Automation:
|
case ModType.Automation:
|
||||||
|
@ -6,10 +6,12 @@ using osu.Framework.Utils;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||||
using osu.Game.Rulesets.Osu.Scoring;
|
using osu.Game.Rulesets.Osu.Scoring;
|
||||||
@ -33,11 +35,6 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
|
|
||||||
#region Constants
|
#region Constants
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The "reaction time" in ms between "seeing" a new hit object and moving to "react" to it.
|
|
||||||
/// </summary>
|
|
||||||
private readonly double reactionTime;
|
|
||||||
|
|
||||||
private readonly HitWindows defaultHitWindows;
|
private readonly HitWindows defaultHitWindows;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -49,12 +46,9 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
|
|
||||||
#region Construction / Initialisation
|
#region Construction / Initialisation
|
||||||
|
|
||||||
public OsuAutoGenerator(IBeatmap beatmap)
|
public OsuAutoGenerator(IBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(beatmap)
|
: base(beatmap, mods)
|
||||||
{
|
{
|
||||||
// Already superhuman, but still somewhat realistic
|
|
||||||
reactionTime = ApplyModsToRate(100);
|
|
||||||
|
|
||||||
defaultHitWindows = new OsuHitWindows();
|
defaultHitWindows = new OsuHitWindows();
|
||||||
defaultHitWindows.SetDifficulty(Beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty);
|
defaultHitWindows.SetDifficulty(Beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty);
|
||||||
}
|
}
|
||||||
@ -240,7 +234,7 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
OsuReplayFrame lastFrame = (OsuReplayFrame)Frames[^1];
|
OsuReplayFrame lastFrame = (OsuReplayFrame)Frames[^1];
|
||||||
|
|
||||||
// Wait until Auto could "see and react" to the next note.
|
// Wait until Auto could "see and react" to the next note.
|
||||||
double waitTime = h.StartTime - Math.Max(0.0, h.TimePreempt - reactionTime);
|
double waitTime = h.StartTime - Math.Max(0.0, h.TimePreempt - getReactionTime(h.StartTime - h.TimePreempt));
|
||||||
|
|
||||||
if (waitTime > lastFrame.Time)
|
if (waitTime > lastFrame.Time)
|
||||||
{
|
{
|
||||||
@ -250,7 +244,7 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
|
|
||||||
Vector2 lastPosition = lastFrame.Position;
|
Vector2 lastPosition = lastFrame.Position;
|
||||||
|
|
||||||
double timeDifference = ApplyModsToTime(h.StartTime - lastFrame.Time);
|
double timeDifference = ApplyModsToTimeDelta(lastFrame.Time, h.StartTime);
|
||||||
|
|
||||||
// Only "snap" to hitcircles if they are far enough apart. As the time between hitcircles gets shorter the snapping threshold goes up.
|
// Only "snap" to hitcircles if they are far enough apart. As the time between hitcircles gets shorter the snapping threshold goes up.
|
||||||
if (timeDifference > 0 && // Sanity checks
|
if (timeDifference > 0 && // Sanity checks
|
||||||
@ -258,7 +252,7 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
timeDifference >= 266)) // ... or the beats are slow enough to tap anyway.
|
timeDifference >= 266)) // ... or the beats are slow enough to tap anyway.
|
||||||
{
|
{
|
||||||
// Perform eased movement
|
// Perform eased movement
|
||||||
for (double time = lastFrame.Time + FrameDelay; time < h.StartTime; time += FrameDelay)
|
for (double time = lastFrame.Time + GetFrameDelay(lastFrame.Time); time < h.StartTime; time += GetFrameDelay(time))
|
||||||
{
|
{
|
||||||
Vector2 currentPosition = Interpolation.ValueAt(time, lastPosition, targetPos, lastFrame.Time, h.StartTime, easing);
|
Vector2 currentPosition = Interpolation.ValueAt(time, lastPosition, targetPos, lastFrame.Time, h.StartTime, easing);
|
||||||
AddFrameToReplay(new OsuReplayFrame((int)time, new Vector2(currentPosition.X, currentPosition.Y)) { Actions = lastFrame.Actions });
|
AddFrameToReplay(new OsuReplayFrame((int)time, new Vector2(currentPosition.X, currentPosition.Y)) { Actions = lastFrame.Actions });
|
||||||
@ -272,6 +266,14 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculates the "reaction time" in ms between "seeing" a new hit object and moving to "react" to it.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Already superhuman, but still somewhat realistic.
|
||||||
|
/// </remarks>
|
||||||
|
private double getReactionTime(double timeInstant) => ApplyModsToRate(timeInstant, 100);
|
||||||
|
|
||||||
// Add frames to click the hitobject
|
// Add frames to click the hitobject
|
||||||
private void addHitObjectClickFrames(OsuHitObject h, Vector2 startPosition, float spinnerDirection)
|
private void addHitObjectClickFrames(OsuHitObject h, Vector2 startPosition, float spinnerDirection)
|
||||||
{
|
{
|
||||||
@ -341,17 +343,23 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
float angle = radius == 0 ? 0 : MathF.Atan2(difference.Y, difference.X);
|
float angle = radius == 0 ? 0 : MathF.Atan2(difference.Y, difference.X);
|
||||||
|
|
||||||
double t;
|
double t;
|
||||||
|
double previousFrame = h.StartTime;
|
||||||
|
|
||||||
for (double j = h.StartTime + FrameDelay; j < spinner.EndTime; j += FrameDelay)
|
for (double nextFrame = h.StartTime + GetFrameDelay(h.StartTime); nextFrame < spinner.EndTime; nextFrame += GetFrameDelay(nextFrame))
|
||||||
{
|
{
|
||||||
t = ApplyModsToTime(j - h.StartTime) * spinnerDirection;
|
t = ApplyModsToTimeDelta(previousFrame, nextFrame) * spinnerDirection;
|
||||||
|
angle += (float)t / 20;
|
||||||
|
|
||||||
Vector2 pos = SPINNER_CENTRE + CirclePosition(t / 20 + angle, SPIN_RADIUS);
|
Vector2 pos = SPINNER_CENTRE + CirclePosition(angle, SPIN_RADIUS);
|
||||||
AddFrameToReplay(new OsuReplayFrame((int)j, new Vector2(pos.X, pos.Y), action));
|
AddFrameToReplay(new OsuReplayFrame((int)nextFrame, new Vector2(pos.X, pos.Y), action));
|
||||||
|
|
||||||
|
previousFrame = nextFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
t = ApplyModsToTime(spinner.EndTime - h.StartTime) * spinnerDirection;
|
t = ApplyModsToTimeDelta(previousFrame, spinner.EndTime) * spinnerDirection;
|
||||||
Vector2 endPosition = SPINNER_CENTRE + CirclePosition(t / 20 + angle, SPIN_RADIUS);
|
angle += (float)t / 20;
|
||||||
|
|
||||||
|
Vector2 endPosition = SPINNER_CENTRE + CirclePosition(angle, SPIN_RADIUS);
|
||||||
|
|
||||||
AddFrameToReplay(new OsuReplayFrame(spinner.EndTime, new Vector2(endPosition.X, endPosition.Y), action));
|
AddFrameToReplay(new OsuReplayFrame(spinner.EndTime, new Vector2(endPosition.X, endPosition.Y), action));
|
||||||
|
|
||||||
@ -359,7 +367,7 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Slider slider:
|
case Slider slider:
|
||||||
for (double j = FrameDelay; j < slider.Duration; j += FrameDelay)
|
for (double j = GetFrameDelay(slider.StartTime); j < slider.Duration; j += GetFrameDelay(slider.StartTime + j))
|
||||||
{
|
{
|
||||||
Vector2 pos = slider.StackedPositionAt(j / slider.Duration);
|
Vector2 pos = slider.StackedPositionAt(j / slider.Duration);
|
||||||
AddFrameToReplay(new OsuReplayFrame(h.StartTime + j, new Vector2(pos.X, pos.Y), action));
|
AddFrameToReplay(new OsuReplayFrame(h.StartTime + j, new Vector2(pos.X, pos.Y), action));
|
||||||
|
@ -5,7 +5,9 @@ using osuTK;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays;
|
||||||
|
|
||||||
@ -22,33 +24,61 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
|
|
||||||
public const float SPIN_RADIUS = 50;
|
public const float SPIN_RADIUS = 50;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The time in ms between each ReplayFrame.
|
|
||||||
/// </summary>
|
|
||||||
protected readonly double FrameDelay;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Construction / Initialisation
|
#region Construction / Initialisation
|
||||||
|
|
||||||
protected Replay Replay;
|
protected Replay Replay;
|
||||||
protected List<ReplayFrame> Frames => Replay.Frames;
|
protected List<ReplayFrame> Frames => Replay.Frames;
|
||||||
|
private readonly IReadOnlyList<IApplicableToRate> timeAffectingMods;
|
||||||
|
|
||||||
protected OsuAutoGeneratorBase(IBeatmap beatmap)
|
protected OsuAutoGeneratorBase(IBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(beatmap)
|
: base(beatmap)
|
||||||
{
|
{
|
||||||
Replay = new Replay();
|
Replay = new Replay();
|
||||||
|
|
||||||
// We are using ApplyModsToRate and not ApplyModsToTime to counteract the speed up / slow down from HalfTime / DoubleTime so that we remain at a constant framerate of 60 fps.
|
timeAffectingMods = mods.OfType<IApplicableToRate>().ToList();
|
||||||
FrameDelay = ApplyModsToRate(1000.0 / 60.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Utilities
|
#region Utilities
|
||||||
|
|
||||||
protected double ApplyModsToTime(double v) => v;
|
/// <summary>
|
||||||
protected double ApplyModsToRate(double v) => v;
|
/// Returns the real duration of time between <paramref name="startTime"/> and <paramref name="endTime"/>
|
||||||
|
/// after applying rate-affecting mods.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method should only be used when <paramref name="startTime"/> and <paramref name="endTime"/> are very close.
|
||||||
|
/// That is because the track rate might be changing with time,
|
||||||
|
/// and the method used here is a rough instantaneous approximation.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="startTime">The start time of the time delta, in original track time.</param>
|
||||||
|
/// <param name="endTime">The end time of the time delta, in original track time.</param>
|
||||||
|
protected double ApplyModsToTimeDelta(double startTime, double endTime)
|
||||||
|
{
|
||||||
|
double delta = endTime - startTime;
|
||||||
|
|
||||||
|
foreach (var mod in timeAffectingMods)
|
||||||
|
delta /= mod.ApplyToRate(startTime);
|
||||||
|
|
||||||
|
return delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected double ApplyModsToRate(double time, double rate)
|
||||||
|
{
|
||||||
|
foreach (var mod in timeAffectingMods)
|
||||||
|
rate = mod.ApplyToRate(time, rate);
|
||||||
|
return rate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculates the interval after which the next <see cref="ReplayFrame"/> should be generated,
|
||||||
|
/// in milliseconds.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="time">The time of the previous frame.</param>
|
||||||
|
protected double GetFrameDelay(double time)
|
||||||
|
=> ApplyModsToRate(time, 1000.0 / 60);
|
||||||
|
|
||||||
private class ReplayFrameComparer : IComparer<ReplayFrame>
|
private class ReplayFrameComparer : IComparer<ReplayFrame>
|
||||||
{
|
{
|
||||||
|
@ -21,6 +21,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private OsuRulesetConfigManager config { get; set; }
|
private OsuRulesetConfigManager config { get; set; }
|
||||||
|
|
||||||
|
private readonly Bindable<bool> configSnakingOut = new Bindable<bool>();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ISkinSource skin, DrawableHitObject drawableObject)
|
private void load(ISkinSource skin, DrawableHitObject drawableObject)
|
||||||
{
|
{
|
||||||
@ -36,10 +38,28 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
accentColour.BindValueChanged(accent => updateAccentColour(skin, accent.NewValue), true);
|
accentColour.BindValueChanged(accent => updateAccentColour(skin, accent.NewValue), true);
|
||||||
|
|
||||||
config?.BindWith(OsuRulesetSetting.SnakingInSliders, SnakingIn);
|
config?.BindWith(OsuRulesetSetting.SnakingInSliders, SnakingIn);
|
||||||
config?.BindWith(OsuRulesetSetting.SnakingOutSliders, SnakingOut);
|
config?.BindWith(OsuRulesetSetting.SnakingOutSliders, configSnakingOut);
|
||||||
|
|
||||||
|
SnakingOut.BindTo(configSnakingOut);
|
||||||
|
|
||||||
BorderSize = skin.GetConfig<OsuSkinConfiguration, float>(OsuSkinConfiguration.SliderBorderSize)?.Value ?? 1;
|
BorderSize = skin.GetConfig<OsuSkinConfiguration, float>(OsuSkinConfiguration.SliderBorderSize)?.Value ?? 1;
|
||||||
BorderColour = skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderBorder)?.Value ?? Color4.White;
|
BorderColour = skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderBorder)?.Value ?? Color4.White;
|
||||||
|
|
||||||
|
drawableObject.HitObjectApplied += onHitObjectApplied;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onHitObjectApplied(DrawableHitObject obj)
|
||||||
|
{
|
||||||
|
var drawableSlider = (DrawableSlider)obj;
|
||||||
|
if (drawableSlider.HitObject == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// When not tracking the follow circle, unbind from the config and forcefully disable snaking out - it looks better that way.
|
||||||
|
if (!drawableSlider.HeadCircle.TrackFollowCircle)
|
||||||
|
{
|
||||||
|
SnakingOut.UnbindFrom(configSnakingOut);
|
||||||
|
SnakingOut.Value = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAccentColour(ISkinSource skin, Color4 defaultAccentColour)
|
private void updateAccentColour(ISkinSource skin, Color4 defaultAccentColour)
|
||||||
|
@ -31,6 +31,12 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
set => ball.Colour = value;
|
set => ball.Colour = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether to track accurately to the visual size of this <see cref="SliderBall"/>.
|
||||||
|
/// If <c>false</c>, tracking will be performed at the final scale at all times.
|
||||||
|
/// </summary>
|
||||||
|
public bool InputTracksVisualSize = true;
|
||||||
|
|
||||||
private readonly Drawable followCircle;
|
private readonly Drawable followCircle;
|
||||||
private readonly DrawableSlider drawableSlider;
|
private readonly DrawableSlider drawableSlider;
|
||||||
private readonly Drawable ball;
|
private readonly Drawable ball;
|
||||||
@ -94,7 +100,14 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
|
|
||||||
tracking = value;
|
tracking = value;
|
||||||
|
|
||||||
followCircle.ScaleTo(tracking ? 2.4f : 1f, 300, Easing.OutQuint);
|
if (InputTracksVisualSize)
|
||||||
|
followCircle.ScaleTo(tracking ? 2.4f : 1f, 300, Easing.OutQuint);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We need to always be tracking the final size, at both endpoints. For now, this is achieved by removing the scale duration.
|
||||||
|
followCircle.ScaleTo(tracking ? 2.4f : 1f);
|
||||||
|
}
|
||||||
|
|
||||||
followCircle.FadeTo(tracking ? 1f : 0, 300, Easing.OutQuint);
|
followCircle.FadeTo(tracking ? 1f : 0, 300, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
54
osu.Game.Rulesets.Osu/UI/ObjectOrderedHitPolicy.cs
Normal file
54
osu.Game.Rulesets.Osu/UI/ObjectOrderedHitPolicy.cs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
// 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.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Ensures that <see cref="HitObject"/>s are hit in order of appearance. The classic note lock.
|
||||||
|
/// <remarks>
|
||||||
|
/// Hits will be blocked until the previous <see cref="HitObject"/>s have been judged.
|
||||||
|
/// </remarks>
|
||||||
|
/// </summary>
|
||||||
|
public class ObjectOrderedHitPolicy : IHitPolicy
|
||||||
|
{
|
||||||
|
public IHitObjectContainer HitObjectContainer { get; set; }
|
||||||
|
|
||||||
|
public bool IsHittable(DrawableHitObject hitObject, double time) => enumerateHitObjectsUpTo(hitObject.HitObject.StartTime).All(obj => obj.AllJudged);
|
||||||
|
|
||||||
|
public void HandleHit(DrawableHitObject hitObject)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<DrawableHitObject> enumerateHitObjectsUpTo(double targetTime)
|
||||||
|
{
|
||||||
|
foreach (var obj in HitObjectContainer.AliveObjects)
|
||||||
|
{
|
||||||
|
if (obj.HitObject.StartTime >= targetTime)
|
||||||
|
yield break;
|
||||||
|
|
||||||
|
switch (obj)
|
||||||
|
{
|
||||||
|
case DrawableSpinner _:
|
||||||
|
continue;
|
||||||
|
|
||||||
|
case DrawableSlider slider:
|
||||||
|
yield return slider.HeadCircle;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
yield return obj;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -31,7 +31,6 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
private readonly ProxyContainer spinnerProxies;
|
private readonly ProxyContainer spinnerProxies;
|
||||||
private readonly JudgementContainer<DrawableOsuJudgement> judgementLayer;
|
private readonly JudgementContainer<DrawableOsuJudgement> judgementLayer;
|
||||||
private readonly FollowPointRenderer followPoints;
|
private readonly FollowPointRenderer followPoints;
|
||||||
private readonly StartTimeOrderedHitPolicy hitPolicy;
|
|
||||||
|
|
||||||
public static readonly Vector2 BASE_SIZE = new Vector2(512, 384);
|
public static readonly Vector2 BASE_SIZE = new Vector2(512, 384);
|
||||||
|
|
||||||
@ -54,10 +53,9 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
approachCircles = new ProxyContainer { RelativeSizeAxes = Axes.Both },
|
approachCircles = new ProxyContainer { RelativeSizeAxes = Axes.Both },
|
||||||
};
|
};
|
||||||
|
|
||||||
hitPolicy = new StartTimeOrderedHitPolicy { HitObjectContainer = HitObjectContainer };
|
HitPolicy = new StartTimeOrderedHitPolicy();
|
||||||
|
|
||||||
var hitWindows = new OsuHitWindows();
|
var hitWindows = new OsuHitWindows();
|
||||||
|
|
||||||
foreach (var result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Where(r => r > HitResult.None && hitWindows.IsHitResultAllowed(r)))
|
foreach (var result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Where(r => r > HitResult.None && hitWindows.IsHitResultAllowed(r)))
|
||||||
poolDictionary.Add(result, new DrawableJudgementPool(result, onJudgmentLoaded));
|
poolDictionary.Add(result, new DrawableJudgementPool(result, onJudgmentLoaded));
|
||||||
|
|
||||||
@ -66,6 +64,18 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
NewResult += onNewResult;
|
NewResult += onNewResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IHitPolicy hitPolicy;
|
||||||
|
|
||||||
|
public IHitPolicy HitPolicy
|
||||||
|
{
|
||||||
|
get => hitPolicy;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
hitPolicy = value ?? throw new ArgumentNullException(nameof(value));
|
||||||
|
hitPolicy.HitObjectContainer = HitObjectContainer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnNewDrawableHitObject(DrawableHitObject drawable)
|
protected override void OnNewDrawableHitObject(DrawableHitObject drawable)
|
||||||
{
|
{
|
||||||
((DrawableOsuHitObject)drawable).CheckHittable = hitPolicy.IsHittable;
|
((DrawableOsuHitObject)drawable).CheckHittable = hitPolicy.IsHittable;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.13.1" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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.Collections.Generic;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
@ -12,7 +13,7 @@ namespace osu.Game.Rulesets.Taiko.Mods
|
|||||||
{
|
{
|
||||||
public class TaikoModAutoplay : ModAutoplay<TaikoHitObject>
|
public class TaikoModAutoplay : ModAutoplay<TaikoHitObject>
|
||||||
{
|
{
|
||||||
public override Score CreateReplayScore(IBeatmap beatmap) => new Score
|
public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList<Mod> mods) => new Score
|
||||||
{
|
{
|
||||||
ScoreInfo = new ScoreInfo { User = new User { Username = "mekkadosu!" } },
|
ScoreInfo = new ScoreInfo { User = new User { Username = "mekkadosu!" } },
|
||||||
Replay = new TaikoAutoGenerator(beatmap).Generate(),
|
Replay = new TaikoAutoGenerator(beatmap).Generate(),
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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.Collections.Generic;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
@ -12,7 +13,7 @@ namespace osu.Game.Rulesets.Taiko.Mods
|
|||||||
{
|
{
|
||||||
public class TaikoModCinema : ModCinema<TaikoHitObject>
|
public class TaikoModCinema : ModCinema<TaikoHitObject>
|
||||||
{
|
{
|
||||||
public override Score CreateReplayScore(IBeatmap beatmap) => new Score
|
public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList<Mod> mods) => new Score
|
||||||
{
|
{
|
||||||
ScoreInfo = new ScoreInfo { User = new User { Username = "mekkadosu!" } },
|
ScoreInfo = new ScoreInfo { User = new User { Username = "mekkadosu!" } },
|
||||||
Replay = new TaikoAutoGenerator(beatmap).Generate(),
|
Replay = new TaikoAutoGenerator(beatmap).Generate(),
|
||||||
|
@ -152,7 +152,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
|||||||
throw new ArgumentOutOfRangeException(nameof(component), $"Invalid component type: {component}");
|
throw new ArgumentOutOfRangeException(nameof(component), $"Invalid component type: {component}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SampleChannel GetSample(ISampleInfo sampleInfo) => Source.GetSample(new LegacyTaikoSampleInfo(sampleInfo));
|
public override Sample GetSample(ISampleInfo sampleInfo) => Source.GetSample(new LegacyTaikoSampleInfo(sampleInfo));
|
||||||
|
|
||||||
public override IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => Source.GetConfig<TLookup, TValue>(lookup);
|
public override IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => Source.GetConfig<TLookup, TValue>(lookup);
|
||||||
|
|
||||||
|
@ -21,6 +21,27 @@ namespace osu.Game.Tests.Chat
|
|||||||
Assert.AreEqual(36, result.Links[0].Length);
|
Assert.AreEqual(36, result.Links[0].Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase(LinkAction.OpenBeatmap, "456", "https://dev.ppy.sh/beatmapsets/123#osu/456")]
|
||||||
|
[TestCase(LinkAction.OpenBeatmap, "456", "https://dev.ppy.sh/beatmapsets/123#osu/456?whatever")]
|
||||||
|
[TestCase(LinkAction.OpenBeatmap, "456", "https://dev.ppy.sh/beatmapsets/123/456")]
|
||||||
|
[TestCase(LinkAction.External, null, "https://dev.ppy.sh/beatmapsets/abc/def")]
|
||||||
|
[TestCase(LinkAction.OpenBeatmapSet, "123", "https://dev.ppy.sh/beatmapsets/123")]
|
||||||
|
[TestCase(LinkAction.OpenBeatmapSet, "123", "https://dev.ppy.sh/beatmapsets/123/whatever")]
|
||||||
|
[TestCase(LinkAction.External, null, "https://dev.ppy.sh/beatmapsets/abc")]
|
||||||
|
public void TestBeatmapLinks(LinkAction expectedAction, string expectedArg, string link)
|
||||||
|
{
|
||||||
|
MessageFormatter.WebsiteRootUrl = "dev.ppy.sh";
|
||||||
|
|
||||||
|
Message result = MessageFormatter.FormatMessage(new Message { Content = link });
|
||||||
|
|
||||||
|
Assert.AreEqual(result.Content, result.DisplayContent);
|
||||||
|
Assert.AreEqual(1, result.Links.Count);
|
||||||
|
Assert.AreEqual(expectedAction, result.Links[0].Action);
|
||||||
|
Assert.AreEqual(expectedArg, result.Links[0].Argument);
|
||||||
|
if (expectedAction == LinkAction.External)
|
||||||
|
Assert.AreEqual(link, result.Links[0].Url);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestMultipleComplexLinks()
|
public void TestMultipleComplexLinks()
|
||||||
{
|
{
|
||||||
|
@ -121,7 +121,7 @@ namespace osu.Game.Tests.Gameplay
|
|||||||
|
|
||||||
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => throw new NotImplementedException();
|
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => throw new NotImplementedException();
|
||||||
|
|
||||||
public SampleChannel GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
|
public Sample GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
|
||||||
|
|
||||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
|
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Tests.Gameplay
|
|||||||
public void TestRetrieveTopLevelSample()
|
public void TestRetrieveTopLevelSample()
|
||||||
{
|
{
|
||||||
ISkin skin = null;
|
ISkin skin = null;
|
||||||
SampleChannel channel = null;
|
Sample channel = null;
|
||||||
|
|
||||||
AddStep("create skin", () => skin = new TestSkin("test-sample", this));
|
AddStep("create skin", () => skin = new TestSkin("test-sample", this));
|
||||||
AddStep("retrieve sample", () => channel = skin.GetSample(new SampleInfo("test-sample")));
|
AddStep("retrieve sample", () => channel = skin.GetSample(new SampleInfo("test-sample")));
|
||||||
@ -47,7 +47,7 @@ namespace osu.Game.Tests.Gameplay
|
|||||||
public void TestRetrieveSampleInSubFolder()
|
public void TestRetrieveSampleInSubFolder()
|
||||||
{
|
{
|
||||||
ISkin skin = null;
|
ISkin skin = null;
|
||||||
SampleChannel channel = null;
|
Sample channel = null;
|
||||||
|
|
||||||
AddStep("create skin", () => skin = new TestSkin("folder/test-sample", this));
|
AddStep("create skin", () => skin = new TestSkin("folder/test-sample", this));
|
||||||
AddStep("retrieve sample", () => channel = skin.GetSample(new SampleInfo("folder/test-sample")));
|
AddStep("retrieve sample", () => channel = skin.GetSample(new SampleInfo("folder/test-sample")));
|
||||||
|
@ -59,7 +59,7 @@ namespace osu.Game.Tests.NonVisual.Skinning
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Drawable GetDrawableComponent(ISkinComponent component) => throw new NotSupportedException();
|
public Drawable GetDrawableComponent(ISkinComponent component) => throw new NotSupportedException();
|
||||||
public SampleChannel GetSample(ISampleInfo sampleInfo) => throw new NotSupportedException();
|
public Sample GetSample(ISampleInfo sampleInfo) => throw new NotSupportedException();
|
||||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotSupportedException();
|
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,12 +68,29 @@ namespace osu.Game.Tests.Online
|
|||||||
Assert.That(converted.FinalRate.Value, Is.EqualTo(0.25));
|
Assert.That(converted.FinalRate.Value, Is.EqualTo(0.25));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestDeserialiseDifficultyAdjustModWithExtendedLimits()
|
||||||
|
{
|
||||||
|
var apiMod = new APIMod(new TestModDifficultyAdjust
|
||||||
|
{
|
||||||
|
OverallDifficulty = { Value = 11 },
|
||||||
|
ExtendedLimits = { Value = true }
|
||||||
|
});
|
||||||
|
|
||||||
|
var deserialised = JsonConvert.DeserializeObject<APIMod>(JsonConvert.SerializeObject(apiMod));
|
||||||
|
var converted = (TestModDifficultyAdjust)deserialised.ToMod(new TestRuleset());
|
||||||
|
|
||||||
|
Assert.That(converted.ExtendedLimits.Value, Is.True);
|
||||||
|
Assert.That(converted.OverallDifficulty.Value, Is.EqualTo(11));
|
||||||
|
}
|
||||||
|
|
||||||
private class TestRuleset : Ruleset
|
private class TestRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override IEnumerable<Mod> GetModsFor(ModType type) => new Mod[]
|
public override IEnumerable<Mod> GetModsFor(ModType type) => new Mod[]
|
||||||
{
|
{
|
||||||
new TestMod(),
|
new TestMod(),
|
||||||
new TestModTimeRamp(),
|
new TestModTimeRamp(),
|
||||||
|
new TestModDifficultyAdjust()
|
||||||
};
|
};
|
||||||
|
|
||||||
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => throw new System.NotImplementedException();
|
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => throw new System.NotImplementedException();
|
||||||
@ -135,5 +152,9 @@ namespace osu.Game.Tests.Online
|
|||||||
Value = true
|
Value = true
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TestModDifficultyAdjust : ModDifficultyAdjust
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,16 @@ namespace osu.Game.Tests.Online
|
|||||||
Assert.That(converted.FinalRate.Value, Is.EqualTo(0.25));
|
Assert.That(converted.FinalRate.Value, Is.EqualTo(0.25));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestDeserialiseEnumMod()
|
||||||
|
{
|
||||||
|
var apiMod = new APIMod(new TestModEnum { TestSetting = { Value = TestEnum.Value2 } });
|
||||||
|
|
||||||
|
var deserialized = MessagePackSerializer.Deserialize<APIMod>(MessagePackSerializer.Serialize(apiMod));
|
||||||
|
|
||||||
|
Assert.That(deserialized.Settings, Contains.Key("test_setting").With.ContainValue(1));
|
||||||
|
}
|
||||||
|
|
||||||
private class TestRuleset : Ruleset
|
private class TestRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override IEnumerable<Mod> GetModsFor(ModType type) => new Mod[]
|
public override IEnumerable<Mod> GetModsFor(ModType type) => new Mod[]
|
||||||
@ -135,5 +145,22 @@ namespace osu.Game.Tests.Online
|
|||||||
Value = true
|
Value = true
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TestModEnum : Mod
|
||||||
|
{
|
||||||
|
public override string Name => "Test Mod";
|
||||||
|
public override string Acronym => "TM";
|
||||||
|
public override double ScoreMultiplier => 1;
|
||||||
|
|
||||||
|
[SettingSource("Test")]
|
||||||
|
public Bindable<TestEnum> TestSetting { get; } = new Bindable<TestEnum>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private enum TestEnum
|
||||||
|
{
|
||||||
|
Value1 = 0,
|
||||||
|
Value2 = 1,
|
||||||
|
Value3 = 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,10 +165,10 @@ namespace osu.Game.Tests.Online
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<BeatmapSetInfo> Import(BeatmapSetInfo item, ArchiveReader archive = null, CancellationToken cancellationToken = default)
|
public override async Task<BeatmapSetInfo> Import(BeatmapSetInfo item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
await AllowImport.Task;
|
await AllowImport.Task;
|
||||||
return await (CurrentImportTask = base.Import(item, archive, cancellationToken));
|
return await (CurrentImportTask = base.Import(item, archive, lowPriority, cancellationToken));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,9 +105,9 @@ namespace osu.Game.Tests.Rulesets
|
|||||||
IsDisposed = true;
|
IsDisposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SampleChannel Get(string name) => null;
|
public Sample Get(string name) => null;
|
||||||
|
|
||||||
public Task<SampleChannel> GetAsync(string name) => null;
|
public Task<Sample> GetAsync(string name) => null;
|
||||||
|
|
||||||
public Stream GetStream(string name) => null;
|
public Stream GetStream(string name) => null;
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ namespace osu.Game.Tests.Skins
|
|||||||
|
|
||||||
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => skin.GetTexture(componentName, wrapModeS, wrapModeT);
|
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => skin.GetTexture(componentName, wrapModeS, wrapModeT);
|
||||||
|
|
||||||
public SampleChannel GetSample(ISampleInfo sampleInfo) => skin.GetSample(sampleInfo);
|
public Sample GetSample(ISampleInfo sampleInfo) => skin.GetSample(sampleInfo);
|
||||||
|
|
||||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => skin.GetConfig<TLookup, TValue>(lookup);
|
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => skin.GetConfig<TLookup, TValue>(lookup);
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics.Audio;
|
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Editing
|
namespace osu.Game.Tests.Visual.Editing
|
||||||
{
|
{
|
||||||
@ -19,14 +19,14 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
public void TestSlidingSampleStopsOnSeek()
|
public void TestSlidingSampleStopsOnSeek()
|
||||||
{
|
{
|
||||||
DrawableSlider slider = null;
|
DrawableSlider slider = null;
|
||||||
DrawableSample[] loopingSamples = null;
|
PoolableSkinnableSample[] loopingSamples = null;
|
||||||
DrawableSample[] onceOffSamples = null;
|
PoolableSkinnableSample[] onceOffSamples = null;
|
||||||
|
|
||||||
AddStep("get first slider", () =>
|
AddStep("get first slider", () =>
|
||||||
{
|
{
|
||||||
slider = Editor.ChildrenOfType<DrawableSlider>().OrderBy(s => s.HitObject.StartTime).First();
|
slider = Editor.ChildrenOfType<DrawableSlider>().OrderBy(s => s.HitObject.StartTime).First();
|
||||||
onceOffSamples = slider.ChildrenOfType<DrawableSample>().Where(s => !s.Looping).ToArray();
|
onceOffSamples = slider.ChildrenOfType<PoolableSkinnableSample>().Where(s => !s.Looping).ToArray();
|
||||||
loopingSamples = slider.ChildrenOfType<DrawableSample>().Where(s => s.Looping).ToArray();
|
loopingSamples = slider.ChildrenOfType<PoolableSkinnableSample>().Where(s => s.Looping).ToArray();
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("start playback", () => EditorClock.Start());
|
AddStep("start playback", () => EditorClock.Start());
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics.Audio;
|
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
@ -20,14 +19,14 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
public void TestAllSamplesStopDuringSeek()
|
public void TestAllSamplesStopDuringSeek()
|
||||||
{
|
{
|
||||||
DrawableSlider slider = null;
|
DrawableSlider slider = null;
|
||||||
DrawableSample[] samples = null;
|
PoolableSkinnableSample[] samples = null;
|
||||||
ISamplePlaybackDisabler sampleDisabler = null;
|
ISamplePlaybackDisabler sampleDisabler = null;
|
||||||
|
|
||||||
AddUntilStep("get variables", () =>
|
AddUntilStep("get variables", () =>
|
||||||
{
|
{
|
||||||
sampleDisabler = Player;
|
sampleDisabler = Player;
|
||||||
slider = Player.ChildrenOfType<DrawableSlider>().OrderBy(s => s.HitObject.StartTime).FirstOrDefault();
|
slider = Player.ChildrenOfType<DrawableSlider>().OrderBy(s => s.HitObject.StartTime).FirstOrDefault();
|
||||||
samples = slider?.ChildrenOfType<DrawableSample>().ToArray();
|
samples = slider?.ChildrenOfType<PoolableSkinnableSample>().ToArray();
|
||||||
|
|
||||||
return slider != null;
|
return slider != null;
|
||||||
});
|
});
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
var beatmap = Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo, Array.Empty<Mod>());
|
var beatmap = Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo, Array.Empty<Mod>());
|
||||||
|
|
||||||
return new ScoreAccessibleReplayPlayer(ruleset.GetAutoplayMod()?.CreateReplayScore(beatmap));
|
return new ScoreAccessibleReplayPlayer(ruleset.GetAutoplayMod()?.CreateReplayScore(beatmap, Array.Empty<Mod>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void AddCheckSteps()
|
protected override void AddCheckSteps()
|
||||||
|
@ -298,7 +298,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => throw new NotImplementedException();
|
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => throw new NotImplementedException();
|
||||||
|
|
||||||
public SampleChannel GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
|
public Sample GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
|
||||||
|
|
||||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotImplementedException();
|
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@ -309,7 +309,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => throw new NotImplementedException();
|
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => throw new NotImplementedException();
|
||||||
|
|
||||||
public SampleChannel GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
|
public Sample GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
|
||||||
|
|
||||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotImplementedException();
|
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@ -321,7 +321,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => throw new NotImplementedException();
|
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => throw new NotImplementedException();
|
||||||
|
|
||||||
public SampleChannel GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
|
public Sample GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
|
||||||
|
|
||||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotImplementedException();
|
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
@ -43,70 +43,60 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestStoppedSoundDoesntResumeAfterPause()
|
public void TestStoppedSoundDoesntResumeAfterPause()
|
||||||
{
|
{
|
||||||
DrawableSample sample = null;
|
|
||||||
AddStep("start sample with looping", () =>
|
AddStep("start sample with looping", () =>
|
||||||
{
|
{
|
||||||
sample = skinnableSound.ChildrenOfType<DrawableSample>().First();
|
|
||||||
|
|
||||||
skinnableSound.Looping = true;
|
skinnableSound.Looping = true;
|
||||||
skinnableSound.Play();
|
skinnableSound.Play();
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for sample to start playing", () => sample.Playing);
|
AddUntilStep("wait for sample to start playing", () => skinnableSound.IsPlaying);
|
||||||
|
|
||||||
AddStep("stop sample", () => skinnableSound.Stop());
|
AddStep("stop sample", () => skinnableSound.Stop());
|
||||||
|
|
||||||
AddUntilStep("wait for sample to stop playing", () => !sample.Playing);
|
AddUntilStep("wait for sample to stop playing", () => !skinnableSound.IsPlaying);
|
||||||
|
|
||||||
AddStep("disable sample playback", () => skinSource.SamplePlaybackDisabled.Value = true);
|
AddStep("disable sample playback", () => skinSource.SamplePlaybackDisabled.Value = true);
|
||||||
|
|
||||||
AddStep("enable sample playback", () => skinSource.SamplePlaybackDisabled.Value = false);
|
AddStep("enable sample playback", () => skinSource.SamplePlaybackDisabled.Value = false);
|
||||||
|
|
||||||
AddWaitStep("wait a bit", 5);
|
AddWaitStep("wait a bit", 5);
|
||||||
AddAssert("sample not playing", () => !sample.Playing);
|
AddAssert("sample not playing", () => !skinnableSound.IsPlaying);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestLoopingSoundResumesAfterPause()
|
public void TestLoopingSoundResumesAfterPause()
|
||||||
{
|
{
|
||||||
DrawableSample sample = null;
|
|
||||||
AddStep("start sample with looping", () =>
|
AddStep("start sample with looping", () =>
|
||||||
{
|
{
|
||||||
skinnableSound.Looping = true;
|
skinnableSound.Looping = true;
|
||||||
skinnableSound.Play();
|
skinnableSound.Play();
|
||||||
sample = skinnableSound.ChildrenOfType<DrawableSample>().First();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for sample to start playing", () => sample.Playing);
|
AddUntilStep("wait for sample to start playing", () => skinnableSound.IsPlaying);
|
||||||
|
|
||||||
AddStep("disable sample playback", () => skinSource.SamplePlaybackDisabled.Value = true);
|
AddStep("disable sample playback", () => skinSource.SamplePlaybackDisabled.Value = true);
|
||||||
AddUntilStep("wait for sample to stop playing", () => !sample.Playing);
|
AddUntilStep("wait for sample to stop playing", () => !skinnableSound.IsPlaying);
|
||||||
|
|
||||||
AddStep("enable sample playback", () => skinSource.SamplePlaybackDisabled.Value = false);
|
AddStep("enable sample playback", () => skinSource.SamplePlaybackDisabled.Value = false);
|
||||||
AddUntilStep("wait for sample to start playing", () => sample.Playing);
|
AddUntilStep("wait for sample to start playing", () => skinnableSound.IsPlaying);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestNonLoopingStopsWithPause()
|
public void TestNonLoopingStopsWithPause()
|
||||||
{
|
{
|
||||||
DrawableSample sample = null;
|
AddStep("start sample", () => skinnableSound.Play());
|
||||||
AddStep("start sample", () =>
|
|
||||||
{
|
|
||||||
skinnableSound.Play();
|
|
||||||
sample = skinnableSound.ChildrenOfType<DrawableSample>().First();
|
|
||||||
});
|
|
||||||
|
|
||||||
AddAssert("sample playing", () => sample.Playing);
|
AddAssert("sample playing", () => skinnableSound.IsPlaying);
|
||||||
|
|
||||||
AddStep("disable sample playback", () => skinSource.SamplePlaybackDisabled.Value = true);
|
AddStep("disable sample playback", () => skinSource.SamplePlaybackDisabled.Value = true);
|
||||||
|
|
||||||
AddUntilStep("sample not playing", () => !sample.Playing);
|
AddUntilStep("sample not playing", () => !skinnableSound.IsPlaying);
|
||||||
|
|
||||||
AddStep("enable sample playback", () => skinSource.SamplePlaybackDisabled.Value = false);
|
AddStep("enable sample playback", () => skinSource.SamplePlaybackDisabled.Value = false);
|
||||||
|
|
||||||
AddAssert("sample not playing", () => !sample.Playing);
|
AddAssert("sample not playing", () => !skinnableSound.IsPlaying);
|
||||||
AddAssert("sample not playing", () => !sample.Playing);
|
AddAssert("sample not playing", () => !skinnableSound.IsPlaying);
|
||||||
AddAssert("sample not playing", () => !sample.Playing);
|
AddAssert("sample not playing", () => !skinnableSound.IsPlaying);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -119,10 +109,10 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
sample = skinnableSound.ChildrenOfType<DrawableSample>().Single();
|
sample = skinnableSound.ChildrenOfType<DrawableSample>().Single();
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("sample playing", () => sample.Playing);
|
AddAssert("sample playing", () => skinnableSound.IsPlaying);
|
||||||
|
|
||||||
AddStep("disable sample playback", () => skinSource.SamplePlaybackDisabled.Value = true);
|
AddStep("disable sample playback", () => skinSource.SamplePlaybackDisabled.Value = true);
|
||||||
AddUntilStep("wait for sample to stop playing", () => !sample.Playing);
|
AddUntilStep("wait for sample to stop playing", () => !skinnableSound.IsPlaying);
|
||||||
|
|
||||||
AddStep("trigger skin change", () => skinSource.TriggerSourceChanged());
|
AddStep("trigger skin change", () => skinSource.TriggerSourceChanged());
|
||||||
|
|
||||||
@ -133,11 +123,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
return sample != oldSample;
|
return sample != oldSample;
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("new sample stopped", () => !sample.Playing);
|
AddAssert("new sample stopped", () => !skinnableSound.IsPlaying);
|
||||||
AddStep("enable sample playback", () => skinSource.SamplePlaybackDisabled.Value = false);
|
AddStep("enable sample playback", () => skinSource.SamplePlaybackDisabled.Value = false);
|
||||||
|
|
||||||
AddWaitStep("wait a bit", 5);
|
AddWaitStep("wait a bit", 5);
|
||||||
AddAssert("new sample not played", () => !sample.Playing);
|
AddAssert("new sample not played", () => !skinnableSound.IsPlaying);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Cached(typeof(ISkinSource))]
|
[Cached(typeof(ISkinSource))]
|
||||||
@ -155,7 +145,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
public Drawable GetDrawableComponent(ISkinComponent component) => source?.GetDrawableComponent(component);
|
public Drawable GetDrawableComponent(ISkinComponent component) => source?.GetDrawableComponent(component);
|
||||||
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => source?.GetTexture(componentName, wrapModeS, wrapModeT);
|
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => source?.GetTexture(componentName, wrapModeS, wrapModeT);
|
||||||
public SampleChannel GetSample(ISampleInfo sampleInfo) => source?.GetSample(sampleInfo);
|
public Sample GetSample(ISampleInfo sampleInfo) => source?.GetSample(sampleInfo);
|
||||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => source?.GetConfig<TLookup, TValue>(lookup);
|
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => source?.GetConfig<TLookup, TValue>(lookup);
|
||||||
|
|
||||||
public void TriggerSourceChanged()
|
public void TriggerSourceChanged()
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -244,11 +243,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task Connect()
|
|
||||||
{
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void StartPlay(int beatmapId)
|
public void StartPlay(int beatmapId)
|
||||||
{
|
{
|
||||||
this.beatmapId = beatmapId;
|
this.beatmapId = beatmapId;
|
||||||
|
@ -69,6 +69,20 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddAssert("last room joined", () => RoomManager.Rooms.Last().Status.Value is JoinedRoomStatus);
|
AddAssert("last room joined", () => RoomManager.Rooms.Last().Status.Value is JoinedRoomStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestClickDeselection()
|
||||||
|
{
|
||||||
|
AddRooms(1);
|
||||||
|
|
||||||
|
AddAssert("no selection", () => checkRoomSelected(null));
|
||||||
|
|
||||||
|
press(Key.Down);
|
||||||
|
AddAssert("first room selected", () => checkRoomSelected(RoomManager.Rooms.First()));
|
||||||
|
|
||||||
|
AddStep("click away", () => InputManager.Click(MouseButton.Left));
|
||||||
|
AddAssert("no selection", () => checkRoomSelected(null));
|
||||||
|
}
|
||||||
|
|
||||||
private void press(Key down)
|
private void press(Key down)
|
||||||
{
|
{
|
||||||
AddStep($"press {down}", () => InputManager.Key(down));
|
AddStep($"press {down}", () => InputManager.Key(down));
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -163,8 +162,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
((ISpectatorClient)this).UserSentFrames(userId, new FrameDataBundle(header, Array.Empty<LegacyReplayFrame>()));
|
((ISpectatorClient)this).UserSentFrames(userId, new FrameDataBundle(header, Array.Empty<LegacyReplayFrame>()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task Connect() => Task.CompletedTask;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,10 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Online;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu.Mods;
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
using osu.Game.Screens.OnlinePlay.Multiplayer.Participants;
|
using osu.Game.Screens.OnlinePlay.Multiplayer.Participants;
|
||||||
@ -19,16 +22,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
public class TestSceneMultiplayerParticipantsList : MultiplayerTestScene
|
public class TestSceneMultiplayerParticipantsList : MultiplayerTestScene
|
||||||
{
|
{
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public new void Setup() => Schedule(() =>
|
public new void Setup() => Schedule(createNewParticipantsList);
|
||||||
{
|
|
||||||
Child = new ParticipantsList
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
Size = new Vector2(380, 0.7f)
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestAddUser()
|
public void TestAddUser()
|
||||||
@ -75,6 +69,50 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddAssert("single panel is for second user", () => this.ChildrenOfType<ParticipantPanel>().Single().User.User == secondUser);
|
AddAssert("single panel is for second user", () => this.ChildrenOfType<ParticipantPanel>().Single().User.User == secondUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestGameStateHasPriorityOverDownloadState()
|
||||||
|
{
|
||||||
|
AddStep("set to downloading map", () => Client.ChangeBeatmapAvailability(BeatmapAvailability.Downloading(0)));
|
||||||
|
checkProgressBarVisibility(true);
|
||||||
|
|
||||||
|
AddStep("make user ready", () => Client.ChangeState(MultiplayerUserState.Results));
|
||||||
|
checkProgressBarVisibility(false);
|
||||||
|
AddUntilStep("ready mark visible", () => this.ChildrenOfType<StateDisplay>().Single().IsPresent);
|
||||||
|
|
||||||
|
AddStep("make user ready", () => Client.ChangeState(MultiplayerUserState.Idle));
|
||||||
|
checkProgressBarVisibility(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestCorrectInitialState()
|
||||||
|
{
|
||||||
|
AddStep("set to downloading map", () => Client.ChangeBeatmapAvailability(BeatmapAvailability.Downloading(0)));
|
||||||
|
AddStep("recreate list", createNewParticipantsList);
|
||||||
|
checkProgressBarVisibility(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestBeatmapDownloadingStates()
|
||||||
|
{
|
||||||
|
AddStep("set to no map", () => Client.ChangeBeatmapAvailability(BeatmapAvailability.NotDownloaded()));
|
||||||
|
AddStep("set to downloading map", () => Client.ChangeBeatmapAvailability(BeatmapAvailability.Downloading(0)));
|
||||||
|
|
||||||
|
checkProgressBarVisibility(true);
|
||||||
|
|
||||||
|
AddRepeatStep("increment progress", () =>
|
||||||
|
{
|
||||||
|
var progress = this.ChildrenOfType<ParticipantPanel>().Single().User.BeatmapAvailability.DownloadProgress ?? 0;
|
||||||
|
Client.ChangeBeatmapAvailability(BeatmapAvailability.Downloading(progress + RNG.NextSingle(0.1f)));
|
||||||
|
}, 25);
|
||||||
|
|
||||||
|
AddAssert("progress bar increased", () => this.ChildrenOfType<ProgressBar>().Single().Current.Value > 0);
|
||||||
|
|
||||||
|
AddStep("set to importing map", () => Client.ChangeBeatmapAvailability(BeatmapAvailability.Importing()));
|
||||||
|
checkProgressBarVisibility(false);
|
||||||
|
|
||||||
|
AddStep("set to available", () => Client.ChangeBeatmapAvailability(BeatmapAvailability.LocallyAvailable()));
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestToggleReadyState()
|
public void TestToggleReadyState()
|
||||||
{
|
{
|
||||||
@ -122,6 +160,26 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
});
|
});
|
||||||
|
|
||||||
Client.ChangeUserState(i, (MultiplayerUserState)RNG.Next(0, (int)MultiplayerUserState.Results + 1));
|
Client.ChangeUserState(i, (MultiplayerUserState)RNG.Next(0, (int)MultiplayerUserState.Results + 1));
|
||||||
|
|
||||||
|
if (RNG.NextBool())
|
||||||
|
{
|
||||||
|
var beatmapState = (DownloadState)RNG.Next(0, (int)DownloadState.LocallyAvailable + 1);
|
||||||
|
|
||||||
|
switch (beatmapState)
|
||||||
|
{
|
||||||
|
case DownloadState.NotDownloaded:
|
||||||
|
Client.ChangeUserBeatmapAvailability(i, BeatmapAvailability.NotDownloaded());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DownloadState.Downloading:
|
||||||
|
Client.ChangeUserBeatmapAvailability(i, BeatmapAvailability.Downloading(RNG.NextSingle()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DownloadState.Importing:
|
||||||
|
Client.ChangeUserBeatmapAvailability(i, BeatmapAvailability.Importing());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -152,5 +210,14 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddStep($"set state: {state}", () => Client.ChangeUserState(0, state));
|
AddStep($"set state: {state}", () => Client.ChangeUserState(0, state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createNewParticipantsList()
|
||||||
|
{
|
||||||
|
Child = new ParticipantsList { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Y, Size = new Vector2(380, 0.7f) };
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkProgressBarVisibility(bool visible) =>
|
||||||
|
AddUntilStep($"progress bar {(visible ? "is" : "is not")}visible", () =>
|
||||||
|
this.ChildrenOfType<ProgressBar>().Single().IsPresent == visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
Ruleset.Value = new OsuRuleset().RulesetInfo;
|
Ruleset.Value = new OsuRuleset().RulesetInfo;
|
||||||
Beatmap.SetDefault();
|
Beatmap.SetDefault();
|
||||||
|
SelectedMods.Value = Array.Empty<Mod>();
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("create song select", () => LoadScreen(songSelect = new TestPlaylistsSongSelect()));
|
AddStep("create song select", () => LoadScreen(songSelect = new TestPlaylistsSongSelect()));
|
||||||
@ -143,7 +144,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
/// Tests that the same <see cref="Mod"/> instances are not shared between two playlist items.
|
/// Tests that the same <see cref="Mod"/> instances are not shared between two playlist items.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
[Ignore("Temporarily disabled due to a non-trivial test failure")]
|
|
||||||
public void TestNewItemHasNewModInstances()
|
public void TestNewItemHasNewModInstances()
|
||||||
{
|
{
|
||||||
AddStep("set dt mod", () => SelectedMods.Value = new[] { new OsuModDoubleTime() });
|
AddStep("set dt mod", () => SelectedMods.Value = new[] { new OsuModDoubleTime() });
|
||||||
|
@ -103,26 +103,26 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
private void testLinksGeneral()
|
private void testLinksGeneral()
|
||||||
{
|
{
|
||||||
addMessageWithChecks("test!");
|
addMessageWithChecks("test!");
|
||||||
addMessageWithChecks("osu.ppy.sh!");
|
addMessageWithChecks("dev.ppy.sh!");
|
||||||
addMessageWithChecks("https://osu.ppy.sh!", 1, expectedActions: LinkAction.External);
|
addMessageWithChecks("https://dev.ppy.sh!", 1, expectedActions: LinkAction.External);
|
||||||
addMessageWithChecks("00:12:345 (1,2) - Test?", 1, expectedActions: LinkAction.OpenEditorTimestamp);
|
addMessageWithChecks("00:12:345 (1,2) - Test?", 1, expectedActions: LinkAction.OpenEditorTimestamp);
|
||||||
addMessageWithChecks("Wiki link for tasty [[Performance Points]]", 1, expectedActions: LinkAction.External);
|
addMessageWithChecks("Wiki link for tasty [[Performance Points]]", 1, expectedActions: LinkAction.External);
|
||||||
addMessageWithChecks("(osu forums)[https://osu.ppy.sh/forum] (old link format)", 1, expectedActions: LinkAction.External);
|
addMessageWithChecks("(osu forums)[https://dev.ppy.sh/forum] (old link format)", 1, expectedActions: LinkAction.External);
|
||||||
addMessageWithChecks("[https://osu.ppy.sh/home New site] (new link format)", 1, expectedActions: LinkAction.External);
|
addMessageWithChecks("[https://dev.ppy.sh/home New site] (new link format)", 1, expectedActions: LinkAction.External);
|
||||||
addMessageWithChecks("[osu forums](https://osu.ppy.sh/forum) (new link format 2)", 1, expectedActions: LinkAction.External);
|
addMessageWithChecks("[osu forums](https://dev.ppy.sh/forum) (new link format 2)", 1, expectedActions: LinkAction.External);
|
||||||
addMessageWithChecks("[https://osu.ppy.sh/home This is only a link to the new osu webpage but this is supposed to test word wrap.]", 1, expectedActions: LinkAction.External);
|
addMessageWithChecks("[https://dev.ppy.sh/home This is only a link to the new osu webpage but this is supposed to test word wrap.]", 1, expectedActions: LinkAction.External);
|
||||||
addMessageWithChecks("is now listening to [https://osu.ppy.sh/s/93523 IMAGE -MATERIAL- <Version 0>]", 1, true, expectedActions: LinkAction.OpenBeatmapSet);
|
addMessageWithChecks("is now listening to [https://dev.ppy.sh/s/93523 IMAGE -MATERIAL- <Version 0>]", 1, true, expectedActions: LinkAction.OpenBeatmapSet);
|
||||||
addMessageWithChecks("is now playing [https://osu.ppy.sh/b/252238 IMAGE -MATERIAL- <Version 0>]", 1, true, expectedActions: LinkAction.OpenBeatmap);
|
addMessageWithChecks("is now playing [https://dev.ppy.sh/b/252238 IMAGE -MATERIAL- <Version 0>]", 1, true, expectedActions: LinkAction.OpenBeatmap);
|
||||||
addMessageWithChecks("Let's (try)[https://osu.ppy.sh/home] [https://osu.ppy.sh/b/252238 multiple links] https://osu.ppy.sh/home", 3,
|
addMessageWithChecks("Let's (try)[https://dev.ppy.sh/home] [https://dev.ppy.sh/b/252238 multiple links] https://dev.ppy.sh/home", 3,
|
||||||
expectedActions: new[] { LinkAction.External, LinkAction.OpenBeatmap, LinkAction.External });
|
expectedActions: new[] { LinkAction.External, LinkAction.OpenBeatmap, LinkAction.External });
|
||||||
addMessageWithChecks("[https://osu.ppy.sh/home New link format with escaped [and \\[ paired] braces]", 1, expectedActions: LinkAction.External);
|
addMessageWithChecks("[https://dev.ppy.sh/home New link format with escaped [and \\[ paired] braces]", 1, expectedActions: LinkAction.External);
|
||||||
addMessageWithChecks("[Markdown link format with escaped [and \\[ paired] braces](https://osu.ppy.sh/home)", 1, expectedActions: LinkAction.External);
|
addMessageWithChecks("[Markdown link format with escaped [and \\[ paired] braces](https://dev.ppy.sh/home)", 1, expectedActions: LinkAction.External);
|
||||||
addMessageWithChecks("(Old link format with escaped (and \\( paired) parentheses)[https://osu.ppy.sh/home] and [[also a rogue wiki link]]", 2, expectedActions: new[] { LinkAction.External, LinkAction.External });
|
addMessageWithChecks("(Old link format with escaped (and \\( paired) parentheses)[https://dev.ppy.sh/home] and [[also a rogue wiki link]]", 2, expectedActions: new[] { LinkAction.External, LinkAction.External });
|
||||||
// note that there's 0 links here (they get removed if a channel is not found)
|
// note that there's 0 links here (they get removed if a channel is not found)
|
||||||
addMessageWithChecks("#lobby or #osu would be blue (and work) in the ChatDisplay test (when a proper ChatOverlay is present).");
|
addMessageWithChecks("#lobby or #osu would be blue (and work) in the ChatDisplay test (when a proper ChatOverlay is present).");
|
||||||
addMessageWithChecks("I am important!", 0, false, true);
|
addMessageWithChecks("I am important!", 0, false, true);
|
||||||
addMessageWithChecks("feels important", 0, true, true);
|
addMessageWithChecks("feels important", 0, true, true);
|
||||||
addMessageWithChecks("likes to post this [https://osu.ppy.sh/home link].", 1, true, true, expectedActions: LinkAction.External);
|
addMessageWithChecks("likes to post this [https://dev.ppy.sh/home link].", 1, true, true, expectedActions: LinkAction.External);
|
||||||
addMessageWithChecks("Join my multiplayer game osump://12346.", 1, expectedActions: LinkAction.JoinMultiplayerMatch);
|
addMessageWithChecks("Join my multiplayer game osump://12346.", 1, expectedActions: LinkAction.JoinMultiplayerMatch);
|
||||||
addMessageWithChecks("Join my [multiplayer game](osump://12346).", 1, expectedActions: LinkAction.JoinMultiplayerMatch);
|
addMessageWithChecks("Join my [multiplayer game](osump://12346).", 1, expectedActions: LinkAction.JoinMultiplayerMatch);
|
||||||
addMessageWithChecks("Join my [#english](osu://chan/#english).", 1, expectedActions: LinkAction.OpenChannel);
|
addMessageWithChecks("Join my [#english](osu://chan/#english).", 1, expectedActions: LinkAction.OpenChannel);
|
||||||
@ -136,9 +136,9 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
int echoCounter = 0;
|
int echoCounter = 0;
|
||||||
|
|
||||||
addEchoWithWait("sent!", "received!");
|
addEchoWithWait("sent!", "received!");
|
||||||
addEchoWithWait("https://osu.ppy.sh/home", null, 500);
|
addEchoWithWait("https://dev.ppy.sh/home", null, 500);
|
||||||
addEchoWithWait("[https://osu.ppy.sh/forum let's try multiple words too!]");
|
addEchoWithWait("[https://dev.ppy.sh/forum let's try multiple words too!]");
|
||||||
addEchoWithWait("(long loading times! clickable while loading?)[https://osu.ppy.sh/home]", null, 5000);
|
addEchoWithWait("(long loading times! clickable while loading?)[https://dev.ppy.sh/home]", null, 5000);
|
||||||
|
|
||||||
void addEchoWithWait(string text, string completeText = null, double delay = 250)
|
void addEchoWithWait(string text, string completeText = null, double delay = 250)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
private class TestFullscreenOverlay : FullscreenOverlay<OverlayHeader>
|
private class TestFullscreenOverlay : FullscreenOverlay<OverlayHeader>
|
||||||
{
|
{
|
||||||
public TestFullscreenOverlay()
|
public TestFullscreenOverlay()
|
||||||
: base(OverlayColourScheme.Pink, null)
|
: base(OverlayColourScheme.Pink)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -52,6 +52,17 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override OverlayHeader CreateHeader() => new TestHeader();
|
||||||
|
|
||||||
|
internal class TestHeader : OverlayHeader
|
||||||
|
{
|
||||||
|
protected override OverlayTitle CreateTitle() => new TestTitle();
|
||||||
|
|
||||||
|
internal class TestTitle : OverlayTitle
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
Add(rankingsOverlay = new TestRankingsOverlay
|
Add(rankingsOverlay = new TestRankingsOverlay
|
||||||
{
|
{
|
||||||
Country = { BindTarget = countryBindable },
|
Country = { BindTarget = countryBindable },
|
||||||
Scope = { BindTarget = scope },
|
Header = { Current = { BindTarget = scope } },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,8 +65,6 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
private class TestRankingsOverlay : RankingsOverlay
|
private class TestRankingsOverlay : RankingsOverlay
|
||||||
{
|
{
|
||||||
public new Bindable<Country> Country => base.Country;
|
public new Bindable<Country> Country => base.Country;
|
||||||
|
|
||||||
public new Bindable<RankingsScope> Scope => base.Scope;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,11 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void SetUp() => Schedule(() => createDisplay(() => new TestModSelectOverlay()));
|
public void SetUp() => Schedule(() =>
|
||||||
|
{
|
||||||
|
SelectedMods.Value = Array.Empty<Mod>();
|
||||||
|
createDisplay(() => new TestModSelectOverlay());
|
||||||
|
});
|
||||||
|
|
||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
public void SetUpSteps()
|
public void SetUpSteps()
|
||||||
@ -47,6 +51,24 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
AddStep("show", () => modSelect.Show());
|
AddStep("show", () => modSelect.Show());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSettingsResetOnDeselection()
|
||||||
|
{
|
||||||
|
var osuModDoubleTime = new OsuModDoubleTime { SpeedChange = { Value = 1.2 } };
|
||||||
|
|
||||||
|
changeRuleset(0);
|
||||||
|
|
||||||
|
AddStep("set dt mod with custom rate", () => { SelectedMods.Value = new[] { osuModDoubleTime }; });
|
||||||
|
|
||||||
|
AddAssert("selected mod matches", () => (SelectedMods.Value.Single() as OsuModDoubleTime)?.SpeedChange.Value == 1.2);
|
||||||
|
|
||||||
|
AddStep("deselect", () => modSelect.DeselectAllButton.Click());
|
||||||
|
AddAssert("selected mods empty", () => SelectedMods.Value.Count == 0);
|
||||||
|
|
||||||
|
AddStep("reselect", () => modSelect.GetModButton(osuModDoubleTime).Click());
|
||||||
|
AddAssert("selected mod has default value", () => (SelectedMods.Value.Single() as OsuModDoubleTime)?.SpeedChange.IsDefault == true);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestAnimationFlushOnClose()
|
public void TestAnimationFlushOnClose()
|
||||||
{
|
{
|
||||||
@ -152,6 +174,45 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSettingsAreRetainedOnReload()
|
||||||
|
{
|
||||||
|
changeRuleset(0);
|
||||||
|
|
||||||
|
AddStep("set customized mod externally", () => SelectedMods.Value = new[] { new OsuModDoubleTime { SpeedChange = { Value = 1.01 } } });
|
||||||
|
|
||||||
|
AddAssert("setting remains", () => (SelectedMods.Value.SingleOrDefault() as OsuModDoubleTime)?.SpeedChange.Value == 1.01);
|
||||||
|
|
||||||
|
AddStep("create overlay", () => createDisplay(() => new TestNonStackedModSelectOverlay()));
|
||||||
|
|
||||||
|
AddAssert("setting remains", () => (SelectedMods.Value.SingleOrDefault() as OsuModDoubleTime)?.SpeedChange.Value == 1.01);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestExternallySetModIsReplacedByOverlayInstance()
|
||||||
|
{
|
||||||
|
Mod external = new OsuModDoubleTime();
|
||||||
|
Mod overlayButtonMod = null;
|
||||||
|
|
||||||
|
changeRuleset(0);
|
||||||
|
|
||||||
|
AddStep("set mod externally", () => { SelectedMods.Value = new[] { external }; });
|
||||||
|
|
||||||
|
AddAssert("ensure button is selected", () =>
|
||||||
|
{
|
||||||
|
var button = modSelect.GetModButton(SelectedMods.Value.Single());
|
||||||
|
overlayButtonMod = button.SelectedMod;
|
||||||
|
return overlayButtonMod.GetType() == external.GetType();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Right now, when an external change occurs, the ModSelectOverlay will replace the global instance with its own
|
||||||
|
AddAssert("mod instance doesn't match", () => external != overlayButtonMod);
|
||||||
|
|
||||||
|
AddAssert("one mod present in global selected", () => SelectedMods.Value.Count == 1);
|
||||||
|
AddAssert("globally selected matches button's mod instance", () => SelectedMods.Value.Contains(overlayButtonMod));
|
||||||
|
AddAssert("globally selected doesn't contain original external change", () => !SelectedMods.Value.Contains(external));
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestNonStacked()
|
public void TestNonStacked()
|
||||||
{
|
{
|
||||||
@ -313,7 +374,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
private void createDisplay(Func<TestModSelectOverlay> createOverlayFunc)
|
private void createDisplay(Func<TestModSelectOverlay> createOverlayFunc)
|
||||||
{
|
{
|
||||||
SelectedMods.Value = Array.Empty<Mod>();
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
modSelect = createOverlayFunc().With(d =>
|
modSelect = createOverlayFunc().With(d =>
|
||||||
|
@ -105,6 +105,15 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
checkDisplayedCount(3);
|
checkDisplayedCount(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestError()
|
||||||
|
{
|
||||||
|
setState(Visibility.Visible);
|
||||||
|
AddStep(@"error #1", sendErrorNotification);
|
||||||
|
AddAssert("Is visible", () => notificationOverlay.State.Value == Visibility.Visible);
|
||||||
|
checkDisplayedCount(1);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestSpam()
|
public void TestSpam()
|
||||||
{
|
{
|
||||||
@ -179,7 +188,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
private void sendBarrage()
|
private void sendBarrage()
|
||||||
{
|
{
|
||||||
switch (RNG.Next(0, 4))
|
switch (RNG.Next(0, 5))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
sendHelloNotification();
|
sendHelloNotification();
|
||||||
@ -196,6 +205,10 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
case 3:
|
case 3:
|
||||||
sendDownloadProgress();
|
sendDownloadProgress();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
sendErrorNotification();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,6 +227,11 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
notificationOverlay.Post(new BackgroundNotification { Text = @"Welcome to osu!. Enjoy your stay!" });
|
notificationOverlay.Post(new BackgroundNotification { Text = @"Welcome to osu!. Enjoy your stay!" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendErrorNotification()
|
||||||
|
{
|
||||||
|
notificationOverlay.Post(new SimpleErrorNotification { Text = @"Rut roh!. Something went wrong!" });
|
||||||
|
}
|
||||||
|
|
||||||
private void sendManyNotifications()
|
private void sendManyNotifications()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="DeepEqual" Version="2.0.0" />
|
<PackageReference Include="DeepEqual" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.13.1" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.17.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.0" />
|
<PackageReference Include="Moq" Version="4.16.0" />
|
||||||
|
@ -13,15 +13,18 @@ namespace osu.Game.Tournament.Tests
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
LoadComponentAsync(new Background("Menu/menu-background-0")
|
BracketLoadTask.ContinueWith(_ => Schedule(() =>
|
||||||
{
|
{
|
||||||
Colour = OsuColour.Gray(0.5f),
|
LoadComponentAsync(new Background("Menu/menu-background-0")
|
||||||
Depth = 10
|
{
|
||||||
}, AddInternal);
|
Colour = OsuColour.Gray(0.5f),
|
||||||
|
Depth = 10
|
||||||
|
}, AddInternal);
|
||||||
|
|
||||||
// Have to construct this here, rather than in the constructor, because
|
// Have to construct this here, rather than in the constructor, because
|
||||||
// we depend on some dependencies to be loaded within OsuGameBase.load().
|
// we depend on some dependencies to be loaded within OsuGameBase.load().
|
||||||
Add(new TestBrowser());
|
Add(new TestBrowser());
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +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.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
@ -154,13 +155,22 @@ namespace osu.Game.Tournament.Tests
|
|||||||
|
|
||||||
protected override void LoadAsyncComplete()
|
protected override void LoadAsyncComplete()
|
||||||
{
|
{
|
||||||
// this has to be run here rather than LoadComplete because
|
BracketLoadTask.ContinueWith(_ => Schedule(() =>
|
||||||
// TestScene.cs is checking the IsLoaded state (on another thread) and expects
|
{
|
||||||
// the runner to be loaded at that point.
|
// this has to be run here rather than LoadComplete because
|
||||||
Add(runner = new TestSceneTestRunner.TestRunner());
|
// TestScene.cs is checking the IsLoaded state (on another thread) and expects
|
||||||
|
// the runner to be loaded at that point.
|
||||||
|
Add(runner = new TestSceneTestRunner.TestRunner());
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RunTestBlocking(TestScene test) => runner.RunTestBlocking(test);
|
public void RunTestBlocking(TestScene test)
|
||||||
|
{
|
||||||
|
while (runner?.IsLoaded != true && Host.ExecutionState == ExecutionState.Running)
|
||||||
|
Thread.Sleep(10);
|
||||||
|
|
||||||
|
runner?.RunTestBlocking(test);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.13.1" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Project">
|
<PropertyGroup Label="Project">
|
||||||
|
@ -13,6 +13,7 @@ using osu.Framework.Graphics.Colour;
|
|||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Tournament.Models;
|
using osu.Game.Tournament.Models;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -32,25 +33,24 @@ namespace osu.Game.Tournament
|
|||||||
private Drawable heightWarning;
|
private Drawable heightWarning;
|
||||||
private Bindable<Size> windowSize;
|
private Bindable<Size> windowSize;
|
||||||
private Bindable<WindowMode> windowMode;
|
private Bindable<WindowMode> windowMode;
|
||||||
|
private LoadingSpinner loadingSpinner;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(FrameworkConfigManager frameworkConfig)
|
private void load(FrameworkConfigManager frameworkConfig)
|
||||||
{
|
{
|
||||||
windowSize = frameworkConfig.GetBindable<Size>(FrameworkSetting.WindowedSize);
|
windowSize = frameworkConfig.GetBindable<Size>(FrameworkSetting.WindowedSize);
|
||||||
windowSize.BindValueChanged(size => ScheduleAfterChildren(() =>
|
|
||||||
{
|
|
||||||
var minWidth = (int)(size.NewValue.Height / 768f * TournamentSceneManager.REQUIRED_WIDTH) - 1;
|
|
||||||
|
|
||||||
heightWarning.Alpha = size.NewValue.Width < minWidth ? 1 : 0;
|
|
||||||
}), true);
|
|
||||||
|
|
||||||
windowMode = frameworkConfig.GetBindable<WindowMode>(FrameworkSetting.WindowMode);
|
windowMode = frameworkConfig.GetBindable<WindowMode>(FrameworkSetting.WindowMode);
|
||||||
windowMode.BindValueChanged(mode => ScheduleAfterChildren(() =>
|
|
||||||
{
|
|
||||||
windowMode.Value = WindowMode.Windowed;
|
|
||||||
}), true);
|
|
||||||
|
|
||||||
AddRange(new[]
|
Add(loadingSpinner = new LoadingSpinner(true, true)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomRight,
|
||||||
|
Origin = Anchor.BottomRight,
|
||||||
|
Margin = new MarginPadding(40),
|
||||||
|
});
|
||||||
|
|
||||||
|
loadingSpinner.Show();
|
||||||
|
|
||||||
|
BracketLoadTask.ContinueWith(_ => LoadComponentsAsync(new[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
@ -93,7 +93,24 @@ namespace osu.Game.Tournament
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = new TournamentSceneManager()
|
Child = new TournamentSceneManager()
|
||||||
}
|
}
|
||||||
});
|
}, drawables =>
|
||||||
|
{
|
||||||
|
loadingSpinner.Hide();
|
||||||
|
loadingSpinner.Expire();
|
||||||
|
|
||||||
|
AddRange(drawables);
|
||||||
|
|
||||||
|
windowSize.BindValueChanged(size => ScheduleAfterChildren(() =>
|
||||||
|
{
|
||||||
|
var minWidth = (int)(size.NewValue.Height / 768f * TournamentSceneManager.REQUIRED_WIDTH) - 1;
|
||||||
|
heightWarning.Alpha = size.NewValue.Width < minWidth ? 1 : 0;
|
||||||
|
}), true);
|
||||||
|
|
||||||
|
windowMode.BindValueChanged(mode => ScheduleAfterChildren(() =>
|
||||||
|
{
|
||||||
|
windowMode.Value = WindowMode.Windowed;
|
||||||
|
}), true);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
@ -29,6 +30,10 @@ namespace osu.Game.Tournament
|
|||||||
private DependencyContainer dependencies;
|
private DependencyContainer dependencies;
|
||||||
private FileBasedIPC ipc;
|
private FileBasedIPC ipc;
|
||||||
|
|
||||||
|
protected Task BracketLoadTask => taskCompletionSource.Task;
|
||||||
|
|
||||||
|
private readonly TaskCompletionSource<bool> taskCompletionSource = new TaskCompletionSource<bool>();
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
{
|
{
|
||||||
return dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
return dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
@ -46,14 +51,9 @@ namespace osu.Game.Tournament
|
|||||||
|
|
||||||
Textures.AddStore(new TextureLoaderStore(new StorageBackedResourceStore(storage)));
|
Textures.AddStore(new TextureLoaderStore(new StorageBackedResourceStore(storage)));
|
||||||
|
|
||||||
readBracket();
|
|
||||||
|
|
||||||
ladder.CurrentMatch.Value = ladder.Matches.FirstOrDefault(p => p.Current.Value);
|
|
||||||
|
|
||||||
dependencies.CacheAs(new StableInfo(storage));
|
dependencies.CacheAs(new StableInfo(storage));
|
||||||
|
|
||||||
dependencies.CacheAs<MatchIPCInfo>(ipc = new FileBasedIPC());
|
Task.Run(readBracket);
|
||||||
Add(ipc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readBracket()
|
private void readBracket()
|
||||||
@ -68,10 +68,6 @@ namespace osu.Game.Tournament
|
|||||||
ladder ??= new LadderInfo();
|
ladder ??= new LadderInfo();
|
||||||
ladder.Ruleset.Value ??= RulesetStore.AvailableRulesets.First();
|
ladder.Ruleset.Value ??= RulesetStore.AvailableRulesets.First();
|
||||||
|
|
||||||
Ruleset.BindTo(ladder.Ruleset);
|
|
||||||
|
|
||||||
dependencies.Cache(ladder);
|
|
||||||
|
|
||||||
bool addedInfo = false;
|
bool addedInfo = false;
|
||||||
|
|
||||||
// assign teams
|
// assign teams
|
||||||
@ -127,6 +123,19 @@ namespace osu.Game.Tournament
|
|||||||
|
|
||||||
if (addedInfo)
|
if (addedInfo)
|
||||||
SaveChanges();
|
SaveChanges();
|
||||||
|
|
||||||
|
ladder.CurrentMatch.Value = ladder.Matches.FirstOrDefault(p => p.Current.Value);
|
||||||
|
|
||||||
|
Schedule(() =>
|
||||||
|
{
|
||||||
|
Ruleset.BindTo(ladder.Ruleset);
|
||||||
|
|
||||||
|
dependencies.Cache(ladder);
|
||||||
|
dependencies.CacheAs<MatchIPCInfo>(ipc = new FileBasedIPC());
|
||||||
|
Add(ipc);
|
||||||
|
|
||||||
|
taskCompletionSource.SetResult(true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -143,7 +152,7 @@ namespace osu.Game.Tournament
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(p.Username) || p.Statistics == null)
|
if (string.IsNullOrEmpty(p.Username) || p.Statistics == null)
|
||||||
{
|
{
|
||||||
PopulateUser(p);
|
PopulateUser(p, immediate: true);
|
||||||
addedInfo = true;
|
addedInfo = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,12 +211,14 @@ namespace osu.Game.Tournament
|
|||||||
return addedInfo;
|
return addedInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PopulateUser(User user, Action success = null, Action failure = null)
|
public void PopulateUser(User user, Action success = null, Action failure = null, bool immediate = false)
|
||||||
{
|
{
|
||||||
var req = new GetUserRequest(user.Id, Ruleset.Value);
|
var req = new GetUserRequest(user.Id, Ruleset.Value);
|
||||||
|
|
||||||
req.Success += res =>
|
req.Success += res =>
|
||||||
{
|
{
|
||||||
|
user.Id = res.Id;
|
||||||
|
|
||||||
user.Username = res.Username;
|
user.Username = res.Username;
|
||||||
user.Statistics = res.Statistics;
|
user.Statistics = res.Statistics;
|
||||||
user.Country = res.Country;
|
user.Country = res.Country;
|
||||||
@ -222,7 +233,10 @@ namespace osu.Game.Tournament
|
|||||||
failure?.Invoke();
|
failure?.Invoke();
|
||||||
};
|
};
|
||||||
|
|
||||||
API.Queue(req);
|
if (immediate)
|
||||||
|
API.Perform(req);
|
||||||
|
else
|
||||||
|
API.Queue(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
@ -27,6 +27,8 @@ namespace osu.Game.Audio
|
|||||||
|
|
||||||
protected TrackManagerPreviewTrack CurrentTrack;
|
protected TrackManagerPreviewTrack CurrentTrack;
|
||||||
|
|
||||||
|
private readonly BindableNumber<double> globalTrackVolumeAdjust = new BindableNumber<double>(OsuGameBase.GLOBAL_TRACK_VOLUME_ADJUST);
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -35,6 +37,7 @@ namespace osu.Game.Audio
|
|||||||
trackStore = new PreviewTrackStore(new OnlineStore());
|
trackStore = new PreviewTrackStore(new OnlineStore());
|
||||||
|
|
||||||
audio.AddItem(trackStore);
|
audio.AddItem(trackStore);
|
||||||
|
trackStore.AddAdjustment(AdjustableProperty.Volume, globalTrackVolumeAdjust);
|
||||||
trackStore.AddAdjustment(AdjustableProperty.Volume, audio.VolumeTrack);
|
trackStore.AddAdjustment(AdjustableProperty.Volume, audio.VolumeTrack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,9 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
protected override string[] HashableFileTypes => new[] { ".osu" };
|
protected override string[] HashableFileTypes => new[] { ".osu" };
|
||||||
|
|
||||||
protected override string ImportFromStablePath => "Songs";
|
protected override string ImportFromStablePath => ".";
|
||||||
|
|
||||||
|
protected override Storage PrepareStableStorage(StableStorage stableStorage) => stableStorage.GetSongStorage();
|
||||||
|
|
||||||
private readonly RulesetStore rulesets;
|
private readonly RulesetStore rulesets;
|
||||||
private readonly BeatmapStore beatmaps;
|
private readonly BeatmapStore beatmaps;
|
||||||
|
@ -51,7 +51,12 @@ namespace osu.Game.Beatmaps
|
|||||||
[JsonProperty(@"tags")]
|
[JsonProperty(@"tags")]
|
||||||
public string Tags { get; set; }
|
public string Tags { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The time in milliseconds to begin playing the track for preview purposes.
|
||||||
|
/// If -1, the track should begin playing at 40% of its length.
|
||||||
|
/// </summary>
|
||||||
public int PreviewTime { get; set; }
|
public int PreviewTime { get; set; }
|
||||||
|
|
||||||
public string AudioFile { get; set; }
|
public string AudioFile { get; set; }
|
||||||
public string BackgroundFile { get; set; }
|
public string BackgroundFile { get; set; }
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual double UnloadDelay => 10000;
|
protected virtual double UnloadDelay => 10000;
|
||||||
|
|
||||||
protected override DelayedLoadWrapper CreateDelayedLoadWrapper(Func<Drawable> createContentFunc, double timeBeforeLoad)
|
protected override DelayedLoadWrapper CreateDelayedLoadWrapper(Func<Drawable> createContentFunc, double timeBeforeLoad) =>
|
||||||
=> new DelayedLoadUnloadWrapper(createContentFunc, timeBeforeLoad, UnloadDelay);
|
new DelayedLoadUnloadWrapper(createContentFunc, timeBeforeLoad, UnloadDelay) { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
protected override double TransformDuration => 400;
|
protected override double TransformDuration => 400;
|
||||||
|
|
||||||
|
@ -266,6 +266,26 @@ namespace osu.Game.Beatmaps
|
|||||||
[NotNull]
|
[NotNull]
|
||||||
public Track LoadTrack() => loadedTrack = GetBeatmapTrack() ?? GetVirtualTrack(1000);
|
public Track LoadTrack() => loadedTrack = GetBeatmapTrack() ?? GetVirtualTrack(1000);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reads the correct track restart point from beatmap metadata and sets looping to enabled.
|
||||||
|
/// </summary>
|
||||||
|
public void PrepareTrackForPreviewLooping()
|
||||||
|
{
|
||||||
|
Track.Looping = true;
|
||||||
|
Track.RestartPoint = Metadata.PreviewTime;
|
||||||
|
|
||||||
|
if (Track.RestartPoint == -1)
|
||||||
|
{
|
||||||
|
if (!Track.IsLoaded)
|
||||||
|
{
|
||||||
|
// force length to be populated (https://github.com/ppy/osu-framework/issues/4202)
|
||||||
|
Track.Seek(Track.CurrentTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
Track.RestartPoint = 0.4f * Track.Length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Transfer a valid audio track into this working beatmap. Used as an optimisation to avoid reload / track swap
|
/// Transfer a valid audio track into this working beatmap. Used as an optimisation to avoid reload / track swap
|
||||||
/// across difficulties in the same beatmap set.
|
/// across difficulties in the same beatmap set.
|
||||||
|
@ -29,6 +29,14 @@ namespace osu.Game.Collections
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual bool ShowManageCollectionsItem => true;
|
protected virtual bool ShowManageCollectionsItem => true;
|
||||||
|
|
||||||
|
private readonly BindableWithCurrent<CollectionFilterMenuItem> current = new BindableWithCurrent<CollectionFilterMenuItem>();
|
||||||
|
|
||||||
|
public new Bindable<CollectionFilterMenuItem> Current
|
||||||
|
{
|
||||||
|
get => current.Current;
|
||||||
|
set => current.Current = value;
|
||||||
|
}
|
||||||
|
|
||||||
private readonly IBindableList<BeatmapCollection> collections = new BindableList<BeatmapCollection>();
|
private readonly IBindableList<BeatmapCollection> collections = new BindableList<BeatmapCollection>();
|
||||||
private readonly IBindableList<BeatmapInfo> beatmaps = new BindableList<BeatmapInfo>();
|
private readonly IBindableList<BeatmapInfo> beatmaps = new BindableList<BeatmapInfo>();
|
||||||
private readonly BindableList<CollectionFilterMenuItem> filters = new BindableList<CollectionFilterMenuItem>();
|
private readonly BindableList<CollectionFilterMenuItem> filters = new BindableList<CollectionFilterMenuItem>();
|
||||||
@ -36,25 +44,28 @@ namespace osu.Game.Collections
|
|||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private ManageCollectionsDialog manageCollectionsDialog { get; set; }
|
private ManageCollectionsDialog manageCollectionsDialog { get; set; }
|
||||||
|
|
||||||
|
[Resolved(CanBeNull = true)]
|
||||||
|
private CollectionManager collectionManager { get; set; }
|
||||||
|
|
||||||
public CollectionFilterDropdown()
|
public CollectionFilterDropdown()
|
||||||
{
|
{
|
||||||
ItemSource = filters;
|
ItemSource = filters;
|
||||||
}
|
Current.Value = new AllBeatmapsCollectionFilterMenuItem();
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
|
||||||
private void load([CanBeNull] CollectionManager collectionManager)
|
|
||||||
{
|
|
||||||
if (collectionManager != null)
|
|
||||||
collections.BindTo(collectionManager.Collections);
|
|
||||||
|
|
||||||
collections.CollectionChanged += (_, __) => collectionsChanged();
|
|
||||||
collectionsChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
|
if (collectionManager != null)
|
||||||
|
collections.BindTo(collectionManager.Collections);
|
||||||
|
|
||||||
|
// Dropdown has logic which triggers a change on the bindable with every change to the contained items.
|
||||||
|
// This is not desirable here, as it leads to multiple filter operations running even though nothing has changed.
|
||||||
|
// An extra bindable is enough to subvert this behaviour.
|
||||||
|
base.Current = Current;
|
||||||
|
|
||||||
|
collections.BindCollectionChanged((_, __) => collectionsChanged(), true);
|
||||||
Current.BindValueChanged(filterChanged, true);
|
Current.BindValueChanged(filterChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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 JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
|
||||||
@ -9,7 +10,7 @@ namespace osu.Game.Collections
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A <see cref="BeatmapCollection"/> filter.
|
/// A <see cref="BeatmapCollection"/> filter.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CollectionFilterMenuItem
|
public class CollectionFilterMenuItem : IEquatable<CollectionFilterMenuItem>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The collection to filter beatmaps from.
|
/// The collection to filter beatmaps from.
|
||||||
@ -33,6 +34,11 @@ namespace osu.Game.Collections
|
|||||||
Collection = collection;
|
Collection = collection;
|
||||||
CollectionName = Collection?.Name.GetBoundCopy() ?? new Bindable<string>("All beatmaps");
|
CollectionName = Collection?.Name.GetBoundCopy() ?? new Bindable<string>("All beatmaps");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Equals(CollectionFilterMenuItem other)
|
||||||
|
=> other != null && CollectionName.Value == other.CollectionName.Value;
|
||||||
|
|
||||||
|
public override int GetHashCode() => CollectionName.Value.GetHashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AllBeatmapsCollectionFilterMenuItem : CollectionFilterMenuItem
|
public class AllBeatmapsCollectionFilterMenuItem : CollectionFilterMenuItem
|
||||||
|
@ -139,35 +139,43 @@ namespace osu.Game.Collections
|
|||||||
PostNotification?.Invoke(notification);
|
PostNotification?.Invoke(notification);
|
||||||
|
|
||||||
var collection = readCollections(stream, notification);
|
var collection = readCollections(stream, notification);
|
||||||
bool importCompleted = false;
|
await importCollections(collection);
|
||||||
|
|
||||||
Schedule(() =>
|
|
||||||
{
|
|
||||||
importCollections(collection);
|
|
||||||
importCompleted = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
while (!IsDisposed && !importCompleted)
|
|
||||||
await Task.Delay(10);
|
|
||||||
|
|
||||||
notification.CompletionText = $"Imported {collection.Count} collections";
|
notification.CompletionText = $"Imported {collection.Count} collections";
|
||||||
notification.State = ProgressNotificationState.Completed;
|
notification.State = ProgressNotificationState.Completed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void importCollections(List<BeatmapCollection> newCollections)
|
private Task importCollections(List<BeatmapCollection> newCollections)
|
||||||
{
|
{
|
||||||
foreach (var newCol in newCollections)
|
var tcs = new TaskCompletionSource<bool>();
|
||||||
{
|
|
||||||
var existing = Collections.FirstOrDefault(c => c.Name == newCol.Name);
|
|
||||||
if (existing == null)
|
|
||||||
Collections.Add(existing = new BeatmapCollection { Name = { Value = newCol.Name.Value } });
|
|
||||||
|
|
||||||
foreach (var newBeatmap in newCol.Beatmaps)
|
Schedule(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (!existing.Beatmaps.Contains(newBeatmap))
|
foreach (var newCol in newCollections)
|
||||||
existing.Beatmaps.Add(newBeatmap);
|
{
|
||||||
|
var existing = Collections.FirstOrDefault(c => c.Name == newCol.Name);
|
||||||
|
if (existing == null)
|
||||||
|
Collections.Add(existing = new BeatmapCollection { Name = { Value = newCol.Name.Value } });
|
||||||
|
|
||||||
|
foreach (var newBeatmap in newCol.Beatmaps)
|
||||||
|
{
|
||||||
|
if (!existing.Beatmaps.Contains(newBeatmap))
|
||||||
|
existing.Beatmaps.Add(newBeatmap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tcs.SetResult(true);
|
||||||
}
|
}
|
||||||
}
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger.Error(e, "Failed to import collection.");
|
||||||
|
tcs.SetException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return tcs.Task;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<BeatmapCollection> readCollections(Stream stream, ProgressNotification notification = null)
|
private List<BeatmapCollection> readCollections(Stream stream, ProgressNotification notification = null)
|
||||||
|
52
osu.Game/Configuration/ModSettingChangeTracker.cs
Normal file
52
osu.Game/Configuration/ModSettingChangeTracker.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// 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;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Game.Overlays.Settings;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
|
namespace osu.Game.Configuration
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A helper class for tracking changes to the settings of a set of <see cref="Mod"/>s.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Ensure to dispose when usage is finished.
|
||||||
|
/// </remarks>
|
||||||
|
public class ModSettingChangeTracker : IDisposable
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Notifies that the setting of a <see cref="Mod"/> has changed.
|
||||||
|
/// </summary>
|
||||||
|
public Action<Mod> SettingChanged;
|
||||||
|
|
||||||
|
private readonly List<ISettingsItem> settings = new List<ISettingsItem>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new <see cref="ModSettingChangeTracker"/> for a set of <see cref="Mod"/>s.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mods">The set of <see cref="Mod"/>s whose settings need to be tracked.</param>
|
||||||
|
public ModSettingChangeTracker(IEnumerable<Mod> mods)
|
||||||
|
{
|
||||||
|
foreach (var mod in mods)
|
||||||
|
{
|
||||||
|
foreach (var setting in mod.CreateSettingsControls().OfType<ISettingsItem>())
|
||||||
|
{
|
||||||
|
setting.SettingChanged += () => SettingChanged?.Invoke(mod);
|
||||||
|
settings.Add(setting);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
SettingChanged = null;
|
||||||
|
|
||||||
|
foreach (var r in settings)
|
||||||
|
r.Dispose();
|
||||||
|
settings.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -16,12 +16,12 @@ namespace osu.Game.Configuration
|
|||||||
[Description("Hit Error (right)")]
|
[Description("Hit Error (right)")]
|
||||||
HitErrorRight,
|
HitErrorRight,
|
||||||
|
|
||||||
[Description("Hit Error (bottom)")]
|
|
||||||
HitErrorBottom,
|
|
||||||
|
|
||||||
[Description("Hit Error (left+right)")]
|
[Description("Hit Error (left+right)")]
|
||||||
HitErrorBoth,
|
HitErrorBoth,
|
||||||
|
|
||||||
|
[Description("Hit Error (bottom)")]
|
||||||
|
HitErrorBottom,
|
||||||
|
|
||||||
[Description("Colour (left)")]
|
[Description("Colour (left)")]
|
||||||
ColourLeft,
|
ColourLeft,
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ namespace osu.Game.Configuration
|
|||||||
yield return new SettingsSlider<float>
|
yield return new SettingsSlider<float>
|
||||||
{
|
{
|
||||||
LabelText = attr.Label,
|
LabelText = attr.Label,
|
||||||
|
TooltipText = attr.Description,
|
||||||
Current = bNumber,
|
Current = bNumber,
|
||||||
KeyboardStep = 0.1f,
|
KeyboardStep = 0.1f,
|
||||||
};
|
};
|
||||||
@ -67,6 +68,7 @@ namespace osu.Game.Configuration
|
|||||||
yield return new SettingsSlider<double>
|
yield return new SettingsSlider<double>
|
||||||
{
|
{
|
||||||
LabelText = attr.Label,
|
LabelText = attr.Label,
|
||||||
|
TooltipText = attr.Description,
|
||||||
Current = bNumber,
|
Current = bNumber,
|
||||||
KeyboardStep = 0.1f,
|
KeyboardStep = 0.1f,
|
||||||
};
|
};
|
||||||
@ -77,6 +79,7 @@ namespace osu.Game.Configuration
|
|||||||
yield return new SettingsSlider<int>
|
yield return new SettingsSlider<int>
|
||||||
{
|
{
|
||||||
LabelText = attr.Label,
|
LabelText = attr.Label,
|
||||||
|
TooltipText = attr.Description,
|
||||||
Current = bNumber
|
Current = bNumber
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -86,6 +89,7 @@ namespace osu.Game.Configuration
|
|||||||
yield return new SettingsCheckbox
|
yield return new SettingsCheckbox
|
||||||
{
|
{
|
||||||
LabelText = attr.Label,
|
LabelText = attr.Label,
|
||||||
|
TooltipText = attr.Description,
|
||||||
Current = bBool
|
Current = bBool
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -95,6 +99,7 @@ namespace osu.Game.Configuration
|
|||||||
yield return new SettingsTextBox
|
yield return new SettingsTextBox
|
||||||
{
|
{
|
||||||
LabelText = attr.Label,
|
LabelText = attr.Label,
|
||||||
|
TooltipText = attr.Description,
|
||||||
Current = bString
|
Current = bString
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -105,6 +110,7 @@ namespace osu.Game.Configuration
|
|||||||
var dropdown = (Drawable)Activator.CreateInstance(dropdownType);
|
var dropdown = (Drawable)Activator.CreateInstance(dropdownType);
|
||||||
|
|
||||||
dropdownType.GetProperty(nameof(SettingsDropdown<object>.LabelText))?.SetValue(dropdown, attr.Label);
|
dropdownType.GetProperty(nameof(SettingsDropdown<object>.LabelText))?.SetValue(dropdown, attr.Label);
|
||||||
|
dropdownType.GetProperty(nameof(SettingsDropdown<object>.TooltipText))?.SetValue(dropdown, attr.Description);
|
||||||
dropdownType.GetProperty(nameof(SettingsDropdown<object>.Current))?.SetValue(dropdown, bindable);
|
dropdownType.GetProperty(nameof(SettingsDropdown<object>.Current))?.SetValue(dropdown, bindable);
|
||||||
|
|
||||||
yield return dropdown;
|
yield return dropdown;
|
||||||
|
@ -38,6 +38,11 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
private const int import_queue_request_concurrency = 1;
|
private const int import_queue_request_concurrency = 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The size of a batch import operation before considering it a lower priority operation.
|
||||||
|
/// </summary>
|
||||||
|
private const int low_priority_import_batch_size = 1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A singleton scheduler shared by all <see cref="ArchiveModelManager{TModel,TFileModel}"/>.
|
/// A singleton scheduler shared by all <see cref="ArchiveModelManager{TModel,TFileModel}"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -47,6 +52,13 @@ namespace osu.Game.Database
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
private static readonly ThreadedTaskScheduler import_scheduler = new ThreadedTaskScheduler(import_queue_request_concurrency, nameof(ArchiveModelManager<TModel, TFileModel>));
|
private static readonly ThreadedTaskScheduler import_scheduler = new ThreadedTaskScheduler(import_queue_request_concurrency, nameof(ArchiveModelManager<TModel, TFileModel>));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A second scheduler for lower priority imports.
|
||||||
|
/// For simplicity, these will just run in parallel with normal priority imports, but a future refactor would see this implemented via a custom scheduler/queue.
|
||||||
|
/// See https://gist.github.com/peppy/f0e118a14751fc832ca30dd48ba3876b for an incomplete version of this.
|
||||||
|
/// </summary>
|
||||||
|
private static readonly ThreadedTaskScheduler import_scheduler_low_priority = new ThreadedTaskScheduler(import_queue_request_concurrency, nameof(ArchiveModelManager<TModel, TFileModel>));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set an endpoint for notifications to be posted to.
|
/// Set an endpoint for notifications to be posted to.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -103,8 +115,11 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Import one or more <typeparamref name="TModel"/> items from filesystem <paramref name="paths"/>.
|
/// Import one or more <typeparamref name="TModel"/> items from filesystem <paramref name="paths"/>.
|
||||||
/// This will post notifications tracking progress.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This will be treated as a low priority import if more than one path is specified; use <see cref="Import(ImportTask[])"/> to always import at standard priority.
|
||||||
|
/// This will post notifications tracking progress.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="paths">One or more archive locations on disk.</param>
|
/// <param name="paths">One or more archive locations on disk.</param>
|
||||||
public Task Import(params string[] paths)
|
public Task Import(params string[] paths)
|
||||||
{
|
{
|
||||||
@ -133,13 +148,15 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
var imported = new List<TModel>();
|
var imported = new List<TModel>();
|
||||||
|
|
||||||
|
bool isLowPriorityImport = tasks.Length > low_priority_import_batch_size;
|
||||||
|
|
||||||
await Task.WhenAll(tasks.Select(async task =>
|
await Task.WhenAll(tasks.Select(async task =>
|
||||||
{
|
{
|
||||||
notification.CancellationToken.ThrowIfCancellationRequested();
|
notification.CancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var model = await Import(task, notification.CancellationToken);
|
var model = await Import(task, isLowPriorityImport, notification.CancellationToken);
|
||||||
|
|
||||||
lock (imported)
|
lock (imported)
|
||||||
{
|
{
|
||||||
@ -193,15 +210,16 @@ namespace osu.Game.Database
|
|||||||
/// Note that this bypasses the UI flow and should only be used for special cases or testing.
|
/// Note that this bypasses the UI flow and should only be used for special cases or testing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="task">The <see cref="ImportTask"/> containing data about the <typeparamref name="TModel"/> to import.</param>
|
/// <param name="task">The <see cref="ImportTask"/> containing data about the <typeparamref name="TModel"/> to import.</param>
|
||||||
|
/// <param name="lowPriority">Whether this is a low priority import.</param>
|
||||||
/// <param name="cancellationToken">An optional cancellation token.</param>
|
/// <param name="cancellationToken">An optional cancellation token.</param>
|
||||||
/// <returns>The imported model, if successful.</returns>
|
/// <returns>The imported model, if successful.</returns>
|
||||||
internal async Task<TModel> Import(ImportTask task, CancellationToken cancellationToken = default)
|
internal async Task<TModel> Import(ImportTask task, bool lowPriority = false, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
TModel import;
|
TModel import;
|
||||||
using (ArchiveReader reader = task.GetReader())
|
using (ArchiveReader reader = task.GetReader())
|
||||||
import = await Import(reader, cancellationToken);
|
import = await Import(reader, lowPriority, cancellationToken);
|
||||||
|
|
||||||
// We may or may not want to delete the file depending on where it is stored.
|
// We may or may not want to delete the file depending on where it is stored.
|
||||||
// e.g. reconstructing/repairing database with items from default storage.
|
// e.g. reconstructing/repairing database with items from default storage.
|
||||||
@ -226,11 +244,12 @@ namespace osu.Game.Database
|
|||||||
public Action<IEnumerable<TModel>> PresentImport;
|
public Action<IEnumerable<TModel>> PresentImport;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Import an item from an <see cref="ArchiveReader"/>.
|
/// Silently import an item from an <see cref="ArchiveReader"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="archive">The archive to be imported.</param>
|
/// <param name="archive">The archive to be imported.</param>
|
||||||
|
/// <param name="lowPriority">Whether this is a low priority import.</param>
|
||||||
/// <param name="cancellationToken">An optional cancellation token.</param>
|
/// <param name="cancellationToken">An optional cancellation token.</param>
|
||||||
public Task<TModel> Import(ArchiveReader archive, CancellationToken cancellationToken = default)
|
public Task<TModel> Import(ArchiveReader archive, bool lowPriority = false, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
@ -253,7 +272,7 @@ namespace osu.Game.Database
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Import(model, archive, cancellationToken);
|
return Import(model, archive, lowPriority, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -303,12 +322,13 @@ namespace osu.Game.Database
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Import an item from a <typeparamref name="TModel"/>.
|
/// Silently import an item from a <typeparamref name="TModel"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The model to be imported.</param>
|
/// <param name="item">The model to be imported.</param>
|
||||||
/// <param name="archive">An optional archive to use for model population.</param>
|
/// <param name="archive">An optional archive to use for model population.</param>
|
||||||
|
/// <param name="lowPriority">Whether this is a low priority import.</param>
|
||||||
/// <param name="cancellationToken">An optional cancellation token.</param>
|
/// <param name="cancellationToken">An optional cancellation token.</param>
|
||||||
public virtual async Task<TModel> Import(TModel item, ArchiveReader archive = null, CancellationToken cancellationToken = default) => await Task.Factory.StartNew(async () =>
|
public virtual async Task<TModel> Import(TModel item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) => await Task.Factory.StartNew(async () =>
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
@ -383,7 +403,7 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
flushEvents(true);
|
flushEvents(true);
|
||||||
return item;
|
return item;
|
||||||
}, cancellationToken, TaskCreationOptions.HideScheduler, import_scheduler).Unwrap();
|
}, cancellationToken, TaskCreationOptions.HideScheduler, lowPriority ? import_scheduler_low_priority : import_scheduler).Unwrap();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Exports an item to a legacy (.zip based) package.
|
/// Exports an item to a legacy (.zip based) package.
|
||||||
@ -625,7 +645,7 @@ namespace osu.Game.Database
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set a storage with access to an osu-stable install for import purposes.
|
/// Set a storage with access to an osu-stable install for import purposes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Func<Storage> GetStableStorage { private get; set; }
|
public Func<StableStorage> GetStableStorage { private get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Denotes whether an osu-stable installation is present to perform automated imports from.
|
/// Denotes whether an osu-stable installation is present to perform automated imports from.
|
||||||
@ -638,9 +658,10 @@ namespace osu.Game.Database
|
|||||||
protected virtual string ImportFromStablePath => null;
|
protected virtual string ImportFromStablePath => null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Select paths to import from stable. Default implementation iterates all directories in <see cref="ImportFromStablePath"/>.
|
/// Select paths to import from stable where all paths should be absolute. Default implementation iterates all directories in <see cref="ImportFromStablePath"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual IEnumerable<string> GetStableImportPaths(Storage stableStoage) => stableStoage.GetDirectories(ImportFromStablePath);
|
protected virtual IEnumerable<string> GetStableImportPaths(Storage storage) => storage.GetDirectories(ImportFromStablePath)
|
||||||
|
.Select(path => storage.GetFullPath(path));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this specified path should be removed after successful import.
|
/// Whether this specified path should be removed after successful import.
|
||||||
@ -654,24 +675,33 @@ namespace osu.Game.Database
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Task ImportFromStableAsync()
|
public Task ImportFromStableAsync()
|
||||||
{
|
{
|
||||||
var stable = GetStableStorage?.Invoke();
|
var stableStorage = GetStableStorage?.Invoke();
|
||||||
|
|
||||||
if (stable == null)
|
if (stableStorage == null)
|
||||||
{
|
{
|
||||||
Logger.Log("No osu!stable installation available!", LoggingTarget.Information, LogLevel.Error);
|
Logger.Log("No osu!stable installation available!", LoggingTarget.Information, LogLevel.Error);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stable.ExistsDirectory(ImportFromStablePath))
|
var storage = PrepareStableStorage(stableStorage);
|
||||||
|
|
||||||
|
if (!storage.ExistsDirectory(ImportFromStablePath))
|
||||||
{
|
{
|
||||||
// This handles situations like when the user does not have a Skins folder
|
// This handles situations like when the user does not have a Skins folder
|
||||||
Logger.Log($"No {ImportFromStablePath} folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error);
|
Logger.Log($"No {ImportFromStablePath} folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.Run(async () => await Import(GetStableImportPaths(GetStableStorage()).Select(f => stable.GetFullPath(f)).ToArray()));
|
return Task.Run(async () => await Import(GetStableImportPaths(storage).ToArray()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Run any required traversal operations on the stable storage location before performing operations.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stableStorage">The stable storage.</param>
|
||||||
|
/// <returns>The usable storage. Return the unchanged <paramref name="stableStorage"/> if no traversal is required.</returns>
|
||||||
|
protected virtual Storage PrepareStableStorage(StableStorage stableStorage) => stableStorage;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -38,7 +38,12 @@ namespace osu.Game.Graphics.Containers
|
|||||||
foreach (var link in links)
|
foreach (var link in links)
|
||||||
{
|
{
|
||||||
AddText(text[previousLinkEnd..link.Index]);
|
AddText(text[previousLinkEnd..link.Index]);
|
||||||
AddLink(text.Substring(link.Index, link.Length), link.Action, link.Argument ?? link.Url);
|
|
||||||
|
string displayText = text.Substring(link.Index, link.Length);
|
||||||
|
string linkArgument = link.Argument ?? link.Url;
|
||||||
|
string tooltip = displayText == link.Url ? null : link.Url;
|
||||||
|
|
||||||
|
AddLink(displayText, link.Action, linkArgument, tooltip);
|
||||||
previousLinkEnd = link.Index + link.Length;
|
previousLinkEnd = link.Index + link.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +57,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
=> createLink(AddText(text, creationParameters), new LinkDetails(LinkAction.Custom, null), tooltipText, action);
|
=> createLink(AddText(text, creationParameters), new LinkDetails(LinkAction.Custom, null), tooltipText, action);
|
||||||
|
|
||||||
public void AddLink(string text, LinkAction action, string argument, string tooltipText = null, Action<SpriteText> creationParameters = null)
|
public void AddLink(string text, LinkAction action, string argument, string tooltipText = null, Action<SpriteText> creationParameters = null)
|
||||||
=> createLink(AddText(text, creationParameters), new LinkDetails(action, argument), null);
|
=> createLink(AddText(text, creationParameters), new LinkDetails(action, argument), tooltipText);
|
||||||
|
|
||||||
public void AddLink(IEnumerable<SpriteText> text, LinkAction action = LinkAction.External, string linkArgument = null, string tooltipText = null)
|
public void AddLink(IEnumerable<SpriteText> text, LinkAction action = LinkAction.External, string linkArgument = null, string tooltipText = null)
|
||||||
{
|
{
|
||||||
|
@ -18,8 +18,10 @@ namespace osu.Game.Graphics.Containers
|
|||||||
[Cached(typeof(IPreviewTrackOwner))]
|
[Cached(typeof(IPreviewTrackOwner))]
|
||||||
public abstract class OsuFocusedOverlayContainer : FocusedOverlayContainer, IPreviewTrackOwner, IKeyBindingHandler<GlobalAction>
|
public abstract class OsuFocusedOverlayContainer : FocusedOverlayContainer, IPreviewTrackOwner, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
private SampleChannel samplePopIn;
|
private Sample samplePopIn;
|
||||||
private SampleChannel samplePopOut;
|
private Sample samplePopOut;
|
||||||
|
protected virtual string PopInSampleName => "UI/overlay-pop-in";
|
||||||
|
protected virtual string PopOutSampleName => "UI/overlay-pop-out";
|
||||||
|
|
||||||
protected override bool BlockNonPositionalInput => true;
|
protected override bool BlockNonPositionalInput => true;
|
||||||
|
|
||||||
@ -40,8 +42,8 @@ namespace osu.Game.Graphics.Containers
|
|||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
samplePopIn = audio.Samples.Get(@"UI/overlay-pop-in");
|
samplePopIn = audio.Samples.Get(PopInSampleName);
|
||||||
samplePopOut = audio.Samples.Get(@"UI/overlay-pop-out");
|
samplePopOut = audio.Samples.Get(PopOutSampleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Graphics
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private NotificationOverlay notificationOverlay { get; set; }
|
private NotificationOverlay notificationOverlay { get; set; }
|
||||||
|
|
||||||
private SampleChannel shutter;
|
private Sample shutter;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config, Storage storage, AudioManager audio)
|
private void load(OsuConfigManager config, Storage storage, AudioManager audio)
|
||||||
|
@ -22,8 +22,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private const int text_size = 17;
|
private const int text_size = 17;
|
||||||
private const int transition_length = 80;
|
private const int transition_length = 80;
|
||||||
|
|
||||||
private SampleChannel sampleClick;
|
private Sample sampleClick;
|
||||||
private SampleChannel sampleHover;
|
private Sample sampleHover;
|
||||||
|
|
||||||
private TextContainer text;
|
private TextContainer text;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class HoverClickSounds : HoverSounds
|
public class HoverClickSounds : HoverSounds
|
||||||
{
|
{
|
||||||
private SampleChannel sampleClick;
|
private Sample sampleClick;
|
||||||
private readonly MouseButton[] buttons;
|
private readonly MouseButton[] buttons;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
// 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 osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Handles debouncing hover sounds at a global level to ensure the effects are not overwhelming.
|
||||||
|
/// </summary>
|
||||||
|
public abstract class HoverSampleDebounceComponent : CompositeDrawable
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Length of debounce for hover sound playback, in milliseconds.
|
||||||
|
/// </summary>
|
||||||
|
public double HoverDebounceTime { get; } = 20;
|
||||||
|
|
||||||
|
private Bindable<double?> lastPlaybackTime;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(AudioManager audio, SessionStatics statics)
|
||||||
|
{
|
||||||
|
lastPlaybackTime = statics.GetBindable<double?>(Static.LastHoverSoundPlaybackTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
{
|
||||||
|
// hover sounds shouldn't be played during scroll operations.
|
||||||
|
if (e.HasAnyButtonPressed)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool enoughTimePassedSinceLastPlayback = !lastPlaybackTime.Value.HasValue || Time.Current - lastPlaybackTime.Value >= HoverDebounceTime;
|
||||||
|
|
||||||
|
if (enoughTimePassedSinceLastPlayback)
|
||||||
|
{
|
||||||
|
PlayHoverSample();
|
||||||
|
lastPlaybackTime.Value = Time.Current;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void PlayHoverSample();
|
||||||
|
}
|
||||||
|
}
|
@ -5,12 +5,10 @@ using System.ComponentModel;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Input.Events;
|
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Framework.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -18,19 +16,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// Adds hover sounds to a drawable.
|
/// Adds hover sounds to a drawable.
|
||||||
/// Does not draw anything.
|
/// Does not draw anything.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class HoverSounds : CompositeDrawable
|
public class HoverSounds : HoverSampleDebounceComponent
|
||||||
{
|
{
|
||||||
private SampleChannel sampleHover;
|
private Sample sampleHover;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Length of debounce for hover sound playback, in milliseconds.
|
|
||||||
/// </summary>
|
|
||||||
public double HoverDebounceTime { get; } = 20;
|
|
||||||
|
|
||||||
protected readonly HoverSampleSet SampleSet;
|
protected readonly HoverSampleSet SampleSet;
|
||||||
|
|
||||||
private Bindable<double?> lastPlaybackTime;
|
|
||||||
|
|
||||||
public HoverSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal)
|
public HoverSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal)
|
||||||
{
|
{
|
||||||
SampleSet = sampleSet;
|
SampleSet = sampleSet;
|
||||||
@ -40,22 +31,13 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, SessionStatics statics)
|
private void load(AudioManager audio, SessionStatics statics)
|
||||||
{
|
{
|
||||||
lastPlaybackTime = statics.GetBindable<double?>(Static.LastHoverSoundPlaybackTime);
|
|
||||||
|
|
||||||
sampleHover = audio.Samples.Get($@"UI/generic-hover{SampleSet.GetDescription()}");
|
sampleHover = audio.Samples.Get($@"UI/generic-hover{SampleSet.GetDescription()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
public override void PlayHoverSample()
|
||||||
{
|
{
|
||||||
bool enoughTimePassedSinceLastPlayback = !lastPlaybackTime.Value.HasValue || Time.Current - lastPlaybackTime.Value >= HoverDebounceTime;
|
sampleHover.Frequency.Value = 0.96 + RNG.NextDouble(0.08);
|
||||||
|
sampleHover.Play();
|
||||||
if (enoughTimePassedSinceLastPlayback)
|
|
||||||
{
|
|
||||||
sampleHover?.Play();
|
|
||||||
lastPlaybackTime.Value = Time.Current;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.OnHover(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,6 +50,9 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Normal,
|
Normal,
|
||||||
|
|
||||||
[Description("-softer")]
|
[Description("-softer")]
|
||||||
Soft
|
Soft,
|
||||||
|
|
||||||
|
[Description("-toolbar")]
|
||||||
|
Toolbar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,8 +46,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
protected readonly Nub Nub;
|
protected readonly Nub Nub;
|
||||||
|
|
||||||
private readonly OsuTextFlowContainer labelText;
|
private readonly OsuTextFlowContainer labelText;
|
||||||
private SampleChannel sampleChecked;
|
private Sample sampleChecked;
|
||||||
private SampleChannel sampleUnchecked;
|
private Sample sampleUnchecked;
|
||||||
|
|
||||||
public OsuCheckbox(bool nubOnRight = true)
|
public OsuCheckbox(bool nubOnRight = true)
|
||||||
{
|
{
|
||||||
@ -64,7 +64,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
},
|
},
|
||||||
Nub = new Nub(),
|
Nub = new Nub(),
|
||||||
new HoverClickSounds()
|
new HoverSounds()
|
||||||
};
|
};
|
||||||
|
|
||||||
if (nubOnRight)
|
if (nubOnRight)
|
||||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private const int max_decimal_digits = 5;
|
private const int max_decimal_digits = 5;
|
||||||
|
|
||||||
private SampleChannel sample;
|
private Sample sample;
|
||||||
private double lastSampleTime;
|
private double lastSampleTime;
|
||||||
private T lastSampleValue;
|
private T lastSampleValue;
|
||||||
|
|
||||||
@ -155,16 +155,15 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
lastSampleValue = value;
|
lastSampleValue = value;
|
||||||
|
|
||||||
lastSampleTime = Clock.CurrentTime;
|
lastSampleTime = Clock.CurrentTime;
|
||||||
sample.Frequency.Value = 1 + NormalizedValue * 0.2f;
|
|
||||||
|
|
||||||
|
var channel = sample.Play();
|
||||||
|
|
||||||
|
channel.Frequency.Value = 1 + NormalizedValue * 0.2f;
|
||||||
if (NormalizedValue == 0)
|
if (NormalizedValue == 0)
|
||||||
sample.Frequency.Value -= 0.4f;
|
channel.Frequency.Value -= 0.4f;
|
||||||
else if (NormalizedValue == 1)
|
else if (NormalizedValue == 1)
|
||||||
sample.Frequency.Value += 0.4f;
|
channel.Frequency.Value += 0.4f;
|
||||||
|
|
||||||
sample.Play();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTooltipText(T value)
|
private void updateTooltipText(T value)
|
||||||
|
@ -23,11 +23,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
public class OsuTextBox : BasicTextBox
|
public class OsuTextBox : BasicTextBox
|
||||||
{
|
{
|
||||||
private readonly SampleChannel[] textAddedSamples = new SampleChannel[4];
|
private readonly Sample[] textAddedSamples = new Sample[4];
|
||||||
private SampleChannel capsTextAddedSample;
|
private Sample capsTextAddedSample;
|
||||||
private SampleChannel textRemovedSample;
|
private Sample textRemovedSample;
|
||||||
private SampleChannel textCommittedSample;
|
private Sample textCommittedSample;
|
||||||
private SampleChannel caretMovedSample;
|
private Sample caretMovedSample;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to allow playing a different samples based on the type of character.
|
/// Whether to allow playing a different samples based on the type of character.
|
||||||
|
@ -40,8 +40,19 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
set => CurrentNumber.Value = value;
|
set => CurrentNumber.Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProgressBar()
|
private readonly bool allowSeek;
|
||||||
|
|
||||||
|
public override bool HandlePositionalInput => allowSeek;
|
||||||
|
public override bool HandleNonPositionalInput => allowSeek;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Construct a new progress bar.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="allowSeek">Whether the user should be allowed to click/drag to adjust the value.</param>
|
||||||
|
public ProgressBar(bool allowSeek)
|
||||||
{
|
{
|
||||||
|
this.allowSeek = allowSeek;
|
||||||
|
|
||||||
CurrentNumber.MinValue = 0;
|
CurrentNumber.MinValue = 0;
|
||||||
CurrentNumber.MaxValue = 1;
|
CurrentNumber.MaxValue = 1;
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user