From 5341a335a6165ceef4d91e910fa2ea5aecbfd025 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 Oct 2023 17:40:44 +0900 Subject: [PATCH] Bypass `Parent` nullability checks for now --- .../TestSceneCatchSkinConfiguration.cs | 2 +- .../Edit/CatchEditorPlayfieldAdjustmentContainer.cs | 2 +- .../Edit/Blueprints/HoldNotePlacementBlueprint.cs | 4 ++-- .../Edit/Blueprints/ManiaSelectionBlueprint.cs | 2 +- osu.Game.Rulesets.Mania/Mods/ManiaModPlayfieldCover.cs | 2 +- .../Editor/TestScenePathControlPointVisualiser.cs | 2 +- .../Editor/TestSceneSliderControlPointPiece.cs | 6 +++--- .../Editor/TestSceneSliderSelectionBlueprint.cs | 2 +- .../Editor/TestSceneSliderSnapping.cs | 2 +- .../Editor/TestSceneSliderSplitting.cs | 2 +- osu.Game.Rulesets.Osu.Tests/TestSceneDrawableJudgement.cs | 2 +- .../Sliders/Components/PathControlPointVisualiser.cs | 8 ++++---- osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs | 6 +++--- .../Objects/Drawables/DrawableOsuHitObject.cs | 2 +- osu.Game.Rulesets.Osu/Skinning/Argon/ArgonSliderBall.cs | 2 +- .../Skinning/Default/SpinnerRotationTracker.cs | 2 +- osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs | 2 +- .../UI/OsuPlayfieldAdjustmentContainer.cs | 6 +++--- .../Edit/Blueprints/TaikoSelectionBlueprint.cs | 4 ++-- .../Objects/Drawables/DrawableSwell.cs | 2 +- .../Skinning/Argon/ArgonElongatedCirclePiece.cs | 2 +- .../Skinning/Default/ElongatedCirclePiece.cs | 2 +- .../UI/TaikoPlayfieldAdjustmentContainer.cs | 2 +- .../Visual/Editing/TestSceneZoomableScrollContainer.cs | 2 +- .../Visual/Gameplay/TestSceneBeatmapSkinFallbacks.cs | 2 +- osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs | 2 +- .../Visual/Gameplay/TestSceneSpectatorPlayback.cs | 2 +- .../Visual/Online/TestSceneBeatmapListingOverlay.cs | 2 +- .../Visual/Playlists/TestScenePlaylistsRoomCreation.cs | 4 ++-- osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs | 8 ++++---- .../UserInterface/TestSceneLogoTrackingContainer.cs | 4 ++-- .../Screens/Ladder/Components/ProgressionPath.cs | 4 ++-- osu.Game/Extensions/DrawableExtensions.cs | 2 +- osu.Game/Graphics/Containers/LogoTrackingContainer.cs | 6 +++--- .../Containers/UprightAspectMaintainingContainer.cs | 2 +- osu.Game/Graphics/Containers/WaveContainer.cs | 4 ++-- osu.Game/Overlays/ChatOverlay.cs | 2 +- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 +- osu.Game/Overlays/NowPlayingOverlay.cs | 2 +- .../Settings/Sections/Input/TabletAreaSelection.cs | 2 +- osu.Game/Overlays/SkinEditor/SkinBlueprint.cs | 2 +- osu.Game/Overlays/SkinEditor/SkinSelectionHandler.cs | 4 ++-- osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs | 2 +- osu.Game/Overlays/Wiki/Markdown/WikiMarkdownImageBlock.cs | 4 ++-- osu.Game/Overlays/Wiki/WikiPanelContainer.cs | 2 +- osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs | 4 ++-- .../OnlinePlay/Multiplayer/Spectate/PlayerGrid_Cell.cs | 6 +++--- osu.Game/Screens/Ranking/ResultsScreen.cs | 2 +- osu.Game/Storyboards/Drawables/DrawableStoryboard.cs | 2 +- osu.Game/Tests/Visual/OsuTestScene.cs | 6 +++--- 50 files changed, 77 insertions(+), 77 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchSkinConfiguration.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchSkinConfiguration.cs index 75ab4ad9d2..e2fc31d869 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchSkinConfiguration.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchSkinConfiguration.cs @@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Catch.Tests private float getCaughtObjectPosition(Fruit fruit) { var caughtObject = catcher.ChildrenOfType().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) diff --git a/osu.Game.Rulesets.Catch/Edit/CatchEditorPlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Catch/Edit/CatchEditorPlayfieldAdjustmentContainer.cs index 0271005dd1..36aee792a8 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchEditorPlayfieldAdjustmentContainer.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchEditorPlayfieldAdjustmentContainer.cs @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Catch.Edit { 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; } } diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePlacementBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePlacementBlueprint.cs index cb275a9aa4..02ad1655b5 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePlacementBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePlacementBlueprint.cs @@ -44,8 +44,8 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints if (Column != null) { - headPiece.Y = Parent.ToLocalSpace(Column.ScreenSpacePositionAtTime(HitObject.StartTime)).Y; - tailPiece.Y = Parent.ToLocalSpace(Column.ScreenSpacePositionAtTime(HitObject.EndTime)).Y; + headPiece.Y = Parent!.ToLocalSpace(Column.ScreenSpacePositionAtTime(HitObject.StartTime)).Y; + tailPiece.Y = Parent!.ToLocalSpace(Column.ScreenSpacePositionAtTime(HitObject.EndTime)).Y; switch (scrollingInfo.Direction.Value) { diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs index 4c356367d3..1ae65dd8c0 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints foreach (var child in InternalChildren) child.Anchor = child.Origin = anchor; - Position = Parent.ToLocalSpace(HitObjectContainer.ScreenSpacePositionAtTime(HitObject.StartTime)) - AnchorPosition; + Position = Parent!.ToLocalSpace(HitObjectContainer.ScreenSpacePositionAtTime(HitObject.StartTime)) - AnchorPosition; Width = HitObjectContainer.DrawWidth; } } diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModPlayfieldCover.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModPlayfieldCover.cs index 09abe8d7f4..bc76c5cfe9 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModPlayfieldCover.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModPlayfieldCover.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Mania.Mods foreach (Column column in maniaPlayfield.Stages.SelectMany(stage => stage.Columns)) { HitObjectContainer hoc = column.HitObjectArea.HitObjectContainer; - Container hocParent = (Container)hoc.Parent; + Container hocParent = (Container)hoc.Parent!; hocParent.Remove(hoc, false); hocParent.Add(new PlayfieldCoveringWrapper(hoc).With(c => diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestScenePathControlPointVisualiser.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestScenePathControlPointVisualiser.cs index 0d6841017e..c267cd1f63 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestScenePathControlPointVisualiser.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestScenePathControlPointVisualiser.cs @@ -169,7 +169,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor AddStep($"move mouse to control point {index}", () => { Vector2 position = slider.Path.ControlPoints[index].Position; - InputManager.MoveMouseTo(visualiser.Pieces[0].Parent.ToScreenSpace(position)); + InputManager.MoveMouseTo(visualiser.Pieces[0].Parent!.ToScreenSpace(position)); }); } diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderControlPointPiece.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderControlPointPiece.cs index db9eea4127..408205d6b2 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderControlPointPiece.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderControlPointPiece.cs @@ -169,7 +169,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor AddStep($"move mouse to {relativePosition}", () => { Vector2 position = slider.Position + relativePosition; - InputManager.MoveMouseTo(drawableObject.Parent.ToScreenSpace(position)); + InputManager.MoveMouseTo(drawableObject.Parent!.ToScreenSpace(position)); }); [Test] @@ -331,7 +331,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor AddStep($"move mouse to {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}", () => { Vector2 position = slider.Position + slider.Path.ControlPoints[index].Position; - InputManager.MoveMouseTo(drawableObject.Parent.ToScreenSpace(position)); + InputManager.MoveMouseTo(drawableObject.Parent!.ToScreenSpace(position)); }); } diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSelectionBlueprint.cs index 8ed77d45d7..413a3c3dfd 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSelectionBlueprint.cs @@ -187,7 +187,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor AddStep($"move mouse to control point {index}", () => { Vector2 position = slider.Position + slider.Path.ControlPoints[index].Position; - InputManager.MoveMouseTo(drawableObject.Parent.ToScreenSpace(position)); + InputManager.MoveMouseTo(drawableObject.Parent!.ToScreenSpace(position)); }); } diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs index f262a4334a..0ae14bdde8 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSnapping.cs @@ -101,7 +101,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor { var firstPiece = this.ChildrenOfType>().Single(piece => piece.ControlPoint == slider.Path.ControlPoints[0]); 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", () => { diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSplitting.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSplitting.cs index 7315344295..60264572ab 100644 --- a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSplitting.cs +++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSplitting.cs @@ -231,7 +231,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor if (slider is null || visualiser is null) return; 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)); }); } diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneDrawableJudgement.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneDrawableJudgement.cs index 5da54f8fcf..874130233a 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneDrawableJudgement.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneDrawableJudgement.cs @@ -75,7 +75,7 @@ namespace osu.Game.Rulesets.Osu.Tests 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. - ((Container)pool.Parent).Clear(false); + ((Container)pool.Parent!).Clear(false); } var container = new Container diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs index c56ffcb140..f624ebc8b5 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs @@ -288,10 +288,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components 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 - 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); - Vector2 movementDelta = Parent.ToLocalSpace(result?.ScreenSpacePosition ?? newHeadPosition) - hitObject.Position; + Vector2 movementDelta = Parent!.ToLocalSpace(result?.ScreenSpacePosition ?? newHeadPosition) - hitObject.Position; hitObject.Position += movementDelta; hitObject.StartTime = result?.Time ?? hitObject.StartTime; @@ -309,9 +309,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components } 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) { diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs b/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs index 2e2d320313..8b0adbe50f 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs @@ -139,12 +139,12 @@ namespace osu.Game.Rulesets.Osu.Mods if (Precision.AlmostEquals(restrictTo.Rotation, 0)) { - start = Parent.ToLocalSpace(restrictTo.ScreenSpaceDrawQuad.TopLeft).X; - end = Parent.ToLocalSpace(restrictTo.ScreenSpaceDrawQuad.TopRight).X; + start = Parent!.ToLocalSpace(restrictTo.ScreenSpaceDrawQuad.TopLeft).X; + end = Parent!.ToLocalSpace(restrictTo.ScreenSpaceDrawQuad.TopRight).X; } else { - float center = restrictTo.ToSpaceOfOtherDrawable(restrictTo.OriginPosition, Parent).X; + float center = restrictTo.ToSpaceOfOtherDrawable(restrictTo.OriginPosition, Parent!).X; float halfDiagonal = (restrictTo.DrawSize / 2).LengthFast; start = center - halfDiagonal; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index ed981d2d5d..bdd818cf18 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -102,7 +102,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables /// 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; /// /// Calculates the position of the given relative to the playfield area. diff --git a/osu.Game.Rulesets.Osu/Skinning/Argon/ArgonSliderBall.cs b/osu.Game.Rulesets.Osu/Skinning/Argon/ArgonSliderBall.cs index 461b4a3b45..325f0a22ad 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Argon/ArgonSliderBall.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Argon/ArgonSliderBall.cs @@ -109,7 +109,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon base.Update(); //undo rotation on layers which should not be rotated. - float appliedRotation = Parent.Rotation; + float appliedRotation = Parent!.Rotation; fill.Rotation = -appliedRotation; } diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerRotationTracker.cs b/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerRotationTracker.cs index 69c2bf3dd0..c3c6629818 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerRotationTracker.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/SpinnerRotationTracker.cs @@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default protected override bool OnMouseMove(MouseMoveEvent e) { - mousePosition = Parent.ToLocalSpace(e.ScreenSpaceMousePosition); + mousePosition = Parent!.ToLocalSpace(e.ScreenSpaceMousePosition); return base.OnMouseMove(e); } diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs index 5535903c73..593a0d18dd 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBall.cs @@ -88,7 +88,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy base.UpdateAfterChildren(); //undo rotation on layers which should not be rotated. - float appliedRotation = Parent.Rotation; + float appliedRotation = Parent!.Rotation; layerNd.Rotation = -appliedRotation; layerSpec.Rotation = -appliedRotation; diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs index 2c3a77a6bc..b139296c61 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs @@ -60,12 +60,12 @@ namespace osu.Game.Rulesets.Osu.UI // game_size = DrawSizePreservingFillContainer.TargetSize = new Vector2(1024, 768) // // 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 = 819.2 + // Parent!.ChildSize.X = min(game_size.X, game_size.Y * (4 / 3)) * playfield_size_adjust + // Parent!.ChildSize.X = 819.2 // // Scale = 819.2 / 512 // 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); // Size = 0.625 Size = Vector2.Divide(Vector2.One, Scale); diff --git a/osu.Game.Rulesets.Taiko/Edit/Blueprints/TaikoSelectionBlueprint.cs b/osu.Game.Rulesets.Taiko/Edit/Blueprints/TaikoSelectionBlueprint.cs index 93b7c7061b..2a824d1f68 100644 --- a/osu.Game.Rulesets.Taiko/Edit/Blueprints/TaikoSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Taiko/Edit/Blueprints/TaikoSelectionBlueprint.cs @@ -30,8 +30,8 @@ namespace osu.Game.Rulesets.Taiko.Edit.Blueprints var topLeft = new Vector2(float.MaxValue, float.MaxValue); var bottomRight = new Vector2(float.MinValue, float.MinValue); - topLeft = Vector2.ComponentMin(topLeft, Parent.ToLocalSpace(DrawableObject.ScreenSpaceDrawQuad.TopLeft)); - bottomRight = Vector2.ComponentMax(bottomRight, Parent.ToLocalSpace(DrawableObject.ScreenSpaceDrawQuad.BottomRight)); + topLeft = Vector2.ComponentMin(topLeft, Parent!.ToLocalSpace(DrawableObject.ScreenSpaceDrawQuad.TopLeft)); + bottomRight = Vector2.ComponentMax(bottomRight, Parent!.ToLocalSpace(DrawableObject.ScreenSpaceDrawQuad.BottomRight)); Size = bottomRight - topLeft; Position = topLeft; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index a8b48450e8..e4a083f218 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -261,7 +261,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { base.Update(); - Size = BaseSize * Parent.RelativeChildSize; + Size = BaseSize * Parent!.RelativeChildSize; // Make the swell stop at the hit target X = Math.Max(0, X); diff --git a/osu.Game.Rulesets.Taiko/Skinning/Argon/ArgonElongatedCirclePiece.cs b/osu.Game.Rulesets.Taiko/Skinning/Argon/ArgonElongatedCirclePiece.cs index 17386cc659..1ac2822a1b 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Argon/ArgonElongatedCirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Argon/ArgonElongatedCirclePiece.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Argon protected override void Update() { base.Update(); - Width = Parent.DrawSize.X + DrawHeight; + Width = Parent!.DrawSize.X + DrawHeight; } } } diff --git a/osu.Game.Rulesets.Taiko/Skinning/Default/ElongatedCirclePiece.cs b/osu.Game.Rulesets.Taiko/Skinning/Default/ElongatedCirclePiece.cs index 11d82a3714..c756b0fb66 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/Default/ElongatedCirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/Default/ElongatedCirclePiece.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Default protected override void Update() { base.Update(); - Width = Parent.DrawSize.X + DrawHeight; + Width = Parent!.DrawSize.X + DrawHeight; } } } diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfieldAdjustmentContainer.cs index 3587783104..54608b77de 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfieldAdjustmentContainer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfieldAdjustmentContainer.cs @@ -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. if (LockPlayfieldAspectRange.Value) { - float currentAspect = Parent.ChildSize.X / Parent.ChildSize.Y; + float currentAspect = Parent!.ChildSize.X / Parent!.ChildSize.Y; if (currentAspect > MAXIMUM_ASPECT) height *= currentAspect / MAXIMUM_ASPECT; diff --git a/osu.Game.Tests/Visual/Editing/TestSceneZoomableScrollContainer.cs b/osu.Game.Tests/Visual/Editing/TestSceneZoomableScrollContainer.cs index a141e4d431..1c8a18e131 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneZoomableScrollContainer.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneZoomableScrollContainer.cs @@ -89,7 +89,7 @@ namespace osu.Game.Tests.Visual.Editing public void TestWidthUpdatesOnDrawSizeChanges() { 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); } diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneBeatmapSkinFallbacks.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneBeatmapSkinFallbacks.cs index 18a180589b..a2ce62105e 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneBeatmapSkinFallbacks.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneBeatmapSkinFallbacks.cs @@ -69,7 +69,7 @@ namespace osu.Game.Tests.Visual.Gameplay var expectedComponentsAdjustmentContainer = new DependencyProvidingContainer { - Position = actualComponentsContainer.Parent.ToSpaceOfOtherDrawable(actualComponentsContainer.DrawPosition, Content), + Position = actualComponentsContainer.Parent!.ToSpaceOfOtherDrawable(actualComponentsContainer.DrawPosition, Content), Size = actualComponentsContainer.DrawSize, Child = expectedComponentsContainer, // proxy the same required dependencies that `actualComponentsContainer` is using. diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs index 65b409a6f7..c51883b221 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs @@ -220,7 +220,7 @@ namespace osu.Game.Tests.Visual.Gameplay public partial class TestInputConsumer : CompositeDrawable, IKeyBindingHandler { - public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent.ReceivePositionalInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent!.ReceivePositionalInputAt(screenSpacePos); private readonly Box box; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs index 794860b9ec..3a5b3864af 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs @@ -259,7 +259,7 @@ namespace osu.Game.Tests.Visual.Gameplay public partial class TestInputConsumer : CompositeDrawable, IKeyBindingHandler { - public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent.ReceivePositionalInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent!.ReceivePositionalInputAt(screenSpacePos); private readonly Box box; diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapListingOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapListingOverlay.cs index 5e49cb633e..8c32135cfd 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapListingOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapListingOverlay.cs @@ -188,7 +188,7 @@ namespace osu.Game.Tests.Visual.Online AddUntilStep("placeholder shown", () => { var notFoundDrawable = overlay.ChildrenOfType().SingleOrDefault(); - return notFoundDrawable != null && notFoundDrawable.IsPresent && notFoundDrawable.Parent.DrawHeight > 0; + return notFoundDrawable != null && notFoundDrawable.IsPresent && notFoundDrawable.Parent!.DrawHeight > 0; }); } diff --git a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsRoomCreation.cs b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsRoomCreation.cs index 6c732f4295..2f66309f04 100644 --- a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsRoomCreation.cs +++ b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsRoomCreation.cs @@ -75,7 +75,7 @@ namespace osu.Game.Tests.Visual.Playlists }); }); - AddUntilStep("Progress details are hidden", () => match.ChildrenOfType().FirstOrDefault()?.Parent.Alpha == 0); + AddUntilStep("Progress details are hidden", () => match.ChildrenOfType().FirstOrDefault()?.Parent!.Alpha == 0); AddUntilStep("Leaderboard shows two aggregate scores", () => match.ChildrenOfType().Count(s => s.ScoreText.Text != "0") == 2); @@ -99,7 +99,7 @@ namespace osu.Game.Tests.Visual.Playlists }); }); - AddUntilStep("Progress details are visible", () => match.ChildrenOfType().FirstOrDefault()?.Parent.Alpha == 1); + AddUntilStep("Progress details are visible", () => match.ChildrenOfType().FirstOrDefault()?.Parent!.Alpha == 1); } [Test] diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs index ec0ad685c5..2926b11067 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs @@ -66,20 +66,20 @@ namespace osu.Game.Tests.Visual.Settings }); 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"); AddAssert("default value button centre aligned to label size", () => { var label = textBox.ChildrenOfType().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); - 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)); - 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)); } /// diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLogoTrackingContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLogoTrackingContainer.cs index 5926f07a11..57ea4ee58e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLogoTrackingContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLogoTrackingContainer.cs @@ -269,8 +269,8 @@ namespace osu.Game.Tests.Visual.UserInterface if (!logoFacade.Transforms.Any() && !transferContainer.Transforms.Any()) { 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); - transferContainer.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); } if (randomPositions) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs index eae11dd8f1..90efac30fd 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs @@ -61,8 +61,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components var topLeft = new Vector2(minX, minY); OriginPosition = new Vector2(PathRadius); - Position = Parent.ToLocalSpace(topLeft); - Vertices = points.Select(p => Parent.ToLocalSpace(p) - Parent.ToLocalSpace(topLeft)).ToList(); + Position = Parent!.ToLocalSpace(topLeft); + Vertices = points.Select(p => Parent!.ToLocalSpace(p) - Parent!.ToLocalSpace(topLeft)).ToList(); } } } diff --git a/osu.Game/Extensions/DrawableExtensions.cs b/osu.Game/Extensions/DrawableExtensions.cs index 6553ad3886..99d748b267 100644 --- a/osu.Game/Extensions/DrawableExtensions.cs +++ b/osu.Game/Extensions/DrawableExtensions.cs @@ -43,7 +43,7 @@ namespace osu.Game.Extensions /// A delta in screen-space coordinates. /// The delta vector in Parent's coordinates. 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); /// /// Some elements don't handle rewind correctly and fixing them is non-trivial. diff --git a/osu.Game/Graphics/Containers/LogoTrackingContainer.cs b/osu.Game/Graphics/Containers/LogoTrackingContainer.cs index 984d60d35e..08eae25951 100644 --- a/osu.Game/Graphics/Containers/LogoTrackingContainer.cs +++ b/osu.Game/Graphics/Containers/LogoTrackingContainer.cs @@ -76,10 +76,10 @@ namespace osu.Game.Graphics.Containers /// Will only be correct if the logo's are set to Axes.Both 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, - absolutePos.Y / Logo.Parent.RelativeToAbsoluteFactor.Y); + return new Vector2(absolutePos.X / Logo.Parent!.RelativeToAbsoluteFactor.X, + absolutePos.Y / Logo.Parent!.RelativeToAbsoluteFactor.Y); } protected override void Update() diff --git a/osu.Game/Graphics/Containers/UprightAspectMaintainingContainer.cs b/osu.Game/Graphics/Containers/UprightAspectMaintainingContainer.cs index 38ab6deb97..f263ae36cb 100644 --- a/osu.Game/Graphics/Containers/UprightAspectMaintainingContainer.cs +++ b/osu.Game/Graphics/Containers/UprightAspectMaintainingContainer.cs @@ -48,7 +48,7 @@ namespace osu.Game.Graphics.Containers private void keepUprightAndUnstretched() { // 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.> parentMatrix.M31 = 0.0f; diff --git a/osu.Game/Graphics/Containers/WaveContainer.cs b/osu.Game/Graphics/Containers/WaveContainer.cs index e84cb276a4..5abc66d2ac 100644 --- a/osu.Game/Graphics/Containers/WaveContainer.cs +++ b/osu.Game/Graphics/Containers/WaveContainer.cs @@ -178,7 +178,7 @@ namespace osu.Game.Graphics.Containers // We can not use RelativeSizeAxes for Height, because the height // 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)); @@ -188,7 +188,7 @@ namespace osu.Game.Graphics.Containers double duration = IsLoaded ? DISAPPEAR_DURATION : 0; // 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)); } } } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index a47d10c565..724f77ad71 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -267,7 +267,7 @@ namespace osu.Game.Overlays if (!isDraggingTopBar) 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; } diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index e1a49f8636..f2b3264a84 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -604,7 +604,7 @@ namespace osu.Game.Overlays.Mods if (columnNumber > 5 && !column.Active.Value) return; // 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 float progress = Math.Min(1, columnNumber / 5f); diff --git a/osu.Game/Overlays/NowPlayingOverlay.cs b/osu.Game/Overlays/NowPlayingOverlay.cs index 6abde713b6..809c1af408 100644 --- a/osu.Game/Overlays/NowPlayingOverlay.cs +++ b/osu.Game/Overlays/NowPlayingOverlay.cs @@ -248,7 +248,7 @@ namespace osu.Game.Overlays { 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; diff --git a/osu.Game/Overlays/Settings/Sections/Input/TabletAreaSelection.cs b/osu.Game/Overlays/Settings/Sections/Input/TabletAreaSelection.cs index 8b15bc8f72..686002fe71 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/TabletAreaSelection.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/TabletAreaSelection.cs @@ -241,7 +241,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input protected override void OnDrag(DragEvent e) { 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) diff --git a/osu.Game/Overlays/SkinEditor/SkinBlueprint.cs b/osu.Game/Overlays/SkinEditor/SkinBlueprint.cs index c090878899..01cd3d97e0 100644 --- a/osu.Game/Overlays/SkinEditor/SkinBlueprint.cs +++ b/osu.Game/Overlays/SkinEditor/SkinBlueprint.cs @@ -202,7 +202,7 @@ namespace osu.Game.Overlays.SkinEditor if (drawable.Parent == null) return; - var newAnchor = drawable.Parent.ToSpaceOfOtherDrawable(drawable.AnchorPosition, this); + var newAnchor = drawable.Parent!.ToSpaceOfOtherDrawable(drawable.AnchorPosition, this); anchorPosition = tweenPosition(anchorPosition ?? newAnchor, newAnchor); anchorBox.Position = anchorPosition.Value; diff --git a/osu.Game/Overlays/SkinEditor/SkinSelectionHandler.cs b/osu.Game/Overlays/SkinEditor/SkinSelectionHandler.cs index 94cf60a422..c4e2c4c6bd 100644 --- a/osu.Game/Overlays/SkinEditor/SkinSelectionHandler.cs +++ b/osu.Game/Overlays/SkinEditor/SkinSelectionHandler.cs @@ -135,7 +135,7 @@ namespace osu.Game.Overlays.SkinEditor { 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); @@ -242,7 +242,7 @@ namespace osu.Game.Overlays.SkinEditor private static void updateDrawablePosition(Drawable drawable, Vector2 screenSpacePosition) { drawable.Position = - drawable.Parent.ToLocalSpace(screenSpacePosition) - drawable.AnchorPosition; + drawable.Parent!.ToLocalSpace(screenSpacePosition) - drawable.AnchorPosition; } private void applyOrigins(Anchor origin) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs index 7d75acb9d1..88326d4048 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs @@ -63,7 +63,7 @@ namespace osu.Game.Overlays.Toolbar protected override bool OnClick(ClickEvent e) { - Parent.TriggerClick(); + Parent!.TriggerClick(); return base.OnClick(e); } } diff --git a/osu.Game/Overlays/Wiki/Markdown/WikiMarkdownImageBlock.cs b/osu.Game/Overlays/Wiki/Markdown/WikiMarkdownImageBlock.cs index bb7c232a13..cae2d0167a 100644 --- a/osu.Game/Overlays/Wiki/Markdown/WikiMarkdownImageBlock.cs +++ b/osu.Game/Overlays/Wiki/Markdown/WikiMarkdownImageBlock.cs @@ -81,10 +81,10 @@ namespace osu.Game.Overlays.Wiki.Markdown { base.Update(); - if (Width > Parent.DrawWidth) + if (Width > Parent!.DrawWidth) { float ratio = Height / Width; - Width = Parent.DrawWidth; + Width = Parent!.DrawWidth; Height = ratio * Width; } } diff --git a/osu.Game/Overlays/Wiki/WikiPanelContainer.cs b/osu.Game/Overlays/Wiki/WikiPanelContainer.cs index ef31e9cfdd..c5b71cfeb6 100644 --- a/osu.Game/Overlays/Wiki/WikiPanelContainer.cs +++ b/osu.Game/Overlays/Wiki/WikiPanelContainer.cs @@ -75,7 +75,7 @@ namespace osu.Game.Overlays.Wiki protected override void Update() { base.Update(); - Height = Math.Max(panelContainer.Height, Parent.DrawHeight); + Height = Math.Max(panelContainer.Height, Parent!.DrawHeight); } private partial class WikiPanelMarkdownContainer : WikiMarkdownContainer diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs index 0c19f6c62e..72d96213ee 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs @@ -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. // 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 bottomExcess = parentQuad.BottomLeft.Y - thisQuad.BottomLeft.Y; @@ -396,7 +396,7 @@ namespace osu.Game.Screens.Edit.Compose.Components { buttons.Anchor = 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) { diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerGrid_Cell.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerGrid_Cell.cs index ffc2328dc0..bc31299615 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerGrid_Cell.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerGrid_Cell.cs @@ -95,11 +95,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate } private Vector2 getFinalPosition() => - Parent.ToLocalSpace(facade.ScreenSpaceDrawQuad.Centre); + Parent!.ToLocalSpace(facade.ScreenSpaceDrawQuad.Centre); private Vector2 getFinalSize() => - Parent.ToLocalSpace(facade.ScreenSpaceDrawQuad.BottomRight) - - Parent.ToLocalSpace(facade.ScreenSpaceDrawQuad.TopLeft); + Parent!.ToLocalSpace(facade.ScreenSpaceDrawQuad.BottomRight) + - Parent!.ToLocalSpace(facade.ScreenSpaceDrawQuad.TopLeft); protected override bool OnClick(ClickEvent e) { diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index 03231f9329..e3d19725da 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -329,7 +329,7 @@ namespace osu.Game.Screens.Ranking ScorePanelList.Attach(detachedPanel); // 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) .Then() .MoveToX(0, 250, Easing.OutElasticQuarter); diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs index 6c14ec243b..fc5ef12fb8 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs @@ -35,7 +35,7 @@ namespace osu.Game.Storyboards.Drawables protected override Container Content { get; } - protected override Vector2 DrawScale => new Vector2(Parent.DrawHeight / 480); + protected override Vector2 DrawScale => new Vector2(Parent!.DrawHeight / 480); private bool passing = true; diff --git a/osu.Game/Tests/Visual/OsuTestScene.cs b/osu.Game/Tests/Visual/OsuTestScene.cs index 096917cf4f..79df951396 100644 --- a/osu.Game/Tests/Visual/OsuTestScene.cs +++ b/osu.Game/Tests/Visual/OsuTestScene.cs @@ -169,15 +169,15 @@ namespace osu.Game.Tests.Visual ChangeBackgroundColour(ColourInfo.GradientVertical(colours.GreyCarmine, colours.GreyCarmineDarker)); - var parentBeatmap = Parent.Dependencies.Get>(); + var parentBeatmap = Parent!.Dependencies.Get>(); parentBeatmap.Value = Beatmap.Value; Beatmap.BindTo(parentBeatmap); - var parentRuleset = Parent.Dependencies.Get>(); + var parentRuleset = Parent!.Dependencies.Get>(); parentRuleset.Value = Ruleset.Value; Ruleset.BindTo(parentRuleset); - var parentMods = Parent.Dependencies.Get>>(); + var parentMods = Parent!.Dependencies.Get>>(); parentMods.Value = SelectedMods.Value; SelectedMods.BindTo(parentMods); }