1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:07:25 +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
{
private readonly DrawableDrumRoll drumRoll;
public DrawableStrongDrumRoll(StrongHitObject strong, DrawableDrumRoll drumRoll)
: base(strong)
: base(strong, drumRoll)
{
this.drumRoll = drumRoll;
}
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
{
if (!drumRoll.Judged)
if (!MainObject.Judged)
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;

View File

@ -7,20 +7,17 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
public class DrawableStrongDrumRollTick : DrawableStrongHitObject
{
private readonly DrawableDrumRollTick tick;
public DrawableStrongDrumRollTick(StrongHitObject strong, DrawableDrumRollTick tick)
: base(strong)
: base(strong, tick)
{
this.tick = tick;
}
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
{
if (!tick.Judged)
if (!MainObject.Judged)
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;

View File

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

View File

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

View File

@ -232,30 +232,32 @@ namespace osu.Game.Rulesets.Taiko.UI
if (!judgedObject.DisplayJudgement)
return;
if (judgementContainer.FirstOrDefault(j => j.JudgedObject == judgedObject) == null)
switch (result.Judgement)
{
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,
});
}
case TaikoStrongHitJudgement _:
if (result.IsHit)
hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == ((DrawableStrongHitObject)judgedObject).MainObject)?.VisualiseSecondHit();
break;
default:
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)
return;
if (!result.IsHit)
break;
bool isRim = judgedObject.HitObject is RimHit;
bool isRim = judgedObject.HitObject is RimHit;
if (result.Judgement is TaikoStrongHitJudgement)
hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == judgedObject)?.VisualiseSecondHit();
else
{
hitExplosionContainer.Add(new HitExplosion(judgedObject, isRim));
hitExplosionContainer.Add(new HitExplosion(judgedObject, isRim));
if (judgedObject.HitObject.Kiai)
kiaiExplosionContainer.Add(new KiaiHitExplosion(judgedObject, isRim));
if (judgedObject.HitObject.Kiai)
kiaiExplosionContainer.Add(new KiaiHitExplosion(judgedObject, isRim));
break;
}
}
}