1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:33:30 +08:00

Merge pull request #18830 from peppy/c-sharp-10

This commit is contained in:
Dean Herbert 2022-06-25 12:03:29 +09:00 committed by GitHub
commit f15698d025
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
208 changed files with 358 additions and 350 deletions

View File

@ -1,7 +1,7 @@
<!-- Contains required properties for osu!framework projects. -->
<Project>
<PropertyGroup Label="C#">
<LangVersion>8.0</LangVersion>
<LangVersion>9.0</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Nullable>enable</Nullable>
</PropertyGroup>

View File

@ -52,7 +52,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.623.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.621.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.624.1" />
</ItemGroup>
<ItemGroup Label="Transitive Dependencies">
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->

View File

@ -57,7 +57,7 @@ namespace osu.Desktop
client.OnReady += onReady;
// safety measure for now, until we performance test / improve backoff for failed connections.
client.OnConnectionFailed += (_, __) => client.Deinitialize();
client.OnConnectionFailed += (_, _) => client.Deinitialize();
client.OnError += (_, e) => Logger.Log($"An error occurred with Discord RPC Client: {e.Code} {e.Message}", LoggingTarget.Network);

View File

@ -129,18 +129,18 @@ namespace osu.Desktop
[SupportedOSPlatform("windows")]
private static void setupSquirrel()
{
SquirrelAwareApp.HandleEvents(onInitialInstall: (version, tools) =>
SquirrelAwareApp.HandleEvents(onInitialInstall: (_, tools) =>
{
tools.CreateShortcutForThisExe();
tools.CreateUninstallerRegistryEntry();
}, onAppUpdate: (version, tools) =>
}, onAppUpdate: (_, tools) =>
{
tools.CreateUninstallerRegistryEntry();
}, onAppUninstall: (version, tools) =>
}, onAppUninstall: (_, tools) =>
{
tools.RemoveShortcutForThisExe();
tools.RemoveUninstallerRegistryEntry();
}, onEveryRun: (version, tools, firstRun) =>
}, onEveryRun: (_, _, _) =>
{
// While setting the `ProcessAppUserModelId` fixes duplicate icons/shortcuts on the taskbar, it currently
// causes the right-click context menu to function incorrectly.

View File

@ -31,7 +31,7 @@ namespace osu.Game.Benchmarks
realm = new RealmAccess(storage, OsuGameBase.CLIENT_DATABASE_FILENAME);
realm.Run(r =>
realm.Run(_ =>
{
realm.Write(c => c.Add(TestResources.CreateTestBeatmapSetInfo(rulesets: new[] { new OsuRuleset().RulesetInfo })));
});

View File

@ -92,7 +92,7 @@ namespace osu.Game.Rulesets.Catch.Tests
new JuiceStreamPathVertex(20, -5)
}));
removeCount = path.RemoveVertices((_, i) => true);
removeCount = path.RemoveVertices((_, _) => true);
Assert.That(removeCount, Is.EqualTo(1));
Assert.That(path.Vertices, Is.EqualTo(new[]
{

View File

@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Catch.Tests
hyperDashCount = 0;
// this needs to be done within the frame stable context due to how quickly hyperdash state changes occur.
Player.DrawableRuleset.FrameStableComponents.OnUpdate += d =>
Player.DrawableRuleset.FrameStableComponents.OnUpdate += _ =>
{
var catcher = Player.ChildrenOfType<Catcher>().FirstOrDefault();

View File

@ -135,15 +135,15 @@ namespace osu.Game.Rulesets.Catch.Edit
{
switch (BlueprintContainer.CurrentTool)
{
case SelectTool _:
case SelectTool:
if (EditorBeatmap.SelectedHitObjects.Count == 0)
return null;
double minTime = EditorBeatmap.SelectedHitObjects.Min(hitObject => hitObject.StartTime);
return getLastSnappableHitObject(minTime);
case FruitCompositionTool _:
case JuiceStreamCompositionTool _:
case FruitCompositionTool:
case JuiceStreamCompositionTool:
if (!CursorInPlacementArea)
return null;

View File

@ -42,10 +42,10 @@ namespace osu.Game.Rulesets.Catch.Edit
case Droplet droplet:
return droplet is TinyDroplet ? PositionRange.EMPTY : new PositionRange(droplet.OriginalX);
case JuiceStream _:
case JuiceStream:
return GetPositionRange(hitObject.NestedHitObjects);
case BananaShower _:
case BananaShower:
// A banana shower occupies the whole screen width.
return new PositionRange(0, CatchPlayfield.WIDTH);

View File

@ -131,7 +131,7 @@ namespace osu.Game.Rulesets.Catch.Edit
{
switch (hitObject)
{
case BananaShower _:
case BananaShower:
return false;
case JuiceStream juiceStream:

View File

@ -389,13 +389,13 @@ namespace osu.Game.Rulesets.Catch.UI
{
switch (source)
{
case Fruit _:
case Fruit:
return caughtFruitPool.Get();
case Banana _:
case Banana:
return caughtBananaPool.Get();
case Droplet _:
case Droplet:
return caughtDropletPool.Get();
default:

View File

@ -173,7 +173,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
switch (original)
{
case IHasDistance _:
case IHasDistance:
{
var generator = new DistanceObjectPatternGenerator(Random, original, beatmap, lastPattern, originalBeatmap);
conversion = generator;

View File

@ -156,9 +156,9 @@ namespace osu.Game.Rulesets.Mania.Difficulty
{
switch (m)
{
case ManiaModNoFail _:
case ManiaModEasy _:
case ManiaModHalfTime _:
case ManiaModNoFail:
case ManiaModEasy:
case ManiaModHalfTime:
scoreMultiplier *= 0.5;
break;
}

View File

@ -146,56 +146,56 @@ namespace osu.Game.Rulesets.Mania
{
switch (mod)
{
case ManiaModKey1 _:
case ManiaModKey1:
value |= LegacyMods.Key1;
break;
case ManiaModKey2 _:
case ManiaModKey2:
value |= LegacyMods.Key2;
break;
case ManiaModKey3 _:
case ManiaModKey3:
value |= LegacyMods.Key3;
break;
case ManiaModKey4 _:
case ManiaModKey4:
value |= LegacyMods.Key4;
break;
case ManiaModKey5 _:
case ManiaModKey5:
value |= LegacyMods.Key5;
break;
case ManiaModKey6 _:
case ManiaModKey6:
value |= LegacyMods.Key6;
break;
case ManiaModKey7 _:
case ManiaModKey7:
value |= LegacyMods.Key7;
break;
case ManiaModKey8 _:
case ManiaModKey8:
value |= LegacyMods.Key8;
break;
case ManiaModKey9 _:
case ManiaModKey9:
value |= LegacyMods.Key9;
break;
case ManiaModDualStages _:
case ManiaModDualStages:
value |= LegacyMods.KeyCoop;
break;
case ManiaModFadeIn _:
case ManiaModFadeIn:
value |= LegacyMods.FadeIn;
value &= ~LegacyMods.Hidden; // this is toggled on in the base call due to inheritance, but we don't want that.
break;
case ManiaModMirror _:
case ManiaModMirror:
value |= LegacyMods.Mirror;
break;
case ManiaModRandom _:
case ManiaModRandom:
value |= LegacyMods.Random;
break;
}

View File

@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Mania.Mods
var rng = new Random((int)Seed.Value);
int availableColumns = ((ManiaBeatmap)beatmap).TotalColumns;
var shuffledColumns = Enumerable.Range(0, availableColumns).OrderBy(item => rng.Next()).ToList();
var shuffledColumns = Enumerable.Range(0, availableColumns).OrderBy(_ => rng.Next()).ToList();
beatmap.HitObjects.OfType<ManiaHitObject>().ForEach(h => h.Column = shuffledColumns[h.Column]);
}

View File

@ -57,11 +57,11 @@ namespace osu.Game.Rulesets.Mania.Replays
{
switch (point)
{
case HitPoint _:
case HitPoint:
actions.Add(columnActions[point.Column]);
break;
case ReleasePoint _:
case ReleasePoint:
actions.Remove(columnActions[point.Column]);
break;
}

View File

@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Osu.Tests
skin.Setup(s => s.GetTexture(It.IsAny<string>())).CallBase();
skin.Setup(s => s.GetTexture(It.IsIn(textureFilenames), It.IsAny<WrapMode>(), It.IsAny<WrapMode>()))
.Returns((string componentName, WrapMode _, WrapMode __) => new Texture(1, 1) { AssetName = componentName });
.Returns((string componentName, WrapMode _, WrapMode _) => new Texture(1, 1) { AssetName = componentName });
Child = new DependencyProvidingContainer
{

View File

@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
lastResult = null;
spinner = nextSpinner;
spinner.OnNewResult += (o, result) => lastResult = result;
spinner.OnNewResult += (_, result) => lastResult = result;
}
return lastResult?.Type == HitResult.Great;
@ -116,7 +116,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
return false;
spinner = nextSpinner;
spinner.OnNewResult += (o, result) => results.Add(result);
spinner.OnNewResult += (_, result) => results.Add(result);
results.Clear();
}

View File

@ -161,7 +161,7 @@ namespace osu.Game.Rulesets.Osu.Tests
=> addCheckPositionChangeSteps(timeAtRepeat(startTime, repeatIndex), positionAtRepeat(repeatIndex), positionRemainsSame);
private Func<double> timeAtRepeat(Func<double> startTime, int repeatIndex) => () => startTime() + 100 + duration_of_span * repeatIndex;
private Func<Vector2> positionAtRepeat(int repeatIndex) => repeatIndex % 2 == 0 ? (Func<Vector2>)getSliderStart : getSliderEnd;
private Func<Vector2> positionAtRepeat(int repeatIndex) => repeatIndex % 2 == 0 ? getSliderStart : getSliderEnd;
private List<Vector2> getSliderCurve() => ((PlaySliderBody)drawableSlider.Body.Drawable).CurrentCurve;
private Vector2 getSliderStart() => getSliderCurve().First();

View File

@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Osu.Edit
});
selectedHitObjects = EditorBeatmap.SelectedHitObjects.GetBoundCopy();
selectedHitObjects.CollectionChanged += (_, __) => updateDistanceSnapGrid();
selectedHitObjects.CollectionChanged += (_, _) => updateDistanceSnapGrid();
placementObject = EditorBeatmap.PlacementObject.GetBoundCopy();
placementObject.ValueChanged += _ => updateDistanceSnapGrid();
@ -204,7 +204,7 @@ namespace osu.Game.Rulesets.Osu.Edit
switch (BlueprintContainer.CurrentTool)
{
case SelectTool _:
case SelectTool:
if (!EditorBeatmap.SelectedHitObjects.Any())
return;

View File

@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public void ApplyToDrawableHitObject(DrawableHitObject drawable)
{
drawable.ApplyCustomUpdateState += (drawableObject, state) =>
drawable.ApplyCustomUpdateState += (drawableObject, _) =>
{
if (!(drawableObject is DrawableHitCircle drawableHitCircle)) return;

View File

@ -88,7 +88,7 @@ namespace osu.Game.Rulesets.Osu.Mods
switch (drawableObject)
{
case DrawableSliderTail _:
case DrawableSliderTail:
using (drawableObject.BeginAbsoluteSequence(fadeStartTime))
drawableObject.FadeOut(fadeDuration);
@ -165,14 +165,14 @@ namespace osu.Game.Rulesets.Osu.Mods
switch (hitObject)
{
case Slider _:
case Slider:
return (fadeOutStartTime, longFadeDuration);
case SliderTick _:
case SliderTick:
double tickFadeOutDuration = Math.Min(hitObject.TimePreempt - DrawableSliderTick.ANIM_DURATION, 1000);
return (hitObject.StartTime - tickFadeOutDuration, tickFadeOutDuration);
case Spinner _:
case Spinner:
return (fadeOutStartTime + longFadeDuration, fadeOutDuration);
default:

View File

@ -44,13 +44,13 @@ namespace osu.Game.Rulesets.Osu.Mods
// apply grow effect
switch (drawable)
{
case DrawableSliderHead _:
case DrawableSliderTail _:
case DrawableSliderHead:
case DrawableSliderTail:
// special cases we should *not* be scaling.
break;
case DrawableSlider _:
case DrawableHitCircle _:
case DrawableSlider:
case DrawableHitCircle:
{
using (drawable.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
drawable.ScaleTo(StartScale.Value).Then().ScaleTo(EndScale, h.TimePreempt, Easing.OutSine);

View File

@ -34,10 +34,10 @@ namespace osu.Game.Rulesets.Osu.Mods
{
switch (drawable)
{
case DrawableSliderHead _:
case DrawableSliderTail _:
case DrawableSliderTick _:
case DrawableSliderRepeat _:
case DrawableSliderHead:
case DrawableSliderTail:
case DrawableSliderTick:
case DrawableSliderRepeat:
return;
default:

View File

@ -156,7 +156,7 @@ namespace osu.Game.Rulesets.Osu.Objects
public Slider()
{
SamplesBindable.CollectionChanged += (_, __) => UpdateNestedSamples();
SamplesBindable.CollectionChanged += (_, _) => UpdateNestedSamples();
Path.Version.ValueChanged += _ => updateNestedPositions();
}

View File

@ -120,19 +120,19 @@ namespace osu.Game.Rulesets.Osu
{
switch (mod)
{
case OsuModAutopilot _:
case OsuModAutopilot:
value |= LegacyMods.Autopilot;
break;
case OsuModSpunOut _:
case OsuModSpunOut:
value |= LegacyMods.SpunOut;
break;
case OsuModTarget _:
case OsuModTarget:
value |= LegacyMods.Target;
break;
case OsuModTouchDevice _:
case OsuModTouchDevice:
value |= LegacyMods.TouchDevice;
break;
}

View File

@ -107,7 +107,7 @@ namespace osu.Game.Rulesets.Osu.Replays
hitWindows = slider.TailCircle.HitWindows;
break;
case Spinner _:
case Spinner:
hitWindows = defaultHitWindows;
break;
}

View File

@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Scoring
{
switch (hitObject)
{
case HitCircle _:
case HitCircle:
return new OsuHitCircleJudgementResult(hitObject, judgement);
default:

View File

@ -126,7 +126,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
break;
case DrawableSpinnerBonusTick _:
case DrawableSpinnerBonusTick:
if (state == ArmedState.Hit)
glow.FlashColour(Color4.White, 200);

View File

@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.UI
switch (obj)
{
case DrawableSpinner _:
case DrawableSpinner:
continue;
case DrawableSlider slider:

View File

@ -96,7 +96,7 @@ namespace osu.Game.Rulesets.Osu.UI
// note: `Slider`'s `ProxiedLayer` is added when its nested `DrawableHitCircle` is loaded.
switch (drawable)
{
case DrawableSpinner _:
case DrawableSpinner:
spinnerProxies.Add(drawable.CreateProxy());
break;

View File

@ -88,11 +88,11 @@ namespace osu.Game.Rulesets.Osu.Utils
switch (hitObject)
{
case HitCircle _:
case HitCircle:
shift = clampHitCircleToPlayfield(current);
break;
case Slider _:
case Slider:
shift = clampSliderToPlayfield(current);
break;
}

View File

@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
AddStep("Setup judgements", () =>
{
judged = false;
Player.ScoreProcessor.NewJudgement += b => judged = true;
Player.ScoreProcessor.NewJudgement += _ => judged = true;
});
AddUntilStep("swell judged", () => judged);
AddAssert("failed", () => Player.GameplayState.HasFailed);

View File

@ -48,8 +48,8 @@ namespace osu.Game.Rulesets.Taiko.Mods
{
switch (hitObject)
{
case DrawableDrumRollTick _:
case DrawableHit _:
case DrawableDrumRollTick:
case DrawableHit:
double preempt = drawableRuleset.TimeRange.Value / drawableRuleset.ControlPointAt(hitObject.HitObject.StartTime).Multiplier;
double start = hitObject.HitObject.StartTime - preempt * fade_out_start_time;
double duration = preempt * fade_out_duration;

View File

@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Taiko.Objects
DisplayColour.Value = Type == HitType.Centre ? COLOUR_CENTRE : COLOUR_RIM;
});
SamplesBindable.BindCollectionChanged((_, __) => updateTypeFromSamples());
SamplesBindable.BindCollectionChanged((_, _) => updateTypeFromSamples());
}
private void updateTypeFromSamples()

View File

@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Taiko.Objects
protected TaikoStrongableHitObject()
{
IsStrongBindable.BindValueChanged(_ => updateSamplesFromType());
SamplesBindable.BindCollectionChanged((_, __) => updateTypeFromSamples());
SamplesBindable.BindCollectionChanged((_, _) => updateTypeFromSamples());
}
private void updateTypeFromSamples()

View File

@ -245,7 +245,7 @@ namespace osu.Game.Rulesets.Taiko.UI
barLinePlayfield.Add(barLine);
break;
case DrawableTaikoHitObject _:
case DrawableTaikoHitObject:
base.Add(h);
break;
@ -261,7 +261,7 @@ namespace osu.Game.Rulesets.Taiko.UI
case DrawableBarLine barLine:
return barLinePlayfield.Remove(barLine);
case DrawableTaikoHitObject _:
case DrawableTaikoHitObject:
return base.Remove(h);
default:
@ -280,12 +280,12 @@ namespace osu.Game.Rulesets.Taiko.UI
switch (result.Judgement)
{
case TaikoStrongJudgement _:
case TaikoStrongJudgement:
if (result.IsHit)
hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == ((DrawableStrongNestedHit)judgedObject).ParentHitObject)?.VisualiseSecondHit(result);
break;
case TaikoDrumRollTickJudgement _:
case TaikoDrumRollTickJudgement:
if (!result.IsHit)
break;

View File

@ -99,7 +99,7 @@ namespace osu.Game.Tests.Collections.IO
public async Task TestImportMalformedDatabase()
{
bool exceptionThrown = false;
UnhandledExceptionEventHandler setException = (_, __) => exceptionThrown = true;
UnhandledExceptionEventHandler setException = (_, _) => exceptionThrown = true;
using (HeadlessGameHost host = new CleanRunHeadlessGameHost())
{

View File

@ -46,7 +46,7 @@ namespace osu.Game.Tests.Database
realm.RegisterCustomSubscription(r =>
{
var subscription = r.All<BeatmapInfo>().QueryAsyncWithNotifications((sender, changes, error) =>
var subscription = r.All<BeatmapInfo>().QueryAsyncWithNotifications((_, _, _) =>
{
realm.Run(_ =>
{

View File

@ -189,7 +189,7 @@ namespace osu.Game.Tests.Database
});
// Can't be used, even from within a valid context.
realm.Run(threadContext =>
realm.Run(_ =>
{
Assert.Throws<InvalidOperationException>(() =>
{

View File

@ -364,12 +364,12 @@ namespace osu.Game.Tests.NonVisual
private void confirmCurrentFrame(int? frame)
{
Assert.AreEqual(frame is int x ? replay.Frames[x].Time : (double?)null, handler.CurrentFrame?.Time, "Unexpected current frame");
Assert.AreEqual(frame is int x ? replay.Frames[x].Time : null, handler.CurrentFrame?.Time, "Unexpected current frame");
}
private void confirmNextFrame(int? frame)
{
Assert.AreEqual(frame is int x ? replay.Frames[x].Time : (double?)null, handler.NextFrame?.Time, "Unexpected next frame");
Assert.AreEqual(frame is int x ? replay.Frames[x].Time : null, handler.NextFrame?.Time, "Unexpected next frame");
}
private class TestReplayFrame : ReplayFrame

View File

@ -157,7 +157,7 @@ namespace osu.Game.Tests.NonVisual.Skinning
{
// use an incrementing width to allow assertion matching on correct textures as they turn from uploads into actual textures.
int width = 1;
Textures = fileNames.ToDictionary(fileName => fileName, fileName => new TextureUpload(new Image<Rgba32>(width, width++)));
Textures = fileNames.ToDictionary(fileName => fileName, _ => new TextureUpload(new Image<Rgba32>(width, width++)));
}
public TextureUpload Get(string name) => Textures.GetValueOrDefault(name);

View File

@ -58,7 +58,7 @@ namespace osu.Game.Tests.Skins
{
AddStep($"Set beatmap skin enabled to {allowBeatmapLookups}", () => config.SetValue(OsuSetting.BeatmapSkins, allowBeatmapLookups));
ISkin expected() => allowBeatmapLookups ? (ISkin)beatmapSource : userSource;
ISkin expected() => allowBeatmapLookups ? beatmapSource : userSource;
AddAssert("Check lookup is from correct source", () => requester.FindProvider(s => s.GetDrawableComponent(new TestSkinComponent()) != null) == expected());
}

View File

@ -322,8 +322,8 @@ namespace osu.Game.Tests.Visual.Gameplay
{
switch (h)
{
case TestPooledHitObject _:
case TestPooledParentHitObject _:
case TestPooledHitObject:
case TestPooledParentHitObject:
return null;
case TestParentHitObject p:

View File

@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual.Gameplay
protected override void LoadComplete()
{
base.LoadComplete();
HealthProcessor.FailConditions += (_, __) => true;
HealthProcessor.FailConditions += (_, _) => true;
}
private double lastFrequency = double.MaxValue;

View File

@ -49,7 +49,7 @@ namespace osu.Game.Tests.Visual.Gameplay
protected override void LoadComplete()
{
base.LoadComplete();
HealthProcessor.FailConditions += (_, __) => true;
HealthProcessor.FailConditions += (_, _) => true;
}
}
}

View File

@ -45,7 +45,7 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test]
public void TestToggleEditor()
{
AddToggleStep("toggle editor visibility", visible => skinEditor.ToggleVisibility());
AddToggleStep("toggle editor visibility", _ => skinEditor.ToggleVisibility());
}
[Test]

View File

@ -103,7 +103,7 @@ namespace osu.Game.Tests.Visual.Gameplay
Child = new SkinProvidingContainer(secondarySource)
{
RelativeSizeAxes = Axes.Both,
Child = consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation"))
Child = consumer = new SkinConsumer("test", _ => new NamedBox("Default Implementation"))
}
};
});
@ -132,7 +132,7 @@ namespace osu.Game.Tests.Visual.Gameplay
};
});
AddStep("add permissive", () => target.Add(consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation"))));
AddStep("add permissive", () => target.Add(consumer = new SkinConsumer("test", _ => new NamedBox("Default Implementation"))));
AddAssert("consumer using override source", () => consumer.Drawable is SecondarySourceBox);
AddAssert("skinchanged only called once", () => consumer.SkinChangedCount == 1);
}
@ -155,7 +155,7 @@ namespace osu.Game.Tests.Visual.Gameplay
};
});
AddStep("add permissive", () => target.Add(consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation"))));
AddStep("add permissive", () => target.Add(consumer = new SkinConsumer("test", _ => new NamedBox("Default Implementation"))));
AddAssert("consumer using override source", () => consumer.Drawable is SecondarySourceBox);
AddStep("disable", () => target.Disable());
AddAssert("consumer using base source", () => consumer.Drawable is BaseSourceBox);

View File

@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual.Gameplay
base.SetUpSteps();
AddStep("enable storyboard", () => LocalConfig.SetValue(OsuSetting.ShowStoryboard, true));
AddStep("set dim level to 0", () => LocalConfig.SetValue<double>(OsuSetting.DimLevel, 0));
AddStep("reset fail conditions", () => currentFailConditions = (_, __) => false);
AddStep("reset fail conditions", () => currentFailConditions = (_, _) => false);
AddStep("set storyboard duration to 2s", () => currentStoryboardDuration = 2000);
AddStep("set ShowResults = true", () => showResults = true);
}
@ -91,7 +91,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{
CreateTest(() =>
{
AddStep("fail on first judgement", () => currentFailConditions = (_, __) => true);
AddStep("fail on first judgement", () => currentFailConditions = (_, _) => true);
// Fail occurs at 164ms with the provided beatmap.
// Fail animation runs for 2.5s realtime but the gameplay time change is *variable* due to the frequency transform being applied, so we need a bit of lenience.

View File

@ -57,7 +57,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
// To emulate `MultiplayerClient.CurrentMatchPlayingUserIds` we need a bindable list of *only IDs*.
// This tracks the list of users 1:1.
MultiplayerUsers.BindCollectionChanged((c, e) =>
MultiplayerUsers.BindCollectionChanged((_, e) =>
{
switch (e.Action)
{

View File

@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
var mockLounge = new Mock<LoungeSubScreen>();
mockLounge
.Setup(l => l.Join(It.IsAny<Room>(), It.IsAny<string>(), It.IsAny<Action<Room>>(), It.IsAny<Action<string>>()))
.Callback<Room, string, Action<Room>, Action<string>>((a, b, c, d) =>
.Callback<Room, string, Action<Room>, Action<string>>((_, _, _, d) =>
{
Task.Run(() =>
{

View File

@ -90,7 +90,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
setRoomCountdown(countdownStart.Duration);
break;
case StopCountdownRequest _:
case StopCountdownRequest:
multiplayerRoom.Countdown = null;
raiseRoomUpdated();
break;

View File

@ -219,7 +219,7 @@ namespace osu.Game.Tests.Visual.Online
{
base.LoadComplete();
Metadata.BindValueChanged(metadata =>
Metadata.BindValueChanged(_ =>
{
foreach (var b in this.ChildrenOfType<YearButton>())
b.Action = () => YearChanged?.Invoke(b.Year);

View File

@ -187,8 +187,8 @@ namespace osu.Game.Tests.Visual.Playlists
// pre-check for requests we should be handling (as they are scheduled below).
switch (request)
{
case ShowPlaylistUserScoreRequest _:
case IndexPlaylistScoresRequest _:
case ShowPlaylistUserScoreRequest:
case IndexPlaylistScoresRequest:
break;
default:

View File

@ -76,7 +76,7 @@ namespace osu.Game.Tests.Visual.Settings
public void ToggleVisibility()
{
AddWaitStep("wait some", 5);
AddToggleStep("toggle visibility", visible => settings.ToggleVisibility());
AddToggleStep("toggle visibility", _ => settings.ToggleVisibility());
}
[Test]

View File

@ -91,19 +91,19 @@ namespace osu.Game.Tests.Visual.SongSelect
switch (instance)
{
case OsuRuleset _:
case OsuRuleset:
testInfoLabels(5);
break;
case TaikoRuleset _:
case TaikoRuleset:
testInfoLabels(5);
break;
case CatchRuleset _:
case CatchRuleset:
testInfoLabels(5);
break;
case ManiaRuleset _:
case ManiaRuleset:
testInfoLabels(4);
break;

View File

@ -70,7 +70,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("Set time before zero", () =>
{
beatContainer.NewBeat = (i, timingControlPoint, effectControlPoint, channelAmplitudes) =>
beatContainer.NewBeat = (i, timingControlPoint, _, _) =>
{
lastActuationTime = gameplayClockContainer.CurrentTime;
lastTimingPoint = timingControlPoint;
@ -105,7 +105,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("Set time before zero", () =>
{
beatContainer.NewBeat = (i, timingControlPoint, effectControlPoint, channelAmplitudes) =>
beatContainer.NewBeat = (i, timingControlPoint, _, _) =>
{
lastBeatIndex = i;
lastBpm = timingControlPoint.BPM;
@ -126,7 +126,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("bind event", () =>
{
beatContainer.NewBeat = (i, timingControlPoint, effectControlPoint, channelAmplitudes) => lastBpm = timingControlPoint.BPM;
beatContainer.NewBeat = (_, timingControlPoint, _, _) => lastBpm = timingControlPoint.BPM;
});
AddUntilStep("wait for trigger", () => lastBpm != null);
@ -157,7 +157,7 @@ namespace osu.Game.Tests.Visual.UserInterface
actualEffectPoint = null;
beatContainer.AllowMistimedEventFiring = false;
beatContainer.NewBeat = (i, timingControlPoint, effectControlPoint, channelAmplitudes) =>
beatContainer.NewBeat = (_, _, effectControlPoint, _) =>
{
if (Precision.AlmostEquals(gameplayClockContainer.CurrentTime + earlyActivationMilliseconds, expectedEffectPoint.Time, BeatSyncedContainer.MISTIMED_ALLOWANCE))
actualEffectPoint = effectControlPoint;

View File

@ -77,13 +77,13 @@ namespace osu.Game.Tests.Visual.UserInterface
};
control.Query.BindValueChanged(q => query.Text = $"Query: {q.NewValue}", true);
control.General.BindCollectionChanged((u, v) => general.Text = $"General: {(control.General.Any() ? string.Join('.', control.General.Select(i => i.ToString().Underscore())) : "")}", true);
control.General.BindCollectionChanged((_, _) => general.Text = $"General: {(control.General.Any() ? string.Join('.', control.General.Select(i => i.ToString().Underscore())) : "")}", true);
control.Ruleset.BindValueChanged(r => ruleset.Text = $"Ruleset: {r.NewValue}", true);
control.Category.BindValueChanged(c => category.Text = $"Category: {c.NewValue}", true);
control.Genre.BindValueChanged(g => genre.Text = $"Genre: {g.NewValue}", true);
control.Language.BindValueChanged(l => language.Text = $"Language: {l.NewValue}", true);
control.Extra.BindCollectionChanged((u, v) => extra.Text = $"Extra: {(control.Extra.Any() ? string.Join('.', control.Extra.Select(i => i.ToString().ToLowerInvariant())) : "")}", true);
control.Ranks.BindCollectionChanged((u, v) => ranks.Text = $"Ranks: {(control.Ranks.Any() ? string.Join('.', control.Ranks.Select(i => i.ToString())) : "")}", true);
control.Extra.BindCollectionChanged((_, _) => extra.Text = $"Extra: {(control.Extra.Any() ? string.Join('.', control.Extra.Select(i => i.ToString().ToLowerInvariant())) : "")}", true);
control.Ranks.BindCollectionChanged((_, _) => ranks.Text = $"Ranks: {(control.Ranks.Any() ? string.Join('.', control.Ranks.Select(i => i.ToString())) : "")}", true);
control.Played.BindValueChanged(p => played.Text = $"Played: {p.NewValue}", true);
control.ExplicitContent.BindValueChanged(e => explicitMap.Text = $"Explicit Maps: {e.NewValue}", true);
});

View File

@ -54,7 +54,7 @@ namespace osu.Game.Tests.Visual.UserInterface
notificationOverlay.Reset();
performer.Setup(g => g.PerformFromScreen(It.IsAny<Action<IScreen>>(), It.IsAny<IEnumerable<Type>>()))
.Callback((Action<IScreen> action, IEnumerable<Type> types) => action(null));
.Callback((Action<IScreen> action, IEnumerable<Type> _) => action(null));
notificationOverlay.Setup(n => n.Post(It.IsAny<Notification>()))
.Callback((Notification n) => lastNotification = n);

View File

@ -78,7 +78,7 @@ namespace osu.Game.Tests.Visual.UserInterface
Origin = Anchor.Centre,
Width = 500,
AutoSizeAxes = Axes.Y,
Child = component = padded ? (LabelledDrawable<Drawable>)new PaddedLabelledDrawable() : new NonPaddedLabelledDrawable(),
Child = component = padded ? new PaddedLabelledDrawable() : new NonPaddedLabelledDrawable(),
};
component.Label = "a sample component";

View File

@ -387,7 +387,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddUntilStep("double time not visible", () => modSelectOverlay.ChildrenOfType<ModPanel>().Where(panel => panel.Mod is OsuModDoubleTime).All(panel => panel.Filtered.Value));
AddAssert("nightcore still visible", () => modSelectOverlay.ChildrenOfType<ModPanel>().Where(panel => panel.Mod is OsuModNightcore).Any(panel => !panel.Filtered.Value));
AddStep("make double time valid again", () => modSelectOverlay.IsValidMod = m => true);
AddStep("make double time valid again", () => modSelectOverlay.IsValidMod = _ => true);
AddUntilStep("double time visible", () => modSelectOverlay.ChildrenOfType<ModPanel>().Where(panel => panel.Mod is OsuModDoubleTime).Any(panel => !panel.Filtered.Value));
AddAssert("nightcore still visible", () => modSelectOverlay.ChildrenOfType<ModPanel>().Where(b => b.Mod is OsuModNightcore).Any(panel => !panel.Filtered.Value));
}

View File

@ -3,7 +3,6 @@
#nullable disable
using System;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Graphics.Sprites;
@ -89,7 +88,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddToggleStep("toggle enabled", toggle =>
{
for (int i = 0; i < 6; i++)
button.Action = toggle ? () => { } : (Action)null;
button.Action = toggle ? () => { } : null;
});
}

View File

@ -3,7 +3,6 @@
#nullable disable
using System;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
@ -29,7 +28,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddToggleStep("toggle enabled", toggle =>
{
for (int i = 0; i < 6; i++)
button.Action = toggle ? () => { } : (Action)null;
button.Action = toggle ? () => { } : null;
});
}

View File

@ -30,7 +30,7 @@ namespace osu.Game.Tournament.Components
{
base.Current = new Bindable<string>(string.Empty);
((OsuTextBox)Control).OnCommit += (sender, newText) =>
((OsuTextBox)Control).OnCommit += (sender, _) =>
{
try
{

View File

@ -45,7 +45,7 @@ namespace osu.Game.Tournament.Components
FillMode = FillMode.Fill
};
(flag = team.FlagName.GetBoundCopy()).BindValueChanged(acronym => flagSprite.Texture = textures.Get($@"Flags/{team.FlagName}"), true);
(flag = team.FlagName.GetBoundCopy()).BindValueChanged(_ => flagSprite.Texture = textures.Get($@"Flags/{team.FlagName}"), true);
}
}
}

View File

@ -27,7 +27,7 @@ namespace osu.Game.Tournament.Components
{
if (team == null) return;
(acronym = team.Acronym.GetBoundCopy()).BindValueChanged(acronym => Text.Text = team?.FullName.Value ?? string.Empty, true);
(acronym = team.Acronym.GetBoundCopy()).BindValueChanged(_ => Text.Text = team?.FullName.Value ?? string.Empty, true);
}
}
}

View File

@ -38,7 +38,7 @@ namespace osu.Game.Tournament.Components
{
if (Team == null) return;
(acronym = Team.Acronym.GetBoundCopy()).BindValueChanged(acronym => AcronymText.Text = Team?.Acronym.Value?.ToUpperInvariant() ?? string.Empty, true);
(acronym = Team.Acronym.GetBoundCopy()).BindValueChanged(_ => AcronymText.Text = Team?.Acronym.Value?.ToUpperInvariant() ?? string.Empty, true);
}
}
}

View File

@ -219,7 +219,7 @@ namespace osu.Game.Tournament.Screens.Drawings
}
}
writeOp = writeOp?.ContinueWith(t => { writeAction(); }) ?? Task.Run(writeAction);
writeOp = writeOp?.ContinueWith(_ => { writeAction(); }) ?? Task.Run(writeAction);
}
private void reloadTeams()

View File

@ -44,7 +44,7 @@ namespace osu.Game.Tournament.Screens.Editors
AddInternal(rightClickMessage = new WarningBox("Right click to place and link matches"));
LadderInfo.Matches.CollectionChanged += (_, __) => updateMessage();
LadderInfo.Matches.CollectionChanged += (_, _) => updateMessage();
updateMessage();
}

View File

@ -49,10 +49,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
};
name = round.Name.GetBoundCopy();
name.BindValueChanged(n => textName.Text = ((losers ? "Losers " : "") + round.Name).ToUpperInvariant(), true);
name.BindValueChanged(_ => textName.Text = ((losers ? "Losers " : "") + round.Name).ToUpperInvariant(), true);
description = round.Description.GetBoundCopy();
description.BindValueChanged(n => textDescription.Text = round.Description.Value?.ToUpperInvariant(), true);
description.BindValueChanged(_ => textDescription.Text = round.Description.Value?.ToUpperInvariant(), true);
}
}
}

View File

@ -75,7 +75,7 @@ namespace osu.Game.Tournament.Screens.Ladder
foreach (var match in LadderInfo.Matches)
addMatch(match);
LadderInfo.Rounds.CollectionChanged += (_, __) => layout.Invalidate();
LadderInfo.Rounds.CollectionChanged += (_, _) => layout.Invalidate();
LadderInfo.Matches.CollectionChanged += (_, args) =>
{
switch (args.Action)

View File

@ -137,7 +137,7 @@ namespace osu.Game.Tournament
heightWarning.Alpha = size.NewValue.Width < minWidth ? 1 : 0;
}), true);
windowMode.BindValueChanged(mode => ScheduleAfterChildren(() =>
windowMode.BindValueChanged(_ => ScheduleAfterChildren(() =>
{
windowMode.Value = WindowMode.Windowed;
}), true);

View File

@ -62,7 +62,7 @@ namespace osu.Game.Tournament
dependencies.Cache(new TournamentVideoResourceStore(storage));
Textures.AddStore(new TextureLoaderStore(new StorageBackedResourceStore(storage)));
Textures.AddTextureSource(new TextureLoaderStore(new StorageBackedResourceStore(storage)));
dependencies.CacheAs(new StableInfo(storage));
}
@ -267,7 +267,7 @@ namespace osu.Game.Tournament
}
else
{
req.Success += res => { populate(); };
req.Success += _ => { populate(); };
req.Failure += _ =>
{
user.OnlineID = 1;

View File

@ -204,12 +204,12 @@ namespace osu.Game.Tournament
switch (currentScreen)
{
case MapPoolScreen _:
case MapPoolScreen:
chatContainer.FadeIn(TournamentScreen.FADE_DELAY);
chatContainer.ResizeWidthTo(1, 500, Easing.OutQuint);
break;
case GameplayScreen _:
case GameplayScreen:
chatContainer.FadeIn(TournamentScreen.FADE_DELAY);
chatContainer.ResizeWidthTo(0.5f, 500, Easing.OutQuint);
break;

View File

@ -254,12 +254,12 @@ namespace osu.Game.Beatmaps.ControlPoints
switch (newPoint)
{
case TimingControlPoint _:
case TimingControlPoint:
// Timing points are a special case and need to be added regardless of fallback availability.
existing = BinarySearch(TimingPoints, time);
break;
case EffectControlPoint _:
case EffectControlPoint:
existing = EffectPointAt(time);
break;
}

View File

@ -102,7 +102,7 @@ namespace osu.Game.Beatmaps.Drawables
// Matches osu-stable, in order to provide new users with roughly the same randomised selection of bundled beatmaps.
var random = new LegacyRandom(DateTime.UtcNow.Year * 1000 + (DateTime.UtcNow.DayOfYear / 7));
downloadableFilenames.AddRange(sourceFilenames.OrderBy(x => random.NextDouble()).Take(limit ?? int.MaxValue));
downloadableFilenames.AddRange(sourceFilenames.OrderBy(_ => random.NextDouble()).Take(limit ?? int.MaxValue));
}
catch { }
}

View File

@ -12,7 +12,7 @@ namespace osu.Game.Beatmaps.Formats
{
public static void Register()
{
AddDecoder<Beatmap>("{", m => new JsonBeatmapDecoder());
AddDecoder<Beatmap>("{", _ => new JsonBeatmapDecoder());
}
protected override void ParseStreamInto(LineBufferedReader stream, Beatmap output)

View File

@ -373,11 +373,11 @@ namespace osu.Game.Beatmaps.Formats
switch (hitObject)
{
case IHasPath _:
case IHasPath:
type |= LegacyHitObjectType.Slider;
break;
case IHasDuration _:
case IHasDuration:
if (onlineRulesetID == 3)
type |= LegacyHitObjectType.Hold;
else

View File

@ -35,7 +35,7 @@ namespace osu.Game.Beatmaps.Formats
{
// note that this isn't completely correct
AddDecoder<Storyboard>(@"osu file format v", m => new LegacyStoryboardDecoder(Parsing.ParseInt(m.Split('v').Last())));
AddDecoder<Storyboard>(@"[Events]", m => new LegacyStoryboardDecoder());
AddDecoder<Storyboard>(@"[Events]", _ => new LegacyStoryboardDecoder());
SetFallbackDecoder<Storyboard>(() => new LegacyStoryboardDecoder());
}

View File

@ -56,12 +56,12 @@ namespace osu.Game.Beatmaps.Legacy
{
switch (newPoint)
{
case SampleControlPoint _:
case SampleControlPoint:
// intentionally don't use SamplePointAt (we always need to consider the first sample point).
var existing = BinarySearch(SamplePoints, time);
return newPoint.IsRedundant(existing);
case DifficultyControlPoint _:
case DifficultyControlPoint:
return newPoint.IsRedundant(DifficultyPointAt(time));
default:

View File

@ -36,7 +36,7 @@ namespace osu.Game.Collections
public BeatmapCollection()
{
BeatmapHashes.CollectionChanged += (_, __) => onChange();
BeatmapHashes.CollectionChanged += (_, _) => onChange();
Name.ValueChanged += _ => onChange();
}

View File

@ -67,7 +67,7 @@ namespace osu.Game.Collections
// An extra bindable is enough to subvert this behaviour.
base.Current = Current;
collections.BindCollectionChanged((_, __) => collectionsChanged(), true);
collections.BindCollectionChanged((_, _) => collectionsChanged(), true);
Current.BindValueChanged(filterChanged, true);
}
@ -233,7 +233,7 @@ namespace osu.Game.Collections
if (collectionBeatmaps != null)
{
collectionBeatmaps.CollectionChanged += (_, __) => collectionChanged();
collectionBeatmaps.CollectionChanged += (_, _) => collectionChanged();
beatmap.BindValueChanged(_ => collectionChanged(), true);
}

View File

@ -261,7 +261,7 @@ namespace osu.Game.Collections
private void backgroundSave()
{
int current = Interlocked.Increment(ref lastSave);
Task.Delay(100).ContinueWith(task =>
Task.Delay(100).ContinueWith(_ =>
{
if (current != lastSave)
return;

View File

@ -454,7 +454,7 @@ namespace osu.Game.Database
public IDisposable SubscribeToPropertyChanged<TModel, TProperty>(Func<Realm, TModel?> modelAccessor, Expression<Func<TModel, TProperty>> propertyLookup, Action<TProperty> onChanged)
where TModel : RealmObjectBase
{
return RegisterCustomSubscription(r =>
return RegisterCustomSubscription(_ =>
{
string propertyName = getMemberName(propertyLookup);

View File

@ -20,7 +20,7 @@ namespace osu.Game.Database
{
private static readonly IMapper write_mapper = new MapperConfiguration(c =>
{
c.ShouldMapField = fi => false;
c.ShouldMapField = _ => false;
c.ShouldMapProperty = pi => pi.SetMethod?.IsPublic == true;
c.CreateMap<BeatmapMetadata, BeatmapMetadata>()
@ -70,7 +70,7 @@ namespace osu.Game.Database
}
});
c.Internal().ForAllMaps((typeMap, expression) =>
c.Internal().ForAllMaps((_, expression) =>
{
expression.ForAllMembers(m =>
{
@ -87,7 +87,7 @@ namespace osu.Game.Database
c.CreateMap<BeatmapSetInfo, BeatmapSetInfo>()
.ConstructUsing(_ => new BeatmapSetInfo(null))
.MaxDepth(2)
.AfterMap((s, d) =>
.AfterMap((_, d) =>
{
foreach (var beatmap in d.Beatmaps)
beatmap.BeatmapSet = d;
@ -97,7 +97,7 @@ namespace osu.Game.Database
// Only hasn't been done yet as we detach at the point of BeatmapInfo less often.
c.CreateMap<BeatmapInfo, BeatmapInfo>()
.MaxDepth(2)
.AfterMap((s, d) =>
.AfterMap((_, d) =>
{
for (int i = 0; i < d.BeatmapSet?.Beatmaps.Count; i++)
{
@ -121,7 +121,7 @@ namespace osu.Game.Database
.ConstructUsing(_ => new BeatmapSetInfo(null))
.MaxDepth(2)
.ForMember(b => b.Files, cc => cc.Ignore())
.AfterMap((s, d) =>
.AfterMap((_, d) =>
{
foreach (var beatmap in d.Beatmaps)
beatmap.BeatmapSet = d;
@ -135,14 +135,14 @@ namespace osu.Game.Database
private static void applyCommonConfiguration(IMapperConfigurationExpression c)
{
c.ShouldMapField = fi => false;
c.ShouldMapField = _ => false;
// This is specifically to avoid mapping explicit interface implementations.
// If we want to limit this further, we can avoid mapping properties with no setter that are not IList<>.
// Takes a bit of effort to determine whether this is the case though, see https://stackoverflow.com/questions/951536/how-do-i-tell-whether-a-type-implements-ilist
c.ShouldMapProperty = pi => pi.GetMethod?.IsPublic == true;
c.Internal().ForAllMaps((typeMap, expression) =>
c.Internal().ForAllMaps((_, expression) =>
{
expression.ForAllMembers(m =>
{

View File

@ -31,7 +31,7 @@ namespace osu.Game.Extensions
{
var tcs = new TaskCompletionSource<bool>();
task.ContinueWith(t =>
task.ContinueWith(_ =>
{
// the previous task has finished execution or been cancelled, so we can run the provided continuation.

View File

@ -27,7 +27,7 @@ namespace osu.Game.Graphics.Containers.Markdown
{
switch (markdownObject)
{
case YamlFrontMatterBlock _:
case YamlFrontMatterBlock:
// Don't parse YAML Frontmatter
break;

View File

@ -260,7 +260,7 @@ namespace osu.Game.Graphics.Containers
if (host.Window == null) return;
bool coversWholeScreen = Size == Vector2.One && safeArea.SafeAreaPadding.Value.Total == Vector2.Zero;
host.Window.CursorConfineRect = coversWholeScreen ? (RectangleF?)null : ToScreenSpace(DrawRectangle).AABBFloat;
host.Window.CursorConfineRect = coversWholeScreen ? null : ToScreenSpace(DrawRectangle).AABBFloat;
}
}
}

View File

@ -74,7 +74,7 @@ namespace osu.Game.Graphics.UserInterface
}
//I'm using ToList() here because Where() returns an Enumerable which can change it's elements afterwards
RemoveRange(Children.Where((bar, index) => index >= value.Count()).ToList());
RemoveRange(Children.Where((_, index) => index >= value.Count()).ToList());
}
}
}

View File

@ -55,12 +55,12 @@ namespace osu.Game.Graphics.UserInterface
switch (e)
{
// blocking scroll can cause weird behaviour when this layer is used within a ScrollContainer.
case ScrollEvent _:
case ScrollEvent:
return false;
// blocking touch events causes the ISourcedFromTouch versions to not be fired, potentially impeding behaviour of drawables *above* the loading layer that may utilise these.
// note that this will not work well if touch handling elements are beneath this loading layer (something to consider for the future).
case TouchEvent _:
case TouchEvent:
return false;
}

View File

@ -1,7 +1,6 @@
// 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 osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
@ -47,7 +46,7 @@ namespace osu.Game.Graphics.UserInterface
protected override void LoadComplete()
{
Active.BindDisabledChanged(disabled => Action = disabled ? (Action?)null : Active.Toggle, true);
Active.BindDisabledChanged(disabled => Action = disabled ? null : Active.Toggle, true);
Active.BindValueChanged(_ =>
{
updateActiveState();

View File

@ -68,7 +68,7 @@ namespace osu.Game.Graphics.UserInterface
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(star_spacing),
ChildrenEnumerable = Enumerable.Range(0, StarCount).Select(i => CreateStar())
ChildrenEnumerable = Enumerable.Range(0, StarCount).Select(_ => CreateStar())
}
};
}

View File

@ -34,6 +34,6 @@ namespace osu.Game.Graphics.UserInterface
{
}
public override IconUsage? GetIconForState(bool state) => state ? (IconUsage?)FontAwesome.Solid.Check : null;
public override IconUsage? GetIconForState(bool state) => state ? FontAwesome.Solid.Check : null;
}
}

View File

@ -51,7 +51,7 @@ namespace osu.Game.Input.Bindings
protected override void LoadComplete()
{
realmSubscription = realm.RegisterForNotifications(queryRealmKeyBindings, (sender, changes, error) =>
realmSubscription = realm.RegisterForNotifications(queryRealmKeyBindings, (sender, _, _) =>
{
// The first fire of this is a bit redundant as this is being called in base.LoadComplete,
// but this is safest in case the subscription is restored after a context recycle.

View File

@ -80,11 +80,11 @@ namespace osu.Game.Input
switch (e)
{
case KeyDownEvent _:
case KeyUpEvent _:
case MouseDownEvent _:
case MouseUpEvent _:
case MouseMoveEvent _:
case KeyDownEvent:
case KeyUpEvent:
case MouseDownEvent:
case MouseUpEvent:
case MouseMoveEvent:
return updateLastInteractionTime();
default:

View File

@ -40,7 +40,7 @@ namespace osu.Game.Online
// Used to interact with manager classes that don't support interface types. Will eventually be replaced.
var beatmapSetInfo = new BeatmapSetInfo { OnlineID = TrackedItem.OnlineID };
realmSubscription = realm.RegisterForNotifications(r => r.All<BeatmapSetInfo>().Where(s => s.OnlineID == TrackedItem.OnlineID && !s.DeletePending), (items, changes, ___) =>
realmSubscription = realm.RegisterForNotifications(r => r.All<BeatmapSetInfo>().Where(s => s.OnlineID == TrackedItem.OnlineID && !s.DeletePending), (items, _, _) =>
{
if (items.Any())
Schedule(() => UpdateState(DownloadState.LocallyAvailable));

View File

@ -465,7 +465,7 @@ namespace osu.Game.Online.Chat
default:
var req = new JoinChannelRequest(channel);
req.Success += () => joinChannel(channel, fetchInitialMessages);
req.Failure += ex => LeaveChannel(channel);
req.Failure += _ => LeaveChannel(channel);
api.Queue(req);
return channel;
}

View File

@ -64,7 +64,7 @@ namespace osu.Game.Online
this.preferMessagePack = preferMessagePack;
apiState.BindTo(api.State);
apiState.BindValueChanged(state => connectIfPossible(), true);
apiState.BindValueChanged(_ => connectIfPossible(), true);
}
public void Reconnect()

View File

@ -101,7 +101,7 @@ namespace osu.Game.Online.Rooms
// handles changes to hash that didn't occur from the import process (ie. a user editing the beatmap in the editor, somehow).
realmSubscription?.Dispose();
realmSubscription = realm.RegisterForNotifications(r => filteredBeatmaps(), (items, changes, ___) =>
realmSubscription = realm.RegisterForNotifications(_ => filteredBeatmaps(), (_, changes, _) =>
{
if (changes == null)
return;

View File

@ -48,7 +48,7 @@ namespace osu.Game.Online
realmSubscription = realm.RegisterForNotifications(r => r.All<ScoreInfo>().Where(s =>
((s.OnlineID > 0 && s.OnlineID == TrackedItem.OnlineID)
|| (!string.IsNullOrEmpty(s.Hash) && s.Hash == TrackedItem.Hash))
&& !s.DeletePending), (items, changes, ___) =>
&& !s.DeletePending), (items, _, _) =>
{
if (items.Any())
Schedule(() => UpdateState(DownloadState.LocallyAvailable));

Some files were not shown because too many files have changed in this diff Show More