Skip to content

Commit 766b745

Browse files
authored
Merge branch 'master' into song-select-v2-wedges-main
2 parents 4abb672 + 244bae5 commit 766b745

File tree

107 files changed

+2563
-2034
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+2563
-2034
lines changed

osu.Game.Rulesets.Catch/Edit/Setup/CatchDifficultySection.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ private void load()
7575
{
7676
Caption = EditorSetupStrings.BaseVelocity,
7777
HintText = EditorSetupStrings.BaseVelocityDescription,
78+
KeyboardStep = 0.1f,
7879
Current = new BindableDouble(Beatmap.Difficulty.SliderMultiplier)
7980
{
8081
Default = 1.4,
@@ -89,6 +90,7 @@ private void load()
8990
{
9091
Caption = EditorSetupStrings.TickRate,
9192
HintText = EditorSetupStrings.TickRateDescription,
93+
KeyboardStep = 1,
9294
Current = new BindableDouble(Beatmap.Difficulty.SliderTickRate)
9395
{
9496
Default = 1,
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
2+
// See the LICENCE file in the repository root for full licence text.
3+
4+
using NUnit.Framework;
5+
using osu.Game.Beatmaps;
6+
using osu.Game.Rulesets.Mania.Mods;
7+
using osu.Game.Screens.Select;
8+
using osu.Game.Screens.Select.Filter;
9+
10+
namespace osu.Game.Rulesets.Mania.Tests
11+
{
12+
[TestFixture]
13+
public class ManiaFilterCriteriaTest
14+
{
15+
[TestCase]
16+
public void TestKeysEqualSingleValue()
17+
{
18+
var criteria = new ManiaFilterCriteria();
19+
criteria.TryParseCustomKeywordCriteria("keys", Operator.Equal, "1");
20+
21+
Assert.True(criteria.Matches(
22+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 1 }),
23+
new FilterCriteria()));
24+
25+
Assert.False(criteria.Matches(
26+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 2 }),
27+
new FilterCriteria()));
28+
29+
Assert.False(criteria.Matches(
30+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 3 }),
31+
new FilterCriteria()));
32+
33+
Assert.True(criteria.Matches(
34+
new BeatmapInfo(new RulesetInfo { OnlineID = 0 }, new BeatmapDifficulty { CircleSize = 4 }),
35+
new FilterCriteria
36+
{
37+
Mods = [new ManiaModKey1()]
38+
}));
39+
}
40+
41+
[TestCase]
42+
public void TestKeysEqualMultipleValues()
43+
{
44+
var criteria = new ManiaFilterCriteria();
45+
criteria.TryParseCustomKeywordCriteria("keys", Operator.Equal, "1,3,5,7");
46+
47+
Assert.True(criteria.Matches(
48+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 1 }),
49+
new FilterCriteria()));
50+
51+
Assert.False(criteria.Matches(
52+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 2 }),
53+
new FilterCriteria()));
54+
55+
Assert.True(criteria.Matches(
56+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 3 }),
57+
new FilterCriteria()));
58+
59+
Assert.True(criteria.Matches(
60+
new BeatmapInfo(new RulesetInfo { OnlineID = 0 }, new BeatmapDifficulty { CircleSize = 4 }),
61+
new FilterCriteria
62+
{
63+
Mods = [new ManiaModKey1()]
64+
}));
65+
}
66+
67+
[TestCase]
68+
public void TestKeysNotEqualSingleValue()
69+
{
70+
var criteria = new ManiaFilterCriteria();
71+
criteria.TryParseCustomKeywordCriteria("keys", Operator.NotEqual, "1");
72+
73+
Assert.False(criteria.Matches(
74+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 1 }),
75+
new FilterCriteria()));
76+
77+
Assert.True(criteria.Matches(
78+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 2 }),
79+
new FilterCriteria()));
80+
81+
Assert.True(criteria.Matches(
82+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 3 }),
83+
new FilterCriteria()));
84+
85+
Assert.False(criteria.Matches(
86+
new BeatmapInfo(new RulesetInfo { OnlineID = 0 }, new BeatmapDifficulty { CircleSize = 4 }),
87+
new FilterCriteria
88+
{
89+
Mods = [new ManiaModKey1()]
90+
}));
91+
}
92+
93+
[TestCase]
94+
public void TestKeysNotEqualMultipleValues()
95+
{
96+
var criteria = new ManiaFilterCriteria();
97+
criteria.TryParseCustomKeywordCriteria("keys", Operator.NotEqual, "1,3,5,7");
98+
99+
Assert.False(criteria.Matches(
100+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 1 }),
101+
new FilterCriteria()));
102+
103+
Assert.True(criteria.Matches(
104+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 2 }),
105+
new FilterCriteria()));
106+
107+
Assert.False(criteria.Matches(
108+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 3 }),
109+
new FilterCriteria()));
110+
111+
Assert.False(criteria.Matches(
112+
new BeatmapInfo(new RulesetInfo { OnlineID = 0 }, new BeatmapDifficulty { CircleSize = 4 }),
113+
new FilterCriteria
114+
{
115+
Mods = [new ManiaModKey1()]
116+
}));
117+
}
118+
119+
[TestCase]
120+
public void TestKeysGreaterOrEqualThan()
121+
{
122+
var criteria = new ManiaFilterCriteria();
123+
criteria.TryParseCustomKeywordCriteria("keys", Operator.GreaterOrEqual, "4");
124+
125+
Assert.False(criteria.Matches(
126+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 1 }),
127+
new FilterCriteria()));
128+
129+
Assert.False(criteria.Matches(
130+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 2 }),
131+
new FilterCriteria()));
132+
133+
Assert.True(criteria.Matches(
134+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 4 }),
135+
new FilterCriteria()));
136+
137+
Assert.True(criteria.Matches(
138+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 5 }),
139+
new FilterCriteria()));
140+
141+
Assert.True(criteria.Matches(
142+
new BeatmapInfo(new RulesetInfo { OnlineID = 0 }, new BeatmapDifficulty { CircleSize = 3 }),
143+
new FilterCriteria
144+
{
145+
Mods = [new ManiaModKey7()]
146+
}));
147+
}
148+
149+
[TestCase]
150+
public void TestFilterIntersection()
151+
{
152+
var criteria = new ManiaFilterCriteria();
153+
criteria.TryParseCustomKeywordCriteria("keys", Operator.Greater, "4");
154+
criteria.TryParseCustomKeywordCriteria("keys", Operator.NotEqual, "7");
155+
156+
Assert.False(criteria.Matches(
157+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 3 }),
158+
new FilterCriteria()));
159+
160+
Assert.False(criteria.Matches(
161+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 4 }),
162+
new FilterCriteria()));
163+
164+
Assert.True(criteria.Matches(
165+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 5 }),
166+
new FilterCriteria()));
167+
168+
Assert.False(criteria.Matches(
169+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 7 }),
170+
new FilterCriteria()));
171+
172+
Assert.True(criteria.Matches(
173+
new BeatmapInfo(new ManiaRuleset().RulesetInfo, new BeatmapDifficulty { CircleSize = 9 }),
174+
new FilterCriteria()));
175+
}
176+
177+
[TestCase]
178+
public void TestInvalidFilters()
179+
{
180+
var criteria = new ManiaFilterCriteria();
181+
182+
Assert.False(criteria.TryParseCustomKeywordCriteria("keys", Operator.Equal, "some text"));
183+
Assert.False(criteria.TryParseCustomKeywordCriteria("keys", Operator.NotEqual, "4,some text"));
184+
Assert.False(criteria.TryParseCustomKeywordCriteria("keys", Operator.GreaterOrEqual, "4,5,6"));
185+
}
186+
}
187+
}

osu.Game.Rulesets.Mania/Configuration/ManiaRulesetConfigManager.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
22
// See the LICENCE file in the repository root for full licence text.
33

4-
using System;
54
using osu.Framework.Configuration.Tracking;
65
using osu.Game.Configuration;
76
using osu.Game.Localisation;
@@ -25,17 +24,6 @@ protected override void InitialiseDefaults()
2524
SetDefault(ManiaRulesetSetting.ScrollDirection, ManiaScrollingDirection.Down);
2625
SetDefault(ManiaRulesetSetting.TimingBasedNoteColouring, false);
2726
SetDefault(ManiaRulesetSetting.MobileLayout, ManiaMobileLayout.Portrait);
28-
29-
#pragma warning disable CS0618
30-
// Although obsolete, this is still required to populate the bindable from the database in case migration is required.
31-
SetDefault<double?>(ManiaRulesetSetting.ScrollTime, null);
32-
33-
if (Get<double?>(ManiaRulesetSetting.ScrollTime) is double scrollTime)
34-
{
35-
SetValue(ManiaRulesetSetting.ScrollSpeed, Math.Round(DrawableManiaRuleset.MAX_TIME_RANGE / scrollTime));
36-
SetValue<double?>(ManiaRulesetSetting.ScrollTime, null);
37-
}
38-
#pragma warning restore CS0618
3927
}
4028

4129
public override TrackedSettings CreateTrackedSettings() => new TrackedSettings
@@ -52,8 +40,6 @@ protected override void InitialiseDefaults()
5240

5341
public enum ManiaRulesetSetting
5442
{
55-
[Obsolete("Use ScrollSpeed instead.")] // Can be removed 2023-11-30
56-
ScrollTime,
5743
ScrollSpeed,
5844
ScrollDirection,
5945
TimingBasedNoteColouring,

osu.Game.Rulesets.Mania/Edit/Setup/ManiaDifficultySection.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ private void load()
8989
{
9090
Caption = EditorSetupStrings.BaseVelocity,
9191
HintText = EditorSetupStrings.BaseVelocityDescription,
92+
KeyboardStep = 0.1f,
9293
Current = new BindableDouble(Beatmap.Difficulty.SliderMultiplier)
9394
{
9495
Default = 1.4,
@@ -103,6 +104,7 @@ private void load()
103104
{
104105
Caption = EditorSetupStrings.TickRate,
105106
HintText = EditorSetupStrings.TickRateDescription,
107+
KeyboardStep = 1,
106108
Current = new BindableDouble(Beatmap.Difficulty.SliderTickRate)
107109
{
108110
Default = 1,

osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Linq;
66
using osu.Framework.Bindables;
77
using osu.Game.Beatmaps;
8+
using osu.Game.Beatmaps.Formats;
89
using osu.Game.Rulesets.Filter;
910
using osu.Game.Rulesets.Mania.Beatmaps;
1011
using osu.Game.Rulesets.Mania.Mods;
@@ -17,28 +18,80 @@ namespace osu.Game.Rulesets.Mania
1718
{
1819
public class ManiaFilterCriteria : IRulesetFilterCriteria
1920
{
20-
private FilterCriteria.OptionalRange<float> keys;
21+
private readonly HashSet<int> includedKeyCounts = Enumerable.Range(1, LegacyBeatmapDecoder.MAX_MANIA_KEY_COUNT).ToHashSet();
2122

2223
public bool Matches(BeatmapInfo beatmapInfo, FilterCriteria criteria)
2324
{
24-
return !keys.HasFilter || keys.IsInRange(ManiaBeatmapConverter.GetColumnCount(LegacyBeatmapConversionDifficultyInfo.FromBeatmapInfo(beatmapInfo), criteria.Mods));
25+
int keyCount = ManiaBeatmapConverter.GetColumnCount(LegacyBeatmapConversionDifficultyInfo.FromBeatmapInfo(beatmapInfo), criteria.Mods);
26+
27+
return includedKeyCounts.Contains(keyCount);
2528
}
2629

27-
public bool TryParseCustomKeywordCriteria(string key, Operator op, string value)
30+
public bool TryParseCustomKeywordCriteria(string key, Operator op, string strValues)
2831
{
2932
switch (key)
3033
{
3134
case "key":
3235
case "keys":
33-
return FilterQueryParser.TryUpdateCriteriaRange(ref keys, op, value);
36+
{
37+
var keyCounts = new HashSet<int>();
38+
39+
foreach (string strValue in strValues.Split(','))
40+
{
41+
if (!int.TryParse(strValue, out int keyCount))
42+
return false;
43+
44+
keyCounts.Add(keyCount);
45+
}
46+
47+
int? singleKeyCount = keyCounts.Count == 1 ? keyCounts.Single() : null;
48+
49+
switch (op)
50+
{
51+
case Operator.Equal:
52+
includedKeyCounts.IntersectWith(keyCounts);
53+
return true;
54+
55+
case Operator.NotEqual:
56+
includedKeyCounts.ExceptWith(keyCounts);
57+
return true;
58+
59+
case Operator.Less:
60+
if (singleKeyCount == null) return false;
61+
62+
includedKeyCounts.RemoveWhere(k => k >= singleKeyCount.Value);
63+
return true;
64+
65+
case Operator.LessOrEqual:
66+
if (singleKeyCount == null) return false;
67+
68+
includedKeyCounts.RemoveWhere(k => k > singleKeyCount.Value);
69+
return true;
70+
71+
case Operator.Greater:
72+
if (singleKeyCount == null) return false;
73+
74+
includedKeyCounts.RemoveWhere(k => k <= singleKeyCount.Value);
75+
return true;
76+
77+
case Operator.GreaterOrEqual:
78+
if (singleKeyCount == null) return false;
79+
80+
includedKeyCounts.RemoveWhere(k => k < singleKeyCount.Value);
81+
return true;
82+
83+
default:
84+
return false;
85+
}
86+
}
3487
}
3588

3689
return false;
3790
}
3891

3992
public bool FilterMayChangeFromMods(ValueChangedEvent<IReadOnlyList<Mod>> mods)
4093
{
41-
if (keys.HasFilter)
94+
if (includedKeyCounts.Count != LegacyBeatmapDecoder.MAX_MANIA_KEY_COUNT)
4295
{
4396
// Interpreting as the Mod type is required for equality comparison.
4497
HashSet<Mod> oldSet = mods.OldValue.OfType<ManiaKeyMod>().AsEnumerable<Mod>().ToHashSet();

osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ public partial class DrawableManiaRuleset : DrawableScrollingRuleset<ManiaHitObj
6060
private readonly BindableDouble configScrollSpeed = new BindableDouble();
6161
private readonly Bindable<ManiaMobileLayout> mobileLayout = new Bindable<ManiaMobileLayout>();
6262

63+
public double TargetTimeRange { get; protected set; }
64+
6365
private double currentTimeRange;
64-
protected double TargetTimeRange;
6566

6667
// Stores the current speed adjustment active in gameplay.
6768
private readonly Track speedAdjustmentTrack = new TrackVirtual(0);
@@ -109,7 +110,13 @@ private void load(ISkinSource source)
109110
configDirection.BindValueChanged(direction => Direction.Value = (ScrollingDirection)direction.NewValue, true);
110111

111112
Config.BindWith(ManiaRulesetSetting.ScrollSpeed, configScrollSpeed);
112-
configScrollSpeed.BindValueChanged(speed => TargetTimeRange = ComputeScrollTime(speed.NewValue));
113+
configScrollSpeed.BindValueChanged(speed =>
114+
{
115+
if (!AllowScrollSpeedAdjustment)
116+
return;
117+
118+
TargetTimeRange = ComputeScrollTime(speed.NewValue);
119+
});
113120

114121
TimeRange.Value = TargetTimeRange = currentTimeRange = ComputeScrollTime(configScrollSpeed.Value);
115122

osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,12 @@ public void TestSpinnerNoBonus()
8686
[Test]
8787
public void TestSpinningSamplePitchShift()
8888
{
89+
PausableSkinnableSound spinSample = null;
90+
8991
AddStep("Add spinner", () => SetContents(_ => testSingle(5, true, 4000)));
90-
AddUntilStep("Pitch starts low", () => getSpinningSample().Frequency.Value < 0.8);
91-
AddUntilStep("Pitch increases", () => getSpinningSample().Frequency.Value > 0.8);
92+
AddUntilStep("wait for spin sample", () => (spinSample = getSpinningSample()) != null);
93+
AddUntilStep("Pitch starts low", () => spinSample.Frequency.Value < 0.8);
94+
AddUntilStep("Pitch increases", () => spinSample.Frequency.Value > 0.8);
9295

9396
PausableSkinnableSound getSpinningSample() =>
9497
drawableSpinner.ChildrenOfType<PausableSkinnableSound>().FirstOrDefault(s => s.Samples.Any(i => i.LookupNames.Any(l => l.Contains("spinnerspin"))));

osu.Game.Rulesets.Osu/Edit/PolygonGenerationPopover.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private void load()
103103
Current = new BindableNumber<int>(3)
104104
{
105105
MinValue = 3,
106-
MaxValue = 10,
106+
MaxValue = 32,
107107
Precision = 1,
108108
},
109109
Instantaneous = true

0 commit comments

Comments
 (0)