Skip to content

Commit

Permalink
Update osu and .NET
Browse files Browse the repository at this point in the history
  • Loading branch information
LumpBloom7 committed Feb 19, 2024
1 parent 4062d26 commit 9552d56
Show file tree
Hide file tree
Showing 19 changed files with 47 additions and 92 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
with:
dotnet-version: "3.1.x"

- name: Install .NET 6.0.x
- name: Install .NET 8.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
dotnet-version: "8.0.x"

- name: Restore Tools
run: dotnet tool restore
Expand All @@ -46,7 +46,7 @@ jobs:
uses: actions/[email protected]
with:
name: osu.Game.Rulesets.Tau.dll
path: "osu.Game.Rulesets.Tau/bin/Debug/net6.0"
path: "osu.Game.Rulesets.Tau/bin/Debug/net8.0"
retention-days: 90

test:
Expand All @@ -67,10 +67,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Install .NET 6.0.x
- name: Install .NET 8.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
dotnet-version: "8.0.x"

# FIXME: libavformat is not included in Ubuntu. Let's fix that.
# https://github.com/ppy/osu-framework/issues/4349
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./osu.Game.Rulesets.Tau/bin/Release/net6.0/osu.Game.Rulesets.Tau.dll
asset_path: ./osu.Game.Rulesets.Tau/bin/Release/net8.0/osu.Game.Rulesets.Tau.dll
asset_name: osu.Game.Rulesets.Tau.dll
asset_content_type: application/vnd.microsoft.portable-executable
16 changes: 2 additions & 14 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,11 @@
"request": "launch",
"program": "dotnet",
"args": [
"${workspaceRoot}/osu.Game.Rulesets.Tau.Tests/bin/Debug/net6.0/osu.Game.Rulesets.Tau.Tests.dll"
"${workspaceRoot}/osu.Game.Rulesets.Tau.Tests/bin/Debug/net8.0/osu.Game.Rulesets.Tau.Tests.dll"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build tests (Debug)",
"console": "internalConsole"
},
{
"name": "Tau for osu! (Tests, Release)",
"type": "coreclr",
"request": "launch",
"program": "dotnet",
"args": [
"${workspaceRoot}/osu.Game.Rulesets.Tau.Tests/bin/Release/net6.0/osu.Game.Rulesets.Tau.Tests.dll"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build tests (Release)",
"console": "internalConsole"
},
}
]
}
29 changes: 1 addition & 28 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,6 @@
"group": "build",
"problemMatcher": "$msCompile"
},
{
"label": "Build tests (Release)",
"type": "shell",
"command": "dotnet",
"args": [
"build",
"--no-restore",
"osu.Game.Rulesets.Tau.Tests",
"/p:Configuration=Release",
"/p:GenerateFullPaths=true",
"/m",
"/verbosity:m"
],
"group": "build",
"problemMatcher": "$msCompile"
},
// Test Tasks
{
"label": "Run tests (Debug)",
Expand All @@ -44,16 +28,5 @@
"group": "test",
"problemMatcher": "$msCompile"
},
{
"label": "Run tests (Release)",
"type": "shell",
"command": "dotnet",
"args": [
"test",
"/p:Configuration=Release",
],
"group": "test",
"problemMatcher": "$msCompile"
}
]
}
}
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Tau.Tests/Objects/TestSceneBeat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (auto && !userTriggered && timeOffset > 0)
// Force success.
ApplyResult(r => r.Type = HitResult.Great);
ApplyResult(HitResult.Great);
else if (timeOffset > 0)
// We'll have to manually apply the result anyways because we have no way of checking if the paddle is in the correct spot.
ApplyResult(r => r.Type = HitResult.Miss);
ApplyResult(HitResult.Miss);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Tau.Tests/Objects/TestSceneHardBeat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
if (auto && !userTriggered && timeOffset > 0)
{
// force success
ApplyResult(r => r.Type = HitResult.Great);
ApplyResult(HitResult.Great);
}
else
base.CheckForResult(userTriggered, timeOffset);
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Tau.Tests/Objects/TestSceneSlider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
if (auto && !userTriggered && timeOffset > 0)
{
// force success
ApplyResult(r => r.Type = HitResult.Great);
ApplyResult(HitResult.Great);
}
else
base.CheckForResult(userTriggered, timeOffset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
if (auto && !userTriggered && timeOffset > 0)
{
// force success
ApplyResult(r => r.Type = HitResult.Great);
ApplyResult(HitResult.Great);
}
else
base.CheckForResult(userTriggered, timeOffset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (auto && !userTriggered && timeOffset > 0)
// Force success.
ApplyResult(r => r.Type = HitResult.Great);
ApplyResult(HitResult.Great);
else if (timeOffset > 0)
// We'll have to manually apply the result anyways because we have no way of checking if the paddle is in the correct spot.
ApplyResult(r => r.Type = HitResult.Miss);
ApplyResult(HitResult.Miss);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</ItemGroup>
<PropertyGroup Label="Project">
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>osu.Game.Rulesets.Tau.Tests</RootNamespace>
</PropertyGroup>
<ItemGroup>
Expand Down
8 changes: 2 additions & 6 deletions osu.Game.Rulesets.Tau/Mods/TauModLenience.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
if (!userTriggered)
{
if (!HitObject.HitWindows.CanBeHit(timeOffset))
ApplyResult(r => r.Type = HitResult.Miss);
ApplyResult(HitResult.Miss);

return;
}
Expand All @@ -98,11 +98,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
result = HitResult.Ok;
}

ApplyResult(r =>
{
r.Type = result;
ApplyCustomResult(r);
});
ApplyResult(result);
}

public override bool OnPressed(KeyBindingPressEvent<TauAction> e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ protected override JudgementResult CreateResult(Judgement judgement)

public virtual bool IsWithinPaddle() => CheckValidation != null && CheckValidation((HitObject.Angle + GetCurrentOffset()).Normalize()).IsValid;

protected override void ApplyCustomResult(JudgementResult result)
public override void ApplyCustomResult(JudgementResult result)
{
if (CheckValidation == null)
return;

var delta = CheckValidation((HitObject.Angle + GetCurrentOffset()).Normalize()).DeltaFromPaddleCenter;
float delta = CheckValidation((HitObject.Angle + GetCurrentOffset()).Normalize()).DeltaFromPaddleCenter;
var beatResult = (TauJudgementResult)result;

if (result.IsHit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ float distanceAt(double t) => inversed
void addVertex(double t, double angle)
{
var p = Extensions.FromPolarCoordinates(distanceAt(t), (float)angle);
int index = (int)(t / trackingCheckpointInterval);
int index = (int)(t / tracking_checkpoint_interval);

path.AddVertex(new Vector3(p.X, p.Y, trackingCheckpoints.ValueAtOrLastOr(index, true) ? 1 : 0));
}
Expand Down
12 changes: 4 additions & 8 deletions osu.Game.Rulesets.Tau/Objects/Drawables/DrawableSlider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private void updateSlidingSample(ValueChangedEvent<bool> tracking)
}

public BindableBool Tracking = new();
private const double trackingCheckpointInterval = 5;
private const double tracking_checkpoint_interval = 5;
private readonly List<bool> trackingCheckpoints = new();

protected override void Update()
Expand All @@ -225,7 +225,7 @@ protected override void Update()
totalTimeHeld += Time.Elapsed;
}

var trackingCheckpointIndex = (int)((Time.Current - HitObject.StartTime) / trackingCheckpointInterval);
int trackingCheckpointIndex = (int)((Time.Current - HitObject.StartTime) / tracking_checkpoint_interval);

if (trackingCheckpointIndex >= 0)
{
Expand Down Expand Up @@ -262,14 +262,10 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
foreach (var nested in NestedHitObjects.Where(n => !n.AllJudged))
{
if (nested is ICanApplyResult res)
res.ForcefullyApplyResult(r => r.Type = result);
res.ForcefullyApplyResult(result);
}

ApplyResult(r =>
{
r.Type = result;
ApplyCustomResult(r);
});
ApplyResult(result);
}

protected override JudgementResult CreateResult(Judgement judgement)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected override void UpdateAfterChildren()
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (HitObject.StartTime <= Time.Current)
ApplyResult(r => r.Type = DrawableSlider.Tracking.Value ? HitResult.Great : HitResult.Miss);
ApplyResult(DrawableSlider.Tracking.Value ? HitResult.Great : HitResult.Miss);
}

protected override void OnApply()
Expand All @@ -117,8 +117,8 @@ protected override void UpdateInitialTransforms()

protected override void UpdateHitStateTransforms(ArmedState state)
{
var velocity = -0.5f / (float)HitObject.TimePreempt;
var timeFadeHit = DrawableSlider.FADE_RANGE / Math.Abs(velocity);
float velocity = -0.5f / (float)HitObject.TimePreempt;
float timeFadeHit = DrawableSlider.FADE_RANGE / Math.Abs(velocity);

if (Properties?.InverseModEnabled.Value == true)
velocity *= -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public DrawableSliderTick(SliderTick hitObject)
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (HitObject.StartTime <= Time.Current)
ApplyResult(r => r.Type = DrawableSlider.Tracking.Value ? HitResult.SmallTickHit : HitResult.SmallTickMiss);
ApplyResult(DrawableSlider.Tracking.Value ? HitResult.SmallTickHit : HitResult.SmallTickMiss);
}
}
}
21 changes: 12 additions & 9 deletions osu.Game.Rulesets.Tau/Objects/Drawables/DrawableTauHitObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
if (!userTriggered)
{
if (!HitObject.HitWindows.CanBeHit(timeOffset))
ApplyResult(r => r.Type = HitResult.Miss);
ApplyResult(HitResult.Miss);

return;
}
Expand All @@ -61,19 +61,22 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
if (result == HitResult.None)
return;

ApplyResult(r =>
{
r.Type = result;
ApplyCustomResult(r);
});
ApplyResult(result);
}

/// <summary>
/// Should return whether or not a <see cref="DrawableHitObject"/> has the correct set of parameters for it to be hit.
/// </summary>
protected virtual bool CheckForValidation() => true;

protected virtual void ApplyCustomResult(JudgementResult result) { }
protected new void ApplyResult(HitResult result)
{
ApplyCustomResult(Result);

base.ApplyResult(result);
}

public virtual void ApplyCustomResult(JudgementResult result) { }

public virtual bool OnPressed(KeyBindingPressEvent<TauAction> e)
{
Expand All @@ -87,8 +90,8 @@ public virtual void OnReleased(KeyBindingReleaseEvent<TauAction> e)
{
}

public void ForcefullyApplyResult(Action<JudgementResult> application)
=> ApplyResult(application);
public void ForcefullyApplyResult(HitResult result)
=> ApplyResult(result);
}

public struct ValidationResult
Expand Down
7 changes: 3 additions & 4 deletions osu.Game.Rulesets.Tau/Objects/Drawables/ICanApplyResult.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;

namespace osu.Game.Rulesets.Tau.Objects.Drawables
{
Expand All @@ -10,6 +9,6 @@ public interface ICanApplyResult
/// Forces a result to the <see cref="DrawableHitObject{TObject}"/>.
/// </summary>
/// <param name="application">The adjustment to be made to the result.</param>
public void ForcefullyApplyResult(Action<JudgementResult> application);
public void ForcefullyApplyResult(HitResult result);
}
}
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Tau/osu.Game.Rulesets.Tau.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Project">
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssemblyTitle>osu.Game.Rulesets.Tau</AssemblyTitle>
<OutputType>Library</OutputType>
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down Expand Up @@ -35,7 +35,7 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game" Version="2024.130.2" />
<PackageReference Include="ppy.osu.Game" Version="2024.219.0" />
</ItemGroup>
<ItemGroup>
<Compile Update="Objects\Drawables\DrawableSlider.Calculations.cs">
Expand Down

0 comments on commit 9552d56

Please sign in to comment.