mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 00:52:59 +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 };
|
protected override Key[] HitKeys { get; } = { Key.F, Key.J };
|
||||||
|
|
||||||
private readonly CirclePiece circlePiece;
|
|
||||||
|
|
||||||
public DrawableCentreHit(Hit hit)
|
public DrawableCentreHit(Hit hit)
|
||||||
: base(hit)
|
: base(hit)
|
||||||
{
|
{
|
||||||
Add(circlePiece = new CirclePiece
|
|
||||||
{
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new CentreHitSymbolPiece()
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
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.Framework.Graphics.Containers;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
using osu.Game.Modes.Taiko.Judgements;
|
using osu.Game.Modes.Taiko.Judgements;
|
||||||
|
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@ -20,15 +21,17 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
|||||||
|
|
||||||
protected override Container<Framework.Graphics.Drawable> Content => bodyContainer;
|
protected override Container<Framework.Graphics.Drawable> Content => bodyContainer;
|
||||||
|
|
||||||
|
protected readonly CirclePiece Circle;
|
||||||
|
|
||||||
private readonly Hit hit;
|
private readonly Hit hit;
|
||||||
|
|
||||||
|
private readonly Container bodyContainer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the last key pressed is a valid hit key.
|
/// Whether the last key pressed is a valid hit key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool validKeyPressed;
|
private bool validKeyPressed;
|
||||||
|
|
||||||
private readonly Container bodyContainer;
|
|
||||||
|
|
||||||
protected DrawableHit(Hit hit)
|
protected DrawableHit(Hit hit)
|
||||||
: base(hit)
|
: base(hit)
|
||||||
{
|
{
|
||||||
@ -38,6 +41,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
Circle = CreateCirclePiece()
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,5 +107,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
|||||||
|
|
||||||
Expire();
|
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 };
|
protected override Key[] HitKeys { get; } = { Key.D, Key.K };
|
||||||
|
|
||||||
private readonly CirclePiece circlePiece;
|
|
||||||
|
|
||||||
public DrawableRimHit(Hit hit)
|
public DrawableRimHit(Hit hit)
|
||||||
: base(hit)
|
: base(hit)
|
||||||
{
|
{
|
||||||
Add(circlePiece = new CirclePiece
|
|
||||||
{
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new RimHitSymbolPiece()
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
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 };
|
protected override Key[] HitKeys { get; } = { Key.F, Key.J };
|
||||||
|
|
||||||
private readonly CirclePiece circlePiece;
|
|
||||||
|
|
||||||
public DrawableStrongCentreHit(Hit hit)
|
public DrawableStrongCentreHit(Hit hit)
|
||||||
: base(hit)
|
: base(hit)
|
||||||
{
|
{
|
||||||
Add(circlePiece = new StrongCirclePiece
|
|
||||||
{
|
|
||||||
Children = new []
|
|
||||||
{
|
|
||||||
new CentreHitSymbolPiece()
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
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 };
|
protected override Key[] HitKeys { get; } = { Key.D, Key.K };
|
||||||
|
|
||||||
private readonly CirclePiece circlePiece;
|
|
||||||
|
|
||||||
public DrawableStrongRimHit(Hit hit)
|
public DrawableStrongRimHit(Hit hit)
|
||||||
: base(hit)
|
: base(hit)
|
||||||
{
|
{
|
||||||
Add(circlePiece = new StrongCirclePiece
|
|
||||||
{
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new RimHitSymbolPiece()
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
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