Skip to content

Commit

Permalink
Add custom HitWindows
Browse files Browse the repository at this point in the history
Use them in HitObject and Scoring
HitResult like the original game : Great, Good, Ok, Miss
  • Loading branch information
Rudicito committed Sep 9, 2024
1 parent f623682 commit dfaf177
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions osu.Game.Rulesets.Gitaroo/GitarooRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using osu.Game.Rulesets.Gitaroo.Beatmaps;
using osu.Game.Rulesets.Gitaroo.Mods;
using osu.Game.Rulesets.Gitaroo.UI;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;

namespace osu.Game.Rulesets.Gitaroo
Expand Down Expand Up @@ -55,6 +56,13 @@ public override IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0) =
Font = OsuFont.Default.With(size: 18),
};

protected override IEnumerable<HitResult> GetValidHitResults() => new[]
{
HitResult.Great,
HitResult.Good,
HitResult.Ok
};

// Leave this line intact. It will bake the correct version into the ruleset on each build/release.
public override string RulesetAPIVersionSupported => CURRENT_RULESET_API_VERSION;
}
Expand Down
4 changes: 4 additions & 0 deletions osu.Game.Rulesets.Gitaroo/Objects/GitarooHitObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
// See the LICENCE file in the repository root for full licence text.

using osu.Game.Rulesets.Gitaroo.Judgements;
using osu.Game.Rulesets.Gitaroo.Scoring;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring;

namespace osu.Game.Rulesets.Gitaroo.Objects
{
public class GitarooHitObject : HitObject
{
public override Judgement CreateJudgement() => new GitarooJudgement();

protected override HitWindows CreateHitWindows() => new GitarooHitWindows();
}
}
20 changes: 20 additions & 0 deletions osu.Game.Rulesets.Gitaroo/Scoring/GitarooHitWindows.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using osu.Game.Rulesets.Scoring;

namespace osu.Game.Rulesets.Gitaroo.Scoring;

public class GitarooHitWindows : HitWindows
{
public override bool IsHitResultAllowed(HitResult result)
{
switch (result)
{
case HitResult.Great:
case HitResult.Good:
case HitResult.Ok:
case HitResult.Miss:
return true;
}

return false;
}
}

0 comments on commit dfaf177

Please sign in to comment.