Add barline drawables.

This commit is contained in:
smoogipooo 2017-03-21 20:39:18 +09:00
parent 4bc038addd
commit b602b7a3ea
5 changed files with 137 additions and 5 deletions

View File

@ -6,6 +6,7 @@
using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Taiko.Judgements;
using osu.Game.Modes.Taiko.Objects;
using osu.Game.Modes.Taiko.Objects.Drawable;
using osu.Game.Modes.Taiko.UI;
namespace osu.Desktop.VisualTests.Tests

View File

@ -0,0 +1,73 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Modes.Taiko.UI;
using OpenTK;
namespace osu.Game.Modes.Taiko.Objects.Drawable
{
/// <summary>
/// A line that scrolls alongside hit objects in the playfield and visualises control points.
/// </summary>
public class DrawableBarLine : Container
{
/// <summary>
/// The line.
/// </summary>
protected Box Tracker;
/// <summary>
/// The
/// </summary>
protected readonly BarLine BarLine;
public DrawableBarLine(BarLine barLine)
{
BarLine = barLine;
Anchor = Anchor.CentreLeft;
Origin = Anchor.Centre;
RelativePositionAxes = Axes.X;
RelativeSizeAxes = Axes.Y;
Width = 2f;
Children = new[]
{
Tracker = new Box
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
EdgeSmoothness = new Vector2(0.5f, 0),
Alpha = 0.75f
}
};
LifetimeStart = BarLine.StartTime - BarLine.PreEmpt * 2;
LifetimeEnd = BarLine.StartTime + BarLine.PreEmpt;
}
protected override void LoadComplete()
{
base.LoadComplete();
Delay(BarLine.StartTime);
FadeOut(100 * BarLine.PreEmpt / 1000);
}
private void moveToTimeOffset(double time) => MoveToX((float)((BarLine.StartTime - time) / BarLine.PreEmpt));
protected override void Update()
{
base.Update();
moveToTimeOffset(Time.Current);
}
}
}

View File

@ -0,0 +1,55 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using OpenTK;
namespace osu.Game.Modes.Taiko.Objects.Drawable
{
public class DrawableMajorBarLine : DrawableBarLine
{
public DrawableMajorBarLine(BarLine barLine)
: base(barLine)
{
Add(new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Children = new[]
{
new EquilateralTriangle
{
Name = "Top",
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Position = new Vector2(0, -10),
Size = new Vector2(-20),
EdgeSmoothness = new Vector2(1),
},
new EquilateralTriangle
{
Name = "Bottom",
Anchor = Anchor.BottomCentre,
Origin = Anchor.TopCentre,
Position = new Vector2(0, 10),
Size = new Vector2(20),
EdgeSmoothness = new Vector2(1),
}
}
});
Tracker.Alpha = 1f;
}
}
}

View File

@ -14,6 +14,7 @@
using osu.Framework.Graphics.Containers;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics.Primitives;
using osu.Game.Modes.Taiko.Objects.Drawable;
namespace osu.Game.Modes.Taiko.UI
{
@ -47,7 +48,7 @@ public class TaikoPlayfield : Playfield<TaikoHitObject, TaikoJudgementInfo>
protected override Container<Drawable> Content => hitObjectContainer;
private Container<RingExplosion> ringExplosionContainer;
//private Container<DrawableBarLine> barLineContainer;
private Container<DrawableBarLine> barLineContainer;
private Container<JudgementText> judgementContainer;
private Container hitObjectContainer;
@ -105,10 +106,10 @@ public TaikoPlayfield()
Scale = new Vector2(PLAYFIELD_SCALE),
BlendingMode = BlendingMode.Additive
},
//barLineContainer = new Container<DrawableBarLine>
//{
// RelativeSizeAxes = Axes.Both,
//},
barLineContainer = new Container<DrawableBarLine>
{
RelativeSizeAxes = Axes.Both,
},
new HitTarget
{
Anchor = Anchor.CentreLeft,

View File

@ -52,6 +52,8 @@
<Compile Include="Judgements\TaikoJudgementInfo.cs" />
<Compile Include="Judgements\TaikoScoreResult.cs" />
<Compile Include="Objects\BarLine.cs" />
<Compile Include="Objects\Drawable\DrawableBarLine.cs" />
<Compile Include="Objects\Drawable\DrawableMajorBarLine.cs" />
<Compile Include="TaikoDifficultyCalculator.cs" />
<Compile Include="Objects\Drawable\DrawableTaikoHit.cs" />
<Compile Include="Objects\TaikoHitObject.cs" />