mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 08:43:20 +08:00
Merge branch 'master' into multiplayer-beatmap-tracker
This commit is contained in:
commit
a71d6a4c97
@ -5,7 +5,7 @@
|
||||
# osu!
|
||||
|
||||
[![Build status](https://ci.appveyor.com/api/projects/status/u2p01nx7l6og8buh?svg=true)](https://ci.appveyor.com/project/peppy/osu)
|
||||
[![GitHub release](https://img.shields.io/github/release/ppy/osu.svg)]()
|
||||
[![GitHub release](https://img.shields.io/github/release/ppy/osu.svg)](https://github.com/ppy/osu/releases/latest)
|
||||
[![CodeFactor](https://www.codefactor.io/repository/github/ppy/osu/badge)](https://www.codefactor.io/repository/github/ppy/osu)
|
||||
[![dev chat](https://discordapp.com/api/guilds/188630481301012481/widget.png?style=shield)](https://discord.gg/ppy)
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
|
||||
<PackageReference Include="DiscordRichPresence" Version="1.0.169" />
|
||||
<PackageReference Include="DiscordRichPresence" Version="1.0.175" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Resources">
|
||||
<EmbeddedResource Include="lazer.ico" />
|
||||
|
@ -29,4 +29,3 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,4 +19,3 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,31 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Rulesets.Mania.Mods;
|
||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
using osu.Game.Rulesets.UI.Scrolling.Algorithms;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Tests.Mods
|
||||
{
|
||||
public class TestSceneManiaModConstantSpeed : ModTestScene
|
||||
{
|
||||
protected override Ruleset CreatePlayerRuleset() => new ManiaRuleset();
|
||||
|
||||
[Test]
|
||||
public void TestConstantScroll() => CreateModTest(new ModTestData
|
||||
{
|
||||
Mod = new ManiaModConstantSpeed(),
|
||||
PassCondition = () =>
|
||||
{
|
||||
var hitObject = Player.ChildrenOfType<DrawableManiaHitObject>().FirstOrDefault();
|
||||
return hitObject?.Dependencies.Get<IScrollingInfo>().Algorithm is ConstantScrollAlgorithm;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -238,6 +238,7 @@ namespace osu.Game.Rulesets.Mania
|
||||
new ManiaModMirror(),
|
||||
new ManiaModDifficultyAdjust(),
|
||||
new ManiaModInvert(),
|
||||
new ManiaModConstantSpeed()
|
||||
};
|
||||
|
||||
case ModType.Automation:
|
||||
|
35
osu.Game.Rulesets.Mania/Mods/ManiaModConstantSpeed.cs
Normal file
35
osu.Game.Rulesets.Mania/Mods/ManiaModConstantSpeed.cs
Normal file
@ -0,0 +1,35 @@
|
||||
// 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.Graphics.Sprites;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.UI;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Mods
|
||||
{
|
||||
public class ManiaModConstantSpeed : Mod, IApplicableToDrawableRuleset<ManiaHitObject>
|
||||
{
|
||||
public override string Name => "Constant Speed";
|
||||
|
||||
public override string Acronym => "CS";
|
||||
|
||||
public override double ScoreMultiplier => 1;
|
||||
|
||||
public override string Description => "No more tricky speed changes!";
|
||||
|
||||
public override IconUsage? Icon => FontAwesome.Solid.Equals;
|
||||
|
||||
public override ModType Type => ModType.Conversion;
|
||||
|
||||
public override bool Ranked => false;
|
||||
|
||||
public void ApplyToDrawableRuleset(DrawableRuleset<ManiaHitObject> drawableRuleset)
|
||||
{
|
||||
var maniaRuleset = (DrawableManiaRuleset)drawableRuleset;
|
||||
maniaRuleset.ScrollMethod = ScrollVisualisationMethod.Constant;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
// 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.Framework.Allocation;
|
||||
@ -11,6 +12,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Input.Handlers;
|
||||
using osu.Game.Replays;
|
||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||
@ -49,6 +51,22 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
|
||||
protected new ManiaRulesetConfigManager Config => (ManiaRulesetConfigManager)base.Config;
|
||||
|
||||
public ScrollVisualisationMethod ScrollMethod
|
||||
{
|
||||
get => scrollMethod;
|
||||
set
|
||||
{
|
||||
if (IsLoaded)
|
||||
throw new InvalidOperationException($"Can't alter {nameof(ScrollMethod)} after ruleset is already loaded");
|
||||
|
||||
scrollMethod = value;
|
||||
}
|
||||
}
|
||||
|
||||
private ScrollVisualisationMethod scrollMethod = ScrollVisualisationMethod.Sequential;
|
||||
|
||||
protected override ScrollVisualisationMethod VisualisationMethod => scrollMethod;
|
||||
|
||||
private readonly Bindable<ManiaScrollingDirection> configDirection = new Bindable<ManiaScrollingDirection>();
|
||||
private readonly Bindable<double> configTimeRange = new BindableDouble();
|
||||
|
||||
|
@ -69,5 +69,9 @@
|
||||
<Name>osu.Game</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="DeepEqual" Version="2.0.0" />
|
||||
<PackageReference Include="Moq" Version="4.16.0" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
</Project>
|
@ -45,6 +45,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="DeepEqual" Version="2.0.0" />
|
||||
<PackageReference Include="Moq" Version="4.16.0" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
</Project>
|
160
osu.Game.Tests/Mods/ModUtilsTest.cs
Normal file
160
osu.Game.Tests/Mods/ModUtilsTest.cs
Normal file
@ -0,0 +1,160 @@
|
||||
// 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.Linq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Utils;
|
||||
|
||||
namespace osu.Game.Tests.Mods
|
||||
{
|
||||
[TestFixture]
|
||||
public class ModUtilsTest
|
||||
{
|
||||
[Test]
|
||||
public void TestModIsCompatibleByItself()
|
||||
{
|
||||
var mod = new Mock<CustomMod1>();
|
||||
Assert.That(ModUtils.CheckCompatibleSet(new[] { mod.Object }));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestIncompatibleThroughTopLevel()
|
||||
{
|
||||
var mod1 = new Mock<CustomMod1>();
|
||||
var mod2 = new Mock<CustomMod2>();
|
||||
|
||||
mod1.Setup(m => m.IncompatibleMods).Returns(new[] { mod2.Object.GetType() });
|
||||
|
||||
// Test both orderings.
|
||||
Assert.That(ModUtils.CheckCompatibleSet(new Mod[] { mod1.Object, mod2.Object }), Is.False);
|
||||
Assert.That(ModUtils.CheckCompatibleSet(new Mod[] { mod2.Object, mod1.Object }), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMultiModIncompatibleWithTopLevel()
|
||||
{
|
||||
var mod1 = new Mock<CustomMod1>();
|
||||
|
||||
// The nested mod.
|
||||
var mod2 = new Mock<CustomMod2>();
|
||||
mod2.Setup(m => m.IncompatibleMods).Returns(new[] { mod1.Object.GetType() });
|
||||
|
||||
var multiMod = new MultiMod(new MultiMod(mod2.Object));
|
||||
|
||||
// Test both orderings.
|
||||
Assert.That(ModUtils.CheckCompatibleSet(new Mod[] { multiMod, mod1.Object }), Is.False);
|
||||
Assert.That(ModUtils.CheckCompatibleSet(new Mod[] { mod1.Object, multiMod }), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTopLevelIncompatibleWithMultiMod()
|
||||
{
|
||||
// The nested mod.
|
||||
var mod1 = new Mock<CustomMod1>();
|
||||
var multiMod = new MultiMod(new MultiMod(mod1.Object));
|
||||
|
||||
var mod2 = new Mock<CustomMod2>();
|
||||
mod2.Setup(m => m.IncompatibleMods).Returns(new[] { typeof(CustomMod1) });
|
||||
|
||||
// Test both orderings.
|
||||
Assert.That(ModUtils.CheckCompatibleSet(new Mod[] { multiMod, mod2.Object }), Is.False);
|
||||
Assert.That(ModUtils.CheckCompatibleSet(new Mod[] { mod2.Object, multiMod }), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCompatibleMods()
|
||||
{
|
||||
var mod1 = new Mock<CustomMod1>();
|
||||
var mod2 = new Mock<CustomMod2>();
|
||||
|
||||
// Test both orderings.
|
||||
Assert.That(ModUtils.CheckCompatibleSet(new Mod[] { mod1.Object, mod2.Object }), Is.True);
|
||||
Assert.That(ModUtils.CheckCompatibleSet(new Mod[] { mod2.Object, mod1.Object }), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestIncompatibleThroughBaseType()
|
||||
{
|
||||
var mod1 = new Mock<CustomMod1>();
|
||||
var mod2 = new Mock<CustomMod2>();
|
||||
mod2.Setup(m => m.IncompatibleMods).Returns(new[] { typeof(Mod) });
|
||||
|
||||
// Test both orderings.
|
||||
Assert.That(ModUtils.CheckCompatibleSet(new Mod[] { mod1.Object, mod2.Object }), Is.False);
|
||||
Assert.That(ModUtils.CheckCompatibleSet(new Mod[] { mod2.Object, mod1.Object }), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAllowedThroughMostDerivedType()
|
||||
{
|
||||
var mod = new Mock<CustomMod1>();
|
||||
Assert.That(ModUtils.CheckAllowed(new[] { mod.Object }, new[] { mod.Object.GetType() }));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNotAllowedThroughBaseType()
|
||||
{
|
||||
var mod = new Mock<CustomMod1>();
|
||||
Assert.That(ModUtils.CheckAllowed(new[] { mod.Object }, new[] { typeof(Mod) }), Is.False);
|
||||
}
|
||||
|
||||
private static readonly object[] invalid_mod_test_scenarios =
|
||||
{
|
||||
// incompatible pair.
|
||||
new object[]
|
||||
{
|
||||
new Mod[] { new OsuModDoubleTime(), new OsuModHalfTime() },
|
||||
new[] { typeof(OsuModDoubleTime), typeof(OsuModHalfTime) }
|
||||
},
|
||||
// incompatible pair with derived class.
|
||||
new object[]
|
||||
{
|
||||
new Mod[] { new OsuModNightcore(), new OsuModHalfTime() },
|
||||
new[] { typeof(OsuModNightcore), typeof(OsuModHalfTime) }
|
||||
},
|
||||
// system mod.
|
||||
new object[]
|
||||
{
|
||||
new Mod[] { new OsuModDoubleTime(), new OsuModTouchDevice() },
|
||||
new[] { typeof(OsuModTouchDevice) }
|
||||
},
|
||||
// multi mod.
|
||||
new object[]
|
||||
{
|
||||
new Mod[] { new MultiMod(new OsuModHalfTime()), new OsuModHalfTime() },
|
||||
new[] { typeof(MultiMod) }
|
||||
},
|
||||
// valid pair.
|
||||
new object[]
|
||||
{
|
||||
new Mod[] { new OsuModDoubleTime(), new OsuModHardRock() },
|
||||
null
|
||||
}
|
||||
};
|
||||
|
||||
[TestCaseSource(nameof(invalid_mod_test_scenarios))]
|
||||
public void TestInvalidModScenarios(Mod[] inputMods, Type[] expectedInvalid)
|
||||
{
|
||||
bool isValid = ModUtils.CheckValidForGameplay(inputMods, out var invalid);
|
||||
|
||||
Assert.That(isValid, Is.EqualTo(expectedInvalid == null));
|
||||
|
||||
if (isValid)
|
||||
Assert.IsNull(invalid);
|
||||
else
|
||||
Assert.That(invalid?.Select(t => t.GetType()), Is.EquivalentTo(expectedInvalid));
|
||||
}
|
||||
|
||||
public abstract class CustomMod1 : Mod
|
||||
{
|
||||
}
|
||||
|
||||
public abstract class CustomMod2 : Mod
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -3,8 +3,12 @@
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Screens;
|
||||
using osu.Game.Screens.OnlinePlay;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
@ -58,5 +62,45 @@ namespace osu.Game.Tests.NonVisual
|
||||
AddStep("end operation", () => operation.Dispose());
|
||||
AddAssert("operation is ended", () => !operationInProgress.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOperationDisposalAfterScreenExit()
|
||||
{
|
||||
TestScreenWithTracker screen = null;
|
||||
OsuScreenStack stack;
|
||||
IDisposable operation = null;
|
||||
|
||||
AddStep("create screen with tracker", () =>
|
||||
{
|
||||
Child = stack = new OsuScreenStack
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
};
|
||||
|
||||
stack.Push(screen = new TestScreenWithTracker());
|
||||
});
|
||||
AddUntilStep("wait for loaded", () => screen.IsLoaded);
|
||||
|
||||
AddStep("begin operation", () => operation = screen.OngoingOperationTracker.BeginOperation());
|
||||
AddAssert("operation in progress", () => screen.OngoingOperationTracker.InProgress.Value);
|
||||
|
||||
AddStep("dispose after screen exit", () =>
|
||||
{
|
||||
screen.Exit();
|
||||
operation.Dispose();
|
||||
});
|
||||
AddAssert("operation ended", () => !screen.OngoingOperationTracker.InProgress.Value);
|
||||
}
|
||||
|
||||
private class TestScreenWithTracker : OsuScreen
|
||||
{
|
||||
public OngoingOperationTracker OngoingOperationTracker { get; private set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChild = OngoingOperationTracker = new OngoingOperationTracker();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ using osu.Game.Rulesets.UI;
|
||||
namespace osu.Game.Tests.Online
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestAPIModSerialization
|
||||
public class TestAPIModJsonSerialization
|
||||
{
|
||||
[Test]
|
||||
public void TestAcronymIsPreserved()
|
139
osu.Game.Tests/Online/TestAPIModMessagePackSerialization.cs
Normal file
139
osu.Game.Tests/Online/TestAPIModMessagePackSerialization.cs
Normal file
@ -0,0 +1,139 @@
|
||||
// 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 MessagePack;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.UI;
|
||||
|
||||
namespace osu.Game.Tests.Online
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestAPIModMessagePackSerialization
|
||||
{
|
||||
[Test]
|
||||
public void TestAcronymIsPreserved()
|
||||
{
|
||||
var apiMod = new APIMod(new TestMod());
|
||||
|
||||
var deserialized = MessagePackSerializer.Deserialize<APIMod>(MessagePackSerializer.Serialize(apiMod));
|
||||
|
||||
Assert.That(deserialized.Acronym, Is.EqualTo(apiMod.Acronym));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRawSettingIsPreserved()
|
||||
{
|
||||
var apiMod = new APIMod(new TestMod { TestSetting = { Value = 2 } });
|
||||
|
||||
var deserialized = MessagePackSerializer.Deserialize<APIMod>(MessagePackSerializer.Serialize(apiMod));
|
||||
|
||||
Assert.That(deserialized.Settings, Contains.Key("test_setting").With.ContainValue(2.0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConvertedModHasCorrectSetting()
|
||||
{
|
||||
var apiMod = new APIMod(new TestMod { TestSetting = { Value = 2 } });
|
||||
|
||||
var deserialized = MessagePackSerializer.Deserialize<APIMod>(MessagePackSerializer.Serialize(apiMod));
|
||||
var converted = (TestMod)deserialized.ToMod(new TestRuleset());
|
||||
|
||||
Assert.That(converted.TestSetting.Value, Is.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDeserialiseTimeRampMod()
|
||||
{
|
||||
// Create the mod with values different from default.
|
||||
var apiMod = new APIMod(new TestModTimeRamp
|
||||
{
|
||||
AdjustPitch = { Value = false },
|
||||
InitialRate = { Value = 1.25 },
|
||||
FinalRate = { Value = 0.25 }
|
||||
});
|
||||
|
||||
var deserialised = MessagePackSerializer.Deserialize<APIMod>(MessagePackSerializer.Serialize(apiMod));
|
||||
var converted = (TestModTimeRamp)deserialised.ToMod(new TestRuleset());
|
||||
|
||||
Assert.That(converted.AdjustPitch.Value, Is.EqualTo(false));
|
||||
Assert.That(converted.InitialRate.Value, Is.EqualTo(1.25));
|
||||
Assert.That(converted.FinalRate.Value, Is.EqualTo(0.25));
|
||||
}
|
||||
|
||||
private class TestRuleset : Ruleset
|
||||
{
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type) => new Mod[]
|
||||
{
|
||||
new TestMod(),
|
||||
new TestModTimeRamp(),
|
||||
};
|
||||
|
||||
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => throw new System.NotImplementedException();
|
||||
|
||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => throw new System.NotImplementedException();
|
||||
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => throw new System.NotImplementedException();
|
||||
|
||||
public override string Description { get; } = string.Empty;
|
||||
public override string ShortName { get; } = string.Empty;
|
||||
}
|
||||
|
||||
private class TestMod : Mod
|
||||
{
|
||||
public override string Name => "Test Mod";
|
||||
public override string Acronym => "TM";
|
||||
public override double ScoreMultiplier => 1;
|
||||
|
||||
[SettingSource("Test")]
|
||||
public BindableNumber<double> TestSetting { get; } = new BindableDouble
|
||||
{
|
||||
MinValue = 0,
|
||||
MaxValue = 10,
|
||||
Default = 5,
|
||||
Precision = 0.01,
|
||||
};
|
||||
}
|
||||
|
||||
private class TestModTimeRamp : ModTimeRamp
|
||||
{
|
||||
public override string Name => "Test Mod";
|
||||
public override string Acronym => "TMTR";
|
||||
public override double ScoreMultiplier => 1;
|
||||
|
||||
[SettingSource("Initial rate", "The starting speed of the track")]
|
||||
public override BindableNumber<double> InitialRate { get; } = new BindableDouble
|
||||
{
|
||||
MinValue = 1,
|
||||
MaxValue = 2,
|
||||
Default = 1.5,
|
||||
Value = 1.5,
|
||||
Precision = 0.01,
|
||||
};
|
||||
|
||||
[SettingSource("Final rate", "The speed increase to ramp towards")]
|
||||
public override BindableNumber<double> FinalRate { get; } = new BindableDouble
|
||||
{
|
||||
MinValue = 0,
|
||||
MaxValue = 1,
|
||||
Default = 0.5,
|
||||
Value = 0.5,
|
||||
Precision = 0.01,
|
||||
};
|
||||
|
||||
[SettingSource("Adjust pitch", "Should pitch be adjusted with speed")]
|
||||
public override BindableBool AdjustPitch { get; } = new BindableBool
|
||||
{
|
||||
Default = true,
|
||||
Value = true
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Storyboards;
|
||||
using osu.Game.Storyboards.Drawables;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
public class TestSceneStoryboardSamplePlayback : PlayerTestScene
|
||||
{
|
||||
private Storyboard storyboard;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
config.Set(OsuSetting.ShowStoryboard, true);
|
||||
|
||||
storyboard = new Storyboard();
|
||||
var backgroundLayer = storyboard.GetLayer("Background");
|
||||
backgroundLayer.Add(new StoryboardSampleInfo("Intro/welcome.mp3", time: -7000, volume: 20));
|
||||
backgroundLayer.Add(new StoryboardSampleInfo("Intro/welcome.mp3", time: -5000, volume: 20));
|
||||
backgroundLayer.Add(new StoryboardSampleInfo("Intro/welcome.mp3", time: 0, volume: 20));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestStoryboardSamplesStopDuringPause()
|
||||
{
|
||||
checkForFirstSamplePlayback();
|
||||
|
||||
AddStep("player paused", () => Player.Pause());
|
||||
AddAssert("player is currently paused", () => Player.GameplayClockContainer.IsPaused.Value);
|
||||
AddAssert("all storyboard samples stopped immediately", () => allStoryboardSamples.All(sound => !sound.IsPlaying));
|
||||
|
||||
AddStep("player resume", () => Player.Resume());
|
||||
AddUntilStep("any storyboard samples playing after resume", () => allStoryboardSamples.Any(sound => sound.IsPlaying));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestStoryboardSamplesStopOnSkip()
|
||||
{
|
||||
checkForFirstSamplePlayback();
|
||||
|
||||
AddStep("skip intro", () => InputManager.Key(osuTK.Input.Key.Space));
|
||||
AddAssert("all storyboard samples stopped immediately", () => allStoryboardSamples.All(sound => !sound.IsPlaying));
|
||||
|
||||
AddUntilStep("any storyboard samples playing after skip", () => allStoryboardSamples.Any(sound => sound.IsPlaying));
|
||||
}
|
||||
|
||||
private void checkForFirstSamplePlayback()
|
||||
{
|
||||
AddUntilStep("storyboard loaded", () => Player.Beatmap.Value.StoryboardLoaded);
|
||||
AddUntilStep("any storyboard samples playing", () => allStoryboardSamples.Any(sound => sound.IsPlaying));
|
||||
}
|
||||
|
||||
private IEnumerable<DrawableStoryboardSample> allStoryboardSamples => Player.ChildrenOfType<DrawableStoryboardSample>();
|
||||
|
||||
protected override bool AllowFail => false;
|
||||
|
||||
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
||||
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new TestPlayer(true, false);
|
||||
|
||||
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null) =>
|
||||
new ClockBackedTestWorkingBeatmap(beatmap, storyboard ?? this.storyboard, Clock, Audio);
|
||||
}
|
||||
}
|
@ -11,8 +11,8 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets;
|
||||
@ -20,6 +20,7 @@ using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Screens.OnlinePlay;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
using osu.Game.Users;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
@ -241,7 +242,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
}
|
||||
|
||||
private void moveToItem(int index, Vector2? offset = null)
|
||||
=> AddStep($"move mouse to item {index}", () => InputManager.MoveMouseTo(playlist.ChildrenOfType<OsuRearrangeableListItem<PlaylistItem>>().ElementAt(index), offset));
|
||||
=> AddStep($"move mouse to item {index}", () => InputManager.MoveMouseTo(playlist.ChildrenOfType<DifficultyIcon>().ElementAt(index), offset));
|
||||
|
||||
private void moveToDragger(int index, Vector2? offset = null) => AddStep($"move mouse to dragger {index}", () =>
|
||||
{
|
||||
@ -252,7 +253,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
private void moveToDeleteButton(int index, Vector2? offset = null) => AddStep($"move mouse to delete button {index}", () =>
|
||||
{
|
||||
var item = playlist.ChildrenOfType<OsuRearrangeableListItem<PlaylistItem>>().ElementAt(index);
|
||||
InputManager.MoveMouseTo(item.ChildrenOfType<IconButton>().ElementAt(0), offset);
|
||||
InputManager.MoveMouseTo(item.ChildrenOfType<DrawableRoomPlaylistItem.PlaylistRemoveButton>().ElementAt(0), offset);
|
||||
});
|
||||
|
||||
private void assertHandleVisibility(int index, bool visible)
|
||||
@ -260,7 +261,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
() => (playlist.ChildrenOfType<OsuRearrangeableListItem<PlaylistItem>.PlaylistItemHandle>().ElementAt(index).Alpha > 0) == visible);
|
||||
|
||||
private void assertDeleteButtonVisibility(int index, bool visible)
|
||||
=> AddAssert($"delete button {index} {(visible ? "is" : "is not")} visible", () => (playlist.ChildrenOfType<IconButton>().ElementAt(2 + index * 2).Alpha > 0) == visible);
|
||||
=> AddAssert($"delete button {index} {(visible ? "is" : "is not")} visible", () => (playlist.ChildrenOfType<DrawableRoomPlaylistItem.PlaylistRemoveButton>().ElementAt(2 + index * 2).Alpha > 0) == visible);
|
||||
|
||||
private void createPlaylist(bool allowEdit, bool allowSelection)
|
||||
{
|
||||
@ -278,7 +279,21 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
playlist.Items.Add(new PlaylistItem
|
||||
{
|
||||
ID = i,
|
||||
Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo },
|
||||
Beatmap =
|
||||
{
|
||||
Value = i % 2 == 1
|
||||
? new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo
|
||||
: new BeatmapInfo
|
||||
{
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Artist = "Artist",
|
||||
Author = new User { Username = "Creator name here" },
|
||||
Title = "Long title used to check background colour",
|
||||
},
|
||||
BeatmapSet = new BeatmapSetInfo()
|
||||
}
|
||||
},
|
||||
Ruleset = { Value = new OsuRuleset().RulesetInfo },
|
||||
RequiredMods =
|
||||
{
|
||||
|
@ -0,0 +1,21 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Screens.OnlinePlay;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public class TestSceneFreeModSelectOverlay : MultiplayerTestScene
|
||||
{
|
||||
[SetUp]
|
||||
public new void Setup() => Schedule(() =>
|
||||
{
|
||||
Child = new FreeModSelectOverlay
|
||||
{
|
||||
State = { Value = Visibility.Visible }
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
@ -8,16 +8,16 @@ using osu.Game.Users;
|
||||
using osuTK;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Overlays.Chat;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public class TestSceneStandAloneChatDisplay : OsuTestScene
|
||||
public class TestSceneStandAloneChatDisplay : OsuManualInputManagerTestScene
|
||||
{
|
||||
private readonly Channel testChannel = new Channel();
|
||||
|
||||
private readonly User admin = new User
|
||||
{
|
||||
Username = "HappyStick",
|
||||
@ -46,92 +46,97 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[Cached]
|
||||
private ChannelManager channelManager = new ChannelManager();
|
||||
|
||||
private readonly TestStandAloneChatDisplay chatDisplay;
|
||||
private readonly TestStandAloneChatDisplay chatDisplay2;
|
||||
private TestStandAloneChatDisplay chatDisplay;
|
||||
private int messageIdSequence;
|
||||
|
||||
private Channel testChannel;
|
||||
|
||||
public TestSceneStandAloneChatDisplay()
|
||||
{
|
||||
Add(channelManager);
|
||||
|
||||
Add(chatDisplay = new TestStandAloneChatDisplay
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Margin = new MarginPadding(20),
|
||||
Size = new Vector2(400, 80)
|
||||
});
|
||||
|
||||
Add(chatDisplay2 = new TestStandAloneChatDisplay(true)
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Margin = new MarginPadding(20),
|
||||
Size = new Vector2(400, 150)
|
||||
});
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() =>
|
||||
{
|
||||
base.LoadComplete();
|
||||
messageIdSequence = 0;
|
||||
channelManager.CurrentChannel.Value = testChannel = new Channel();
|
||||
|
||||
channelManager.CurrentChannel.Value = testChannel;
|
||||
Children = new[]
|
||||
{
|
||||
chatDisplay = new TestStandAloneChatDisplay
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Margin = new MarginPadding(20),
|
||||
Size = new Vector2(400, 80),
|
||||
Channel = { Value = testChannel },
|
||||
},
|
||||
new TestStandAloneChatDisplay(true)
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Margin = new MarginPadding(20),
|
||||
Size = new Vector2(400, 150),
|
||||
Channel = { Value = testChannel },
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
chatDisplay.Channel.Value = testChannel;
|
||||
chatDisplay2.Channel.Value = testChannel;
|
||||
|
||||
int sequence = 0;
|
||||
|
||||
AddStep("message from admin", () => testChannel.AddNewMessages(new Message(sequence++)
|
||||
[Test]
|
||||
public void TestManyMessages()
|
||||
{
|
||||
AddStep("message from admin", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||
{
|
||||
Sender = admin,
|
||||
Content = "I am a wang!"
|
||||
}));
|
||||
|
||||
AddStep("message from team red", () => testChannel.AddNewMessages(new Message(sequence++)
|
||||
AddStep("message from team red", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||
{
|
||||
Sender = redUser,
|
||||
Content = "I am team red."
|
||||
}));
|
||||
|
||||
AddStep("message from team red", () => testChannel.AddNewMessages(new Message(sequence++)
|
||||
AddStep("message from team red", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||
{
|
||||
Sender = redUser,
|
||||
Content = "I plan to win!"
|
||||
}));
|
||||
|
||||
AddStep("message from team blue", () => testChannel.AddNewMessages(new Message(sequence++)
|
||||
AddStep("message from team blue", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||
{
|
||||
Sender = blueUser,
|
||||
Content = "Not on my watch. Prepare to eat saaaaaaaaaand. Lots and lots of saaaaaaand."
|
||||
}));
|
||||
|
||||
AddStep("message from admin", () => testChannel.AddNewMessages(new Message(sequence++)
|
||||
AddStep("message from admin", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||
{
|
||||
Sender = admin,
|
||||
Content = "Okay okay, calm down guys. Let's do this!"
|
||||
}));
|
||||
|
||||
AddStep("message from long username", () => testChannel.AddNewMessages(new Message(sequence++)
|
||||
AddStep("message from long username", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||
{
|
||||
Sender = longUsernameUser,
|
||||
Content = "Hi guys, my new username is lit!"
|
||||
}));
|
||||
|
||||
AddStep("message with new date", () => testChannel.AddNewMessages(new Message(sequence++)
|
||||
AddStep("message with new date", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||
{
|
||||
Sender = longUsernameUser,
|
||||
Content = "Message from the future!",
|
||||
Timestamp = DateTimeOffset.Now
|
||||
}));
|
||||
|
||||
AddUntilStep("ensure still scrolled to bottom", () => chatDisplay.ScrolledToBottom);
|
||||
checkScrolledToBottom();
|
||||
|
||||
const int messages_per_call = 10;
|
||||
AddRepeatStep("add many messages", () =>
|
||||
{
|
||||
for (int i = 0; i < messages_per_call; i++)
|
||||
{
|
||||
testChannel.AddNewMessages(new Message(sequence++)
|
||||
testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||
{
|
||||
Sender = longUsernameUser,
|
||||
Content = "Many messages! " + Guid.NewGuid(),
|
||||
@ -153,9 +158,133 @@ namespace osu.Game.Tests.Visual.Online
|
||||
return true;
|
||||
});
|
||||
|
||||
AddUntilStep("ensure still scrolled to bottom", () => chatDisplay.ScrolledToBottom);
|
||||
checkScrolledToBottom();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests that when a message gets wrapped by the chat display getting contracted while scrolled to bottom, the chat will still keep scrolling down.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestMessageWrappingKeepsAutoScrolling()
|
||||
{
|
||||
fillChat();
|
||||
|
||||
// send message with short words for text wrapping to occur when contracting chat.
|
||||
sendMessage();
|
||||
|
||||
AddStep("contract chat", () => chatDisplay.Width -= 100);
|
||||
checkScrolledToBottom();
|
||||
|
||||
AddStep("send another message", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||
{
|
||||
Sender = admin,
|
||||
Content = "As we were saying...",
|
||||
}));
|
||||
|
||||
checkScrolledToBottom();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUserScrollOverride()
|
||||
{
|
||||
fillChat();
|
||||
|
||||
sendMessage();
|
||||
checkScrolledToBottom();
|
||||
|
||||
AddStep("User scroll up", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(chatDisplay.ScreenSpaceDrawQuad.Centre);
|
||||
InputManager.PressButton(MouseButton.Left);
|
||||
InputManager.MoveMouseTo(chatDisplay.ScreenSpaceDrawQuad.Centre + new Vector2(0, chatDisplay.ScreenSpaceDrawQuad.Height));
|
||||
InputManager.ReleaseButton(MouseButton.Left);
|
||||
});
|
||||
|
||||
checkNotScrolledToBottom();
|
||||
sendMessage();
|
||||
checkNotScrolledToBottom();
|
||||
|
||||
AddRepeatStep("User scroll to bottom", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(chatDisplay.ScreenSpaceDrawQuad.Centre);
|
||||
InputManager.PressButton(MouseButton.Left);
|
||||
InputManager.MoveMouseTo(chatDisplay.ScreenSpaceDrawQuad.Centre - new Vector2(0, chatDisplay.ScreenSpaceDrawQuad.Height));
|
||||
InputManager.ReleaseButton(MouseButton.Left);
|
||||
}, 5);
|
||||
|
||||
checkScrolledToBottom();
|
||||
sendMessage();
|
||||
checkScrolledToBottom();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLocalEchoMessageResetsScroll()
|
||||
{
|
||||
fillChat();
|
||||
|
||||
sendMessage();
|
||||
checkScrolledToBottom();
|
||||
|
||||
AddStep("User scroll up", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(chatDisplay.ScreenSpaceDrawQuad.Centre);
|
||||
InputManager.PressButton(MouseButton.Left);
|
||||
InputManager.MoveMouseTo(chatDisplay.ScreenSpaceDrawQuad.Centre + new Vector2(0, chatDisplay.ScreenSpaceDrawQuad.Height));
|
||||
InputManager.ReleaseButton(MouseButton.Left);
|
||||
});
|
||||
|
||||
checkNotScrolledToBottom();
|
||||
sendMessage();
|
||||
checkNotScrolledToBottom();
|
||||
|
||||
sendLocalMessage();
|
||||
checkScrolledToBottom();
|
||||
|
||||
sendMessage();
|
||||
checkScrolledToBottom();
|
||||
}
|
||||
|
||||
private void fillChat()
|
||||
{
|
||||
AddStep("fill chat", () =>
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||
{
|
||||
Sender = longUsernameUser,
|
||||
Content = $"some stuff {Guid.NewGuid()}",
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
checkScrolledToBottom();
|
||||
}
|
||||
|
||||
private void sendMessage()
|
||||
{
|
||||
AddStep("send lorem ipsum", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||
{
|
||||
Sender = longUsernameUser,
|
||||
Content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce et bibendum velit.",
|
||||
}));
|
||||
}
|
||||
|
||||
private void sendLocalMessage()
|
||||
{
|
||||
AddStep("send local echo", () => testChannel.AddLocalEcho(new LocalEchoMessage
|
||||
{
|
||||
Sender = longUsernameUser,
|
||||
Content = "This is a local echo message.",
|
||||
}));
|
||||
}
|
||||
|
||||
private void checkScrolledToBottom() =>
|
||||
AddUntilStep("is scrolled to bottom", () => chatDisplay.ScrolledToBottom);
|
||||
|
||||
private void checkNotScrolledToBottom() =>
|
||||
AddUntilStep("not scrolled to bottom", () => !chatDisplay.ScrolledToBottom);
|
||||
|
||||
private class TestStandAloneChatDisplay : StandAloneChatDisplay
|
||||
{
|
||||
public TestStandAloneChatDisplay(bool textbox = false)
|
||||
@ -165,7 +294,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
|
||||
protected DrawableChannel DrawableChannel => InternalChildren.OfType<DrawableChannel>().First();
|
||||
|
||||
protected OsuScrollContainer ScrollContainer => (OsuScrollContainer)((Container)DrawableChannel.Child).Child;
|
||||
protected UserTrackingScrollContainer ScrollContainer => (UserTrackingScrollContainer)((Container)DrawableChannel.Child).Child;
|
||||
|
||||
public FillFlowContainer FillFlow => (FillFlowContainer)ScrollContainer.Child;
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics.Containers;
|
||||
@ -28,12 +27,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("push screen", () => LoadScreen(loungeScreen = new PlaylistsLoungeSubScreen
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Width = 0.5f,
|
||||
}));
|
||||
AddStep("push screen", () => LoadScreen(loungeScreen = new PlaylistsLoungeSubScreen()));
|
||||
|
||||
AddUntilStep("wait for present", () => loungeScreen.IsCurrentScreen());
|
||||
}
|
||||
|
21
osu.Game.Tests/Visual/UserInterface/TestSceneModIcon.cs
Normal file
21
osu.Game.Tests/Visual/UserInterface/TestSceneModIcon.cs
Normal file
@ -0,0 +1,21 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.UI;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public class TestSceneModIcon : OsuTestScene
|
||||
{
|
||||
[Test]
|
||||
public void TestChangeModType()
|
||||
{
|
||||
ModIcon icon = null;
|
||||
|
||||
AddStep("create mod icon", () => Child = icon = new ModIcon(new OsuModDoubleTime()));
|
||||
AddStep("change mod", () => icon.Mod = new OsuModEasy());
|
||||
}
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -38,28 +39,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() =>
|
||||
{
|
||||
SelectedMods.Value = Array.Empty<Mod>();
|
||||
Children = new Drawable[]
|
||||
{
|
||||
modSelect = new TestModSelectOverlay
|
||||
{
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
SelectedMods = { BindTarget = SelectedMods }
|
||||
},
|
||||
|
||||
modDisplay = new ModDisplay
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Position = new Vector2(-5, 25),
|
||||
Current = { BindTarget = modSelect.SelectedMods }
|
||||
}
|
||||
};
|
||||
});
|
||||
public void SetUp() => Schedule(() => createDisplay(() => new TestModSelectOverlay()));
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
@ -67,6 +47,32 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddStep("show", () => modSelect.Show());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAnimationFlushOnClose()
|
||||
{
|
||||
changeRuleset(0);
|
||||
|
||||
AddStep("Select all fun mods", () =>
|
||||
{
|
||||
modSelect.ModSectionsContainer
|
||||
.Single(c => c.ModType == ModType.DifficultyIncrease)
|
||||
.SelectAll();
|
||||
});
|
||||
|
||||
AddUntilStep("many mods selected", () => modDisplay.Current.Value.Count >= 5);
|
||||
|
||||
AddStep("trigger deselect and close overlay", () =>
|
||||
{
|
||||
modSelect.ModSectionsContainer
|
||||
.Single(c => c.ModType == ModType.DifficultyIncrease)
|
||||
.DeselectAll();
|
||||
|
||||
modSelect.Hide();
|
||||
});
|
||||
|
||||
AddAssert("all mods deselected", () => modDisplay.Current.Value.Count == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOsuMods()
|
||||
{
|
||||
@ -146,6 +152,46 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNonStacked()
|
||||
{
|
||||
changeRuleset(0);
|
||||
|
||||
AddStep("create overlay", () => createDisplay(() => new TestNonStackedModSelectOverlay()));
|
||||
|
||||
AddStep("show", () => modSelect.Show());
|
||||
|
||||
AddAssert("ensure all buttons are spread out", () => modSelect.ChildrenOfType<ModButton>().All(m => m.Mods.Length <= 1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestChangeIsValidChangesButtonVisibility()
|
||||
{
|
||||
changeRuleset(0);
|
||||
|
||||
AddAssert("double time visible", () => modSelect.ChildrenOfType<ModButton>().Any(b => b.Mods.Any(m => m is OsuModDoubleTime)));
|
||||
|
||||
AddStep("make double time invalid", () => modSelect.IsValidMod = m => !(m is OsuModDoubleTime));
|
||||
AddUntilStep("double time not visible", () => modSelect.ChildrenOfType<ModButton>().All(b => !b.Mods.Any(m => m is OsuModDoubleTime)));
|
||||
AddAssert("nightcore still visible", () => modSelect.ChildrenOfType<ModButton>().Any(b => b.Mods.Any(m => m is OsuModNightcore)));
|
||||
|
||||
AddStep("make double time valid again", () => modSelect.IsValidMod = m => true);
|
||||
AddUntilStep("double time visible", () => modSelect.ChildrenOfType<ModButton>().Any(b => b.Mods.Any(m => m is OsuModDoubleTime)));
|
||||
AddAssert("nightcore still visible", () => modSelect.ChildrenOfType<ModButton>().Any(b => b.Mods.Any(m => m is OsuModNightcore)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestChangeIsValidPreservesSelection()
|
||||
{
|
||||
changeRuleset(0);
|
||||
|
||||
AddStep("select DT + HD", () => SelectedMods.Value = new Mod[] { new OsuModDoubleTime(), new OsuModHidden() });
|
||||
AddAssert("DT + HD selected", () => modSelect.ChildrenOfType<ModButton>().Count(b => b.Selected) == 2);
|
||||
|
||||
AddStep("make NF invalid", () => modSelect.IsValidMod = m => !(m is ModNoFail));
|
||||
AddAssert("DT + HD still selected", () => modSelect.ChildrenOfType<ModButton>().Count(b => b.Selected) == 2);
|
||||
}
|
||||
|
||||
private void testSingleMod(Mod mod)
|
||||
{
|
||||
selectNext(mod);
|
||||
@ -265,12 +311,37 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
private void checkLabelColor(Func<Color4> getColour) => AddAssert("check label has expected colour", () => modSelect.MultiplierLabel.Colour.AverageColour == getColour());
|
||||
|
||||
private class TestModSelectOverlay : ModSelectOverlay
|
||||
private void createDisplay(Func<TestModSelectOverlay> createOverlayFunc)
|
||||
{
|
||||
SelectedMods.Value = Array.Empty<Mod>();
|
||||
Children = new Drawable[]
|
||||
{
|
||||
modSelect = createOverlayFunc().With(d =>
|
||||
{
|
||||
d.Origin = Anchor.BottomCentre;
|
||||
d.Anchor = Anchor.BottomCentre;
|
||||
d.SelectedMods.BindTarget = SelectedMods;
|
||||
}),
|
||||
modDisplay = new ModDisplay
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Position = new Vector2(-5, 25),
|
||||
Current = { BindTarget = modSelect.SelectedMods }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private class TestModSelectOverlay : SoloModSelectOverlay
|
||||
{
|
||||
public new Bindable<IReadOnlyList<Mod>> SelectedMods => base.SelectedMods;
|
||||
|
||||
public bool AllLoaded => ModSectionsContainer.Children.All(c => c.ModIconsLoaded);
|
||||
|
||||
public new FillFlowContainer<ModSection> ModSectionsContainer =>
|
||||
base.ModSectionsContainer;
|
||||
|
||||
public ModButton GetModButton(Mod mod)
|
||||
{
|
||||
var section = ModSectionsContainer.Children.Single(s => s.ModType == mod.Type);
|
||||
@ -283,5 +354,10 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
public new Color4 LowMultiplierColour => base.LowMultiplierColour;
|
||||
public new Color4 HighMultiplierColour => base.HighMultiplierColour;
|
||||
}
|
||||
|
||||
private class TestNonStackedModSelectOverlay : TestModSelectOverlay
|
||||
{
|
||||
protected override bool Stacked => false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddUntilStep("wait for ready", () => modSelect.State.Value == Visibility.Visible && modSelect.ButtonsLoaded);
|
||||
}
|
||||
|
||||
private class TestModSelectOverlay : ModSelectOverlay
|
||||
private class TestModSelectOverlay : SoloModSelectOverlay
|
||||
{
|
||||
public new VisibilityContainer ModSettingsContainer => base.ModSettingsContainer;
|
||||
public new TriangleButton CustomiseButton => base.CustomiseButton;
|
||||
|
@ -7,6 +7,7 @@
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||
<PackageReference Include="Moq" Version="4.16.0" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Project">
|
||||
<OutputType>WinExe</OutputType>
|
||||
|
@ -25,6 +25,8 @@ namespace osu.Game.Graphics.Containers
|
||||
/// </summary>
|
||||
public bool UserScrolling { get; private set; }
|
||||
|
||||
public void CancelUserScroll() => UserScrolling = false;
|
||||
|
||||
public UserTrackingScrollContainer()
|
||||
{
|
||||
}
|
||||
@ -45,5 +47,11 @@ namespace osu.Game.Graphics.Containers
|
||||
UserScrolling = false;
|
||||
base.ScrollTo(value, animated, distanceDecay);
|
||||
}
|
||||
|
||||
public new void ScrollToEnd(bool animated = true, bool allowDuringDrag = false)
|
||||
{
|
||||
UserScrolling = false;
|
||||
base.ScrollToEnd(animated, allowDuringDrag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,54 +4,38 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Online;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class DownloadButton : OsuAnimatedButton
|
||||
public class DownloadButton : GrayButton
|
||||
{
|
||||
public readonly Bindable<DownloadState> State = new Bindable<DownloadState>();
|
||||
|
||||
private readonly SpriteIcon icon;
|
||||
private readonly SpriteIcon checkmark;
|
||||
private readonly Box background;
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
public readonly Bindable<DownloadState> State = new Bindable<DownloadState>();
|
||||
|
||||
private SpriteIcon checkmark;
|
||||
|
||||
public DownloadButton()
|
||||
: base(FontAwesome.Solid.Download)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Depth = float.MaxValue
|
||||
},
|
||||
icon = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(13),
|
||||
Icon = FontAwesome.Solid.Download,
|
||||
},
|
||||
checkmark = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
X = 8,
|
||||
Size = Vector2.Zero,
|
||||
Icon = FontAwesome.Solid.Check,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
AddInternal(checkmark = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
X = 8,
|
||||
Size = Vector2.Zero,
|
||||
Icon = FontAwesome.Solid.Check,
|
||||
});
|
||||
|
||||
State.BindValueChanged(updateState, true);
|
||||
}
|
||||
|
||||
@ -60,27 +44,27 @@ namespace osu.Game.Graphics.UserInterface
|
||||
switch (state.NewValue)
|
||||
{
|
||||
case DownloadState.NotDownloaded:
|
||||
background.FadeColour(colours.Gray4, 500, Easing.InOutExpo);
|
||||
icon.MoveToX(0, 500, Easing.InOutExpo);
|
||||
Background.FadeColour(colours.Gray4, 500, Easing.InOutExpo);
|
||||
Icon.MoveToX(0, 500, Easing.InOutExpo);
|
||||
checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo);
|
||||
TooltipText = "Download";
|
||||
break;
|
||||
|
||||
case DownloadState.Downloading:
|
||||
background.FadeColour(colours.Blue, 500, Easing.InOutExpo);
|
||||
icon.MoveToX(0, 500, Easing.InOutExpo);
|
||||
Background.FadeColour(colours.Blue, 500, Easing.InOutExpo);
|
||||
Icon.MoveToX(0, 500, Easing.InOutExpo);
|
||||
checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo);
|
||||
TooltipText = "Downloading...";
|
||||
break;
|
||||
|
||||
case DownloadState.Importing:
|
||||
background.FadeColour(colours.Yellow, 500, Easing.InOutExpo);
|
||||
Background.FadeColour(colours.Yellow, 500, Easing.InOutExpo);
|
||||
TooltipText = "Importing";
|
||||
break;
|
||||
|
||||
case DownloadState.LocallyAvailable:
|
||||
background.FadeColour(colours.Green, 500, Easing.InOutExpo);
|
||||
icon.MoveToX(-8, 500, Easing.InOutExpo);
|
||||
Background.FadeColour(colours.Green, 500, Easing.InOutExpo);
|
||||
Icon.MoveToX(-8, 500, Easing.InOutExpo);
|
||||
checkmark.ScaleTo(new Vector2(13), 500, Easing.InOutExpo);
|
||||
break;
|
||||
}
|
||||
|
48
osu.Game/Graphics/UserInterface/GrayButton.cs
Normal file
48
osu.Game/Graphics/UserInterface/GrayButton.cs
Normal file
@ -0,0 +1,48 @@
|
||||
// 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.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class GrayButton : OsuAnimatedButton
|
||||
{
|
||||
protected SpriteIcon Icon { get; private set; }
|
||||
protected Box Background { get; private set; }
|
||||
|
||||
private readonly IconUsage icon;
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
public GrayButton(IconUsage icon)
|
||||
{
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Background = new Box
|
||||
{
|
||||
Colour = colours.Gray4,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Depth = float.MaxValue
|
||||
},
|
||||
Icon = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(13),
|
||||
Icon = icon,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -42,13 +42,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
},
|
||||
};
|
||||
|
||||
Current.ValueChanged += filled =>
|
||||
{
|
||||
if (filled.NewValue)
|
||||
fill.FadeIn(200, Easing.OutQuint);
|
||||
else
|
||||
fill.FadeTo(0.01f, 200, Easing.OutQuint); //todo: remove once we figure why containers aren't drawing at all times
|
||||
};
|
||||
Current.ValueChanged += filled => fill.FadeTo(filled.NewValue ? 1 : 0, 200, Easing.OutQuint);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -5,6 +5,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics.Containers;
|
||||
@ -18,6 +19,11 @@ namespace osu.Game.Graphics.UserInterface
|
||||
public Color4 UncheckedColor { get; set; } = Color4.White;
|
||||
public int FadeDuration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to play sounds when the state changes as a result of user interaction.
|
||||
/// </summary>
|
||||
protected virtual bool PlaySoundsOnUserChange => true;
|
||||
|
||||
public string LabelText
|
||||
{
|
||||
set
|
||||
@ -43,7 +49,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
private SampleChannel sampleChecked;
|
||||
private SampleChannel sampleUnchecked;
|
||||
|
||||
public OsuCheckbox()
|
||||
public OsuCheckbox(bool nubOnRight = true)
|
||||
{
|
||||
AutoSizeAxes = Axes.Y;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
@ -52,26 +58,42 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
labelText = new OsuTextFlowContainer
|
||||
labelText = new OsuTextFlowContainer(ApplyLabelParameters)
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Padding = new MarginPadding { Right = Nub.EXPANDED_SIZE + nub_padding }
|
||||
},
|
||||
Nub = new Nub
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Margin = new MarginPadding { Right = nub_padding },
|
||||
},
|
||||
Nub = new Nub(),
|
||||
new HoverClickSounds()
|
||||
};
|
||||
|
||||
if (nubOnRight)
|
||||
{
|
||||
Nub.Anchor = Anchor.CentreRight;
|
||||
Nub.Origin = Anchor.CentreRight;
|
||||
Nub.Margin = new MarginPadding { Right = nub_padding };
|
||||
labelText.Padding = new MarginPadding { Right = Nub.EXPANDED_SIZE + nub_padding * 2 };
|
||||
}
|
||||
else
|
||||
{
|
||||
Nub.Anchor = Anchor.CentreLeft;
|
||||
Nub.Origin = Anchor.CentreLeft;
|
||||
Nub.Margin = new MarginPadding { Left = nub_padding };
|
||||
labelText.Padding = new MarginPadding { Left = Nub.EXPANDED_SIZE + nub_padding * 2 };
|
||||
}
|
||||
|
||||
Nub.Current.BindTo(Current);
|
||||
|
||||
Current.DisabledChanged += disabled => labelText.Alpha = Nub.Alpha = disabled ? 0.3f : 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A function which can be overridden to change the parameters of the label's text.
|
||||
/// </summary>
|
||||
protected virtual void ApplyLabelParameters(SpriteText text)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
@ -96,10 +118,14 @@ namespace osu.Game.Graphics.UserInterface
|
||||
protected override void OnUserChange(bool value)
|
||||
{
|
||||
base.OnUserChange(value);
|
||||
if (value)
|
||||
sampleChecked?.Play();
|
||||
else
|
||||
sampleUnchecked?.Play();
|
||||
|
||||
if (PlaySoundsOnUserChange)
|
||||
{
|
||||
if (value)
|
||||
sampleChecked?.Play();
|
||||
else
|
||||
sampleUnchecked?.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ namespace osu.Game.Online.API
|
||||
|
||||
[JsonProperty("settings")]
|
||||
[Key(1)]
|
||||
[MessagePackFormatter(typeof(ModSettingsDictionaryFormatter))]
|
||||
public Dictionary<string, object> Settings { get; set; } = new Dictionary<string, object>();
|
||||
|
||||
[JsonConstructor]
|
||||
|
67
osu.Game/Online/API/ModSettingsDictionaryFormatter.cs
Normal file
67
osu.Game/Online/API/ModSettingsDictionaryFormatter.cs
Normal file
@ -0,0 +1,67 @@
|
||||
// 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.Buffers;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using MessagePack;
|
||||
using MessagePack.Formatters;
|
||||
using osu.Framework.Bindables;
|
||||
|
||||
namespace osu.Game.Online.API
|
||||
{
|
||||
public class ModSettingsDictionaryFormatter : IMessagePackFormatter<Dictionary<string, object>>
|
||||
{
|
||||
public void Serialize(ref MessagePackWriter writer, Dictionary<string, object> value, MessagePackSerializerOptions options)
|
||||
{
|
||||
var primitiveFormatter = PrimitiveObjectFormatter.Instance;
|
||||
|
||||
writer.WriteArrayHeader(value.Count);
|
||||
|
||||
foreach (var kvp in value)
|
||||
{
|
||||
var stringBytes = new ReadOnlySequence<byte>(Encoding.UTF8.GetBytes(kvp.Key));
|
||||
writer.WriteString(in stringBytes);
|
||||
|
||||
switch (kvp.Value)
|
||||
{
|
||||
case Bindable<double> d:
|
||||
primitiveFormatter.Serialize(ref writer, d.Value, options);
|
||||
break;
|
||||
|
||||
case Bindable<int> i:
|
||||
primitiveFormatter.Serialize(ref writer, i.Value, options);
|
||||
break;
|
||||
|
||||
case Bindable<float> f:
|
||||
primitiveFormatter.Serialize(ref writer, f.Value, options);
|
||||
break;
|
||||
|
||||
case Bindable<bool> b:
|
||||
primitiveFormatter.Serialize(ref writer, b.Value, options);
|
||||
break;
|
||||
|
||||
default:
|
||||
// fall back for non-bindable cases.
|
||||
primitiveFormatter.Serialize(ref writer, kvp.Value, options);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, object> Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
|
||||
{
|
||||
var output = new Dictionary<string, object>();
|
||||
|
||||
int itemCount = reader.ReadArrayHeader();
|
||||
|
||||
for (int i = 0; i < itemCount; i++)
|
||||
{
|
||||
output[reader.ReadString()] =
|
||||
PrimitiveObjectFormatter.Instance.Deserialize(ref reader, options);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
}
|
@ -468,6 +468,12 @@ namespace osu.Game
|
||||
private void modsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)
|
||||
{
|
||||
updateModDefaults();
|
||||
|
||||
if (!ModUtils.CheckValidForGameplay(mods.NewValue, out var invalid))
|
||||
{
|
||||
// ensure we always have a valid set of mods.
|
||||
SelectedMods.Value = mods.NewValue.Except(invalid).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateModDefaults()
|
||||
|
@ -16,6 +16,7 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.Chat
|
||||
@ -24,7 +25,7 @@ namespace osu.Game.Overlays.Chat
|
||||
{
|
||||
public readonly Channel Channel;
|
||||
protected FillFlowContainer ChatLineFlow;
|
||||
private OsuScrollContainer scroll;
|
||||
private ChannelScrollContainer scroll;
|
||||
|
||||
private bool scrollbarVisible = true;
|
||||
|
||||
@ -56,7 +57,7 @@ namespace osu.Game.Overlays.Chat
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
Child = scroll = new OsuScrollContainer
|
||||
Child = scroll = new ChannelScrollContainer
|
||||
{
|
||||
ScrollbarVisible = scrollbarVisible,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -80,12 +81,6 @@ namespace osu.Game.Overlays.Chat
|
||||
Channel.PendingMessageResolved += pendingMessageResolved;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
scrollToEnd();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
@ -113,8 +108,6 @@ namespace osu.Game.Overlays.Chat
|
||||
ChatLineFlow.Clear();
|
||||
}
|
||||
|
||||
bool shouldScrollToEnd = scroll.IsScrolledToEnd(10) || !chatLines.Any() || newMessages.Any(m => m is LocalMessage);
|
||||
|
||||
// Add up to last Channel.MAX_HISTORY messages
|
||||
var displayMessages = newMessages.Skip(Math.Max(0, newMessages.Count() - Channel.MAX_HISTORY));
|
||||
|
||||
@ -153,8 +146,10 @@ namespace osu.Game.Overlays.Chat
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldScrollToEnd)
|
||||
scrollToEnd();
|
||||
// due to the scroll adjusts from old messages removal above, a scroll-to-end must be enforced,
|
||||
// to avoid making the container think the user has scrolled back up and unwantedly disable auto-scrolling.
|
||||
if (newMessages.Any(m => m is LocalMessage))
|
||||
scroll.ScrollToEnd();
|
||||
});
|
||||
|
||||
private void pendingMessageResolved(Message existing, Message updated) => Schedule(() =>
|
||||
@ -178,8 +173,6 @@ namespace osu.Game.Overlays.Chat
|
||||
|
||||
private IEnumerable<ChatLine> chatLines => ChatLineFlow.Children.OfType<ChatLine>();
|
||||
|
||||
private void scrollToEnd() => ScheduleAfterChildren(() => scroll.ScrollToEnd());
|
||||
|
||||
public class DaySeparator : Container
|
||||
{
|
||||
public float TextSize
|
||||
@ -243,5 +236,51 @@ namespace osu.Game.Overlays.Chat
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="OsuScrollContainer"/> with functionality to automatically scroll whenever the maximum scrollable distance increases.
|
||||
/// </summary>
|
||||
private class ChannelScrollContainer : UserTrackingScrollContainer
|
||||
{
|
||||
/// <summary>
|
||||
/// The chat will be automatically scrolled to end if and only if
|
||||
/// the distance between the current scroll position and the end of the scroll
|
||||
/// is less than this value.
|
||||
/// </summary>
|
||||
private const float auto_scroll_leniency = 10f;
|
||||
|
||||
private float? lastExtent;
|
||||
|
||||
protected override void OnUserScroll(float value, bool animated = true, double? distanceDecay = default)
|
||||
{
|
||||
base.OnUserScroll(value, animated, distanceDecay);
|
||||
lastExtent = null;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
// If the user has scrolled to the bottom of the container, we should resume tracking new content.
|
||||
if (UserScrolling && IsScrolledToEnd(auto_scroll_leniency))
|
||||
CancelUserScroll();
|
||||
|
||||
// If the user hasn't overridden our behaviour and there has been new content added to the container, we should update our scroll position to track it.
|
||||
bool requiresScrollUpdate = !UserScrolling && (lastExtent == null || Precision.AlmostBigger(ScrollableExtent, lastExtent.Value));
|
||||
|
||||
if (requiresScrollUpdate)
|
||||
{
|
||||
// Schedule required to allow FillFlow to be the correct size.
|
||||
Schedule(() =>
|
||||
{
|
||||
if (!UserScrolling)
|
||||
{
|
||||
ScrollToEnd();
|
||||
lastExtent = ScrollableExtent;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,31 +11,30 @@ using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Humanizer;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public abstract class ModSection : Container
|
||||
public class ModSection : CompositeDrawable
|
||||
{
|
||||
private readonly OsuSpriteText headerLabel;
|
||||
private readonly Drawable header;
|
||||
|
||||
public FillFlowContainer<ModButtonEmpty> ButtonsContainer { get; }
|
||||
|
||||
public Action<Mod> Action;
|
||||
protected abstract Key[] ToggleKeys { get; }
|
||||
public abstract ModType ModType { get; }
|
||||
|
||||
public string Header
|
||||
{
|
||||
get => headerLabel.Text;
|
||||
set => headerLabel.Text = value;
|
||||
}
|
||||
public Key[] ToggleKeys;
|
||||
|
||||
public readonly ModType ModType;
|
||||
|
||||
public IEnumerable<Mod> SelectedMods => buttons.Select(b => b.SelectedMod).Where(m => m != null);
|
||||
|
||||
private CancellationTokenSource modsLoadCts;
|
||||
|
||||
protected bool SelectionAnimationRunning => pendingSelectionOperations.Count > 0;
|
||||
|
||||
/// <summary>
|
||||
/// True when all mod icons have completed loading.
|
||||
/// </summary>
|
||||
@ -52,7 +51,11 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
return new ModButton(m)
|
||||
{
|
||||
SelectionChanged = Action,
|
||||
SelectionChanged = mod =>
|
||||
{
|
||||
ModButtonStateChanged(mod);
|
||||
Action?.Invoke(mod);
|
||||
},
|
||||
};
|
||||
}).ToArray();
|
||||
|
||||
@ -61,7 +64,7 @@ namespace osu.Game.Overlays.Mods
|
||||
if (modContainers.Length == 0)
|
||||
{
|
||||
ModIconsLoaded = true;
|
||||
headerLabel.Hide();
|
||||
header.Hide();
|
||||
Hide();
|
||||
return;
|
||||
}
|
||||
@ -76,11 +79,15 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
buttons = modContainers.OfType<ModButton>().ToArray();
|
||||
|
||||
headerLabel.FadeIn(200);
|
||||
header.FadeIn(200);
|
||||
this.FadeIn(200);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void ModButtonStateChanged(Mod mod)
|
||||
{
|
||||
}
|
||||
|
||||
private ModButton[] buttons = Array.Empty<ModButton>();
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
@ -97,30 +104,75 @@ namespace osu.Game.Overlays.Mods
|
||||
return base.OnKeyDown(e);
|
||||
}
|
||||
|
||||
public void DeselectAll() => DeselectTypes(buttons.Select(b => b.SelectedMod?.GetType()).Where(t => t != null));
|
||||
private const double initial_multiple_selection_delay = 120;
|
||||
|
||||
private double selectionDelay = initial_multiple_selection_delay;
|
||||
private double lastSelection;
|
||||
|
||||
private readonly Queue<Action> pendingSelectionOperations = new Queue<Action>();
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (selectionDelay == initial_multiple_selection_delay || Time.Current - lastSelection >= selectionDelay)
|
||||
{
|
||||
if (pendingSelectionOperations.TryDequeue(out var dequeuedAction))
|
||||
{
|
||||
dequeuedAction();
|
||||
|
||||
// each time we play an animation, we decrease the time until the next animation (to ramp the visual and audible elements).
|
||||
selectionDelay = Math.Max(30, selectionDelay * 0.8f);
|
||||
lastSelection = Time.Current;
|
||||
}
|
||||
else
|
||||
{
|
||||
// reset the selection delay after all animations have been completed.
|
||||
// this will cause the next action to be immediately performed.
|
||||
selectionDelay = initial_multiple_selection_delay;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects all mods.
|
||||
/// </summary>
|
||||
public void SelectAll()
|
||||
{
|
||||
pendingSelectionOperations.Clear();
|
||||
|
||||
foreach (var button in buttons.Where(b => !b.Selected))
|
||||
pendingSelectionOperations.Enqueue(() => button.SelectAt(0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deselects all mods.
|
||||
/// </summary>
|
||||
public void DeselectAll()
|
||||
{
|
||||
pendingSelectionOperations.Clear();
|
||||
DeselectTypes(buttons.Select(b => b.SelectedMod?.GetType()).Where(t => t != null));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deselect one or more mods in this section.
|
||||
/// </summary>
|
||||
/// <param name="modTypes">The types of <see cref="Mod"/>s which should be deselected.</param>
|
||||
/// <param name="immediate">Set to true to bypass animations and update selections immediately.</param>
|
||||
/// <param name="immediate">Whether the deselection should happen immediately. Should only be used when required to ensure correct selection flow.</param>
|
||||
public void DeselectTypes(IEnumerable<Type> modTypes, bool immediate = false)
|
||||
{
|
||||
int delay = 0;
|
||||
|
||||
foreach (var button in buttons)
|
||||
{
|
||||
Mod selected = button.SelectedMod;
|
||||
if (selected == null) continue;
|
||||
if (button.SelectedMod == null) continue;
|
||||
|
||||
foreach (var type in modTypes)
|
||||
{
|
||||
if (type.IsInstanceOfType(selected))
|
||||
if (type.IsInstanceOfType(button.SelectedMod))
|
||||
{
|
||||
if (immediate)
|
||||
button.Deselect();
|
||||
else
|
||||
Scheduler.AddDelayed(button.Deselect, delay += 50);
|
||||
pendingSelectionOperations.Enqueue(button.Deselect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -130,13 +182,13 @@ namespace osu.Game.Overlays.Mods
|
||||
/// Updates all buttons with the given list of selected mods.
|
||||
/// </summary>
|
||||
/// <param name="newSelectedMods">The new list of selected mods to select.</param>
|
||||
public void UpdateSelectedMods(IReadOnlyList<Mod> newSelectedMods)
|
||||
public void UpdateSelectedButtons(IReadOnlyList<Mod> newSelectedMods)
|
||||
{
|
||||
foreach (var button in buttons)
|
||||
updateButtonMods(button, newSelectedMods);
|
||||
updateButtonSelection(button, newSelectedMods);
|
||||
}
|
||||
|
||||
private void updateButtonMods(ModButton button, IReadOnlyList<Mod> newSelectedMods)
|
||||
private void updateButtonSelection(ModButton button, IReadOnlyList<Mod> newSelectedMods)
|
||||
{
|
||||
foreach (var mod in newSelectedMods)
|
||||
{
|
||||
@ -153,23 +205,19 @@ namespace osu.Game.Overlays.Mods
|
||||
button.Deselect();
|
||||
}
|
||||
|
||||
protected ModSection()
|
||||
public ModSection(ModType type)
|
||||
{
|
||||
ModType = type;
|
||||
|
||||
AutoSizeAxes = Axes.Y;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
|
||||
Origin = Anchor.TopCentre;
|
||||
Anchor = Anchor.TopCentre;
|
||||
|
||||
Children = new Drawable[]
|
||||
InternalChildren = new[]
|
||||
{
|
||||
headerLabel = new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.TopLeft,
|
||||
Anchor = Anchor.TopLeft,
|
||||
Position = new Vector2(0f, 0f),
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold)
|
||||
},
|
||||
header = CreateHeader(type.Humanize(LetterCasing.Title)),
|
||||
ButtonsContainer = new FillFlowContainer<ModButtonEmpty>
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
@ -185,5 +233,20 @@ namespace osu.Game.Overlays.Mods
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected virtual Drawable CreateHeader(string text) => new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
||||
Text = text
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Play out all remaining animations immediately to leave mods in a good (final) state.
|
||||
/// </summary>
|
||||
public void FlushAnimation()
|
||||
{
|
||||
while (pendingSelectionOperations.TryDequeue(out var dequeuedAction))
|
||||
dequeuedAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -19,30 +20,54 @@ using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Overlays.Mods.Sections;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Screens;
|
||||
using osu.Game.Utils;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public class ModSelectOverlay : WaveOverlayContainer
|
||||
public abstract class ModSelectOverlay : WaveOverlayContainer
|
||||
{
|
||||
private readonly Func<Mod, bool> isValidMod;
|
||||
public const float HEIGHT = 510;
|
||||
|
||||
protected readonly TriangleButton DeselectAllButton;
|
||||
protected readonly TriangleButton CustomiseButton;
|
||||
protected readonly TriangleButton CloseButton;
|
||||
|
||||
protected readonly Drawable MultiplierSection;
|
||||
protected readonly OsuSpriteText MultiplierLabel;
|
||||
|
||||
protected readonly FillFlowContainer FooterContainer;
|
||||
|
||||
protected override bool BlockNonPositionalInput => false;
|
||||
|
||||
protected override bool DimMainContent => false;
|
||||
|
||||
/// <summary>
|
||||
/// Whether <see cref="Mod"/>s underneath the same <see cref="MultiMod"/> instance should appear as stacked buttons.
|
||||
/// </summary>
|
||||
protected virtual bool Stacked => true;
|
||||
|
||||
[NotNull]
|
||||
private Func<Mod, bool> isValidMod = m => true;
|
||||
|
||||
/// <summary>
|
||||
/// A function that checks whether a given mod is selectable.
|
||||
/// </summary>
|
||||
[NotNull]
|
||||
public Func<Mod, bool> IsValidMod
|
||||
{
|
||||
get => isValidMod;
|
||||
set
|
||||
{
|
||||
isValidMod = value ?? throw new ArgumentNullException(nameof(value));
|
||||
updateAvailableMods();
|
||||
}
|
||||
}
|
||||
|
||||
protected readonly FillFlowContainer<ModSection> ModSectionsContainer;
|
||||
|
||||
protected readonly ModSettingsContainer ModSettingsContainer;
|
||||
@ -57,14 +82,10 @@ namespace osu.Game.Overlays.Mods
|
||||
private const float content_width = 0.8f;
|
||||
private const float footer_button_spacing = 20;
|
||||
|
||||
private readonly FillFlowContainer footerContainer;
|
||||
|
||||
private SampleChannel sampleOn, sampleOff;
|
||||
|
||||
public ModSelectOverlay(Func<Mod, bool> isValidMod = null)
|
||||
protected ModSelectOverlay()
|
||||
{
|
||||
this.isValidMod = isValidMod ?? (m => true);
|
||||
|
||||
Waves.FirstWaveColour = Color4Extensions.FromHex(@"19b0e2");
|
||||
Waves.SecondWaveColour = Color4Extensions.FromHex(@"2280a2");
|
||||
Waves.ThirdWaveColour = Color4Extensions.FromHex(@"005774");
|
||||
@ -190,13 +211,31 @@ namespace osu.Game.Overlays.Mods
|
||||
Width = content_width,
|
||||
LayoutDuration = 200,
|
||||
LayoutEasing = Easing.OutQuint,
|
||||
Children = new ModSection[]
|
||||
Children = new[]
|
||||
{
|
||||
new DifficultyReductionSection { Action = modButtonPressed },
|
||||
new DifficultyIncreaseSection { Action = modButtonPressed },
|
||||
new AutomationSection { Action = modButtonPressed },
|
||||
new ConversionSection { Action = modButtonPressed },
|
||||
new FunSection { Action = modButtonPressed },
|
||||
CreateModSection(ModType.DifficultyReduction).With(s =>
|
||||
{
|
||||
s.ToggleKeys = new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P };
|
||||
s.Action = modButtonPressed;
|
||||
}),
|
||||
CreateModSection(ModType.DifficultyIncrease).With(s =>
|
||||
{
|
||||
s.ToggleKeys = new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L };
|
||||
s.Action = modButtonPressed;
|
||||
}),
|
||||
CreateModSection(ModType.Automation).With(s =>
|
||||
{
|
||||
s.ToggleKeys = new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M };
|
||||
s.Action = modButtonPressed;
|
||||
}),
|
||||
CreateModSection(ModType.Conversion).With(s =>
|
||||
{
|
||||
s.Action = modButtonPressed;
|
||||
}),
|
||||
CreateModSection(ModType.Fun).With(s =>
|
||||
{
|
||||
s.Action = modButtonPressed;
|
||||
}),
|
||||
}
|
||||
},
|
||||
}
|
||||
@ -231,7 +270,7 @@ namespace osu.Game.Overlays.Mods
|
||||
Colour = new Color4(172, 20, 116, 255),
|
||||
Alpha = 0.5f,
|
||||
},
|
||||
footerContainer = new FillFlowContainer
|
||||
FooterContainer = new FillFlowContainer
|
||||
{
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
@ -245,7 +284,7 @@ namespace osu.Game.Overlays.Mods
|
||||
Vertical = 15,
|
||||
Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
|
||||
},
|
||||
Children = new Drawable[]
|
||||
Children = new[]
|
||||
{
|
||||
DeselectAllButton = new TriangleButton
|
||||
{
|
||||
@ -272,7 +311,7 @@ namespace osu.Game.Overlays.Mods
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
},
|
||||
new FillFlowContainer
|
||||
MultiplierSection = new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Spacing = new Vector2(footer_button_spacing / 2, 0),
|
||||
@ -328,33 +367,25 @@ namespace osu.Game.Overlays.Mods
|
||||
refreshSelectedMods();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deselect one or more mods.
|
||||
/// </summary>
|
||||
/// <param name="modTypes">The types of <see cref="Mod"/>s which should be deselected.</param>
|
||||
/// <param name="immediate">Set to true to bypass animations and update selections immediately.</param>
|
||||
private void deselectTypes(Type[] modTypes, bool immediate = false)
|
||||
{
|
||||
if (modTypes.Length == 0) return;
|
||||
|
||||
foreach (var section in ModSectionsContainer.Children)
|
||||
section.DeselectTypes(modTypes, immediate);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
availableMods.BindValueChanged(availableModsChanged, true);
|
||||
SelectedMods.BindValueChanged(selectedModsChanged, true);
|
||||
availableMods.BindValueChanged(_ => updateAvailableMods(), true);
|
||||
SelectedMods.BindValueChanged(_ => updateSelectedButtons(), true);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
|
||||
footerContainer.MoveToX(content_width, WaveContainer.DISAPPEAR_DURATION, Easing.InSine);
|
||||
footerContainer.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.InSine);
|
||||
foreach (var section in ModSectionsContainer)
|
||||
{
|
||||
section.FlushAnimation();
|
||||
}
|
||||
|
||||
FooterContainer.MoveToX(content_width, WaveContainer.DISAPPEAR_DURATION, Easing.InSine);
|
||||
FooterContainer.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.InSine);
|
||||
|
||||
foreach (var section in ModSectionsContainer.Children)
|
||||
{
|
||||
@ -368,8 +399,8 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
base.PopIn();
|
||||
|
||||
footerContainer.MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
footerContainer.FadeIn(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
FooterContainer.MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
FooterContainer.FadeIn(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
|
||||
foreach (var section in ModSectionsContainer.Children)
|
||||
{
|
||||
@ -400,18 +431,53 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
public override bool OnPressed(GlobalAction action) => false; // handled by back button
|
||||
|
||||
private void availableModsChanged(ValueChangedEvent<Dictionary<ModType, IReadOnlyList<Mod>>> mods)
|
||||
private void updateAvailableMods()
|
||||
{
|
||||
if (mods.NewValue == null) return;
|
||||
if (availableMods?.Value == null)
|
||||
return;
|
||||
|
||||
foreach (var section in ModSectionsContainer.Children)
|
||||
section.Mods = mods.NewValue[section.ModType].Where(isValidMod);
|
||||
{
|
||||
IEnumerable<Mod> modEnumeration = availableMods.Value[section.ModType];
|
||||
|
||||
if (!Stacked)
|
||||
modEnumeration = ModUtils.FlattenMods(modEnumeration);
|
||||
|
||||
section.Mods = modEnumeration.Select(getValidModOrNull).Where(m => m != null);
|
||||
}
|
||||
|
||||
updateSelectedButtons();
|
||||
}
|
||||
|
||||
private void selectedModsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)
|
||||
/// <summary>
|
||||
/// Returns a valid form of a given <see cref="Mod"/> if possible, or null otherwise.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is a recursive process during which any invalid mods are culled while preserving <see cref="MultiMod"/> structures where possible.
|
||||
/// </remarks>
|
||||
/// <param name="mod">The <see cref="Mod"/> to check.</param>
|
||||
/// <returns>A valid form of <paramref name="mod"/> if exists, or null otherwise.</returns>
|
||||
[CanBeNull]
|
||||
private Mod getValidModOrNull([NotNull] Mod mod)
|
||||
{
|
||||
if (!(mod is MultiMod multi))
|
||||
return IsValidMod(mod) ? mod : null;
|
||||
|
||||
var validSubset = multi.Mods.Select(getValidModOrNull).Where(m => m != null).ToArray();
|
||||
|
||||
if (validSubset.Length == 0)
|
||||
return null;
|
||||
|
||||
return validSubset.Length == 1 ? validSubset[0] : new MultiMod(validSubset);
|
||||
}
|
||||
|
||||
private void updateSelectedButtons()
|
||||
{
|
||||
// Enumeration below may update the bindable list.
|
||||
var selectedMods = SelectedMods.Value.ToList();
|
||||
|
||||
foreach (var section in ModSectionsContainer.Children)
|
||||
section.UpdateSelectedMods(mods.NewValue);
|
||||
section.UpdateSelectedButtons(selectedMods);
|
||||
|
||||
updateMods();
|
||||
}
|
||||
@ -438,22 +504,42 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
if (selectedMod != null)
|
||||
{
|
||||
if (State.Value == Visibility.Visible) sampleOn?.Play();
|
||||
if (State.Value == Visibility.Visible)
|
||||
Scheduler.AddOnce(playSelectedSound);
|
||||
|
||||
deselectTypes(selectedMod.IncompatibleMods, true);
|
||||
OnModSelected(selectedMod);
|
||||
|
||||
if (selectedMod.RequiresConfiguration) ModSettingsContainer.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (State.Value == Visibility.Visible) sampleOff?.Play();
|
||||
if (State.Value == Visibility.Visible)
|
||||
Scheduler.AddOnce(playDeselectedSound);
|
||||
}
|
||||
|
||||
refreshSelectedMods();
|
||||
}
|
||||
|
||||
private void playSelectedSound() => sampleOn?.Play();
|
||||
private void playDeselectedSound() => sampleOff?.Play();
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when a new <see cref="Mod"/> has been selected.
|
||||
/// </summary>
|
||||
/// <param name="mod">The <see cref="Mod"/> that has been selected.</param>
|
||||
protected virtual void OnModSelected(Mod mod)
|
||||
{
|
||||
}
|
||||
|
||||
private void refreshSelectedMods() => SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="ModSection"/> that groups <see cref="Mod"/>s with the same <see cref="ModType"/>.
|
||||
/// </summary>
|
||||
/// <param name="type">The <see cref="ModType"/> of <see cref="Mod"/>s in the section.</param>
|
||||
/// <returns>The <see cref="ModSection"/>.</returns>
|
||||
protected virtual ModSection CreateModSection(ModType type) => new ModSection(type);
|
||||
|
||||
#region Disposal
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
@ -1,19 +0,0 @@
|
||||
// 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.Mods;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Overlays.Mods.Sections
|
||||
{
|
||||
public class AutomationSection : ModSection
|
||||
{
|
||||
protected override Key[] ToggleKeys => new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M };
|
||||
public override ModType ModType => ModType.Automation;
|
||||
|
||||
public AutomationSection()
|
||||
{
|
||||
Header = @"Automation";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
// 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.Mods;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Overlays.Mods.Sections
|
||||
{
|
||||
public class ConversionSection : ModSection
|
||||
{
|
||||
protected override Key[] ToggleKeys => null;
|
||||
public override ModType ModType => ModType.Conversion;
|
||||
|
||||
public ConversionSection()
|
||||
{
|
||||
Header = @"Conversion";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
// 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.Mods;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Overlays.Mods.Sections
|
||||
{
|
||||
public class DifficultyIncreaseSection : ModSection
|
||||
{
|
||||
protected override Key[] ToggleKeys => new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L };
|
||||
public override ModType ModType => ModType.DifficultyIncrease;
|
||||
|
||||
public DifficultyIncreaseSection()
|
||||
{
|
||||
Header = @"Difficulty Increase";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
// 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.Mods;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Overlays.Mods.Sections
|
||||
{
|
||||
public class DifficultyReductionSection : ModSection
|
||||
{
|
||||
protected override Key[] ToggleKeys => new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P };
|
||||
public override ModType ModType => ModType.DifficultyReduction;
|
||||
|
||||
public DifficultyReductionSection()
|
||||
{
|
||||
Header = @"Difficulty Reduction";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
// 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.Mods;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Overlays.Mods.Sections
|
||||
{
|
||||
public class FunSection : ModSection
|
||||
{
|
||||
protected override Key[] ToggleKeys => null;
|
||||
public override ModType ModType => ModType.Fun;
|
||||
|
||||
public FunSection()
|
||||
{
|
||||
Header = @"Fun";
|
||||
}
|
||||
}
|
||||
}
|
18
osu.Game/Overlays/Mods/SoloModSelectOverlay.cs
Normal file
18
osu.Game/Overlays/Mods/SoloModSelectOverlay.cs
Normal file
@ -0,0 +1,18 @@
|
||||
// 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.Mods;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public class SoloModSelectOverlay : ModSelectOverlay
|
||||
{
|
||||
protected override void OnModSelected(Mod mod)
|
||||
{
|
||||
base.OnModSelected(mod);
|
||||
|
||||
foreach (var section in ModSectionsContainer.Children)
|
||||
section.DeselectTypes(mod.IncompatibleMods, true);
|
||||
}
|
||||
}
|
||||
}
|
@ -29,8 +29,6 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
private const float size = 80;
|
||||
|
||||
private readonly ModType type;
|
||||
|
||||
public virtual string TooltipText => showTooltip ? mod.IconTooltip : null;
|
||||
|
||||
private Mod mod;
|
||||
@ -42,10 +40,18 @@ namespace osu.Game.Rulesets.UI
|
||||
set
|
||||
{
|
||||
mod = value;
|
||||
updateMod(value);
|
||||
|
||||
if (IsLoaded)
|
||||
updateMod(value);
|
||||
}
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
private Color4 backgroundColour;
|
||||
private Color4 highlightedColour;
|
||||
|
||||
/// <summary>
|
||||
/// Construct a new instance.
|
||||
/// </summary>
|
||||
@ -56,8 +62,6 @@ namespace osu.Game.Rulesets.UI
|
||||
this.mod = mod ?? throw new ArgumentNullException(nameof(mod));
|
||||
this.showTooltip = showTooltip;
|
||||
|
||||
type = mod.Type;
|
||||
|
||||
Size = new Vector2(size);
|
||||
|
||||
Children = new Drawable[]
|
||||
@ -89,6 +93,13 @@ namespace osu.Game.Rulesets.UI
|
||||
Icon = FontAwesome.Solid.Question
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Selected.BindValueChanged(_ => updateColour());
|
||||
|
||||
updateMod(mod);
|
||||
}
|
||||
@ -102,20 +113,14 @@ namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
modIcon.FadeOut();
|
||||
modAcronym.FadeIn();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
modIcon.FadeIn();
|
||||
modAcronym.FadeOut();
|
||||
}
|
||||
|
||||
modIcon.FadeIn();
|
||||
modAcronym.FadeOut();
|
||||
}
|
||||
|
||||
private Color4 backgroundColour;
|
||||
private Color4 highlightedColour;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
switch (type)
|
||||
switch (value.Type)
|
||||
{
|
||||
default:
|
||||
case ModType.DifficultyIncrease:
|
||||
@ -149,12 +154,13 @@ namespace osu.Game.Rulesets.UI
|
||||
modIcon.Colour = colours.Yellow;
|
||||
break;
|
||||
}
|
||||
|
||||
updateColour();
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
private void updateColour()
|
||||
{
|
||||
base.LoadComplete();
|
||||
Selected.BindValueChanged(selected => background.Colour = selected.NewValue ? highlightedColour : backgroundColour, true);
|
||||
background.Colour = Selected.Value ? highlightedColour : backgroundColour;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,11 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
scrollingInfo = new LocalScrollingInfo();
|
||||
scrollingInfo.Direction.BindTo(Direction);
|
||||
scrollingInfo.TimeRange.BindTo(TimeRange);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
switch (VisualisationMethod)
|
||||
{
|
||||
case ScrollVisualisationMethod.Sequential:
|
||||
@ -106,11 +110,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
scrollingInfo.Algorithm = new ConstantScrollAlgorithm();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
double lastObjectTime = Objects.LastOrDefault()?.GetEndTime() ?? double.MaxValue;
|
||||
double baseBeatLength = TimingControlPoint.DEFAULT_BEAT_LENGTH;
|
||||
|
||||
|
@ -109,7 +109,16 @@ namespace osu.Game.Screens.Edit
|
||||
if (Beatmap.Value is DummyWorkingBeatmap)
|
||||
{
|
||||
isNewBeatmap = true;
|
||||
Beatmap.Value = beatmapManager.CreateNew(Ruleset.Value, api.LocalUser.Value);
|
||||
|
||||
var newBeatmap = beatmapManager.CreateNew(Ruleset.Value, api.LocalUser.Value);
|
||||
|
||||
// this is a bit haphazard, but guards against setting the lease Beatmap bindable if
|
||||
// the editor has already been exited.
|
||||
if (!ValidForPush)
|
||||
return;
|
||||
|
||||
// this probably shouldn't be set in the asynchronous load method, but everything following relies on it.
|
||||
Beatmap.Value = newBeatmap;
|
||||
}
|
||||
|
||||
beatDivisor.Value = Beatmap.Value.BeatmapInfo.BeatDivisor;
|
||||
|
@ -124,101 +124,111 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
modDisplay.Current.Value = requiredMods.ToArray();
|
||||
}
|
||||
|
||||
protected override Drawable CreateContent() => maskingContainer = new Container
|
||||
protected override Drawable CreateContent()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 50,
|
||||
Masking = true,
|
||||
CornerRadius = 10,
|
||||
Children = new Drawable[]
|
||||
Action<SpriteText> fontParameters = s => s.Font = OsuFont.Default.With(weight: FontWeight.SemiBold);
|
||||
|
||||
return maskingContainer = new Container
|
||||
{
|
||||
new Box // A transparent box that forces the border to be drawn if the panel background is opaque
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 50,
|
||||
Masking = true,
|
||||
CornerRadius = 10,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
AlwaysPresent = true
|
||||
},
|
||||
new PanelBackground
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Beatmap = { BindTarget = beatmap }
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Left = 8 },
|
||||
Spacing = new Vector2(8, 0),
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new Drawable[]
|
||||
new Box // A transparent box that forces the border to be drawn if the panel background is opaque
|
||||
{
|
||||
difficultyIconContainer = new Container
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
AlwaysPresent = true
|
||||
},
|
||||
new PanelBackground
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Beatmap = { BindTarget = beatmap }
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Left = 8 },
|
||||
Spacing = new Vector2(8, 0),
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
difficultyIconContainer = new Container
|
||||
{
|
||||
beatmapText = new LinkFlowContainer { AutoSizeAxes = Axes.Both },
|
||||
new FillFlowContainer
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(10f, 0),
|
||||
Children = new Drawable[]
|
||||
beatmapText = new LinkFlowContainer(fontParameters) { AutoSizeAxes = Axes.Both },
|
||||
new FillFlowContainer
|
||||
{
|
||||
new FillFlowContainer
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(10f, 0),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(10f, 0),
|
||||
Children = new Drawable[]
|
||||
new FillFlowContainer
|
||||
{
|
||||
authorText = new LinkFlowContainer { AutoSizeAxes = Axes.Both },
|
||||
explicitContentPill = new ExplicitContentBeatmapPill
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(10f, 0),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Alpha = 0f,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Margin = new MarginPadding { Top = 3f },
|
||||
}
|
||||
authorText = new LinkFlowContainer(fontParameters) { AutoSizeAxes = Axes.Both },
|
||||
explicitContentPill = new ExplicitContentBeatmapPill
|
||||
{
|
||||
Alpha = 0f,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Margin = new MarginPadding { Top = 3f },
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Child = modDisplay = new ModDisplay
|
||||
new Container
|
||||
{
|
||||
Scale = new Vector2(0.4f),
|
||||
DisplayUnrankedText = false,
|
||||
ExpansionMode = ExpansionMode.AlwaysExpanded
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Child = modDisplay = new ModDisplay
|
||||
{
|
||||
Scale = new Vector2(0.4f),
|
||||
DisplayUnrankedText = false,
|
||||
ExpansionMode = ExpansionMode.AlwaysExpanded
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Direction = FillDirection.Horizontal,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Spacing = new Vector2(5),
|
||||
X = -10,
|
||||
ChildrenEnumerable = CreateButtons().Select(button => button.With(b =>
|
||||
{
|
||||
b.Anchor = Anchor.Centre;
|
||||
b.Origin = Anchor.Centre;
|
||||
}))
|
||||
}
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Direction = FillDirection.Horizontal,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
X = -18,
|
||||
ChildrenEnumerable = CreateButtons()
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
protected virtual IEnumerable<Drawable> CreateButtons() =>
|
||||
new Drawable[]
|
||||
@ -227,14 +237,29 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
{
|
||||
Size = new Vector2(50, 30)
|
||||
},
|
||||
new IconButton
|
||||
new PlaylistRemoveButton
|
||||
{
|
||||
Icon = FontAwesome.Solid.MinusSquare,
|
||||
Size = new Vector2(30, 30),
|
||||
Alpha = allowEdit ? 1 : 0,
|
||||
Action = () => RequestDeletion?.Invoke(Model),
|
||||
},
|
||||
};
|
||||
|
||||
public class PlaylistRemoveButton : GrayButton
|
||||
{
|
||||
public PlaylistRemoveButton()
|
||||
: base(FontAwesome.Solid.MinusSquare)
|
||||
{
|
||||
TooltipText = "Remove from playlist";
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Icon.Scale = new Vector2(0.8f);
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
if (allowSelection)
|
||||
@ -318,24 +343,18 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
Colour = Color4.Black,
|
||||
Width = 0.4f,
|
||||
},
|
||||
// Piecewise-linear gradient with 3 segments to make it appear smoother
|
||||
// Piecewise-linear gradient with 2 segments to make it appear smoother
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientHorizontal(Color4.Black, new Color4(0f, 0f, 0f, 0.9f)),
|
||||
Width = 0.05f,
|
||||
Colour = ColourInfo.GradientHorizontal(Color4.Black, new Color4(0f, 0f, 0f, 0.7f)),
|
||||
Width = 0.4f,
|
||||
},
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.9f), new Color4(0f, 0f, 0f, 0.1f)),
|
||||
Width = 0.2f,
|
||||
},
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.1f), new Color4(0, 0, 0, 0)),
|
||||
Width = 0.05f,
|
||||
Colour = ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.7f), new Color4(0, 0, 0, 0.4f)),
|
||||
Width = 0.4f,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
145
osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs
Normal file
145
osu.Game/Screens/OnlinePlay/FreeModSelectOverlay.cs
Normal file
@ -0,0 +1,145 @@
|
||||
// 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.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Overlays.Mods;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="ModSelectOverlay"/> used for free-mod selection in online play.
|
||||
/// </summary>
|
||||
public class FreeModSelectOverlay : ModSelectOverlay
|
||||
{
|
||||
protected override bool Stacked => false;
|
||||
|
||||
public new Func<Mod, bool> IsValidMod
|
||||
{
|
||||
get => base.IsValidMod;
|
||||
set => base.IsValidMod = m => m.HasImplementation && !m.RequiresConfiguration && !(m is ModAutoplay) && value(m);
|
||||
}
|
||||
|
||||
public FreeModSelectOverlay()
|
||||
{
|
||||
IsValidMod = m => true;
|
||||
|
||||
CustomiseButton.Alpha = 0;
|
||||
MultiplierSection.Alpha = 0;
|
||||
DeselectAllButton.Alpha = 0;
|
||||
|
||||
Drawable selectAllButton;
|
||||
Drawable deselectAllButton;
|
||||
|
||||
FooterContainer.AddRange(new[]
|
||||
{
|
||||
selectAllButton = new TriangleButton
|
||||
{
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Width = 180,
|
||||
Text = "Select All",
|
||||
Action = selectAll,
|
||||
},
|
||||
// Unlike the base mod select overlay, this button deselects mods instantaneously.
|
||||
deselectAllButton = new TriangleButton
|
||||
{
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Width = 180,
|
||||
Text = "Deselect All",
|
||||
Action = deselectAll,
|
||||
},
|
||||
});
|
||||
|
||||
FooterContainer.SetLayoutPosition(selectAllButton, -2);
|
||||
FooterContainer.SetLayoutPosition(deselectAllButton, -1);
|
||||
}
|
||||
|
||||
private void selectAll()
|
||||
{
|
||||
foreach (var section in ModSectionsContainer.Children)
|
||||
section.SelectAll();
|
||||
}
|
||||
|
||||
private void deselectAll()
|
||||
{
|
||||
foreach (var section in ModSectionsContainer.Children)
|
||||
section.DeselectAll();
|
||||
}
|
||||
|
||||
protected override ModSection CreateModSection(ModType type) => new FreeModSection(type);
|
||||
|
||||
private class FreeModSection : ModSection
|
||||
{
|
||||
private HeaderCheckbox checkbox;
|
||||
|
||||
public FreeModSection(ModType type)
|
||||
: base(type)
|
||||
{
|
||||
}
|
||||
|
||||
protected override Drawable CreateHeader(string text) => new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Child = checkbox = new HeaderCheckbox
|
||||
{
|
||||
LabelText = text,
|
||||
Changed = onCheckboxChanged
|
||||
}
|
||||
};
|
||||
|
||||
private void onCheckboxChanged(bool value)
|
||||
{
|
||||
if (value)
|
||||
SelectAll();
|
||||
else
|
||||
DeselectAll();
|
||||
}
|
||||
|
||||
protected override void ModButtonStateChanged(Mod mod)
|
||||
{
|
||||
base.ModButtonStateChanged(mod);
|
||||
|
||||
if (!SelectionAnimationRunning)
|
||||
{
|
||||
var validButtons = ButtonsContainer.OfType<ModButton>().Where(b => b.Mod.HasImplementation);
|
||||
checkbox.Current.Value = validButtons.All(b => b.Selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class HeaderCheckbox : OsuCheckbox
|
||||
{
|
||||
public Action<bool> Changed;
|
||||
|
||||
protected override bool PlaySoundsOnUserChange => false;
|
||||
|
||||
public HeaderCheckbox()
|
||||
: base(false)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
protected override void ApplyLabelParameters(SpriteText text)
|
||||
{
|
||||
base.ApplyLabelParameters(text);
|
||||
|
||||
text.Font = OsuFont.GetFont(weight: FontWeight.Bold);
|
||||
}
|
||||
|
||||
protected override void OnUserChange(bool value)
|
||||
{
|
||||
base.OnUserChange(value);
|
||||
Changed?.Invoke(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -111,7 +111,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
|
||||
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea();
|
||||
|
||||
protected override ModSelectOverlay CreateModSelectOverlay() => new ModSelectOverlay(isValidMod);
|
||||
protected override ModSelectOverlay CreateModSelectOverlay() => new SoloModSelectOverlay { IsValidMod = isValidMod };
|
||||
|
||||
private bool isValidMod(Mod mod) => !(mod is ModAutoplay) && (mod as MultiMod)?.Mods.Any(mm => mm is ModAutoplay) != true;
|
||||
}
|
||||
|
@ -47,26 +47,21 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
|
||||
private void endOperationWithKnownLease(LeasedBindable<bool> lease)
|
||||
{
|
||||
if (lease != leasedInProgress)
|
||||
return;
|
||||
|
||||
// for extra safety, marshal the end of operation back to the update thread if necessary.
|
||||
Scheduler.Add(() =>
|
||||
{
|
||||
leasedInProgress?.Return();
|
||||
if (lease != leasedInProgress)
|
||||
return;
|
||||
|
||||
// UnbindAll() is purposefully used instead of Return() - the two do roughly the same thing, with one difference:
|
||||
// the former won't throw if the lease has already been returned before.
|
||||
// this matters because framework can unbind the lease via the internal UnbindAllBindables(), which is not always detectable
|
||||
// (it is in the case of disposal, but not in the case of screen exit - at least not cleanly).
|
||||
leasedInProgress?.UnbindAll();
|
||||
leasedInProgress = null;
|
||||
}, false);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
// base call does an UnbindAllBindables().
|
||||
// clean up the leased reference here so that it doesn't get returned twice.
|
||||
leasedInProgress = null;
|
||||
}
|
||||
|
||||
private class OngoingOperation : IDisposable
|
||||
{
|
||||
private readonly OngoingOperationTracker tracker;
|
||||
|
@ -200,7 +200,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||
Child = new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 300,
|
||||
Height = 500,
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
|
@ -353,7 +353,7 @@ namespace osu.Game.Screens.Play
|
||||
},
|
||||
skipOverlay = new SkipOverlay(DrawableRuleset.GameplayStartTime)
|
||||
{
|
||||
RequestSkip = GameplayClockContainer.Skip
|
||||
RequestSkip = performUserRequestedSkip
|
||||
},
|
||||
FailOverlay = new FailOverlay
|
||||
{
|
||||
@ -488,6 +488,17 @@ namespace osu.Game.Screens.Play
|
||||
this.Exit();
|
||||
}
|
||||
|
||||
private void performUserRequestedSkip()
|
||||
{
|
||||
// user requested skip
|
||||
// disable sample playback to stop currently playing samples and perform skip
|
||||
samplePlaybackDisabled.Value = true;
|
||||
GameplayClockContainer.Skip();
|
||||
|
||||
// return samplePlaybackDisabled.Value to what is defined by the beatmap's current state
|
||||
updateSampleDisabledState();
|
||||
}
|
||||
|
||||
private void performUserRequestedExit()
|
||||
{
|
||||
if (ValidForResume && HasFailed && !FailOverlay.IsPresent)
|
||||
|
@ -81,7 +81,7 @@ namespace osu.Game.Screens.Select
|
||||
item.RequiredMods.AddRange(Mods.Value.Select(m => m.CreateCopy()));
|
||||
}
|
||||
|
||||
protected override ModSelectOverlay CreateModSelectOverlay() => new ModSelectOverlay(isValidMod);
|
||||
protected override ModSelectOverlay CreateModSelectOverlay() => new SoloModSelectOverlay { IsValidMod = isValidMod };
|
||||
|
||||
private bool isValidMod(Mod mod) => !(mod is ModAutoplay) && (mod as MultiMod)?.Mods.Any(mm => mm is ModAutoplay) != true;
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual ModSelectOverlay CreateModSelectOverlay() => new ModSelectOverlay();
|
||||
protected virtual ModSelectOverlay CreateModSelectOverlay() => new SoloModSelectOverlay();
|
||||
|
||||
protected virtual void ApplyFilterToCarousel(FilterCriteria criteria)
|
||||
{
|
||||
|
@ -43,26 +43,28 @@ namespace osu.Game.Skinning
|
||||
if (samplePlaybackDisabler != null)
|
||||
{
|
||||
samplePlaybackDisabled.BindTo(samplePlaybackDisabler.SamplePlaybackDisabled);
|
||||
samplePlaybackDisabled.BindValueChanged(disabled =>
|
||||
samplePlaybackDisabled.BindValueChanged(SamplePlaybackDisabledChanged);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void SamplePlaybackDisabledChanged(ValueChangedEvent<bool> disabled)
|
||||
{
|
||||
if (!RequestedPlaying) return;
|
||||
|
||||
// let non-looping samples that have already been started play out to completion (sounds better than abruptly cutting off).
|
||||
if (!Looping) return;
|
||||
|
||||
cancelPendingStart();
|
||||
|
||||
if (disabled.NewValue)
|
||||
base.Stop();
|
||||
else
|
||||
{
|
||||
// schedule so we don't start playing a sample which is no longer alive.
|
||||
scheduledStart = Schedule(() =>
|
||||
{
|
||||
if (!RequestedPlaying) return;
|
||||
|
||||
// let non-looping samples that have already been started play out to completion (sounds better than abruptly cutting off).
|
||||
if (!Looping) return;
|
||||
|
||||
cancelPendingStart();
|
||||
|
||||
if (disabled.NewValue)
|
||||
base.Stop();
|
||||
else
|
||||
{
|
||||
// schedule so we don't start playing a sample which is no longer alive.
|
||||
scheduledStart = Schedule(() =>
|
||||
{
|
||||
if (RequestedPlaying)
|
||||
base.Play();
|
||||
});
|
||||
}
|
||||
if (RequestedPlaying)
|
||||
base.Play();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,21 @@ namespace osu.Game.Storyboards.Drawables
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SamplePlaybackDisabledChanged(ValueChangedEvent<bool> disabled)
|
||||
{
|
||||
if (!RequestedPlaying) return;
|
||||
|
||||
if (!Looping && disabled.NewValue)
|
||||
{
|
||||
// the default behaviour for sample disabling is to allow one-shot samples to play out.
|
||||
// storyboards regularly have long running samples that can cause this behaviour to lead to unintended results.
|
||||
// for this reason, we immediately stop such samples.
|
||||
Stop();
|
||||
}
|
||||
|
||||
base.SamplePlaybackDisabledChanged(disabled);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
133
osu.Game/Utils/ModUtils.cs
Normal file
133
osu.Game/Utils/ModUtils.cs
Normal file
@ -0,0 +1,133 @@
|
||||
// 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.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace osu.Game.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// A set of utilities to handle <see cref="Mod"/> combinations.
|
||||
/// </summary>
|
||||
public static class ModUtils
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks that all <see cref="Mod"/>s are compatible with each-other, and that all appear within a set of allowed types.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The allowed types must contain exact <see cref="Mod"/> types for the respective <see cref="Mod"/>s to be allowed.
|
||||
/// </remarks>
|
||||
/// <param name="combination">The <see cref="Mod"/>s to check.</param>
|
||||
/// <param name="allowedTypes">The set of allowed <see cref="Mod"/> types.</param>
|
||||
/// <returns>Whether all <see cref="Mod"/>s are compatible with each-other and appear in the set of allowed types.</returns>
|
||||
public static bool CheckCompatibleSetAndAllowed(IEnumerable<Mod> combination, IEnumerable<Type> allowedTypes)
|
||||
{
|
||||
// Prevent multiple-enumeration.
|
||||
var combinationList = combination as ICollection<Mod> ?? combination.ToArray();
|
||||
return CheckCompatibleSet(combinationList, out _) && CheckAllowed(combinationList, allowedTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks that all <see cref="Mod"/>s in a combination are compatible with each-other.
|
||||
/// </summary>
|
||||
/// <param name="combination">The <see cref="Mod"/> combination to check.</param>
|
||||
/// <returns>Whether all <see cref="Mod"/>s in the combination are compatible with each-other.</returns>
|
||||
public static bool CheckCompatibleSet(IEnumerable<Mod> combination)
|
||||
=> CheckCompatibleSet(combination, out _);
|
||||
|
||||
/// <summary>
|
||||
/// Checks that all <see cref="Mod"/>s in a combination are compatible with each-other.
|
||||
/// </summary>
|
||||
/// <param name="combination">The <see cref="Mod"/> combination to check.</param>
|
||||
/// <param name="invalidMods">Any invalid mods in the set.</param>
|
||||
/// <returns>Whether all <see cref="Mod"/>s in the combination are compatible with each-other.</returns>
|
||||
public static bool CheckCompatibleSet(IEnumerable<Mod> combination, [NotNullWhen(false)] out List<Mod>? invalidMods)
|
||||
{
|
||||
combination = FlattenMods(combination).ToArray();
|
||||
invalidMods = null;
|
||||
|
||||
foreach (var mod in combination)
|
||||
{
|
||||
foreach (var type in mod.IncompatibleMods)
|
||||
{
|
||||
foreach (var invalid in combination.Where(m => type.IsInstanceOfType(m)))
|
||||
{
|
||||
invalidMods ??= new List<Mod>();
|
||||
invalidMods.Add(invalid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return invalidMods == null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks that all <see cref="Mod"/>s in a combination appear within a set of allowed types.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The set of allowed types must contain exact <see cref="Mod"/> types for the respective <see cref="Mod"/>s to be allowed.
|
||||
/// </remarks>
|
||||
/// <param name="combination">The <see cref="Mod"/> combination to check.</param>
|
||||
/// <param name="allowedTypes">The set of allowed <see cref="Mod"/> types.</param>
|
||||
/// <returns>Whether all <see cref="Mod"/>s in the combination are allowed.</returns>
|
||||
public static bool CheckAllowed(IEnumerable<Mod> combination, IEnumerable<Type> allowedTypes)
|
||||
{
|
||||
var allowedSet = new HashSet<Type>(allowedTypes);
|
||||
|
||||
return combination.SelectMany(FlattenMod)
|
||||
.All(m => allowedSet.Contains(m.GetType()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check the provided combination of mods are valid for a local gameplay session.
|
||||
/// </summary>
|
||||
/// <param name="mods">The mods to check.</param>
|
||||
/// <param name="invalidMods">Invalid mods, if any were found. Can be null if all mods were valid.</param>
|
||||
/// <returns>Whether the input mods were all valid. If false, <paramref name="invalidMods"/> will contain all invalid entries.</returns>
|
||||
public static bool CheckValidForGameplay(IEnumerable<Mod> mods, out List<Mod>? invalidMods)
|
||||
{
|
||||
mods = mods.ToArray();
|
||||
|
||||
CheckCompatibleSet(mods, out invalidMods);
|
||||
|
||||
foreach (var mod in mods)
|
||||
{
|
||||
if (mod.Type == ModType.System || !mod.HasImplementation || mod is MultiMod)
|
||||
{
|
||||
invalidMods ??= new List<Mod>();
|
||||
invalidMods.Add(mod);
|
||||
}
|
||||
}
|
||||
|
||||
return invalidMods == null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flattens a set of <see cref="Mod"/>s, returning a new set with all <see cref="MultiMod"/>s removed.
|
||||
/// </summary>
|
||||
/// <param name="mods">The set of <see cref="Mod"/>s to flatten.</param>
|
||||
/// <returns>The new set, containing all <see cref="Mod"/>s in <paramref name="mods"/> recursively with all <see cref="MultiMod"/>s removed.</returns>
|
||||
public static IEnumerable<Mod> FlattenMods(IEnumerable<Mod> mods) => mods.SelectMany(FlattenMod);
|
||||
|
||||
/// <summary>
|
||||
/// Flattens a <see cref="Mod"/>, returning a set of <see cref="Mod"/>s in-place of any <see cref="MultiMod"/>s.
|
||||
/// </summary>
|
||||
/// <param name="mod">The <see cref="Mod"/> to flatten.</param>
|
||||
/// <returns>A set of singular "flattened" <see cref="Mod"/>s</returns>
|
||||
public static IEnumerable<Mod> FlattenMod(Mod mod)
|
||||
{
|
||||
if (mod is MultiMod multi)
|
||||
{
|
||||
foreach (var m in multi.Mods.SelectMany(FlattenMod))
|
||||
yield return m;
|
||||
}
|
||||
else
|
||||
yield return mod;
|
||||
}
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ namespace osu.Game.Utils
|
||||
|
||||
var options = new SentryOptions
|
||||
{
|
||||
Dsn = new Dsn("https://5e342cd55f294edebdc9ad604d28bbd3@sentry.io/1255255"),
|
||||
Dsn = "https://5e342cd55f294edebdc9ad604d28bbd3@sentry.io/1255255",
|
||||
Release = game.Version
|
||||
};
|
||||
|
||||
|
@ -20,17 +20,19 @@
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="DiffPlex" Version="1.6.3" />
|
||||
<PackageReference Include="Humanizer" Version="2.8.26" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="3.1.10" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="3.1.11" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="3.1.10" />
|
||||
<PackageReference Include="MessagePack" Version="2.2.85" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="5.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="5.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.NETCore.Targets" Version="3.1.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2021.128.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1202.0" />
|
||||
<PackageReference Include="Sentry" Version="2.1.8" />
|
||||
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
||||
<PackageReference Include="Sentry" Version="3.0.1" />
|
||||
<PackageReference Include="SharpCompress" Version="0.27.1" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
@ -80,6 +80,9 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="3.0.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="3.0.3" />
|
||||
<PackageReference Include="MessagePack" Version="1.7.3.7" />
|
||||
<PackageReference Include="MessagePack.Annotations" Version="2.2.85" />
|
||||
</ItemGroup>
|
||||
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
||||
<ItemGroup Label="Transitive Dependencies">
|
||||
@ -89,10 +92,10 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2021.128.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.27.1" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.NativeLibs" Version="2020.923.0" ExcludeAssets="all" />
|
||||
<PackageReference Include="ppy.osu.Framework.NativeLibs" Version="2021.115.0" ExcludeAssets="all" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user