1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 07:32:55 +08:00

Merge branch 'master' into general-fixes

This commit is contained in:
Dan Balasescu 2017-04-04 20:27:26 +09:00 committed by GitHub
commit eef49c8195
25 changed files with 353 additions and 89 deletions

View File

@ -6,7 +6,7 @@ using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; using osu.Game.Modes.Taiko.Objects.Drawables.Pieces;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {

View File

@ -8,7 +8,7 @@ using osu.Framework.Testing;
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; using osu.Game.Modes.Taiko.Objects;
using osu.Game.Modes.Taiko.Objects.Drawable; using osu.Game.Modes.Taiko.Objects.Drawables;
using osu.Game.Modes.Taiko.UI; using osu.Game.Modes.Taiko.UI;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
@ -19,6 +19,8 @@ namespace osu.Desktop.VisualTests.Tests
private TaikoPlayfield playfield; private TaikoPlayfield playfield;
protected override double TimePerAction => 500;
public override void Reset() public override void Reset()
{ {
base.Reset(); base.Reset();
@ -32,6 +34,8 @@ namespace osu.Desktop.VisualTests.Tests
AddStep("Strong Centre", () => addCentreHit(true)); AddStep("Strong Centre", () => addCentreHit(true));
AddStep("Rim", () => addRimHit(false)); AddStep("Rim", () => addRimHit(false));
AddStep("Strong Rim", () => addRimHit(true)); AddStep("Strong Rim", () => addRimHit(true));
AddStep("Add bar line", () => addBarLine(false));
AddStep("Add major bar line", () => addBarLine(true));
Add(new Container Add(new Container
{ {
@ -73,12 +77,23 @@ namespace osu.Desktop.VisualTests.Tests
}); });
} }
private void addBarLine(bool major)
{
BarLine bl = new BarLine
{
StartTime = Time.Current + 1000,
PreEmpt = 1000
};
playfield.AddBarLine(major ? new DrawableMajorBarLine(bl) : new DrawableBarLine(bl));
}
private void addSwell() private void addSwell()
{ {
playfield.Add(new DrawableSwell(new Swell playfield.Add(new DrawableSwell(new Swell
{ {
StartTime = Time.Current + 1000, StartTime = Time.Current + 1000,
EndTime = Time.Current + 5000, EndTime = Time.Current + 1000,
PreEmpt = 1000 PreEmpt = 1000
})); }));
} }
@ -88,7 +103,7 @@ namespace osu.Desktop.VisualTests.Tests
var d = new DrumRoll var d = new DrumRoll
{ {
StartTime = Time.Current + 1000, StartTime = Time.Current + 1000,
Distance = 20000, Distance = 1000,
PreEmpt = 1000, PreEmpt = 1000,
}; };

View File

@ -0,0 +1,26 @@
// 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.Game.Beatmaps.Timing;
using osu.Game.Database;
namespace osu.Game.Modes.Taiko.Objects
{
public class BarLine
{
/// <summary>
/// The start time of the control point this bar line represents.
/// </summary>
public double StartTime;
/// <summary>
/// The time to scroll in the bar line.
/// </summary>
public double PreEmpt;
public void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
{
PreEmpt = TaikoHitObject.BASE_SCROLL_TIME / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / 1000;
}
}
}

View File

@ -0,0 +1,81 @@
// 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.Drawables
{
/// <summary>
/// A line that scrolls alongside hit objects in the playfield and visualises control points.
/// </summary>
public class DrawableBarLine : Container
{
/// <summary>
/// The width of the line tracker.
/// </summary>
private const float tracker_width = 2f;
/// <summary>
/// Fade out time calibrated to a pre-empt of 1000ms.
/// </summary>
private const float base_fadeout_time = 100f;
/// <summary>
/// The visual line tracker.
/// </summary>
protected Box Tracker;
/// <summary>
/// The bar line.
/// </summary>
protected readonly BarLine BarLine;
public DrawableBarLine(BarLine barLine)
{
BarLine = barLine;
Anchor = Anchor.CentreLeft;
Origin = Anchor.Centre;
RelativePositionAxes = Axes.X;
RelativeSizeAxes = Axes.Y;
Width = tracker_width;
Children = new[]
{
Tracker = new Box
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
EdgeSmoothness = new Vector2(0.5f, 0),
Alpha = 0.75f
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
LifetimeStart = BarLine.StartTime - BarLine.PreEmpt * 2;
LifetimeEnd = BarLine.StartTime + BarLine.PreEmpt;
Delay(BarLine.StartTime - Time.Current);
FadeOut(base_fadeout_time * BarLine.PreEmpt / 1000);
}
private void updateScrollPosition(double time) => MoveToX((float)((BarLine.StartTime - time) / BarLine.PreEmpt));
protected override void Update()
{
base.Update();
updateScrollPosition(Time.Current);
}
}
}

View File

@ -1,12 +1,12 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Input;
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
using osu.Game.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Graphics;
using osu.Game.Modes.Taiko.Objects.Drawables.Pieces;
using OpenTK.Input;
namespace osu.Game.Modes.Taiko.Objects.Drawable namespace osu.Game.Modes.Taiko.Objects.Drawables
{ {
public class DrawableCentreHit : DrawableHit public class DrawableCentreHit : DrawableHit
{ {

View File

@ -1,18 +1,18 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK; using System.Linq;
using OpenTK.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Game.Graphics; using osu.Game.Graphics;
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 osu.Game.Modes.Taiko.Objects.Drawables.Pieces;
using System.Linq; using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Modes.Taiko.Objects.Drawable namespace osu.Game.Modes.Taiko.Objects.Drawables
{ {
public class DrawableDrumRoll : DrawableTaikoHitObject public class DrawableDrumRoll : DrawableTaikoHitObject
{ {

View File

@ -1,17 +1,17 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Input;
using osu.Game.Modes.Taiko.Judgements;
using System; using System;
using osu.Game.Modes.Objects.Drawables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Taiko.Judgements;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Graphics.Sprites; using OpenTK.Input;
namespace osu.Game.Modes.Taiko.Objects.Drawable namespace osu.Game.Modes.Taiko.Objects.Drawables
{ {
public class DrawableDrumRollTick : DrawableTaikoHitObject public class DrawableDrumRollTick : DrawableTaikoHitObject
{ {

View File

@ -1,16 +1,16 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Input; using System;
using System.Linq;
using osu.Framework.Graphics; 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 osu.Game.Modes.Taiko.Objects.Drawables.Pieces;
using System; using OpenTK.Input;
using System.Linq;
namespace osu.Game.Modes.Taiko.Objects.Drawable namespace osu.Game.Modes.Taiko.Objects.Drawables
{ {
public abstract class DrawableHit : DrawableTaikoHitObject public abstract class DrawableHit : DrawableTaikoHitObject
{ {
@ -19,7 +19,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
/// </summary> /// </summary>
protected abstract Key[] HitKeys { get; } protected abstract Key[] HitKeys { get; }
protected override Container<Framework.Graphics.Drawable> Content => bodyContainer; protected override Container<Drawable> Content => bodyContainer;
protected readonly CirclePiece Circle; protected readonly CirclePiece Circle;

View File

@ -0,0 +1,57 @@
// 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.Drawables
{
public class DrawableMajorBarLine : DrawableBarLine
{
/// <summary>
/// The vertical offset of the triangles from the line tracker.
/// </summary>
private const float triangle_offfset = 10f;
/// <summary>
/// The size of the triangles.
/// </summary>
private const float triangle_size = 20f;
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, -triangle_offfset),
Size = new Vector2(-triangle_size),
EdgeSmoothness = new Vector2(1),
},
new EquilateralTriangle
{
Name = "Bottom",
Anchor = Anchor.BottomCentre,
Origin = Anchor.TopCentre,
Position = new Vector2(0, triangle_offfset),
Size = new Vector2(triangle_size),
EdgeSmoothness = new Vector2(1),
}
}
});
Tracker.Alpha = 1f;
}
}
}

View File

@ -3,10 +3,10 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Modes.Taiko.Objects.Drawables.Pieces;
using OpenTK.Input; using OpenTK.Input;
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
namespace osu.Game.Modes.Taiko.Objects.Drawable namespace osu.Game.Modes.Taiko.Objects.Drawables
{ {
public class DrawableRimHit : DrawableHit public class DrawableRimHit : DrawableHit
{ {

View File

@ -1,12 +1,12 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Input;
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Modes.Taiko.Objects.Drawables.Pieces;
using OpenTK.Input;
namespace osu.Game.Modes.Taiko.Objects.Drawable namespace osu.Game.Modes.Taiko.Objects.Drawables
{ {
public class DrawableStrongCentreHit : DrawableStrongHit public class DrawableStrongCentreHit : DrawableStrongHit
{ {

View File

@ -2,9 +2,9 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Judgements;
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; using osu.Game.Modes.Taiko.Objects.Drawables.Pieces;
namespace osu.Game.Modes.Taiko.Objects.Drawable namespace osu.Game.Modes.Taiko.Objects.Drawables
{ {
public class DrawableStrongDrumRoll : DrawableDrumRoll public class DrawableStrongDrumRoll : DrawableDrumRoll
{ {

View File

@ -1,14 +1,14 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Input;
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Input; using osu.Framework.Input;
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 OpenTK.Input;
namespace osu.Game.Modes.Taiko.Objects.Drawable namespace osu.Game.Modes.Taiko.Objects.Drawables
{ {
public abstract class DrawableStrongHit : DrawableHit public abstract class DrawableStrongHit : DrawableHit
{ {

View File

@ -3,10 +3,10 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Modes.Taiko.Objects.Drawables.Pieces;
using OpenTK.Input; using OpenTK.Input;
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
namespace osu.Game.Modes.Taiko.Objects.Drawable namespace osu.Game.Modes.Taiko.Objects.Drawables
{ {
public class DrawableStrongRimHit : DrawableStrongHit public class DrawableStrongRimHit : DrawableStrongHit
{ {

View File

@ -1,9 +1,8 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK; using System;
using OpenTK.Graphics; using System.Linq;
using OpenTK.Input;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -12,11 +11,12 @@ using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics; using osu.Game.Graphics;
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 osu.Game.Modes.Taiko.Objects.Drawables.Pieces;
using System; using OpenTK;
using System.Linq; using OpenTK.Graphics;
using OpenTK.Input;
namespace osu.Game.Modes.Taiko.Objects.Drawable namespace osu.Game.Modes.Taiko.Objects.Drawables
{ {
public class DrawableSwell : DrawableTaikoHitObject public class DrawableSwell : DrawableTaikoHitObject
{ {
@ -56,11 +56,11 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
{ {
this.swell = swell; this.swell = swell;
Children = new Framework.Graphics.Drawable[] Children = new Drawable[]
{ {
bodyContainer = new Container bodyContainer = new Container
{ {
Children = new Framework.Graphics.Drawable[] Children = new Drawable[]
{ {
expandingRing = new CircularContainer expandingRing = new CircularContainer
{ {
@ -89,7 +89,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
Masking = true, Masking = true,
BorderThickness = target_ring_thick_border, BorderThickness = target_ring_thick_border,
BlendingMode = BlendingMode.Additive, BlendingMode = BlendingMode.Additive,
Children = new Framework.Graphics.Drawable[] Children = new Drawable[]
{ {
new Box new Box
{ {

View File

@ -1,14 +1,14 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Input; using System.Collections.Generic;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input;
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 System.Collections.Generic; using OpenTK.Input;
using osu.Framework.Input;
namespace osu.Game.Modes.Taiko.Objects.Drawable namespace osu.Game.Modes.Taiko.Objects.Drawables
{ {
public abstract class DrawableTaikoHitObject : DrawableHitObject<TaikoHitObject, TaikoJudgement> public abstract class DrawableTaikoHitObject : DrawableHitObject<TaikoHitObject, TaikoJudgement>
{ {

View File

@ -1,12 +1,12 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using OpenTK; using OpenTK;
namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces
{ {
/// <summary> /// <summary>
/// The symbol used for centre hit pieces. /// The symbol used for centre hit pieces.

View File

@ -1,16 +1,16 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Backgrounds;
using OpenTK.Graphics; using OpenTK.Graphics;
using System;
using osu.Game.Graphics;
namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces
{ {
/// <summary> /// <summary>
/// A circle piece which is used uniformly through osu!taiko to visualise hitobjects. /// A circle piece which is used uniformly through osu!taiko to visualise hitobjects.
@ -63,7 +63,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
set { throw new InvalidOperationException($"{nameof(CirclePiece)} must always use CentreLeft origin."); } set { throw new InvalidOperationException($"{nameof(CirclePiece)} must always use CentreLeft origin."); }
} }
protected override Container<Framework.Graphics.Drawable> Content => SymbolContainer; protected override Container<Drawable> Content => SymbolContainer;
protected readonly Container SymbolContainer; protected readonly Container SymbolContainer;
private readonly Container background; private readonly Container background;
@ -81,7 +81,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Children = new Framework.Graphics.Drawable[] Children = new Drawable[]
{ {
background = new CircularContainer background = new CircularContainer
{ {
@ -90,7 +90,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Masking = true, Masking = true,
Children = new Framework.Graphics.Drawable[] Children = new Drawable[]
{ {
new Box new Box
{ {

View File

@ -1,13 +1,13 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces
{ {
/// <summary> /// <summary>
/// The symbol used for rim hit pieces. /// The symbol used for rim hit pieces.

View File

@ -3,7 +3,7 @@
using OpenTK; using OpenTK;
namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces
{ {
/// <summary> /// <summary>
/// A type of circle piece which is drawn at a higher scale to represent a "strong" piece. /// A type of circle piece which is drawn at a higher scale to represent a "strong" piece.

View File

@ -1,10 +1,10 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Graphics;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Graphics;
namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces
{ {
/// <summary> /// <summary>
/// The symbol used for swell pieces. /// The symbol used for swell pieces.

View File

@ -17,7 +17,7 @@ namespace osu.Game.Modes.Taiko.Objects
/// <summary> /// <summary>
/// Time (in milliseconds) to scroll in the hit object with a speed-adjusted beat length of 1 second. /// Time (in milliseconds) to scroll in the hit object with a speed-adjusted beat length of 1 second.
/// </summary> /// </summary>
private const double base_scroll_time = 6000; public const double BASE_SCROLL_TIME = 6000;
/// <summary> /// <summary>
/// The velocity multiplier applied to this hit object. /// The velocity multiplier applied to this hit object.
@ -44,7 +44,7 @@ namespace osu.Game.Modes.Taiko.Objects
{ {
base.ApplyDefaults(timing, difficulty); base.ApplyDefaults(timing, difficulty);
PreEmpt = base_scroll_time / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / VelocityMultiplier / 1000; PreEmpt = BASE_SCROLL_TIME / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / VelocityMultiplier / 1000;
ControlPoint overridePoint; ControlPoint overridePoint;
Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode; Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode;

View File

@ -1,17 +1,21 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Beatmaps; using osu.Framework.Allocation;
using osu.Framework.MathUtils;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Timing;
using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Objects.Types;
using osu.Game.Modes.Replays;
using osu.Game.Modes.Scoring; using osu.Game.Modes.Scoring;
using osu.Game.Modes.Taiko.Beatmaps; using osu.Game.Modes.Taiko.Beatmaps;
using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Judgements;
using osu.Game.Modes.Taiko.Objects; using osu.Game.Modes.Taiko.Objects;
using osu.Game.Modes.Taiko.Objects.Drawable; using osu.Game.Modes.Taiko.Objects.Drawables;
using osu.Game.Modes.Taiko.Scoring; using osu.Game.Modes.Taiko.Scoring;
using osu.Game.Modes.UI; using osu.Game.Modes.UI;
using osu.Game.Modes.Replays;
using osu.Game.Modes.Taiko.Replays; using osu.Game.Modes.Taiko.Replays;
namespace osu.Game.Modes.Taiko.UI namespace osu.Game.Modes.Taiko.UI
@ -23,6 +27,79 @@ namespace osu.Game.Modes.Taiko.UI
{ {
} }
[BackgroundDependencyLoader]
private void load()
{
loadBarLines();
}
private void loadBarLines()
{
var taikoPlayfield = Playfield as TaikoPlayfield;
if (taikoPlayfield == null)
return;
TaikoHitObject lastObject = Beatmap.HitObjects[Beatmap.HitObjects.Count - 1];
double lastHitTime = 1 + (lastObject as IHasEndTime)?.EndTime ?? lastObject.StartTime;
var timingPoints = Beatmap.TimingInfo.ControlPoints.FindAll(cp => cp.TimingChange);
if (timingPoints.Count == 0)
return;
int currentIndex = 0;
while (currentIndex < timingPoints.Count && Precision.AlmostEquals(timingPoints[currentIndex].BeatLength, 0))
currentIndex++;
double time = timingPoints[currentIndex].Time;
double measureLength = timingPoints[currentIndex].BeatLength * (int)timingPoints[currentIndex].TimeSignature;
// Find the bar line time closest to 0
time -= measureLength * (int)(time / measureLength);
// Always start barlines from a positive time
while (time < 0)
time += measureLength;
int currentBeat = 0;
while (time <= lastHitTime)
{
ControlPoint current = timingPoints[currentIndex];
if (time > current.Time || current.OmitFirstBarLine)
{
bool isMajor = currentBeat % (int)current.TimeSignature == 0;
var barLine = new BarLine
{
StartTime = time,
};
barLine.ApplyDefaults(Beatmap.TimingInfo, Beatmap.BeatmapInfo.Difficulty);
taikoPlayfield.AddBarLine(isMajor ? new DrawableMajorBarLine(barLine) : new DrawableBarLine(barLine));
currentBeat++;
}
double bl = current.BeatLength;
if (bl < 800)
bl *= (int)current.TimeSignature;
time += bl;
if (currentIndex + 1 >= timingPoints.Count || time < timingPoints[currentIndex + 1].Time)
continue;
currentBeat = 0;
currentIndex++;
time = timingPoints[currentIndex].Time;
}
}
public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor(this); public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor(this);
protected override IBeatmapConverter<TaikoHitObject> CreateBeatmapConverter() => new TaikoBeatmapConverter(); protected override IBeatmapConverter<TaikoHitObject> CreateBeatmapConverter() => new TaikoBeatmapConverter();

View File

@ -14,8 +14,8 @@ using osu.Game.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Game.Modes.Taiko.Objects.Drawable;
using System.Linq; using System.Linq;
using osu.Game.Modes.Taiko.Objects.Drawables;
namespace osu.Game.Modes.Taiko.UI namespace osu.Game.Modes.Taiko.UI
{ {
@ -40,7 +40,7 @@ namespace osu.Game.Modes.Taiko.UI
protected override Container<Drawable> Content => hitObjectContainer; protected override Container<Drawable> Content => hitObjectContainer;
private readonly Container<HitExplosion> hitExplosionContainer; private readonly Container<HitExplosion> hitExplosionContainer;
//private Container<DrawableBarLine> barLineContainer; private readonly Container<DrawableBarLine> barLineContainer;
private readonly Container<DrawableTaikoJudgement> judgementContainer; private readonly Container<DrawableTaikoJudgement> judgementContainer;
private readonly Container hitObjectContainer; private readonly Container hitObjectContainer;
@ -96,10 +96,10 @@ namespace osu.Game.Modes.Taiko.UI
Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2),
BlendingMode = BlendingMode.Additive BlendingMode = BlendingMode.Additive
}, },
//barLineContainer = new Container<DrawableBarLine> barLineContainer = new Container<DrawableBarLine>
//{ {
// RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
//}, },
new HitTarget new HitTarget
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
@ -174,6 +174,11 @@ namespace osu.Game.Modes.Taiko.UI
swell.OnStart += () => topLevelHitContainer.Add(swell.CreateProxy()); swell.OnStart += () => topLevelHitContainer.Add(swell.CreateProxy());
} }
public void AddBarLine(DrawableBarLine barLine)
{
barLineContainer.Add(barLine);
}
public override void OnJudgement(DrawableHitObject<TaikoHitObject, TaikoJudgement> judgedObject) public override void OnJudgement(DrawableHitObject<TaikoHitObject, TaikoJudgement> judgedObject)
{ {
bool wasHit = judgedObject.Judgement.Result == HitResult.Hit; bool wasHit = judgedObject.Judgement.Result == HitResult.Hit;

View File

@ -53,23 +53,26 @@
<Compile Include="Judgements\TaikoStrongHitJudgement.cs" /> <Compile Include="Judgements\TaikoStrongHitJudgement.cs" />
<Compile Include="Judgements\TaikoJudgement.cs" /> <Compile Include="Judgements\TaikoJudgement.cs" />
<Compile Include="Judgements\TaikoHitResult.cs" /> <Compile Include="Judgements\TaikoHitResult.cs" />
<Compile Include="Objects\BarLine.cs" />
<Compile Include="Objects\Drawables\DrawableBarLine.cs" />
<Compile Include="Objects\Drawables\DrawableMajorBarLine.cs" />
<Compile Include="Objects\CentreHit.cs" /> <Compile Include="Objects\CentreHit.cs" />
<Compile Include="Objects\Drawable\DrawableRimHit.cs" /> <Compile Include="Objects\Drawables\DrawableRimHit.cs" />
<Compile Include="Objects\Drawable\DrawableStrongRimHit.cs" /> <Compile Include="Objects\Drawables\DrawableStrongRimHit.cs" />
<Compile Include="Objects\Drawable\DrawableCentreHit.cs" /> <Compile Include="Objects\Drawables\DrawableCentreHit.cs" />
<Compile Include="Objects\Drawable\DrawableHit.cs" /> <Compile Include="Objects\Drawables\DrawableHit.cs" />
<Compile Include="Objects\Drawable\DrawableStrongDrumRoll.cs" /> <Compile Include="Objects\Drawables\DrawableStrongDrumRoll.cs" />
<Compile Include="Objects\Drawable\DrawableStrongCentreHit.cs" /> <Compile Include="Objects\Drawables\DrawableStrongCentreHit.cs" />
<Compile Include="Objects\Drawable\DrawableStrongHit.cs" /> <Compile Include="Objects\Drawables\DrawableStrongHit.cs" />
<Compile Include="Objects\Drawable\Pieces\CentreHitSymbolPiece.cs" /> <Compile Include="Objects\Drawables\Pieces\CentreHitSymbolPiece.cs" />
<Compile Include="Objects\Drawable\DrawableDrumRoll.cs" /> <Compile Include="Objects\Drawables\DrawableDrumRoll.cs" />
<Compile Include="Objects\Drawable\DrawableDrumRollTick.cs" /> <Compile Include="Objects\Drawables\DrawableDrumRollTick.cs" />
<Compile Include="Objects\Drawable\DrawableSwell.cs" /> <Compile Include="Objects\Drawables\DrawableSwell.cs" />
<Compile Include="Objects\Drawable\DrawableTaikoHitObject.cs" /> <Compile Include="Objects\Drawables\DrawableTaikoHitObject.cs" />
<Compile Include="Objects\Drawable\Pieces\RimHitSymbolPiece.cs" /> <Compile Include="Objects\Drawables\Pieces\RimHitSymbolPiece.cs" />
<Compile Include="Objects\Drawable\Pieces\StrongCirclePiece.cs" /> <Compile Include="Objects\Drawables\Pieces\StrongCirclePiece.cs" />
<Compile Include="Objects\Drawable\Pieces\CirclePiece.cs" /> <Compile Include="Objects\Drawables\Pieces\CirclePiece.cs" />
<Compile Include="Objects\Drawable\Pieces\SwellSymbolPiece.cs" /> <Compile Include="Objects\Drawables\Pieces\SwellSymbolPiece.cs" />
<Compile Include="Objects\DrumRoll.cs" /> <Compile Include="Objects\DrumRoll.cs" />
<Compile Include="Objects\DrumRollTick.cs" /> <Compile Include="Objects\DrumRollTick.cs" />
<Compile Include="Objects\Hit.cs" /> <Compile Include="Objects\Hit.cs" />