mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 14:55:37 +08:00
Reduce complexity of instantiating circle pieces in hits.
This commit is contained in:
parent
ef992b03bf
commit
6e612bbefc
@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
protected override Key[] HitKeys { get; } = { Key.F, Key.J };
|
||||
|
||||
private readonly CirclePiece circlePiece;
|
||||
|
||||
public DrawableCentreHit(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
Add(circlePiece = new CirclePiece
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
new CentreHitSymbolPiece()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
circlePiece.AccentColour = colours.PinkDarker;
|
||||
Circle.AccentColour = colours.PinkDarker;
|
||||
}
|
||||
|
||||
protected override CirclePiece CreateCirclePiece() => new CirclePiece
|
||||
{
|
||||
Children = new[] { new CentreHitSymbolPiece() }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
@ -20,15 +21,17 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
|
||||
protected override Container<Framework.Graphics.Drawable> Content => bodyContainer;
|
||||
|
||||
protected readonly CirclePiece Circle;
|
||||
|
||||
private readonly Hit hit;
|
||||
|
||||
private readonly Container bodyContainer;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the last key pressed is a valid hit key.
|
||||
/// </summary>
|
||||
private bool validKeyPressed;
|
||||
|
||||
private readonly Container bodyContainer;
|
||||
|
||||
protected DrawableHit(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
@ -38,6 +41,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Children = new[]
|
||||
{
|
||||
Circle = CreateCirclePiece()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -100,5 +107,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
|
||||
Expire();
|
||||
}
|
||||
|
||||
protected abstract CirclePiece CreateCirclePiece();
|
||||
}
|
||||
}
|
||||
|
@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
protected override Key[] HitKeys { get; } = { Key.D, Key.K };
|
||||
|
||||
private readonly CirclePiece circlePiece;
|
||||
|
||||
public DrawableRimHit(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
Add(circlePiece = new CirclePiece
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
new RimHitSymbolPiece()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
circlePiece.AccentColour = colours.BlueDarker;
|
||||
Circle.AccentColour = colours.BlueDarker;
|
||||
}
|
||||
|
||||
protected override CirclePiece CreateCirclePiece() => new CirclePiece
|
||||
{
|
||||
Children = new[] { new RimHitSymbolPiece() }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
protected override Key[] HitKeys { get; } = { Key.F, Key.J };
|
||||
|
||||
private readonly CirclePiece circlePiece;
|
||||
|
||||
public DrawableStrongCentreHit(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
Add(circlePiece = new StrongCirclePiece
|
||||
{
|
||||
Children = new []
|
||||
{
|
||||
new CentreHitSymbolPiece()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
circlePiece.AccentColour = colours.PinkDarker;
|
||||
Circle.AccentColour = colours.PinkDarker;
|
||||
}
|
||||
|
||||
protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece
|
||||
{
|
||||
Children = new[] { new CentreHitSymbolPiece() }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
protected override Key[] HitKeys { get; } = { Key.D, Key.K };
|
||||
|
||||
private readonly CirclePiece circlePiece;
|
||||
|
||||
public DrawableStrongRimHit(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
Add(circlePiece = new StrongCirclePiece
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
new RimHitSymbolPiece()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
circlePiece.AccentColour = colours.BlueDarker;
|
||||
Circle.AccentColour = colours.BlueDarker;
|
||||
}
|
||||
|
||||
protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece
|
||||
{
|
||||
Children = new[] { new RimHitSymbolPiece() }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user