1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-08 04:32:54 +08:00

Apply further changes to remove remaining weirdness

This commit is contained in:
Bartłomiej Dach 2024-02-05 13:35:41 +01:00
parent 39fe078984
commit fb80d76b4a
No known key found for this signature in database
11 changed files with 41 additions and 71 deletions

View File

@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.EmptyFreeform.Objects.Drawables
{ {
if (timeOffset >= 0) if (timeOffset >= 0)
// todo: implement judgement logic // todo: implement judgement logic
ApplyResult(static (r, hitObject) => r.Type = HitResult.Perfect); ApplyResult(HitResult.Perfect);
} }
protected override void UpdateHitStateTransforms(ArmedState state) protected override void UpdateHitStateTransforms(ArmedState state)

View File

@ -9,7 +9,6 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -50,10 +49,10 @@ namespace osu.Game.Rulesets.Pippidon.Objects.Drawables
{ {
if (timeOffset >= 0) if (timeOffset >= 0)
{ {
ApplyResult(static (r, hitObject) => if (IsHovered)
{ ApplyMaxResult();
r.Type = hitObject.IsHovered ? HitResult.Perfect : HitResult.Miss; else
}); ApplyMinResult();
} }
} }

View File

@ -3,7 +3,6 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -24,7 +23,7 @@ namespace osu.Game.Rulesets.EmptyScrolling.Objects.Drawables
{ {
if (timeOffset >= 0) if (timeOffset >= 0)
// todo: implement judgement logic // todo: implement judgement logic
ApplyResult(static (r, hitObject) => r.Type = HitResult.Perfect); ApplyMaxResult();
} }
protected override void UpdateHitStateTransforms(ArmedState state) protected override void UpdateHitStateTransforms(ArmedState state)

View File

@ -10,7 +10,6 @@ using osu.Framework.Graphics.Textures;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Pippidon.UI; using osu.Game.Rulesets.Pippidon.UI;
using osu.Game.Rulesets.Scoring;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -50,11 +49,10 @@ namespace osu.Game.Rulesets.Pippidon.Objects.Drawables
{ {
if (timeOffset >= 0) if (timeOffset >= 0)
{ {
ApplyResult(static (r, hitObject) => if (currentLane.Value == HitObject.Lane)
{ ApplyMaxResult();
var pippidonHitObject = (DrawablePippidonHitObject)hitObject; else
r.Type = pippidonHitObject.currentLane.Value == pippidonHitObject.HitObject.Lane ? HitResult.Perfect : HitResult.Miss; ApplyMinResult();
});
} }
} }

View File

@ -64,11 +64,10 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
if (timeOffset >= 0 && Result != null) if (timeOffset >= 0 && Result != null)
{ {
ApplyResult(static (r, hitObject) => if (CheckPosition.Invoke(HitObject))
{ ApplyMaxResult();
var catchHitObject = (DrawableCatchHitObject)hitObject; else
r.Type = catchHitObject.CheckPosition!.Invoke(catchHitObject.HitObject) ? r.Judgement.MaxResult : r.Judgement.MinResult; ApplyMinResult();
});
} }
} }

View File

@ -38,8 +38,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
private Drawable headPiece; private Drawable headPiece;
private HitResult hitResult;
public DrawableNote() public DrawableNote()
: this(null) : this(null)
{ {
@ -96,18 +94,13 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
return; return;
} }
hitResult = HitObject.HitWindows.ResultFor(timeOffset); var result = HitObject.HitWindows.ResultFor(timeOffset);
if (hitResult == HitResult.None) if (result == HitResult.None)
return; return;
hitResult = GetCappedResult(hitResult); result = GetCappedResult(result);
ApplyResult(result);
ApplyResult(static (r, hitObject) =>
{
var note = (DrawableNote)hitObject;
r.Type = note.hitResult;
});
} }
/// <summary> /// <summary>

View File

@ -160,19 +160,19 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
return; return;
} }
HitResult hitResult = ResultFor(timeOffset); var result = ResultFor(timeOffset);
var clickAction = CheckHittable?.Invoke(this, Time.Current, hitResult); var clickAction = CheckHittable?.Invoke(this, Time.Current, result);
if (clickAction == ClickAction.Shake) if (clickAction == ClickAction.Shake)
Shake(); Shake();
if (hitResult == HitResult.None || clickAction != ClickAction.Hit) if (result == HitResult.None || clickAction != ClickAction.Hit)
return; return;
Vector2? hitPosition = null; Vector2? hitPosition = null;
// Todo: This should also consider misses, but they're a little more interesting to handle, since we don't necessarily know the position at the time of a miss. // Todo: This should also consider misses, but they're a little more interesting to handle, since we don't necessarily know the position at the time of a miss.
if (hitResult.IsHit()) if (result.IsHit())
{ {
var localMousePosition = ToLocalSpace(inputManager.CurrentState.Mouse.Position); var localMousePosition = ToLocalSpace(inputManager.CurrentState.Mouse.Position);
hitPosition = HitObject.StackedPosition + (localMousePosition - DrawSize / 2); hitPosition = HitObject.StackedPosition + (localMousePosition - DrawSize / 2);
@ -184,7 +184,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
circleResult.Type = state.result; circleResult.Type = state.result;
circleResult.CursorPositionAtHit = state.position; circleResult.CursorPositionAtHit = state.position;
}, (hitResult, hitPosition)); }, (result, hitPosition));
} }
/// <summary> /// <summary>

View File

@ -11,8 +11,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
public override bool DisplayResult => false; public override bool DisplayResult => false;
private bool hit;
public DrawableSpinnerTick() public DrawableSpinnerTick()
: this(null) : this(null)
{ {
@ -39,12 +37,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
/// <param name="hit">Whether this tick was reached.</param> /// <param name="hit">Whether this tick was reached.</param>
internal void TriggerResult(bool hit) internal void TriggerResult(bool hit)
{ {
this.hit = hit; if (hit)
ApplyResult(static (r, hitObject) => ApplyMaxResult();
{ else
var spinnerTick = (DrawableSpinnerTick)hitObject; ApplyMinResult();
r.Type = spinnerTick.hit ? r.Judgement.MaxResult : r.Judgement.MinResult;
});
} }
} }
} }

View File

@ -37,8 +37,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
private double? lastPressHandleTime; private double? lastPressHandleTime;
private HitResult hitResult;
private readonly Bindable<HitType> type = new Bindable<HitType>(); private readonly Bindable<HitType> type = new Bindable<HitType>();
public DrawableHit() public DrawableHit()
@ -105,20 +103,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
return; return;
} }
hitResult = HitObject.HitWindows.ResultFor(timeOffset); var result = HitObject.HitWindows.ResultFor(timeOffset);
if (hitResult == HitResult.None) if (result == HitResult.None)
return; return;
if (!validActionPressed) if (!validActionPressed)
ApplyMinResult(); ApplyMinResult();
else else
{ ApplyResult(result);
ApplyResult(static (r, hitObject) =>
{
var drawableHit = (DrawableHit)hitObject;
r.Type = drawableHit.hitResult;
});
}
} }
public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e)

View File

@ -41,8 +41,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
private double? lastPressHandleTime; private double? lastPressHandleTime;
private int numHits;
public override bool DisplayResult => false; public override bool DisplayResult => false;
public DrawableSwell() public DrawableSwell()
@ -194,7 +192,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
nextTick?.TriggerResult(true); nextTick?.TriggerResult(true);
numHits = ticks.Count(r => r.IsHit); int numHits = ticks.Count(r => r.IsHit);
float completion = (float)numHits / HitObject.RequiredHits; float completion = (float)numHits / HitObject.RequiredHits;
@ -215,7 +213,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
if (timeOffset < 0) if (timeOffset < 0)
return; return;
numHits = 0; int numHits = 0;
foreach (var tick in ticks) foreach (var tick in ticks)
{ {
@ -229,11 +227,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
tick.TriggerResult(false); tick.TriggerResult(false);
} }
ApplyResult(static (r, hitObject) => if (numHits == HitObject.RequiredHits)
{ ApplyMaxResult();
var swell = (DrawableSwell)hitObject; else
r.Type = swell.numHits == swell.HitObject.RequiredHits ? r.Judgement.MaxResult : r.Judgement.MinResult; ApplyMinResult();
});
} }
} }

View File

@ -15,8 +15,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{ {
public override bool DisplayResult => false; public override bool DisplayResult => false;
private bool hit;
public DrawableSwellTick() public DrawableSwellTick()
: this(null) : this(null)
{ {
@ -31,13 +29,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
public void TriggerResult(bool hit) public void TriggerResult(bool hit)
{ {
this.hit = hit;
HitObject.StartTime = Time.Current; HitObject.StartTime = Time.Current;
ApplyResult(static (r, hitObject) =>
{ if (hit)
var swellTick = (DrawableSwellTick)hitObject; ApplyMaxResult();
r.Type = swellTick.hit ? r.Judgement.MaxResult : r.Judgement.MinResult; else
}); ApplyMinResult();
} }
protected override void CheckForResult(bool userTriggered, double timeOffset) protected override void CheckForResult(bool userTriggered, double timeOffset)