1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 16:47:29 +08:00

Replace usages of is null with == null

This commit is contained in:
Dean Herbert 2024-04-03 01:50:39 +08:00
parent aa7b357063
commit 94cbe1838f
No known key found for this signature in database
8 changed files with 17 additions and 17 deletions

View File

@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddAssert("slider created", () =>
{
if (circle1 is null || circle2 is null || slider is null)
if (circle1 == null || circle2 == null || slider == null)
return false;
var controlPoints = slider.Path.ControlPoints;
@ -111,7 +111,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddAssert("slider created", () =>
{
if (slider1 is null || slider2 is null || slider1Path is null)
if (slider1 == null || slider2 == null || slider1Path == null)
return false;
var controlPoints1 = slider1Path.ControlPoints;
@ -143,7 +143,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddAssert("slider end is at same completion for last slider", () =>
{
if (slider1Path is null || slider2 is null)
if (slider1Path == null || slider2 == null)
return false;
var mergedSlider = (Slider)EditorBeatmap.SelectedHitObjects.First();
@ -256,7 +256,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddAssert("slider created", () =>
{
if (slider1 is null || slider2 is null || slider1Path is null)
if (slider1 == null || slider2 == null || slider1Path == null)
return false;
var controlPoints1 = slider1Path.ControlPoints;
@ -288,7 +288,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddAssert("slider end is at same completion for last slider", () =>
{
if (slider1Path is null || slider2 is null)
if (slider1Path == null || slider2 == null)
return false;
var mergedSlider = (Slider)EditorBeatmap.SelectedHitObjects.First();
@ -322,7 +322,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddAssert("slider created", () =>
{
if (slider1 is null || slider2 is null || slider1Path is null)
if (slider1 == null || slider2 == null || slider1Path == null)
return false;
var controlPoints1 = slider1Path.ControlPoints;
@ -354,7 +354,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddAssert("slider end is at same completion for last slider", () =>
{
if (slider1Path is null || slider2 is null)
if (slider1Path == null || slider2 == null)
return false;
var mergedSlider = (Slider)EditorBeatmap.SelectedHitObjects.First();

View File

@ -178,7 +178,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddStep("add hitsounds", () =>
{
if (slider is null) return;
if (slider == null) return;
sample = new HitSampleInfo("hitwhistle", HitSampleInfo.BANK_SOFT, volume: 70);
slider.Samples.Add(sample.With());
@ -228,7 +228,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
{
AddStep($"move mouse to control point {index}", () =>
{
if (slider is null || visualiser is null) return;
if (slider == null || visualiser == null) return;
Vector2 position = slider.Path.ControlPoints[index].Position + slider.Position;
InputManager.MoveMouseTo(visualiser.Pieces[0].Parent!.ToScreenSpace(position));
@ -239,7 +239,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
{
AddStep($"click context menu item \"{contextMenuText}\"", () =>
{
if (visualiser is null) return;
if (visualiser == null) return;
MenuItem? item = visualiser.ContextMenuItems?.FirstOrDefault(menuItem => menuItem.Text.Value == contextMenuText);

View File

@ -311,7 +311,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
foreach (var splitPoint in controlPointsToSplitAt)
{
if (splitPoint == controlPoints[0] || splitPoint == controlPoints[^1] || splitPoint.Type is null)
if (splitPoint == controlPoints[0] || splitPoint == controlPoints[^1] || splitPoint.Type == null)
continue;
// Split off the section of slider before this control point so the remaining control points to split are in the latter part of the slider.

View File

@ -781,7 +781,7 @@ namespace osu.Game.Overlays.Mods
/// </remarks>>
public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{
if (e.Repeat || e.Action != PlatformAction.SelectAll || SelectAllModsButton is null)
if (e.Repeat || e.Action != PlatformAction.SelectAll || SelectAllModsButton == null)
return false;
SelectAllModsButton.TriggerClick();

View File

@ -347,7 +347,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
// Edge-case rules (to match stable).
if (type == PathType.PERFECT_CURVE)
{
int endPointLength = endPoint is null ? 0 : 1;
int endPointLength = endPoint == null ? 0 : 1;
if (vertices.Length + endPointLength != 3)
type = PathType.BEZIER;

View File

@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.Objects
public bool Equals(PathControlPoint other) => Position == other?.Position && Type == other.Type;
public override string ToString() => type is null
public override string ToString() => type == null
? $"Position={Position}"
: $"Position={Position}, Type={type}";
}

View File

@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Objects
{
var controlPoints = sliderPath.ControlPoints;
var inheritedLinearPoints = controlPoints.Where(p => sliderPath.PointsInSegment(p)[0].Type == PathType.LINEAR && p.Type is null).ToList();
var inheritedLinearPoints = controlPoints.Where(p => sliderPath.PointsInSegment(p)[0].Type == PathType.LINEAR && p.Type == null).ToList();
// Inherited points after a linear point, as well as the first control point if it inherited,
// should be treated as linear points, so their types are temporarily changed to linear.
@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Objects
inheritedLinearPoints.ForEach(p => p.Type = null);
// Recalculate middle perfect curve control points at the end of the slider path.
if (controlPoints.Count >= 3 && controlPoints[^3].Type == PathType.PERFECT_CURVE && controlPoints[^2].Type is null && segmentEnds.Any())
if (controlPoints.Count >= 3 && controlPoints[^3].Type == PathType.PERFECT_CURVE && controlPoints[^2].Type == null && segmentEnds.Any())
{
double lastSegmentStart = segmentEnds.Length > 1 ? segmentEnds[^2] : 0;
double lastSegmentEnd = segmentEnds[^1];

View File

@ -177,7 +177,7 @@ namespace osu.Game.Rulesets.UI
modAcronym.Text = value.Acronym;
modIcon.Icon = value.Icon ?? FontAwesome.Solid.Question;
if (value.Icon is null)
if (value.Icon == null)
{
modIcon.FadeOut();
modAcronym.FadeIn();