Populate hit offsets from score processor

This commit is contained in:
smoogipoo
2020-06-15 22:44:55 +09:00
parent f9db37a1de
commit 900da88498
5 changed files with 135 additions and 2 deletions

View File

@ -7,8 +7,11 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using osu.Game.Rulesets.Scoring;
using osuTK;
@ -32,6 +35,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected virtual OsuSkinComponents CirclePieceComponent => OsuSkinComponents.HitCircle;
private InputManager inputManager;
public DrawableHitCircle(HitCircle h)
: base(h)
{
@ -86,6 +91,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
AccentColour.BindValueChanged(accent => ApproachCircle.Colour = accent.NewValue, true);
}
protected override void LoadComplete()
{
base.LoadComplete();
inputManager = GetContainingInputManager();
}
public override double LifetimeStart
{
get => base.LifetimeStart;
@ -126,7 +138,19 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
return;
}
ApplyResult(r => r.Type = result);
ApplyResult(r =>
{
var circleResult = (OsuHitCircleJudgementResult)r;
if (result != HitResult.Miss)
{
var localMousePosition = ToLocalSpace(inputManager.CurrentState.Mouse.Position);
circleResult.HitPosition = HitObject.StackedPosition + (localMousePosition - DrawSize / 2);
circleResult.Radius = (float)HitObject.Radius;
}
circleResult.Type = result;
});
}
protected override void UpdateInitialTransforms()
@ -172,6 +196,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
public Drawable ProxiedLayer => ApproachCircle;
protected override JudgementResult CreateResult(Judgement judgement) => new OsuHitCircleJudgementResult(HitObject, judgement);
public class HitReceptor : CompositeDrawable, IKeyBindingHandler<OsuAction>
{
// IsHovered is used