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

Fix playfield display

This commit is contained in:
smoogipoo 2018-08-03 16:46:03 +09:00
parent b778a8d207
commit e6775c7a16
5 changed files with 40 additions and 41 deletions

View File

@ -7,20 +7,17 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{ {
public class DrawableStrongDrumRoll : DrawableStrongHitObject public class DrawableStrongDrumRoll : DrawableStrongHitObject
{ {
private readonly DrawableDrumRoll drumRoll;
public DrawableStrongDrumRoll(StrongHitObject strong, DrawableDrumRoll drumRoll) public DrawableStrongDrumRoll(StrongHitObject strong, DrawableDrumRoll drumRoll)
: base(strong) : base(strong, drumRoll)
{ {
this.drumRoll = drumRoll;
} }
protected override void CheckForJudgements(bool userTriggered, double timeOffset) protected override void CheckForJudgements(bool userTriggered, double timeOffset)
{ {
if (!drumRoll.Judged) if (!MainObject.Judged)
return; return;
ApplyResult(r => r.Type = drumRoll.IsHit ? HitResult.Great : HitResult.Miss); ApplyResult(r => r.Type = MainObject.IsHit ? HitResult.Great : HitResult.Miss);
} }
public override bool OnPressed(TaikoAction action) => false; public override bool OnPressed(TaikoAction action) => false;

View File

@ -7,20 +7,17 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{ {
public class DrawableStrongDrumRollTick : DrawableStrongHitObject public class DrawableStrongDrumRollTick : DrawableStrongHitObject
{ {
private readonly DrawableDrumRollTick tick;
public DrawableStrongDrumRollTick(StrongHitObject strong, DrawableDrumRollTick tick) public DrawableStrongDrumRollTick(StrongHitObject strong, DrawableDrumRollTick tick)
: base(strong) : base(strong, tick)
{ {
this.tick = tick;
} }
protected override void CheckForJudgements(bool userTriggered, double timeOffset) protected override void CheckForJudgements(bool userTriggered, double timeOffset)
{ {
if (!tick.Judged) if (!MainObject.Judged)
return; return;
ApplyResult(r => r.Type = tick.IsHit ? HitResult.Great : HitResult.Miss); ApplyResult(r => r.Type = MainObject.IsHit ? HitResult.Great : HitResult.Miss);
} }
public override bool OnPressed(TaikoAction action) => false; public override bool OnPressed(TaikoAction action) => false;

View File

@ -15,23 +15,22 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
/// </summary> /// </summary>
private const double second_hit_window = 30; private const double second_hit_window = 30;
private readonly DrawableHit hit; public DrawableHit MainObject => (DrawableHit)base.MainObject;
public DrawableStrongHit(StrongHitObject strong, DrawableHit hit) public DrawableStrongHit(StrongHitObject strong, DrawableHit hit)
: base(strong) : base(strong, hit)
{ {
this.hit = hit;
} }
protected override void CheckForJudgements(bool userTriggered, double timeOffset) protected override void CheckForJudgements(bool userTriggered, double timeOffset)
{ {
if (!hit.Result.HasResult) if (!MainObject.Result.HasResult)
{ {
base.CheckForJudgements(userTriggered, timeOffset); base.CheckForJudgements(userTriggered, timeOffset);
return; return;
} }
if (!hit.Result.IsHit) if (!MainObject.Result.IsHit)
{ {
ApplyResult(r => r.Type = HitResult.Miss); ApplyResult(r => r.Type = HitResult.Miss);
return; return;
@ -44,22 +43,22 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
return; return;
} }
if (Math.Abs(hit.Result.TimeOffset - timeOffset) < second_hit_window) if (Math.Abs(MainObject.Result.TimeOffset - timeOffset) < second_hit_window)
ApplyResult(r => r.Type = HitResult.Great); ApplyResult(r => r.Type = HitResult.Great);
} }
public override bool OnPressed(TaikoAction action) public override bool OnPressed(TaikoAction action)
{ {
// Don't process actions until the main hitobject is hit // Don't process actions until the main hitobject is hit
if (!hit.IsHit) if (!MainObject.IsHit)
return false; return false;
// Don't process actions if the pressed button was released // Don't process actions if the pressed button was released
if (hit.HitAction == null) if (MainObject.HitAction == null)
return false; return false;
// Don't handle invalid hit action presses // Don't handle invalid hit action presses
if (!hit.HitActions.Contains(action)) if (!MainObject.HitActions.Contains(action))
return false; return false;
return UpdateJudgement(true); return UpdateJudgement(true);

View File

@ -7,9 +7,13 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{ {
public abstract class DrawableStrongHitObject : DrawableTaikoHitObject public abstract class DrawableStrongHitObject : DrawableTaikoHitObject
{ {
protected DrawableStrongHitObject(StrongHitObject strong) public readonly DrawableHitObject MainObject;
protected DrawableStrongHitObject(StrongHitObject strong, DrawableHitObject mainObject)
: base(strong) : base(strong)
{ {
MainObject = mainObject;
AlwaysPresent = true; AlwaysPresent = true;
} }

View File

@ -232,30 +232,32 @@ namespace osu.Game.Rulesets.Taiko.UI
if (!judgedObject.DisplayJudgement) if (!judgedObject.DisplayJudgement)
return; return;
if (judgementContainer.FirstOrDefault(j => j.JudgedObject == judgedObject) == null) switch (result.Judgement)
{ {
judgementContainer.Add(new DrawableTaikoJudgement(result, judgedObject) case TaikoStrongHitJudgement _:
{ if (result.IsHit)
Anchor = result.IsHit ? Anchor.TopLeft : Anchor.CentreLeft, hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == ((DrawableStrongHitObject)judgedObject).MainObject)?.VisualiseSecondHit();
Origin = result.IsHit ? Anchor.BottomCentre : Anchor.Centre, break;
RelativePositionAxes = Axes.X, default:
X = result.IsHit ? judgedObject.Position.X : 0, judgementContainer.Add(new DrawableTaikoJudgement(result, judgedObject)
}); {
} Anchor = result.IsHit ? Anchor.TopLeft : Anchor.CentreLeft,
Origin = result.IsHit ? Anchor.BottomCentre : Anchor.Centre,
RelativePositionAxes = Axes.X,
X = result.IsHit ? judgedObject.Position.X : 0,
});
if (!result.IsHit) if (!result.IsHit)
return; break;
bool isRim = judgedObject.HitObject is RimHit; bool isRim = judgedObject.HitObject is RimHit;
if (result.Judgement is TaikoStrongHitJudgement) hitExplosionContainer.Add(new HitExplosion(judgedObject, isRim));
hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == judgedObject)?.VisualiseSecondHit();
else
{
hitExplosionContainer.Add(new HitExplosion(judgedObject, isRim));
if (judgedObject.HitObject.Kiai) if (judgedObject.HitObject.Kiai)
kiaiExplosionContainer.Add(new KiaiHitExplosion(judgedObject, isRim)); kiaiExplosionContainer.Add(new KiaiHitExplosion(judgedObject, isRim));
break;
} }
} }
} }