mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Remove HitJudgementResolver; reimplement in DrawableHitObject.
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
@ -10,7 +11,7 @@ using OpenTK;
|
||||
|
||||
namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
{
|
||||
public class DrawableHitCircle : DrawableHitObject
|
||||
public class DrawableHitCircle : DrawableOsuHitObject
|
||||
{
|
||||
private OsuHitObject osuObject;
|
||||
|
||||
@ -39,9 +40,12 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
circle = new CirclePiece
|
||||
{
|
||||
Colour = osuObject.Colour,
|
||||
Hit = () => Hit(new JudgementInfo {
|
||||
UserTriggered = true,
|
||||
}),
|
||||
Hit = () =>
|
||||
{
|
||||
((PositionalJudgementInfo)Judgement).PositionOffset = Vector2.Zero; //todo: set to correct value
|
||||
UpdateJudgement(true);
|
||||
return true;
|
||||
},
|
||||
},
|
||||
number = new NumberPiece(),
|
||||
ring = new RingPiece(),
|
||||
@ -68,6 +72,38 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
UpdateState(State);
|
||||
}
|
||||
|
||||
double hit50 = 150;
|
||||
double hit100 = 80;
|
||||
double hit300 = 30;
|
||||
|
||||
protected override void CheckJudgement(bool userTriggered)
|
||||
{
|
||||
if (!userTriggered)
|
||||
{
|
||||
if (Judgement.TimeOffset > hit50)
|
||||
Judgement.Result = HitResult.Miss;
|
||||
return;
|
||||
}
|
||||
|
||||
double hitOffset = Math.Abs(Judgement.TimeOffset);
|
||||
|
||||
if (hitOffset < hit50)
|
||||
{
|
||||
Judgement.Result = HitResult.Hit;
|
||||
|
||||
OsuJudgementInfo osuInfo = Judgement as OsuJudgementInfo;
|
||||
|
||||
if (hitOffset < hit300)
|
||||
osuInfo.Score = OsuScoreResult.Hit300;
|
||||
else if (hitOffset < hit100)
|
||||
osuInfo.Score = OsuScoreResult.Hit100;
|
||||
else if (hitOffset < hit50)
|
||||
osuInfo.Score = OsuScoreResult.Hit50;
|
||||
}
|
||||
else
|
||||
Judgement.Result = HitResult.Miss;
|
||||
}
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
{
|
||||
if (!IsLoaded) return;
|
||||
@ -75,7 +111,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
Flush(true); //move to DrawableHitObject
|
||||
ApproachCircle.Flush(true);
|
||||
|
||||
double t = osuObject.EndTime + (Judgement?.TimeOffset ?? 0);
|
||||
double t = osuObject.EndTime + Judgement.TimeOffset;
|
||||
|
||||
Alpha = 0;
|
||||
|
||||
@ -121,7 +157,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
explosion?.Expire();
|
||||
explosion = null;
|
||||
|
||||
Schedule(() => Add(explosion = new HitExplosion(HitResult.Miss)));
|
||||
Schedule(() => Add(explosion = new HitExplosion((OsuJudgementInfo)Judgement)));
|
||||
|
||||
FadeOut(800);
|
||||
break;
|
||||
@ -134,7 +170,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
|
||||
explode.FadeIn(flash_in);
|
||||
|
||||
Schedule(() => Add(explosion = new HitExplosion(Judgement.Result)));
|
||||
Schedule(() => Add(explosion = new HitExplosion((OsuJudgementInfo)Judgement)));
|
||||
|
||||
Delay(flash_in, true);
|
||||
|
||||
|
56
osu.Game.Mode.Osu/Objects/Drawables/DrawableOsuHitObject.cs
Normal file
56
osu.Game.Mode.Osu/Objects/Drawables/DrawableOsuHitObject.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Game.Modes.Objects;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
|
||||
namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
{
|
||||
public class DrawableOsuHitObject : DrawableHitObject
|
||||
{
|
||||
public DrawableOsuHitObject(OsuHitObject hitObject)
|
||||
: base(hitObject)
|
||||
{
|
||||
}
|
||||
|
||||
public override JudgementInfo CreateJudgementInfo() => new OsuJudgementInfo();
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class OsuJudgementInfo : PositionalJudgementInfo
|
||||
{
|
||||
public OsuScoreResult Score;
|
||||
public ComboResult Combo;
|
||||
}
|
||||
|
||||
public enum ComboResult
|
||||
{
|
||||
[Description(@"")]
|
||||
None,
|
||||
[Description(@"Good")]
|
||||
Good,
|
||||
[Description(@"Amazing")]
|
||||
Perfect
|
||||
}
|
||||
|
||||
public enum OsuScoreResult
|
||||
{
|
||||
[Description(@"Miss")]
|
||||
Miss,
|
||||
[Description(@"50")]
|
||||
Hit50,
|
||||
[Description(@"100")]
|
||||
Hit100,
|
||||
[Description(@"300")]
|
||||
Hit300,
|
||||
[Description(@"500")]
|
||||
Hit500
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ using OpenTK;
|
||||
|
||||
namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
{
|
||||
class DrawableSlider : DrawableHitObject
|
||||
class DrawableSlider : DrawableOsuHitObject
|
||||
{
|
||||
public DrawableSlider(Slider h) : base(h)
|
||||
{
|
||||
@ -18,7 +18,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
Add(new CirclePiece
|
||||
{
|
||||
Colour = h.Colour,
|
||||
Hit = () => Hit(new JudgementInfo()),
|
||||
Position = h.Curve.PositionAt(i) - h.Position //non-relative?
|
||||
});
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
@ -12,7 +13,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
private SpriteText line1;
|
||||
private SpriteText line2;
|
||||
|
||||
public HitExplosion(HitResult hitResult, ComboResult comboResult = ComboResult.None)
|
||||
public HitExplosion(OsuJudgementInfo judgement)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Anchor = Anchor.Centre;
|
||||
@ -27,13 +28,13 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Text = hitResult.GetDescription(),
|
||||
Text = judgement.Score.GetDescription(),
|
||||
Font = @"Venera",
|
||||
TextSize = 20,
|
||||
},
|
||||
line2 = new SpriteText
|
||||
{
|
||||
Text = comboResult.GetDescription(),
|
||||
Text = judgement.Combo.GetDescription(),
|
||||
Font = @"Venera",
|
||||
TextSize = 14,
|
||||
}
|
||||
|
@ -49,8 +49,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
{
|
||||
Hit?.Invoke();
|
||||
return true;
|
||||
return Hit?.Invoke() ?? false;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user