1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:43:05 +08:00

Merge pull request #25155 from peppy/fix-new-inspections

Fix various new rider EAP inspections
This commit is contained in:
Bartłomiej Dach 2023-10-17 17:04:39 +02:00 committed by GitHub
commit e927267c4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
68 changed files with 120 additions and 111 deletions

View File

@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Catch.Tests
private float getCaughtObjectPosition(Fruit fruit) private float getCaughtObjectPosition(Fruit fruit)
{ {
var caughtObject = catcher.ChildrenOfType<CaughtObject>().Single(c => c.HitObject == fruit); var caughtObject = catcher.ChildrenOfType<CaughtObject>().Single(c => c.HitObject == fruit);
return caughtObject.Parent.ToSpaceOfOtherDrawable(caughtObject.Position, catcher).X; return caughtObject.Parent!.ToSpaceOfOtherDrawable(caughtObject.Position, catcher).X;
} }
private void catchFruit(Fruit fruit, float x) private void catchFruit(Fruit fruit, float x)

View File

@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Catch.Edit
{ {
base.Update(); base.Update();
Scale = new Vector2(Math.Min(Parent.ChildSize.X / CatchPlayfield.WIDTH, Parent.ChildSize.Y / CatchPlayfield.HEIGHT)); Scale = new Vector2(Math.Min(Parent!.ChildSize.X / CatchPlayfield.WIDTH, Parent!.ChildSize.Y / CatchPlayfield.HEIGHT));
Height = 1 / Scale.Y; Height = 1 / Scale.Y;
} }
} }

View File

@ -44,8 +44,8 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
if (Column != null) if (Column != null)
{ {
headPiece.Y = Parent.ToLocalSpace(Column.ScreenSpacePositionAtTime(HitObject.StartTime)).Y; headPiece.Y = Parent!.ToLocalSpace(Column.ScreenSpacePositionAtTime(HitObject.StartTime)).Y;
tailPiece.Y = Parent.ToLocalSpace(Column.ScreenSpacePositionAtTime(HitObject.EndTime)).Y; tailPiece.Y = Parent!.ToLocalSpace(Column.ScreenSpacePositionAtTime(HitObject.EndTime)).Y;
switch (scrollingInfo.Direction.Value) switch (scrollingInfo.Direction.Value)
{ {

View File

@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
foreach (var child in InternalChildren) foreach (var child in InternalChildren)
child.Anchor = child.Origin = anchor; child.Anchor = child.Origin = anchor;
Position = Parent.ToLocalSpace(HitObjectContainer.ScreenSpacePositionAtTime(HitObject.StartTime)) - AnchorPosition; Position = Parent!.ToLocalSpace(HitObjectContainer.ScreenSpacePositionAtTime(HitObject.StartTime)) - AnchorPosition;
Width = HitObjectContainer.DrawWidth; Width = HitObjectContainer.DrawWidth;
} }
} }

View File

@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Mania.Mods
foreach (Column column in maniaPlayfield.Stages.SelectMany(stage => stage.Columns)) foreach (Column column in maniaPlayfield.Stages.SelectMany(stage => stage.Columns))
{ {
HitObjectContainer hoc = column.HitObjectArea.HitObjectContainer; HitObjectContainer hoc = column.HitObjectArea.HitObjectContainer;
Container hocParent = (Container)hoc.Parent; Container hocParent = (Container)hoc.Parent!;
hocParent.Remove(hoc, false); hocParent.Remove(hoc, false);
hocParent.Add(new PlayfieldCoveringWrapper(hoc).With(c => hocParent.Add(new PlayfieldCoveringWrapper(hoc).With(c =>

View File

@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
}); });
moveMouseToHitObject(1); moveMouseToHitObject(1);
AddAssert("merge option available", () => selectionHandler.ContextMenuItems.Any(o => o.Text.Value == "Merge selection")); AddAssert("merge option available", () => selectionHandler.ContextMenuItems?.Any(o => o.Text.Value == "Merge selection") == true);
mergeSelection(); mergeSelection();
@ -198,7 +198,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
}); });
moveMouseToHitObject(1); moveMouseToHitObject(1);
AddAssert("merge option not available", () => selectionHandler.ContextMenuItems.Length > 0 && selectionHandler.ContextMenuItems.All(o => o.Text.Value != "Merge selection")); AddAssert("merge option not available", () => selectionHandler.ContextMenuItems?.Length > 0 && selectionHandler.ContextMenuItems.All(o => o.Text.Value != "Merge selection"));
mergeSelection(); mergeSelection();
AddAssert("circles not merged", () => circle1 is not null && circle2 is not null AddAssert("circles not merged", () => circle1 is not null && circle2 is not null
&& EditorBeatmap.HitObjects.Contains(circle1) && EditorBeatmap.HitObjects.Contains(circle2)); && EditorBeatmap.HitObjects.Contains(circle1) && EditorBeatmap.HitObjects.Contains(circle2));
@ -222,7 +222,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
}); });
moveMouseToHitObject(1); moveMouseToHitObject(1);
AddAssert("merge option available", () => selectionHandler.ContextMenuItems.Any(o => o.Text.Value == "Merge selection")); AddAssert("merge option available", () => selectionHandler.ContextMenuItems?.Any(o => o.Text.Value == "Merge selection") == true);
mergeSelection(); mergeSelection();

View File

@ -169,7 +169,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddStep($"move mouse to control point {index}", () => AddStep($"move mouse to control point {index}", () =>
{ {
Vector2 position = slider.Path.ControlPoints[index].Position; Vector2 position = slider.Path.ControlPoints[index].Position;
InputManager.MoveMouseTo(visualiser.Pieces[0].Parent.ToScreenSpace(position)); InputManager.MoveMouseTo(visualiser.Pieces[0].Parent!.ToScreenSpace(position));
}); });
} }

View File

@ -169,7 +169,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddStep($"move mouse to {relativePosition}", () => AddStep($"move mouse to {relativePosition}", () =>
{ {
Vector2 position = slider.Position + relativePosition; Vector2 position = slider.Position + relativePosition;
InputManager.MoveMouseTo(drawableObject.Parent.ToScreenSpace(position)); InputManager.MoveMouseTo(drawableObject.Parent!.ToScreenSpace(position));
}); });
[Test] [Test]
@ -331,7 +331,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddStep($"move mouse to {relativePosition}", () => AddStep($"move mouse to {relativePosition}", () =>
{ {
Vector2 position = slider.Position + relativePosition; Vector2 position = slider.Position + relativePosition;
InputManager.MoveMouseTo(drawableObject.Parent.ToScreenSpace(position)); InputManager.MoveMouseTo(drawableObject.Parent!.ToScreenSpace(position));
}); });
} }
@ -340,7 +340,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddStep($"move mouse to control point {index}", () => AddStep($"move mouse to control point {index}", () =>
{ {
Vector2 position = slider.Position + slider.Path.ControlPoints[index].Position; Vector2 position = slider.Position + slider.Path.ControlPoints[index].Position;
InputManager.MoveMouseTo(drawableObject.Parent.ToScreenSpace(position)); InputManager.MoveMouseTo(drawableObject.Parent!.ToScreenSpace(position));
}); });
} }

View File

@ -187,7 +187,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddStep($"move mouse to control point {index}", () => AddStep($"move mouse to control point {index}", () =>
{ {
Vector2 position = slider.Position + slider.Path.ControlPoints[index].Position; Vector2 position = slider.Position + slider.Path.ControlPoints[index].Position;
InputManager.MoveMouseTo(drawableObject.Parent.ToScreenSpace(position)); InputManager.MoveMouseTo(drawableObject.Parent!.ToScreenSpace(position));
}); });
} }

View File

@ -101,7 +101,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
{ {
var firstPiece = this.ChildrenOfType<PathControlPointPiece<Slider>>().Single(piece => piece.ControlPoint == slider.Path.ControlPoints[0]); var firstPiece = this.ChildrenOfType<PathControlPointPiece<Slider>>().Single(piece => piece.ControlPoint == slider.Path.ControlPoints[0]);
var pos = slider.Path.PositionAt(0.25d) + slider.Position; var pos = slider.Path.PositionAt(0.25d) + slider.Position;
InputManager.MoveMouseTo(firstPiece.Parent.ToScreenSpace(pos)); InputManager.MoveMouseTo(firstPiece.Parent!.ToScreenSpace(pos));
}); });
AddStep("move slider end", () => AddStep("move slider end", () =>
{ {

View File

@ -231,7 +231,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
if (slider is null || visualiser is null) return; if (slider is null || visualiser is null) return;
Vector2 position = slider.Path.ControlPoints[index].Position + slider.Position; Vector2 position = slider.Path.ControlPoints[index].Position + slider.Position;
InputManager.MoveMouseTo(visualiser.Pieces[0].Parent.ToScreenSpace(position)); InputManager.MoveMouseTo(visualiser.Pieces[0].Parent!.ToScreenSpace(position));
}); });
} }
@ -241,7 +241,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
{ {
if (visualiser is null) return; if (visualiser is null) return;
MenuItem? item = visualiser.ContextMenuItems.FirstOrDefault(menuItem => menuItem.Text.Value == contextMenuText); MenuItem? item = visualiser.ContextMenuItems?.FirstOrDefault(menuItem => menuItem.Text.Value == contextMenuText);
item?.Action.Value?.Invoke(); item?.Action.Value?.Invoke();
}); });

View File

@ -75,7 +75,7 @@ namespace osu.Game.Rulesets.Osu.Tests
pool = pools[poolIndex]; pool = pools[poolIndex];
// We need to make sure neither the pool nor the judgement get disposed when new content is set, and they both share the same parent. // We need to make sure neither the pool nor the judgement get disposed when new content is set, and they both share the same parent.
((Container)pool.Parent).Clear(false); ((Container)pool.Parent!).Clear(false);
} }
var container = new Container var container = new Container

View File

@ -288,10 +288,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
if (selectedControlPoints.Contains(hitObject.Path.ControlPoints[0])) if (selectedControlPoints.Contains(hitObject.Path.ControlPoints[0]))
{ {
// Special handling for selections containing head control point - the position of the hit object changes which means the snapped position and time have to be taken into account // Special handling for selections containing head control point - the position of the hit object changes which means the snapped position and time have to be taken into account
Vector2 newHeadPosition = Parent.ToScreenSpace(e.MousePosition + (dragStartPositions[0] - dragStartPositions[draggedControlPointIndex])); Vector2 newHeadPosition = Parent!.ToScreenSpace(e.MousePosition + (dragStartPositions[0] - dragStartPositions[draggedControlPointIndex]));
var result = snapProvider?.FindSnappedPositionAndTime(newHeadPosition); var result = snapProvider?.FindSnappedPositionAndTime(newHeadPosition);
Vector2 movementDelta = Parent.ToLocalSpace(result?.ScreenSpacePosition ?? newHeadPosition) - hitObject.Position; Vector2 movementDelta = Parent!.ToLocalSpace(result?.ScreenSpacePosition ?? newHeadPosition) - hitObject.Position;
hitObject.Position += movementDelta; hitObject.Position += movementDelta;
hitObject.StartTime = result?.Time ?? hitObject.StartTime; hitObject.StartTime = result?.Time ?? hitObject.StartTime;
@ -309,9 +309,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
} }
else else
{ {
var result = snapProvider?.FindSnappedPositionAndTime(Parent.ToScreenSpace(e.MousePosition), SnapType.GlobalGrids); var result = snapProvider?.FindSnappedPositionAndTime(Parent!.ToScreenSpace(e.MousePosition), SnapType.GlobalGrids);
Vector2 movementDelta = Parent.ToLocalSpace(result?.ScreenSpacePosition ?? Parent.ToScreenSpace(e.MousePosition)) - dragStartPositions[draggedControlPointIndex] - hitObject.Position; Vector2 movementDelta = Parent!.ToLocalSpace(result?.ScreenSpacePosition ?? Parent!.ToScreenSpace(e.MousePosition)) - dragStartPositions[draggedControlPointIndex] - hitObject.Position;
for (int i = 0; i < controlPoints.Count; ++i) for (int i = 0; i < controlPoints.Count; ++i)
{ {

View File

@ -139,12 +139,12 @@ namespace osu.Game.Rulesets.Osu.Mods
if (Precision.AlmostEquals(restrictTo.Rotation, 0)) if (Precision.AlmostEquals(restrictTo.Rotation, 0))
{ {
start = Parent.ToLocalSpace(restrictTo.ScreenSpaceDrawQuad.TopLeft).X; start = Parent!.ToLocalSpace(restrictTo.ScreenSpaceDrawQuad.TopLeft).X;
end = Parent.ToLocalSpace(restrictTo.ScreenSpaceDrawQuad.TopRight).X; end = Parent!.ToLocalSpace(restrictTo.ScreenSpaceDrawQuad.TopRight).X;
} }
else else
{ {
float center = restrictTo.ToSpaceOfOtherDrawable(restrictTo.OriginPosition, Parent).X; float center = restrictTo.ToSpaceOfOtherDrawable(restrictTo.OriginPosition, Parent!).X;
float halfDiagonal = (restrictTo.DrawSize / 2).LengthFast; float halfDiagonal = (restrictTo.DrawSize / 2).LengthFast;
start = center - halfDiagonal; start = center - halfDiagonal;

View File

@ -102,7 +102,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
/// </summary> /// </summary>
public void MissForcefully() => ApplyResult(r => r.Type = r.Judgement.MinResult); public void MissForcefully() => ApplyResult(r => r.Type = r.Judgement.MinResult);
private RectangleF parentScreenSpaceRectangle => ((DrawableOsuHitObject)ParentHitObject)?.parentScreenSpaceRectangle ?? Parent.ScreenSpaceDrawQuad.AABBFloat; private RectangleF parentScreenSpaceRectangle => ((DrawableOsuHitObject)ParentHitObject)?.parentScreenSpaceRectangle ?? Parent!.ScreenSpaceDrawQuad.AABBFloat;
/// <summary> /// <summary>
/// Calculates the position of the given <paramref name="drawable"/> relative to the playfield area. /// Calculates the position of the given <paramref name="drawable"/> relative to the playfield area.

View File

@ -109,7 +109,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
base.Update(); base.Update();
//undo rotation on layers which should not be rotated. //undo rotation on layers which should not be rotated.
float appliedRotation = Parent.Rotation; float appliedRotation = Parent!.Rotation;
fill.Rotation = -appliedRotation; fill.Rotation = -appliedRotation;
} }

View File

@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
protected override bool OnMouseMove(MouseMoveEvent e) protected override bool OnMouseMove(MouseMoveEvent e)
{ {
mousePosition = Parent.ToLocalSpace(e.ScreenSpaceMousePosition); mousePosition = Parent!.ToLocalSpace(e.ScreenSpaceMousePosition);
return base.OnMouseMove(e); return base.OnMouseMove(e);
} }

View File

@ -88,7 +88,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
base.UpdateAfterChildren(); base.UpdateAfterChildren();
//undo rotation on layers which should not be rotated. //undo rotation on layers which should not be rotated.
float appliedRotation = Parent.Rotation; float appliedRotation = Parent!.Rotation;
layerNd.Rotation = -appliedRotation; layerNd.Rotation = -appliedRotation;
layerSpec.Rotation = -appliedRotation; layerSpec.Rotation = -appliedRotation;

View File

@ -60,12 +60,12 @@ namespace osu.Game.Rulesets.Osu.UI
// game_size = DrawSizePreservingFillContainer.TargetSize = new Vector2(1024, 768) // game_size = DrawSizePreservingFillContainer.TargetSize = new Vector2(1024, 768)
// //
// Parent is a 4:3 aspect enforced, using height as the constricting dimension // Parent is a 4:3 aspect enforced, using height as the constricting dimension
// Parent.ChildSize.X = min(game_size.X, game_size.Y * (4 / 3)) * playfield_size_adjust // Parent!.ChildSize.X = min(game_size.X, game_size.Y * (4 / 3)) * playfield_size_adjust
// Parent.ChildSize.X = 819.2 // Parent!.ChildSize.X = 819.2
// //
// Scale = 819.2 / 512 // Scale = 819.2 / 512
// Scale = 1.6 // Scale = 1.6
Scale = new Vector2(Parent.ChildSize.X / OsuPlayfield.BASE_SIZE.X); Scale = new Vector2(Parent!.ChildSize.X / OsuPlayfield.BASE_SIZE.X);
Position = new Vector2(0, (PlayfieldShift ? 8f : 0f) * Scale.X); Position = new Vector2(0, (PlayfieldShift ? 8f : 0f) * Scale.X);
// Size = 0.625 // Size = 0.625
Size = Vector2.Divide(Vector2.One, Scale); Size = Vector2.Divide(Vector2.One, Scale);

View File

@ -30,8 +30,8 @@ namespace osu.Game.Rulesets.Taiko.Edit.Blueprints
var topLeft = new Vector2(float.MaxValue, float.MaxValue); var topLeft = new Vector2(float.MaxValue, float.MaxValue);
var bottomRight = new Vector2(float.MinValue, float.MinValue); var bottomRight = new Vector2(float.MinValue, float.MinValue);
topLeft = Vector2.ComponentMin(topLeft, Parent.ToLocalSpace(DrawableObject.ScreenSpaceDrawQuad.TopLeft)); topLeft = Vector2.ComponentMin(topLeft, Parent!.ToLocalSpace(DrawableObject.ScreenSpaceDrawQuad.TopLeft));
bottomRight = Vector2.ComponentMax(bottomRight, Parent.ToLocalSpace(DrawableObject.ScreenSpaceDrawQuad.BottomRight)); bottomRight = Vector2.ComponentMax(bottomRight, Parent!.ToLocalSpace(DrawableObject.ScreenSpaceDrawQuad.BottomRight));
Size = bottomRight - topLeft; Size = bottomRight - topLeft;
Position = topLeft; Position = topLeft;

View File

@ -261,7 +261,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{ {
base.Update(); base.Update();
Size = BaseSize * Parent.RelativeChildSize; Size = BaseSize * Parent!.RelativeChildSize;
// Make the swell stop at the hit target // Make the swell stop at the hit target
X = Math.Max(0, X); X = Math.Max(0, X);

View File

@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Argon
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
Width = Parent.DrawSize.X + DrawHeight; Width = Parent!.DrawSize.X + DrawHeight;
} }
} }
} }

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Default
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
Width = Parent.DrawSize.X + DrawHeight; Width = Parent!.DrawSize.X + DrawHeight;
} }
} }
} }

View File

@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Taiko.UI
// This is still a bit weird, because readability changes with window size, but it is what it is. // This is still a bit weird, because readability changes with window size, but it is what it is.
if (LockPlayfieldAspectRange.Value) if (LockPlayfieldAspectRange.Value)
{ {
float currentAspect = Parent.ChildSize.X / Parent.ChildSize.Y; float currentAspect = Parent!.ChildSize.X / Parent!.ChildSize.Y;
if (currentAspect > MAXIMUM_ASPECT) if (currentAspect > MAXIMUM_ASPECT)
height *= currentAspect / MAXIMUM_ASPECT; height *= currentAspect / MAXIMUM_ASPECT;

View File

@ -182,7 +182,7 @@ namespace osu.Game.Tests.Visual.Editing
if (sameRuleset) if (sameRuleset)
{ {
AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog is CreateNewDifficultyDialog); AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog is CreateNewDifficultyDialog);
AddStep("confirm creation with no objects", () => DialogOverlay.CurrentDialog.PerformOkAction()); AddStep("confirm creation with no objects", () => DialogOverlay.CurrentDialog!.PerformOkAction());
} }
AddUntilStep("wait for created", () => AddUntilStep("wait for created", () =>
@ -269,7 +269,7 @@ namespace osu.Game.Tests.Visual.Editing
AddStep("create new difficulty", () => Editor.CreateNewDifficulty(new OsuRuleset().RulesetInfo)); AddStep("create new difficulty", () => Editor.CreateNewDifficulty(new OsuRuleset().RulesetInfo));
AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog is CreateNewDifficultyDialog); AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog is CreateNewDifficultyDialog);
AddStep("confirm creation as a copy", () => DialogOverlay.CurrentDialog.Buttons.ElementAt(1).TriggerClick()); AddStep("confirm creation as a copy", () => DialogOverlay.CurrentDialog!.Buttons.ElementAt(1).TriggerClick());
AddUntilStep("wait for created", () => AddUntilStep("wait for created", () =>
{ {
@ -342,7 +342,7 @@ namespace osu.Game.Tests.Visual.Editing
AddStep("create new difficulty", () => Editor.CreateNewDifficulty(new OsuRuleset().RulesetInfo)); AddStep("create new difficulty", () => Editor.CreateNewDifficulty(new OsuRuleset().RulesetInfo));
AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog is CreateNewDifficultyDialog); AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog is CreateNewDifficultyDialog);
AddStep("confirm creation as a copy", () => DialogOverlay.CurrentDialog.Buttons.ElementAt(1).TriggerClick()); AddStep("confirm creation as a copy", () => DialogOverlay.CurrentDialog!.Buttons.ElementAt(1).TriggerClick());
AddUntilStep("wait for created", () => AddUntilStep("wait for created", () =>
{ {
@ -380,7 +380,7 @@ namespace osu.Game.Tests.Visual.Editing
AddStep("try to create new difficulty", () => Editor.CreateNewDifficulty(new OsuRuleset().RulesetInfo)); AddStep("try to create new difficulty", () => Editor.CreateNewDifficulty(new OsuRuleset().RulesetInfo));
AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog is CreateNewDifficultyDialog); AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog is CreateNewDifficultyDialog);
AddStep("confirm creation with no objects", () => DialogOverlay.CurrentDialog.PerformOkAction()); AddStep("confirm creation with no objects", () => DialogOverlay.CurrentDialog!.PerformOkAction());
AddUntilStep("wait for created", () => AddUntilStep("wait for created", () =>
{ {
@ -415,7 +415,7 @@ namespace osu.Game.Tests.Visual.Editing
if (sameRuleset) if (sameRuleset)
{ {
AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog is CreateNewDifficultyDialog); AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog is CreateNewDifficultyDialog);
AddStep("confirm creation with no objects", () => DialogOverlay.CurrentDialog.PerformOkAction()); AddStep("confirm creation with no objects", () => DialogOverlay.CurrentDialog!.PerformOkAction());
} }
AddUntilStep("wait for created", () => AddUntilStep("wait for created", () =>
@ -476,7 +476,7 @@ namespace osu.Game.Tests.Visual.Editing
AddStep("exit", () => Editor.Exit()); AddStep("exit", () => Editor.Exit());
AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog is PromptForSaveDialog); AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog is PromptForSaveDialog);
AddStep("attempt to save", () => DialogOverlay.CurrentDialog.PerformOkAction()); AddStep("attempt to save", () => DialogOverlay.CurrentDialog!.PerformOkAction());
AddAssert("editor is still current", () => Editor.IsCurrentScreen()); AddAssert("editor is still current", () => Editor.IsCurrentScreen());
} }

View File

@ -89,7 +89,7 @@ namespace osu.Game.Tests.Visual.Editing
public void TestWidthUpdatesOnDrawSizeChanges() public void TestWidthUpdatesOnDrawSizeChanges()
{ {
AddStep("Shrink scroll container", () => scrollContainer.Width = 0.5f); AddStep("Shrink scroll container", () => scrollContainer.Width = 0.5f);
AddAssert("Scroll container width shrunk", () => scrollContainer.DrawWidth == scrollContainer.Parent.DrawWidth / 2); AddAssert("Scroll container width shrunk", () => scrollContainer.DrawWidth == scrollContainer.Parent!.DrawWidth / 2);
AddAssert("Inner container width matches scroll container", () => innerBox.DrawWidth == scrollContainer.DrawWidth); AddAssert("Inner container width matches scroll container", () => innerBox.DrawWidth == scrollContainer.DrawWidth);
} }

View File

@ -69,7 +69,7 @@ namespace osu.Game.Tests.Visual.Gameplay
var expectedComponentsAdjustmentContainer = new DependencyProvidingContainer var expectedComponentsAdjustmentContainer = new DependencyProvidingContainer
{ {
Position = actualComponentsContainer.Parent.ToSpaceOfOtherDrawable(actualComponentsContainer.DrawPosition, Content), Position = actualComponentsContainer.Parent!.ToSpaceOfOtherDrawable(actualComponentsContainer.DrawPosition, Content),
Size = actualComponentsContainer.DrawSize, Size = actualComponentsContainer.DrawSize,
Child = expectedComponentsContainer, Child = expectedComponentsContainer,
// proxy the same required dependencies that `actualComponentsContainer` is using. // proxy the same required dependencies that `actualComponentsContainer` is using.

View File

@ -220,7 +220,7 @@ namespace osu.Game.Tests.Visual.Gameplay
public partial class TestInputConsumer : CompositeDrawable, IKeyBindingHandler<TestAction> public partial class TestInputConsumer : CompositeDrawable, IKeyBindingHandler<TestAction>
{ {
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent.ReceivePositionalInputAt(screenSpacePos); public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent!.ReceivePositionalInputAt(screenSpacePos);
private readonly Box box; private readonly Box box;

View File

@ -259,7 +259,7 @@ namespace osu.Game.Tests.Visual.Gameplay
public partial class TestInputConsumer : CompositeDrawable, IKeyBindingHandler<TestAction> public partial class TestInputConsumer : CompositeDrawable, IKeyBindingHandler<TestAction>
{ {
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent.ReceivePositionalInputAt(screenSpacePos); public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent!.ReceivePositionalInputAt(screenSpacePos);
private readonly Box box; private readonly Box box;

View File

@ -188,7 +188,7 @@ namespace osu.Game.Tests.Visual.Online
AddUntilStep("placeholder shown", () => AddUntilStep("placeholder shown", () =>
{ {
var notFoundDrawable = overlay.ChildrenOfType<BeatmapListingOverlay.NotFoundDrawable>().SingleOrDefault(); var notFoundDrawable = overlay.ChildrenOfType<BeatmapListingOverlay.NotFoundDrawable>().SingleOrDefault();
return notFoundDrawable != null && notFoundDrawable.IsPresent && notFoundDrawable.Parent.DrawHeight > 0; return notFoundDrawable != null && notFoundDrawable.IsPresent && notFoundDrawable.Parent!.DrawHeight > 0;
}); });
} }

View File

@ -75,7 +75,7 @@ namespace osu.Game.Tests.Visual.Playlists
}); });
}); });
AddUntilStep("Progress details are hidden", () => match.ChildrenOfType<RoomLocalUserInfo>().FirstOrDefault()?.Parent.Alpha == 0); AddUntilStep("Progress details are hidden", () => match.ChildrenOfType<RoomLocalUserInfo>().FirstOrDefault()?.Parent!.Alpha == 0);
AddUntilStep("Leaderboard shows two aggregate scores", () => match.ChildrenOfType<MatchLeaderboardScore>().Count(s => s.ScoreText.Text != "0") == 2); AddUntilStep("Leaderboard shows two aggregate scores", () => match.ChildrenOfType<MatchLeaderboardScore>().Count(s => s.ScoreText.Text != "0") == 2);
@ -99,7 +99,7 @@ namespace osu.Game.Tests.Visual.Playlists
}); });
}); });
AddUntilStep("Progress details are visible", () => match.ChildrenOfType<RoomLocalUserInfo>().FirstOrDefault()?.Parent.Alpha == 1); AddUntilStep("Progress details are visible", () => match.ChildrenOfType<RoomLocalUserInfo>().FirstOrDefault()?.Parent!.Alpha == 1);
} }
[Test] [Test]

View File

@ -66,20 +66,20 @@ namespace osu.Game.Tests.Visual.Settings
}); });
AddStep("set non-default value", () => revertToDefaultButton.Current.Value = "non-default"); AddStep("set non-default value", () => revertToDefaultButton.Current.Value = "non-default");
AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(revertToDefaultButton.Parent.DrawHeight, control.DrawHeight, 1)); AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(revertToDefaultButton.Parent!.DrawHeight, control.DrawHeight, 1));
AddStep("set label", () => textBox.LabelText = "label text"); AddStep("set label", () => textBox.LabelText = "label text");
AddAssert("default value button centre aligned to label size", () => AddAssert("default value button centre aligned to label size", () =>
{ {
var label = textBox.ChildrenOfType<OsuSpriteText>().Single(spriteText => spriteText.Text == "label text"); var label = textBox.ChildrenOfType<OsuSpriteText>().Single(spriteText => spriteText.Text == "label text");
return Precision.AlmostEquals(revertToDefaultButton.Parent.DrawHeight, label.DrawHeight, 1); return Precision.AlmostEquals(revertToDefaultButton.Parent!.DrawHeight, label.DrawHeight, 1);
}); });
AddStep("clear label", () => textBox.LabelText = default); AddStep("clear label", () => textBox.LabelText = default);
AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(revertToDefaultButton.Parent.DrawHeight, control.DrawHeight, 1)); AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(revertToDefaultButton.Parent!.DrawHeight, control.DrawHeight, 1));
AddStep("set warning text", () => textBox.SetNoticeText("This is some very important warning text! Hopefully it doesn't break the alignment of the default value indicator...", true)); AddStep("set warning text", () => textBox.SetNoticeText("This is some very important warning text! Hopefully it doesn't break the alignment of the default value indicator...", true));
AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(revertToDefaultButton.Parent.DrawHeight, control.DrawHeight, 1)); AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(revertToDefaultButton.Parent!.DrawHeight, control.DrawHeight, 1));
} }
/// <summary> /// <summary>

View File

@ -269,8 +269,8 @@ namespace osu.Game.Tests.Visual.UserInterface
if (!logoFacade.Transforms.Any() && !transferContainer.Transforms.Any()) if (!logoFacade.Transforms.Any() && !transferContainer.Transforms.Any())
{ {
Random random = new Random(); Random random = new Random();
trackingContainer.Delay(500).MoveTo(new Vector2(random.Next(0, (int)logo.Parent.DrawWidth), random.Next(0, (int)logo.Parent.DrawHeight)), 300); trackingContainer.Delay(500).MoveTo(new Vector2(random.Next(0, (int)logo.Parent!.DrawWidth), random.Next(0, (int)logo.Parent!.DrawHeight)), 300);
transferContainer.Delay(500).MoveTo(new Vector2(random.Next(0, (int)logo.Parent.DrawWidth), random.Next(0, (int)logo.Parent.DrawHeight)), 300); transferContainer.Delay(500).MoveTo(new Vector2(random.Next(0, (int)logo.Parent!.DrawWidth), random.Next(0, (int)logo.Parent!.DrawHeight)), 300);
} }
if (randomPositions) if (randomPositions)

View File

@ -15,7 +15,7 @@ namespace osu.Game.Tournament.Components
public new Bindable<DateTimeOffset>? Current public new Bindable<DateTimeOffset>? Current
{ {
get => current; get => current;
set => current.Current = value; set => current.Current = value!;
} }
public DateTextBox() public DateTextBox()

View File

@ -61,8 +61,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
var topLeft = new Vector2(minX, minY); var topLeft = new Vector2(minX, minY);
OriginPosition = new Vector2(PathRadius); OriginPosition = new Vector2(PathRadius);
Position = Parent.ToLocalSpace(topLeft); Position = Parent!.ToLocalSpace(topLeft);
Vertices = points.Select(p => Parent.ToLocalSpace(p) - Parent.ToLocalSpace(topLeft)).ToList(); Vertices = points.Select(p => Parent!.ToLocalSpace(p) - Parent!.ToLocalSpace(topLeft)).ToList();
} }
} }
} }

View File

@ -70,9 +70,9 @@ namespace osu.Game.Beatmaps
throw new NotImplementedException(); throw new NotImplementedException();
} }
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new DummyBeatmapConverter { Beatmap = beatmap }; public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new DummyBeatmapConverter(beatmap);
public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => null; public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => throw new NotImplementedException();
public override string Description => "dummy"; public override string Description => "dummy";
@ -80,9 +80,15 @@ namespace osu.Game.Beatmaps
private class DummyBeatmapConverter : IBeatmapConverter private class DummyBeatmapConverter : IBeatmapConverter
{ {
public event Action<HitObject, IEnumerable<HitObject>> ObjectConverted; public IBeatmap Beatmap { get; }
public IBeatmap Beatmap { get; set; } public DummyBeatmapConverter(IBeatmap beatmap)
{
Beatmap = beatmap;
}
[CanBeNull]
public event Action<HitObject, IEnumerable<HitObject>> ObjectConverted;
public bool CanConvert() => true; public bool CanConvert() => true;

View File

@ -86,7 +86,7 @@ namespace osu.Game.Beatmaps
public event Action<WorkingBeatmap> OnInvalidated; public event Action<WorkingBeatmap> OnInvalidated;
public virtual WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo) public virtual WorkingBeatmap GetWorkingBeatmap([CanBeNull] BeatmapInfo beatmapInfo)
{ {
if (beatmapInfo?.BeatmapSet == null) if (beatmapInfo?.BeatmapSet == null)
return DefaultBeatmap; return DefaultBeatmap;

View File

@ -43,7 +43,7 @@ namespace osu.Game.Extensions
/// <param name="delta">A delta in screen-space coordinates.</param> /// <param name="delta">A delta in screen-space coordinates.</param>
/// <returns>The delta vector in Parent's coordinates.</returns> /// <returns>The delta vector in Parent's coordinates.</returns>
public static Vector2 ScreenSpaceDeltaToParentSpace(this Drawable drawable, Vector2 delta) => public static Vector2 ScreenSpaceDeltaToParentSpace(this Drawable drawable, Vector2 delta) =>
drawable.Parent.ToLocalSpace(drawable.Parent.ToScreenSpace(Vector2.Zero) + delta); drawable.Parent!.ToLocalSpace(drawable.Parent!.ToScreenSpace(Vector2.Zero) + delta);
/// <summary> /// <summary>
/// Some elements don't handle rewind correctly and fixing them is non-trivial. /// Some elements don't handle rewind correctly and fixing them is non-trivial.

View File

@ -22,7 +22,7 @@ namespace osu.Game.Graphics.Backgrounds
Sprite.Texture = skin.GetTexture("menu-background") ?? Sprite.Texture; Sprite.Texture = skin.GetTexture("menu-background") ?? Sprite.Texture;
} }
public override bool Equals(Background other) public override bool Equals(Background? other)
{ {
if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true; if (ReferenceEquals(this, other)) return true;

View File

@ -76,10 +76,10 @@ namespace osu.Game.Graphics.Containers
/// <remarks>Will only be correct if the logo's <see cref="Drawable.RelativePositionAxes"/> are set to Axes.Both</remarks> /// <remarks>Will only be correct if the logo's <see cref="Drawable.RelativePositionAxes"/> are set to Axes.Both</remarks>
protected Vector2 ComputeLogoTrackingPosition() protected Vector2 ComputeLogoTrackingPosition()
{ {
var absolutePos = Logo.Parent.ToLocalSpace(LogoFacade.ScreenSpaceDrawQuad.Centre); var absolutePos = Logo.Parent!.ToLocalSpace(LogoFacade.ScreenSpaceDrawQuad.Centre);
return new Vector2(absolutePos.X / Logo.Parent.RelativeToAbsoluteFactor.X, return new Vector2(absolutePos.X / Logo.Parent!.RelativeToAbsoluteFactor.X,
absolutePos.Y / Logo.Parent.RelativeToAbsoluteFactor.Y); absolutePos.Y / Logo.Parent!.RelativeToAbsoluteFactor.Y);
} }
protected override void Update() protected override void Update()

View File

@ -119,11 +119,11 @@ namespace osu.Game.Graphics.Containers
headerBackgroundContainer.Clear(); headerBackgroundContainer.Clear();
headerBackground = value; headerBackground = value;
if (value == null) return; if (headerBackground != null)
{
headerBackgroundContainer.Add(headerBackground); headerBackgroundContainer.Add(headerBackground);
lastKnownScroll = null;
lastKnownScroll = null; }
} }
} }

View File

@ -48,7 +48,7 @@ namespace osu.Game.Graphics.Containers
private void keepUprightAndUnstretched() private void keepUprightAndUnstretched()
{ {
// Decomposes the inverse of the parent DrawInfo.Matrix into rotation, shear and scale. // Decomposes the inverse of the parent DrawInfo.Matrix into rotation, shear and scale.
var parentMatrix = Parent.DrawInfo.Matrix; var parentMatrix = Parent!.DrawInfo.Matrix;
// Remove Translation.> // Remove Translation.>
parentMatrix.M31 = 0.0f; parentMatrix.M31 = 0.0f;

View File

@ -178,7 +178,7 @@ namespace osu.Game.Graphics.Containers
// We can not use RelativeSizeAxes for Height, because the height // We can not use RelativeSizeAxes for Height, because the height
// of our parent diminishes as the content moves up. // of our parent diminishes as the content moves up.
Height = Parent.Parent.DrawSize.Y * 1.5f; Height = Parent!.Parent!.DrawSize.Y * 1.5f;
} }
protected override void PopIn() => Schedule(() => this.MoveToY(FinalPosition, APPEAR_DURATION, easing_show)); protected override void PopIn() => Schedule(() => this.MoveToY(FinalPosition, APPEAR_DURATION, easing_show));
@ -188,7 +188,7 @@ namespace osu.Game.Graphics.Containers
double duration = IsLoaded ? DISAPPEAR_DURATION : 0; double duration = IsLoaded ? DISAPPEAR_DURATION : 0;
// scheduling is required as parent may not be present at the time this is called. // scheduling is required as parent may not be present at the time this is called.
Schedule(() => this.MoveToY(Parent.Parent.DrawSize.Y, duration, easing_hide)); Schedule(() => this.MoveToY(Parent!.Parent!.DrawSize.Y, duration, easing_hide));
} }
} }
} }

View File

@ -62,7 +62,7 @@ namespace osu.Game.Graphics.UserInterface
if (!PlaySamplesOnAdjust) if (!PlaySamplesOnAdjust)
return; return;
if (Clock == null || Clock.CurrentTime - lastSampleTime <= 30) if (Clock.CurrentTime - lastSampleTime <= 30)
return; return;
if (value.Equals(lastSampleValue)) if (value.Equals(lastSampleValue))

View File

@ -13,7 +13,7 @@ namespace osu.Game.IO
public bool IsManaged => ID > 0; public bool IsManaged => ID > 0;
public string Hash { get; set; } public string Hash { get; set; } = string.Empty;
public int ReferenceCount { get; set; } public int ReferenceCount { get; set; }
} }

View File

@ -29,7 +29,7 @@ namespace osu.Game.Online.API.Requests.Responses
public DateTimeOffset JoinDate; public DateTimeOffset JoinDate;
[JsonProperty(@"username")] [JsonProperty(@"username")]
public string Username { get; set; } public string Username { get; set; } = string.Empty;
[JsonProperty(@"previous_usernames")] [JsonProperty(@"previous_usernames")]
public string[] PreviousUsernames; public string[] PreviousUsernames;

View File

@ -22,6 +22,6 @@ namespace osu.Game.Online.Placeholders
AddText(this.message = message); AddText(this.message = message);
} }
public override bool Equals(Placeholder other) => (other as MessagePlaceholder)?.message == message; public override bool Equals(Placeholder? other) => (other as MessagePlaceholder)?.message == message;
} }
} }

View File

@ -267,7 +267,7 @@ namespace osu.Game.Overlays
if (!isDraggingTopBar) if (!isDraggingTopBar)
return; return;
float targetChatHeight = dragStartChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent.DrawSize.Y; float targetChatHeight = dragStartChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent!.DrawSize.Y;
chatHeight.Value = targetChatHeight; chatHeight.Value = targetChatHeight;
} }

View File

@ -17,7 +17,7 @@ namespace osu.Game.Overlays
public abstract partial class FullscreenOverlay<T> : WaveOverlayContainer, INamedOverlayComponent public abstract partial class FullscreenOverlay<T> : WaveOverlayContainer, INamedOverlayComponent
where T : OverlayHeader where T : OverlayHeader
{ {
public virtual string IconTexture => Header.Title.IconTexture ?? string.Empty; public virtual string IconTexture => Header.Title.IconTexture;
public virtual LocalisableString Title => Header.Title.Title; public virtual LocalisableString Title => Header.Title.Title;
public virtual LocalisableString Description => Header.Title.Description; public virtual LocalisableString Description => Header.Title.Description;

View File

@ -604,7 +604,7 @@ namespace osu.Game.Overlays.Mods
if (columnNumber > 5 && !column.Active.Value) return; if (columnNumber > 5 && !column.Active.Value) return;
// use X position of the column on screen as a basis for panning the sample // use X position of the column on screen as a basis for panning the sample
float balance = column.Parent.BoundingBox.Centre.X / RelativeToAbsoluteFactor.X; float balance = column.Parent!.BoundingBox.Centre.X / RelativeToAbsoluteFactor.X;
// dip frequency and ramp volume of sample over the first 5 displayed columns // dip frequency and ramp volume of sample over the first 5 displayed columns
float progress = Math.Min(1, columnNumber / 5f); float progress = Math.Min(1, columnNumber / 5f);

View File

@ -248,7 +248,7 @@ namespace osu.Game.Overlays
{ {
base.UpdateAfterChildren(); base.UpdateAfterChildren();
playlistContainer.Height = MathF.Min(Parent.DrawHeight - margin * 3 - player_height, PlaylistOverlay.PLAYLIST_HEIGHT); playlistContainer.Height = MathF.Min(Parent!.DrawHeight - margin * 3 - player_height, PlaylistOverlay.PLAYLIST_HEIGHT);
float height = player_height; float height = player_height;

View File

@ -241,7 +241,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
protected override void OnDrag(DragEvent e) protected override void OnDrag(DragEvent e)
{ {
var newPos = Position + e.Delta; var newPos = Position + e.Delta;
this.MoveTo(Vector2.Clamp(newPos, Vector2.Zero, Parent.Size)); this.MoveTo(Vector2.Clamp(newPos, Vector2.Zero, Parent!.Size));
} }
protected override void OnDragEnd(DragEndEvent e) protected override void OnDragEnd(DragEndEvent e)

View File

@ -202,7 +202,7 @@ namespace osu.Game.Overlays.SkinEditor
if (drawable.Parent == null) if (drawable.Parent == null)
return; return;
var newAnchor = drawable.Parent.ToSpaceOfOtherDrawable(drawable.AnchorPosition, this); var newAnchor = drawable.Parent!.ToSpaceOfOtherDrawable(drawable.AnchorPosition, this);
anchorPosition = tweenPosition(anchorPosition ?? newAnchor, newAnchor); anchorPosition = tweenPosition(anchorPosition ?? newAnchor, newAnchor);
anchorBox.Position = anchorPosition.Value; anchorBox.Position = anchorPosition.Value;

View File

@ -135,7 +135,7 @@ namespace osu.Game.Overlays.SkinEditor
{ {
var drawableItem = (Drawable)b.Item; var drawableItem = (Drawable)b.Item;
var flippedPosition = GeometryUtils.GetFlippedPosition(direction, flipOverOrigin ? drawableItem.Parent.ScreenSpaceDrawQuad : selectionQuad, b.ScreenSpaceSelectionPoint); var flippedPosition = GeometryUtils.GetFlippedPosition(direction, flipOverOrigin ? drawableItem.Parent!.ScreenSpaceDrawQuad : selectionQuad, b.ScreenSpaceSelectionPoint);
updateDrawablePosition(drawableItem, flippedPosition); updateDrawablePosition(drawableItem, flippedPosition);
@ -242,7 +242,7 @@ namespace osu.Game.Overlays.SkinEditor
private static void updateDrawablePosition(Drawable drawable, Vector2 screenSpacePosition) private static void updateDrawablePosition(Drawable drawable, Vector2 screenSpacePosition)
{ {
drawable.Position = drawable.Position =
drawable.Parent.ToLocalSpace(screenSpacePosition) - drawable.AnchorPosition; drawable.Parent!.ToLocalSpace(screenSpacePosition) - drawable.AnchorPosition;
} }
private void applyOrigins(Anchor origin) private void applyOrigins(Anchor origin)

View File

@ -63,7 +63,7 @@ namespace osu.Game.Overlays.Toolbar
protected override bool OnClick(ClickEvent e) protected override bool OnClick(ClickEvent e)
{ {
Parent.TriggerClick(); Parent!.TriggerClick();
return base.OnClick(e); return base.OnClick(e);
} }
} }

View File

@ -81,10 +81,10 @@ namespace osu.Game.Overlays.Wiki.Markdown
{ {
base.Update(); base.Update();
if (Width > Parent.DrawWidth) if (Width > Parent!.DrawWidth)
{ {
float ratio = Height / Width; float ratio = Height / Width;
Width = Parent.DrawWidth; Width = Parent!.DrawWidth;
Height = ratio * Width; Height = ratio * Width;
} }
} }

View File

@ -75,7 +75,7 @@ namespace osu.Game.Overlays.Wiki
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
Height = Math.Max(panelContainer.Height, Parent.DrawHeight); Height = Math.Max(panelContainer.Height, Parent!.DrawHeight);
} }
private partial class WikiPanelMarkdownContainer : WikiMarkdownContainer private partial class WikiPanelMarkdownContainer : WikiMarkdownContainer

View File

@ -23,11 +23,12 @@ namespace osu.Game.Rulesets.Objects.Legacy
/// <summary> /// <summary>
/// <see cref="ConvertSlider"/>s don't need a curve since they're converted to ruleset-specific hitobjects. /// <see cref="ConvertSlider"/>s don't need a curve since they're converted to ruleset-specific hitobjects.
/// </summary> /// </summary>
public SliderPath Path { get; set; } public SliderPath Path { get; set; } = null!;
public double Distance => Path.Distance; public double Distance => Path.Distance;
public IList<IList<HitSampleInfo>> NodeSamples { get; set; } public IList<IList<HitSampleInfo>> NodeSamples { get; set; } = null!;
public int RepeatCount { get; set; } public int RepeatCount { get; set; }
[JsonIgnore] [JsonIgnore]

View File

@ -186,7 +186,7 @@ namespace osu.Game.Rulesets.UI
this.fallback = fallback; this.fallback = fallback;
} }
public override Texture Get(string name, WrapMode wrapModeS, WrapMode wrapModeT) public override Texture? Get(string name, WrapMode wrapModeS, WrapMode wrapModeT)
=> primary.Get(name, wrapModeS, wrapModeT) ?? fallback.Get(name, wrapModeS, wrapModeT); => primary.Get(name, wrapModeS, wrapModeT) ?? fallback.Get(name, wrapModeS, wrapModeT);
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)

View File

@ -15,7 +15,7 @@ namespace osu.Game.Screens.Backgrounds
AddInternal(new Background(textureName)); AddInternal(new Background(textureName));
} }
public override bool Equals(BackgroundScreen other) public override bool Equals(BackgroundScreen? other)
{ {
if (other is BackgroundScreenCustom backgroundScreenCustom) if (other is BackgroundScreenCustom backgroundScreenCustom)
return base.Equals(other) && textureName == backgroundScreenCustom.textureName; return base.Equals(other) && textureName == backgroundScreenCustom.textureName;

View File

@ -383,7 +383,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
// Shrink the parent quad to give a bit of padding so the buttons don't stick *right* on the border. // Shrink the parent quad to give a bit of padding so the buttons don't stick *right* on the border.
// AABBFloat assumes no rotation. one would hope the whole editor is not being rotated. // AABBFloat assumes no rotation. one would hope the whole editor is not being rotated.
var parentQuad = Parent.ScreenSpaceDrawQuad.AABBFloat.Shrink(ToLocalSpace(thisQuad.TopLeft + new Vector2(button_padding * 2))); var parentQuad = Parent!.ScreenSpaceDrawQuad.AABBFloat.Shrink(ToLocalSpace(thisQuad.TopLeft + new Vector2(button_padding * 2)));
float topExcess = thisQuad.TopLeft.Y - parentQuad.TopLeft.Y; float topExcess = thisQuad.TopLeft.Y - parentQuad.TopLeft.Y;
float bottomExcess = parentQuad.BottomLeft.Y - thisQuad.BottomLeft.Y; float bottomExcess = parentQuad.BottomLeft.Y - thisQuad.BottomLeft.Y;
@ -396,7 +396,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
{ {
buttons.Anchor = Anchor.BottomCentre; buttons.Anchor = Anchor.BottomCentre;
buttons.Origin = Anchor.BottomCentre; buttons.Origin = Anchor.BottomCentre;
buttons.Y = Math.Min(0, ToLocalSpace(Parent.ScreenSpaceDrawQuad.BottomLeft).Y - DrawHeight); buttons.Y = Math.Min(0, ToLocalSpace(Parent!.ScreenSpaceDrawQuad.BottomLeft).Y - DrawHeight);
} }
else if (topExcess > bottomExcess) else if (topExcess > bottomExcess)
{ {

View File

@ -95,11 +95,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
} }
private Vector2 getFinalPosition() => private Vector2 getFinalPosition() =>
Parent.ToLocalSpace(facade.ScreenSpaceDrawQuad.Centre); Parent!.ToLocalSpace(facade.ScreenSpaceDrawQuad.Centre);
private Vector2 getFinalSize() => private Vector2 getFinalSize() =>
Parent.ToLocalSpace(facade.ScreenSpaceDrawQuad.BottomRight) Parent!.ToLocalSpace(facade.ScreenSpaceDrawQuad.BottomRight)
- Parent.ToLocalSpace(facade.ScreenSpaceDrawQuad.TopLeft); - Parent!.ToLocalSpace(facade.ScreenSpaceDrawQuad.TopLeft);
protected override bool OnClick(ClickEvent e) protected override bool OnClick(ClickEvent e)
{ {

View File

@ -89,9 +89,9 @@ namespace osu.Game.Screens
public virtual bool? AllowGlobalTrackControl => null; public virtual bool? AllowGlobalTrackControl => null;
public Bindable<WorkingBeatmap> Beatmap { get; private set; } public Bindable<WorkingBeatmap> Beatmap { get; private set; } = null!;
public Bindable<RulesetInfo> Ruleset { get; private set; } public Bindable<RulesetInfo> Ruleset { get; private set; } = null!;
public Bindable<IReadOnlyList<Mod>> Mods { get; private set; } public Bindable<IReadOnlyList<Mod>> Mods { get; private set; }

View File

@ -4,6 +4,7 @@
#nullable disable #nullable disable
using System; using System;
using JetBrains.Annotations;
using osu.Framework; using osu.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
@ -211,6 +212,7 @@ namespace osu.Game.Screens.Play
public partial class FadeContainer : Container, IStateful<Visibility> public partial class FadeContainer : Container, IStateful<Visibility>
{ {
[CanBeNull]
public event Action<Visibility> StateChanged; public event Action<Visibility> StateChanged;
private Visibility state; private Visibility state;

View File

@ -329,7 +329,7 @@ namespace osu.Game.Screens.Ranking
ScorePanelList.Attach(detachedPanel); ScorePanelList.Attach(detachedPanel);
// Move into its original location in the attached container first, then to the final location. // Move into its original location in the attached container first, then to the final location.
float origLocation = detachedPanel.Parent.ToLocalSpace(screenSpacePos).X; float origLocation = detachedPanel.Parent!.ToLocalSpace(screenSpacePos).X;
detachedPanel.MoveToX(origLocation) detachedPanel.MoveToX(origLocation)
.Then() .Then()
.MoveToX(0, 250, Easing.OutElasticQuarter); .MoveToX(0, 250, Easing.OutElasticQuarter);

View File

@ -647,7 +647,7 @@ namespace osu.Game.Screens.Select
beginLooping(); beginLooping();
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending) if (!Beatmap.Value.BeatmapSetInfo.DeletePending)
{ {
updateCarouselSelection(); updateCarouselSelection();

View File

@ -35,7 +35,7 @@ namespace osu.Game.Storyboards.Drawables
protected override Container<DrawableStoryboardLayer> Content { get; } protected override Container<DrawableStoryboardLayer> Content { get; }
protected override Vector2 DrawScale => new Vector2(Parent.DrawHeight / 480); protected override Vector2 DrawScale => new Vector2(Parent!.DrawHeight / 480);
private bool passing = true; private bool passing = true;

View File

@ -169,15 +169,15 @@ namespace osu.Game.Tests.Visual
ChangeBackgroundColour(ColourInfo.GradientVertical(colours.GreyCarmine, colours.GreyCarmineDarker)); ChangeBackgroundColour(ColourInfo.GradientVertical(colours.GreyCarmine, colours.GreyCarmineDarker));
var parentBeatmap = Parent.Dependencies.Get<Bindable<WorkingBeatmap>>(); var parentBeatmap = Parent!.Dependencies.Get<Bindable<WorkingBeatmap>>();
parentBeatmap.Value = Beatmap.Value; parentBeatmap.Value = Beatmap.Value;
Beatmap.BindTo(parentBeatmap); Beatmap.BindTo(parentBeatmap);
var parentRuleset = Parent.Dependencies.Get<Bindable<RulesetInfo>>(); var parentRuleset = Parent!.Dependencies.Get<Bindable<RulesetInfo>>();
parentRuleset.Value = Ruleset.Value; parentRuleset.Value = Ruleset.Value;
Ruleset.BindTo(parentRuleset); Ruleset.BindTo(parentRuleset);
var parentMods = Parent.Dependencies.Get<Bindable<IReadOnlyList<Mod>>>(); var parentMods = Parent!.Dependencies.Get<Bindable<IReadOnlyList<Mod>>>();
parentMods.Value = SelectedMods.Value; parentMods.Value = SelectedMods.Value;
SelectedMods.BindTo(parentMods); SelectedMods.BindTo(parentMods);
} }