From abd946650644145fff860fa31043da0ca96d7e22 Mon Sep 17 00:00:00 2001 From: Derrick Timmermans Date: Wed, 21 Feb 2024 22:48:10 +0100 Subject: [PATCH] Update to NET8 --- .vscode/launch.json | 6 +++--- .../osu.Game.Rulesets.Rush.Tests.csproj | 2 +- .../Input/RushInputManager.cs | 2 +- .../Objects/Drawables/DrawableDualHit.cs | 2 +- .../Objects/Drawables/DrawableFeverBonus.cs | 5 +++-- .../Objects/Drawables/DrawableHeart.cs | 6 +++--- .../Objects/Drawables/DrawableLanedHit.cs | 4 ++-- .../Objects/Drawables/DrawableMiniBoss.cs | 2 +- .../Objects/Drawables/DrawableMiniBossTick.cs | 2 +- .../Objects/Drawables/DrawableRushHitObject.cs | 18 +++++++----------- .../Objects/Drawables/DrawableSawblade.cs | 4 ++-- .../Objects/Drawables/DrawableStarSheet.cs | 6 +++--- .../Objects/Drawables/DrawableStarSheetHead.cs | 4 ++-- .../Objects/Drawables/DrawableStarSheetTail.cs | 6 +++--- .../osu.Game.Rulesets.Rush.csproj | 4 ++-- 15 files changed, 35 insertions(+), 38 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 64b3ff21..40b5c9e7 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,7 +7,7 @@ "request": "launch", "program": "dotnet", "args": [ - "${workspaceRoot}/osu.Game.Rulesets.Rush.Tests/bin/Debug/net6.0/osu.Game.Rulesets.Rush.Tests.dll" + "${workspaceRoot}/osu.Game.Rulesets.Rush.Tests/bin/Debug/net8.0/osu.Game.Rulesets.Rush.Tests.dll" ], "cwd": "${workspaceRoot}", "preLaunchTask": "Build tests (Debug)", @@ -19,7 +19,7 @@ "request": "launch", "program": "dotnet", "args": [ - "${workspaceRoot}/osu.Game.Rulesets.Rush.Tests/bin/Release/net6.0/osu.Game.Rulesets.Rush.Tests.dll" + "${workspaceRoot}/osu.Game.Rulesets.Rush.Tests/bin/Release/net8.0/osu.Game.Rulesets.Rush.Tests.dll" ], "cwd": "${workspaceRoot}", "preLaunchTask": "Build tests (Release)", @@ -31,7 +31,7 @@ "request": "launch", "program": "dotnet", "args": [ - "${workspaceRoot}/osu.Game.Rulesets.Rush.Tests/bin/Development/net6.0/osu.Game.Rulesets.Rush.Tests.dll" + "${workspaceRoot}/osu.Game.Rulesets.Rush.Tests/bin/Development/net8.0/osu.Game.Rulesets.Rush.Tests.dll" ], "cwd": "${workspaceRoot}", "preLaunchTask": "Build tests (Development)", diff --git a/osu.Game.Rulesets.Rush.Tests/osu.Game.Rulesets.Rush.Tests.csproj b/osu.Game.Rulesets.Rush.Tests/osu.Game.Rulesets.Rush.Tests.csproj index a0dee943..fa40f2c6 100644 --- a/osu.Game.Rulesets.Rush.Tests/osu.Game.Rulesets.Rush.Tests.csproj +++ b/osu.Game.Rulesets.Rush.Tests/osu.Game.Rulesets.Rush.Tests.csproj @@ -17,7 +17,7 @@ WinExe - net6.0 + net8.0 true diff --git a/osu.Game.Rulesets.Rush/Input/RushInputManager.cs b/osu.Game.Rulesets.Rush/Input/RushInputManager.cs index a6a2020f..f4d92a6a 100644 --- a/osu.Game.Rulesets.Rush/Input/RushInputManager.cs +++ b/osu.Game.Rulesets.Rush/Input/RushInputManager.cs @@ -22,7 +22,7 @@ public partial class RushInputManager : RulesetInputManager /// /// Retrieves all actions in a currenty pressed states. /// - public SlimReadOnlyListWrapper PressedActions => ((List)KeyBindingContainer.PressedActions).AsSlimReadOnly(); + public SlimReadOnlyListWrapper PressedActions => KeyBindingContainer.PressedActions; public RushInputManager(RulesetInfo ruleset) : base(ruleset, 0, SimultaneousBindingMode.Unique) diff --git a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableDualHit.cs b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableDualHit.cs index a9a2d7d3..e0434458 100644 --- a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableDualHit.cs +++ b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableDualHit.cs @@ -87,7 +87,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) // We can judge this object the instant the nested objects are judged if (Air.AllJudged && Ground.AllJudged) - ApplyResult(r => r.Type = (Air.IsHit && Ground.IsHit) ? r.Judgement.MaxResult : r.Judgement.MinResult); + ApplyResult((Air.IsHit && Ground.IsHit) ? Result.Judgement.MaxResult : Result.Judgement.MinResult); } protected override void UpdateHitStateTransforms(ArmedState state) diff --git a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableFeverBonus.cs b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableFeverBonus.cs index 76aa38c5..5838fc1a 100644 --- a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableFeverBonus.cs +++ b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableFeverBonus.cs @@ -3,6 +3,7 @@ using System; using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Rush.Objects.Drawables { @@ -21,10 +22,10 @@ public DrawableFeverBonus(FeverBonus hitObject) { } - public new void ApplyResult(Action application) + public new void ApplyResult(HitResult result) { if (!Result.HasResult) - base.ApplyResult(application); + base.ApplyResult(result); } protected override void CheckForResult(bool userTriggered, double timeOffset) diff --git a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableHeart.cs b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableHeart.cs index 0568eb05..91b01106 100644 --- a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableHeart.cs +++ b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableHeart.cs @@ -54,7 +54,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) if (userTriggered) { if (result != HitResult.None) - ApplyResult(r => r.Type = r.Judgement.MaxResult); + ApplyResult(Result.Judgement.MaxResult); return; } @@ -65,11 +65,11 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) // if we've passed the object and can longer hit it, miss if (result == HitResult.None) - ApplyResult(r => r.Type = r.Judgement.MinResult); + ApplyResult(Result.Judgement.MinResult); // else if we're still able to hit it, check if the player is in the correct lane else if (playfield.PlayerSprite.CollidesWith(HitObject)) - ApplyResult(r => r.Type = r.Judgement.MaxResult); + ApplyResult(Result.Judgement.MaxResult); } } } diff --git a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableLanedHit.cs b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableLanedHit.cs index 0cf1bad2..d7a70011 100644 --- a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableLanedHit.cs +++ b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableLanedHit.cs @@ -78,7 +78,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) if (!userTriggered) { if (!HitObject.HitWindows.CanBeHit(timeOffset)) - ApplyResult(r => r.Type = r.Judgement.MinResult); + ApplyResult(Result.Judgement.MinResult); return; } @@ -86,7 +86,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) if (result == HitResult.None) return; - ApplyResult(r => r.Type = result); + ApplyResult(result); } protected override void UpdateHitStateTransforms(ArmedState state) diff --git a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableMiniBoss.cs b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableMiniBoss.cs index 430f0e5b..80740217 100644 --- a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableMiniBoss.cs +++ b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableMiniBoss.cs @@ -131,7 +131,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) ? HitResult.Good : HitResult.Miss; - ApplyResult(r => r.Type = hitResult); + ApplyResult(hitResult); } } diff --git a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableMiniBossTick.cs b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableMiniBossTick.cs index ce1fc24a..901c144d 100644 --- a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableMiniBossTick.cs +++ b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableMiniBossTick.cs @@ -27,7 +27,7 @@ public DrawableMiniBossTick(MiniBossTick hitObject) public void TriggerResult(HitResult type) { HitObject.StartTime = Time.Current; - ApplyResult(r => r.Type = type); + ApplyResult(type); } protected override void CheckForResult(bool userTriggered, double timeOffset) diff --git a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableRushHitObject.cs b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableRushHitObject.cs index 48ae8ece..539ecc9b 100644 --- a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableRushHitObject.cs +++ b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableRushHitObject.cs @@ -17,6 +17,7 @@ using osu.Game.Rulesets.Rush.Judgements; using osu.Game.Rulesets.Rush.UI; using osu.Game.Rulesets.Rush.UI.Fever; +using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI.Scrolling; using osuTK.Graphics; @@ -75,7 +76,7 @@ protected virtual void OnDirectionChanged(ValueChangedEvent protected override void CheckForResult(bool userTriggered, double timeOffset) { if (timeOffset >= 0) - ApplyResult(r => r.Type = r.Judgement.MaxResult); + ApplyResult(Result.Judgement.MaxResult); } public virtual bool OnPressed(KeyBindingPressEvent e) => false; @@ -106,24 +107,19 @@ protected override void UpdateHitStateTransforms(ArmedState state) protected override JudgementResult CreateResult(Judgement judgement) => new RushJudgementResult(HitObject, (RushJudgement)judgement); - protected new void ApplyResult(Action application) + protected new void ApplyResult(HitResult result) { // This is the only point to correctly apply values to the judgement // result in correct time, check whether the player collided now. - void rushApplication(JudgementResult br) - { - var r = (RushJudgementResult)br; - - application?.Invoke(r); - r.PlayerCollided = drawableRuleset.PlayerCollidesWith(r.HitObject); - }; + var r = (RushJudgementResult)Result; + r.PlayerCollided = drawableRuleset.PlayerCollidesWith(r.HitObject); - base.ApplyResult(rushApplication); + base.ApplyResult(result); foreach (var bonus in feverBonusContainer) { bool eligible = IsHit && feverProcessor.InFeverMode.Value; - bonus.ApplyResult(result => result.Type = eligible ? result.Judgement.MaxResult : result.Judgement.MinResult); + bonus.ApplyResult(eligible ? bonus.Result.Judgement.MaxResult : bonus.Result.Judgement.MinResult); } } diff --git a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableSawblade.cs b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableSawblade.cs index 20db4ebe..93c94fe8 100644 --- a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableSawblade.cs +++ b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableSawblade.cs @@ -77,13 +77,13 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) { case HitResult.None: // if we've reached the trailing "none", we successfully dodged the sawblade - ApplyResult(r => r.Type = r.Judgement.MaxResult); + ApplyResult(Result.Judgement.MaxResult); break; case HitResult.Miss: // sawblades only hurt the player if they collide within the trailing "miss" hit window if (playfield.PlayerSprite.CollidesWith(HitObject)) - ApplyResult(r => r.Type = r.Judgement.MinResult); + ApplyResult(Result.Judgement.MinResult); break; } diff --git a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableStarSheet.cs b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableStarSheet.cs index ac5d2135..8a8748aa 100644 --- a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableStarSheet.cs +++ b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableStarSheet.cs @@ -144,7 +144,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) // Head missed, judge as overall missed. if (Head.Result.Type == Head.Result.Judgement.MinResult) { - ApplyResult(r => r.Type = r.Judgement.MinResult); + ApplyResult(Result.Judgement.MinResult); return; } @@ -157,7 +157,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) // Released before required progress for completion, judge as overall missed. if (userTriggered && Progress < REQUIRED_COMPLETION) { - ApplyResult(r => r.Type = r.Judgement.MinResult); + ApplyResult(Result.Judgement.MinResult); return; } @@ -169,7 +169,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) if (!Tail.Judged) return; - ApplyResult(r => r.Type = r.Judgement.MaxResult); + ApplyResult(Result.Judgement.MaxResult); } private bool iHandledPressed = false; diff --git a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableStarSheetHead.cs b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableStarSheetHead.cs index c77c4430..8bcf1ef5 100644 --- a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableStarSheetHead.cs +++ b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableStarSheetHead.cs @@ -32,11 +32,11 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) if (result == HitResult.None) return; - ApplyResult(r => r.Type = result); + ApplyResult(result); } else if (!HitObject.HitWindows.CanBeHit(timeOffset)) { - ApplyResult(r => r.Type = r.Judgement.MinResult); + ApplyResult(Result.Judgement.MinResult); } } } diff --git a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableStarSheetTail.cs b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableStarSheetTail.cs index 7c2fa4a0..ba38b92c 100644 --- a/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableStarSheetTail.cs +++ b/osu.Game.Rulesets.Rush/Objects/Drawables/DrawableStarSheetTail.cs @@ -30,7 +30,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) // Apply tail miss at its time when the entire star sheet has already been judged as missed. if (overallMissed && timeOffset >= 0) { - ApplyResult(r => r.Type = r.Judgement.MinResult); + ApplyResult(Result.Judgement.MinResult); return; } @@ -38,7 +38,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) if (!userTriggered) { if (timeOffset >= 0) - ApplyResult(r => r.Type = r.Judgement.MaxResult); + ApplyResult(Result.Judgement.MaxResult); return; } @@ -47,7 +47,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) return; // ...and an automatic perfect if they release within any "hit" judged period - ApplyResult(r => r.Type = r.Judgement.MaxResult); + ApplyResult(Result.Judgement.MaxResult); } } } diff --git a/osu.Game.Rulesets.Rush/osu.Game.Rulesets.Rush.csproj b/osu.Game.Rulesets.Rush/osu.Game.Rulesets.Rush.csproj index 2c1c7b1c..b7564e7a 100644 --- a/osu.Game.Rulesets.Rush/osu.Game.Rulesets.Rush.csproj +++ b/osu.Game.Rulesets.Rush/osu.Game.Rulesets.Rush.csproj @@ -1,7 +1,7 @@ Debug;Release;Development - net6.0 + net8.0 Library AnyCPU osu.Game.Rulesets.Rush @@ -33,6 +33,6 @@ - +