mirror of
https://github.com/osukey/osukey.git
synced 2025-08-02 22:26:41 +09:00
Merge branch 'master' into better-hitsounds
This commit is contained in:
9
osu.Game.Modes.Taiko/Objects/BarLine.cs
Normal file
9
osu.Game.Modes.Taiko/Objects/BarLine.cs
Normal file
@ -0,0 +1,9 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects
|
||||
{
|
||||
public class BarLine : TaikoHitObject
|
||||
{
|
||||
}
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// 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 osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
public class DrawableDrumRollTick : DrawableTaikoHitObject
|
||||
{
|
||||
/// <summary>
|
||||
/// The size of a tick.
|
||||
/// </summary>
|
||||
private const float tick_size = TaikoHitObject.CIRCLE_RADIUS / 2;
|
||||
|
||||
/// <summary>
|
||||
/// Any tick that is not the first for a drumroll is not filled, but is instead displayed
|
||||
/// as a hollow circle. This is what controls the border width of that circle.
|
||||
/// </summary>
|
||||
private const float tick_border_width = tick_size / 4;
|
||||
|
||||
private readonly DrumRollTick tick;
|
||||
|
||||
private readonly CircularContainer bodyContainer;
|
||||
|
||||
public DrawableDrumRollTick(DrumRollTick tick)
|
||||
: base(tick)
|
||||
{
|
||||
this.tick = tick;
|
||||
|
||||
Anchor = Anchor.CentreLeft;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
RelativePositionAxes = Axes.X;
|
||||
Size = new Vector2(tick_size);
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
bodyContainer = new CircularContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
BorderThickness = tick_border_width,
|
||||
BorderColour = Color4.White,
|
||||
Children = new[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = tick.FirstTick ? 1 : 0,
|
||||
AlwaysPresent = true
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override TaikoJudgement CreateJudgement() => new TaikoDrumRollTickJudgement { SecondHit = tick.IsStrong };
|
||||
|
||||
protected override void CheckJudgement(bool userTriggered)
|
||||
{
|
||||
if (!userTriggered)
|
||||
{
|
||||
if (Judgement.TimeOffset > tick.HitWindow)
|
||||
Judgement.Result = HitResult.Miss;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Math.Abs(Judgement.TimeOffset) < tick.HitWindow)
|
||||
{
|
||||
Judgement.Result = HitResult.Hit;
|
||||
Judgement.TaikoResult = TaikoHitResult.Great;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case ArmedState.Hit:
|
||||
bodyContainer.ScaleTo(0, 100, EasingTypes.OutQuint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateScrollPosition(double time)
|
||||
{
|
||||
// Ticks don't move
|
||||
}
|
||||
|
||||
protected override bool HandleKeyPress(Key key)
|
||||
{
|
||||
return Judgement.Result == HitResult.None && UpdateJudgement(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
// 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.Modes.Taiko.Judgements;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
public class DrawableStrongDrumRoll : DrawableDrumRoll
|
||||
{
|
||||
public DrawableStrongDrumRoll(DrumRoll drumRoll)
|
||||
: base(drumRoll)
|
||||
{
|
||||
}
|
||||
|
||||
protected override TaikoJudgement CreateJudgement() => new TaikoJudgement { SecondHit = true };
|
||||
|
||||
protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece();
|
||||
}
|
||||
}
|
@ -1,158 +0,0 @@
|
||||
// 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.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using OpenTK.Graphics;
|
||||
using System;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
||||
{
|
||||
/// <summary>
|
||||
/// A circle piece which is used uniformly through osu!taiko to visualise hitobjects.
|
||||
/// <para>
|
||||
/// The body of this piece will overshoot its parent by <see cref="CirclePiece.Height"/> to form
|
||||
/// a rounded (_[-Width-]_) figure such that a regular "circle" is the result of a parent with Width = 0.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public class CirclePiece : Container, IHasAccentColour
|
||||
{
|
||||
public const float SYMBOL_SIZE = TaikoHitObject.CIRCLE_RADIUS * 2f * 0.45f;
|
||||
public const float SYMBOL_BORDER = 8;
|
||||
public const float SYMBOL_INNER_SIZE = SYMBOL_SIZE - 2 * SYMBOL_BORDER;
|
||||
|
||||
private Color4 accentColour;
|
||||
/// <summary>
|
||||
/// The colour of the inner circle and outer glows.
|
||||
/// </summary>
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return accentColour; }
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
|
||||
background.Colour = AccentColour;
|
||||
|
||||
resetEdgeEffects();
|
||||
}
|
||||
}
|
||||
|
||||
private bool kiaiMode;
|
||||
/// <summary>
|
||||
/// Whether Kiai mode effects are enabled for this circle piece.
|
||||
/// </summary>
|
||||
public bool KiaiMode
|
||||
{
|
||||
get { return kiaiMode; }
|
||||
set
|
||||
{
|
||||
kiaiMode = value;
|
||||
|
||||
resetEdgeEffects();
|
||||
}
|
||||
}
|
||||
|
||||
public override Anchor Origin
|
||||
{
|
||||
get { return Anchor.CentreLeft; }
|
||||
set { throw new InvalidOperationException($"{nameof(CirclePiece)} must always use CentreLeft origin."); }
|
||||
}
|
||||
|
||||
protected override Container<Framework.Graphics.Drawable> Content => SymbolContainer;
|
||||
protected readonly Container SymbolContainer;
|
||||
|
||||
private readonly Container background;
|
||||
private readonly Container innerLayer;
|
||||
|
||||
public CirclePiece()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = TaikoHitObject.CIRCLE_RADIUS * 2;
|
||||
|
||||
// The "inner layer" is the body of the CirclePiece that overshoots it by Height/2 px on both sides
|
||||
AddInternal(innerLayer = new Container
|
||||
{
|
||||
Name = "Inner Layer",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Children = new Framework.Graphics.Drawable[]
|
||||
{
|
||||
background = new CircularContainer
|
||||
{
|
||||
Name = "Background",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
Children = new Framework.Graphics.Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new Triangles
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ColourLight = Color4.White,
|
||||
ColourDark = Color4.White.Darken(0.1f)
|
||||
}
|
||||
}
|
||||
},
|
||||
new CircularContainer
|
||||
{
|
||||
Name = "Ring",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
BorderThickness = 8,
|
||||
BorderColour = Color4.White,
|
||||
Masking = true,
|
||||
Children = new[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
AlwaysPresent = true
|
||||
}
|
||||
}
|
||||
},
|
||||
SymbolContainer = new Container
|
||||
{
|
||||
Name = "Symbol",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
// Add the overshoot to compensate for corner radius
|
||||
innerLayer.Width = DrawWidth + DrawHeight;
|
||||
}
|
||||
|
||||
private void resetEdgeEffects()
|
||||
{
|
||||
background.EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Glow,
|
||||
Colour = AccentColour,
|
||||
Radius = KiaiMode ? 50 : 8
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
||||
{
|
||||
/// <summary>
|
||||
/// A type of circle piece which is drawn at a higher scale to represent a "strong" piece.
|
||||
/// </summary>
|
||||
public class StrongCirclePiece : CirclePiece
|
||||
{
|
||||
/// <summary>
|
||||
/// The amount to scale up the base circle to show it as a "strong" piece.
|
||||
/// </summary>
|
||||
private const float strong_scale = 1.5f;
|
||||
|
||||
public StrongCirclePiece()
|
||||
{
|
||||
SymbolContainer.Scale = new Vector2(strong_scale);
|
||||
}
|
||||
|
||||
public override Vector2 Size => new Vector2(base.Size.X, base.Size.Y * strong_scale);
|
||||
}
|
||||
}
|
80
osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs
Normal file
80
osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs
Normal file
@ -0,0 +1,80 @@
|
||||
// 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
|
||||
}
|
||||
};
|
||||
|
||||
LifetimeStart = BarLine.StartTime - BarLine.ScrollTime * 2;
|
||||
LifetimeEnd = BarLine.StartTime + BarLine.ScrollTime;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
Delay(BarLine.StartTime - Time.Current);
|
||||
FadeOut(base_fadeout_time * BarLine.ScrollTime / 1000);
|
||||
}
|
||||
|
||||
private void updateScrollPosition(double time) => MoveToX((float)((BarLine.StartTime - time) / BarLine.ScrollTime));
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
updateScrollPosition(Time.Current);
|
||||
}
|
||||
}
|
||||
}
|
@ -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 DrawableBarLineMajor : 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 DrawableBarLineMajor(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;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// 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.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
|
||||
{
|
||||
@ -15,17 +15,13 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
public DrawableCentreHit(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
MainPiece.Add(new CentreHitSymbolPiece());
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Circle.AccentColour = colours.PinkDarker;
|
||||
MainPiece.AccentColour = colours.PinkDarker;
|
||||
}
|
||||
|
||||
protected override CirclePiece CreateCirclePiece() => new CirclePiece
|
||||
{
|
||||
Children = new[] { new CentreHitSymbolPiece() }
|
||||
};
|
||||
}
|
||||
}
|
@ -1,31 +1,27 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// 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.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 DrawableCentreHitStrong : DrawableHitStrong
|
||||
{
|
||||
protected override Key[] HitKeys { get; } = { Key.F, Key.J };
|
||||
|
||||
public DrawableStrongCentreHit(Hit hit)
|
||||
public DrawableCentreHitStrong(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
MainPiece.Add(new CentreHitSymbolPiece());
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Circle.AccentColour = colours.PinkDarker;
|
||||
MainPiece.AccentColour = colours.PinkDarker;
|
||||
}
|
||||
|
||||
protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece
|
||||
{
|
||||
Children = new[] { new CentreHitSymbolPiece() }
|
||||
};
|
||||
}
|
||||
}
|
@ -1,30 +1,25 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawables.Pieces;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawables
|
||||
{
|
||||
public class DrawableDrumRoll : DrawableTaikoHitObject
|
||||
public class DrawableDrumRoll : DrawableTaikoHitObject<DrumRoll>
|
||||
{
|
||||
/// <summary>
|
||||
/// Number of rolling hits required to reach the dark/final accent colour.
|
||||
/// </summary>
|
||||
private const int rolling_hits_for_dark_accent = 5;
|
||||
|
||||
private readonly DrumRoll drumRoll;
|
||||
|
||||
private readonly CirclePiece circle;
|
||||
|
||||
private Color4 accentDarkColour;
|
||||
|
||||
/// <summary>
|
||||
@ -35,32 +30,32 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
public DrawableDrumRoll(DrumRoll drumRoll)
|
||||
: base(drumRoll)
|
||||
{
|
||||
this.drumRoll = drumRoll;
|
||||
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Width = (float)(drumRoll.Duration / drumRoll.PreEmpt);
|
||||
|
||||
Add(circle = CreateCirclePiece());
|
||||
circle.KiaiMode = HitObject.Kiai;
|
||||
|
||||
foreach (var tick in drumRoll.Ticks)
|
||||
{
|
||||
var newTick = new DrawableDrumRollTick(tick)
|
||||
{
|
||||
X = (float)((tick.StartTime - HitObject.StartTime) / drumRoll.Duration)
|
||||
X = (float)((tick.StartTime - HitObject.StartTime) / HitObject.Duration)
|
||||
};
|
||||
|
||||
newTick.OnJudgement += onTickJudgement;
|
||||
|
||||
AddNested(newTick);
|
||||
Add(newTick);
|
||||
MainPiece.Add(newTick);
|
||||
}
|
||||
}
|
||||
|
||||
protected override TaikoJudgement CreateJudgement() => new TaikoJudgement { SecondHit = HitObject.IsStrong };
|
||||
|
||||
protected override TaikoPiece CreateMainPiece() => new ElongatedCirclePiece(HitObject.IsStrong)
|
||||
{
|
||||
Length = (float)(HitObject.Duration / HitObject.ScrollTime),
|
||||
PlayfieldLengthReference = () => Parent.DrawSize.X
|
||||
};
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
circle.AccentColour = AccentColour = colours.YellowDark;
|
||||
MainPiece.AccentColour = AccentColour = colours.YellowDark;
|
||||
accentDarkColour = colours.YellowDarker;
|
||||
}
|
||||
|
||||
@ -72,7 +67,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
// is further than mid point of the play field, so the time taken to scroll in should always
|
||||
// be greater than the time taken to scroll out to the left of the screen.
|
||||
// Thus, using PreEmpt here is enough for the drum roll to completely scroll out.
|
||||
LifetimeEnd = drumRoll.EndTime + drumRoll.PreEmpt;
|
||||
LifetimeEnd = HitObject.EndTime + HitObject.ScrollTime;
|
||||
}
|
||||
|
||||
private void onTickJudgement(DrawableHitObject<TaikoHitObject, TaikoJudgement> obj)
|
||||
@ -85,7 +80,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
rollingHits = MathHelper.Clamp(rollingHits, 0, rolling_hits_for_dark_accent);
|
||||
|
||||
Color4 newAccent = Interpolation.ValueAt((float)rollingHits / rolling_hits_for_dark_accent, AccentColour, accentDarkColour, 0, 1);
|
||||
circle.FadeAccent(newAccent, 100);
|
||||
MainPiece.FadeAccent(newAccent, 100);
|
||||
}
|
||||
|
||||
protected override void CheckJudgement(bool userTriggered)
|
||||
@ -98,10 +93,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
|
||||
int countHit = NestedHitObjects.Count(o => o.Judgement.Result == HitResult.Hit);
|
||||
|
||||
if (countHit > drumRoll.RequiredGoodHits)
|
||||
if (countHit > HitObject.RequiredGoodHits)
|
||||
{
|
||||
Judgement.Result = HitResult.Hit;
|
||||
Judgement.TaikoResult = countHit >= drumRoll.RequiredGreatHits ? TaikoHitResult.Great : TaikoHitResult.Good;
|
||||
Judgement.TaikoResult = countHit >= HitObject.RequiredGreatHits ? TaikoHitResult.Great : TaikoHitResult.Good;
|
||||
}
|
||||
else
|
||||
Judgement.Result = HitResult.Miss;
|
||||
@ -110,7 +105,5 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
protected override void UpdateState(ArmedState state)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual CirclePiece CreateCirclePiece() => new CirclePiece();
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using OpenTK.Input;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawables.Pieces;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawables
|
||||
{
|
||||
public class DrawableDrumRollTick : DrawableTaikoHitObject<DrumRollTick>
|
||||
{
|
||||
public DrawableDrumRollTick(DrumRollTick tick)
|
||||
: base(tick)
|
||||
{
|
||||
}
|
||||
|
||||
protected override TaikoPiece CreateMainPiece() => new TickPiece
|
||||
{
|
||||
Filled = HitObject.FirstTick
|
||||
};
|
||||
|
||||
protected override TaikoJudgement CreateJudgement() => new TaikoDrumRollTickJudgement { SecondHit = HitObject.IsStrong };
|
||||
|
||||
protected override void CheckJudgement(bool userTriggered)
|
||||
{
|
||||
if (!userTriggered)
|
||||
{
|
||||
if (Judgement.TimeOffset > HitObject.HitWindow)
|
||||
Judgement.Result = HitResult.Miss;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Math.Abs(Judgement.TimeOffset) < HitObject.HitWindow)
|
||||
{
|
||||
Judgement.Result = HitResult.Hit;
|
||||
Judgement.TaikoResult = TaikoHitResult.Great;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case ArmedState.Hit:
|
||||
Content.ScaleTo(0, 100, EasingTypes.OutQuint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateScrollPosition(double time)
|
||||
{
|
||||
// Ticks don't move
|
||||
}
|
||||
|
||||
protected override bool HandleKeyPress(Key key)
|
||||
{
|
||||
return Judgement.Result == HitResult.None && UpdateJudgement(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,32 +1,22 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.Input;
|
||||
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;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
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 DrawableHit : DrawableTaikoHitObject
|
||||
public abstract class DrawableHit : DrawableTaikoHitObject<Hit>
|
||||
{
|
||||
/// <summary>
|
||||
/// A list of keys which can result in hits for this HitObject.
|
||||
/// </summary>
|
||||
protected abstract Key[] HitKeys { get; }
|
||||
|
||||
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>
|
||||
@ -35,41 +25,28 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
protected DrawableHit(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
this.hit = hit;
|
||||
|
||||
AddInternal(bodyContainer = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Children = new[]
|
||||
{
|
||||
Circle = CreateCirclePiece()
|
||||
}
|
||||
});
|
||||
|
||||
Circle.KiaiMode = HitObject.Kiai;
|
||||
}
|
||||
|
||||
protected override void CheckJudgement(bool userTriggered)
|
||||
{
|
||||
if (!userTriggered)
|
||||
{
|
||||
if (Judgement.TimeOffset > hit.HitWindowGood)
|
||||
if (Judgement.TimeOffset > HitObject.HitWindowGood)
|
||||
Judgement.Result = HitResult.Miss;
|
||||
return;
|
||||
}
|
||||
|
||||
double hitOffset = Math.Abs(Judgement.TimeOffset);
|
||||
|
||||
if (hitOffset > hit.HitWindowMiss)
|
||||
if (hitOffset > HitObject.HitWindowMiss)
|
||||
return;
|
||||
|
||||
if (!validKeyPressed)
|
||||
Judgement.Result = HitResult.Miss;
|
||||
else if (hitOffset < hit.HitWindowGood)
|
||||
else if (hitOffset < HitObject.HitWindowGood)
|
||||
{
|
||||
Judgement.Result = HitResult.Hit;
|
||||
Judgement.TaikoResult = hitOffset < hit.HitWindowGreat ? TaikoHitResult.Great : TaikoHitResult.Good;
|
||||
Judgement.TaikoResult = hitOffset < HitObject.HitWindowGreat ? TaikoHitResult.Great : TaikoHitResult.Good;
|
||||
}
|
||||
else
|
||||
Judgement.Result = HitResult.Miss;
|
||||
@ -92,24 +69,26 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
switch (State)
|
||||
{
|
||||
case ArmedState.Idle:
|
||||
Delay(hit.HitWindowMiss);
|
||||
Delay(HitObject.HitWindowMiss);
|
||||
break;
|
||||
case ArmedState.Miss:
|
||||
FadeOut(100);
|
||||
break;
|
||||
case ArmedState.Hit:
|
||||
bodyContainer.ScaleTo(0.8f, 400, EasingTypes.OutQuad);
|
||||
bodyContainer.MoveToY(-200, 250, EasingTypes.Out);
|
||||
bodyContainer.Delay(250);
|
||||
bodyContainer.MoveToY(0, 500, EasingTypes.In);
|
||||
|
||||
FadeOut(600);
|
||||
|
||||
const float gravity_time = 300;
|
||||
const float gravity_travel_height = 200;
|
||||
|
||||
Content.ScaleTo(0.8f, gravity_time * 2, EasingTypes.OutQuad);
|
||||
|
||||
MoveToY(-gravity_travel_height, gravity_time, EasingTypes.Out);
|
||||
Delay(gravity_time, true);
|
||||
MoveToY(gravity_travel_height * 2, gravity_time * 2, EasingTypes.In);
|
||||
break;
|
||||
}
|
||||
|
||||
Expire();
|
||||
}
|
||||
|
||||
protected abstract CirclePiece CreateCirclePiece();
|
||||
}
|
||||
}
|
@ -1,16 +1,17 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.Input;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using OpenTK.Input;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawables.Pieces;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawables
|
||||
{
|
||||
public abstract class DrawableStrongHit : DrawableHit
|
||||
public abstract class DrawableHitStrong : DrawableHit
|
||||
{
|
||||
/// <summary>
|
||||
/// The lenience for the second key press.
|
||||
@ -22,11 +23,13 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
private bool firstKeyHeld;
|
||||
private Key firstHitKey;
|
||||
|
||||
protected DrawableStrongHit(Hit hit)
|
||||
protected DrawableHitStrong(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
}
|
||||
|
||||
protected override TaikoPiece CreateMainPiece() => new CirclePiece(true);
|
||||
|
||||
protected override TaikoJudgement CreateJudgement() => new TaikoStrongHitJudgement();
|
||||
|
||||
protected override void CheckJudgement(bool userTriggered)
|
@ -3,10 +3,10 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawables.Pieces;
|
||||
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
|
||||
{
|
||||
@ -15,17 +15,13 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
public DrawableRimHit(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
MainPiece.Add(new RimHitSymbolPiece());
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Circle.AccentColour = colours.BlueDarker;
|
||||
MainPiece.AccentColour = colours.BlueDarker;
|
||||
}
|
||||
|
||||
protected override CirclePiece CreateCirclePiece() => new CirclePiece
|
||||
{
|
||||
Children = new[] { new RimHitSymbolPiece() }
|
||||
};
|
||||
}
|
||||
}
|
@ -3,29 +3,25 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawables.Pieces;
|
||||
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 DrawableRimHitStrong : DrawableHitStrong
|
||||
{
|
||||
protected override Key[] HitKeys { get; } = { Key.D, Key.K };
|
||||
|
||||
public DrawableStrongRimHit(Hit hit)
|
||||
public DrawableRimHitStrong(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
MainPiece.Add(new RimHitSymbolPiece());
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Circle.AccentColour = colours.BlueDarker;
|
||||
MainPiece.AccentColour = colours.BlueDarker;
|
||||
}
|
||||
|
||||
protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece
|
||||
{
|
||||
Children = new[] { new RimHitSymbolPiece() }
|
||||
};
|
||||
}
|
||||
}
|
@ -1,9 +1,8 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
@ -12,13 +11,14 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
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;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawables.Pieces;
|
||||
using OpenTK;
|
||||
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<Swell>
|
||||
{
|
||||
/// <summary>
|
||||
/// Invoked when the swell has reached the hit target, i.e. when CurrentTime >= StartTime.
|
||||
@ -31,8 +31,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
private const float target_ring_scale = 5f;
|
||||
private const float inner_ring_alpha = 0.65f;
|
||||
|
||||
private readonly Swell swell;
|
||||
|
||||
private readonly Container bodyContainer;
|
||||
private readonly CircularContainer targetRing;
|
||||
private readonly CircularContainer expandingRing;
|
||||
@ -54,13 +52,12 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
public DrawableSwell(Swell swell)
|
||||
: base(swell)
|
||||
{
|
||||
this.swell = swell;
|
||||
|
||||
Children = new Framework.Graphics.Drawable[]
|
||||
Children = new Drawable[]
|
||||
{
|
||||
bodyContainer = new Container
|
||||
{
|
||||
Children = new Framework.Graphics.Drawable[]
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
expandingRing = new CircularContainer
|
||||
{
|
||||
@ -89,7 +86,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
Masking = true,
|
||||
BorderThickness = target_ring_thick_border,
|
||||
BlendingMode = BlendingMode.Additive,
|
||||
Children = new Framework.Graphics.Drawable[]
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
@ -120,6 +117,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
},
|
||||
circlePiece = new CirclePiece
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Children = new []
|
||||
{
|
||||
symbol = new SwellSymbolPiece()
|
||||
@ -146,18 +145,18 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
userHits++;
|
||||
|
||||
var completion = (float)userHits / swell.RequiredHits;
|
||||
var completion = (float)userHits / HitObject.RequiredHits;
|
||||
|
||||
expandingRing.FadeTo(expandingRing.Alpha + MathHelper.Clamp(completion / 16, 0.1f, 0.6f), 50);
|
||||
expandingRing.Delay(50);
|
||||
expandingRing.FadeTo(completion / 8, 2000, EasingTypes.OutQuint);
|
||||
expandingRing.DelayReset();
|
||||
|
||||
symbol.RotateTo((float)(completion * swell.Duration / 8), 4000, EasingTypes.OutQuint);
|
||||
symbol.RotateTo((float)(completion * HitObject.Duration / 8), 4000, EasingTypes.OutQuint);
|
||||
|
||||
expandingRing.ScaleTo(1f + Math.Min(target_ring_scale - 1f, (target_ring_scale - 1f) * completion * 1.3f), 260, EasingTypes.OutQuint);
|
||||
|
||||
if (userHits == swell.RequiredHits)
|
||||
if (userHits == HitObject.RequiredHits)
|
||||
{
|
||||
Judgement.Result = HitResult.Hit;
|
||||
Judgement.TaikoResult = TaikoHitResult.Great;
|
||||
@ -169,7 +168,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
return;
|
||||
|
||||
//TODO: THIS IS SHIT AND CAN'T EXIST POST-TAIKO WORLD CUP
|
||||
if (userHits > swell.RequiredHits / 2)
|
||||
if (userHits > HitObject.RequiredHits / 2)
|
||||
{
|
||||
Judgement.Result = HitResult.Hit;
|
||||
Judgement.TaikoResult = TaikoHitResult.Good;
|
||||
@ -189,7 +188,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
|
||||
Delay(preempt, true);
|
||||
|
||||
Delay(Judgement.TimeOffset + swell.Duration, true);
|
||||
Delay(Judgement.TimeOffset + HitObject.Duration, true);
|
||||
|
||||
const float out_transition_time = 300;
|
||||
|
@ -1,16 +1,20 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// 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.Containers;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawables.Pieces;
|
||||
using OpenTK;
|
||||
using OpenTK.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<TaikoHitType> : DrawableHitObject<TaikoHitObject, TaikoJudgement>
|
||||
where TaikoHitType : TaikoHitObject
|
||||
{
|
||||
/// <summary>
|
||||
/// A list of keys which this hit object will accept. These are the standard Taiko keys for now.
|
||||
@ -18,33 +22,52 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
/// </summary>
|
||||
private readonly List<Key> validKeys = new List<Key>(new[] { Key.D, Key.F, Key.J, Key.K });
|
||||
|
||||
protected DrawableTaikoHitObject(TaikoHitObject hitObject)
|
||||
public override Vector2 OriginPosition => new Vector2(DrawHeight / 2);
|
||||
|
||||
protected override Container<Drawable> Content => bodyContainer;
|
||||
|
||||
protected readonly TaikoPiece MainPiece;
|
||||
|
||||
private readonly Container bodyContainer;
|
||||
|
||||
public new TaikoHitType HitObject;
|
||||
|
||||
protected DrawableTaikoHitObject(TaikoHitType hitObject)
|
||||
: base(hitObject)
|
||||
{
|
||||
HitObject = hitObject;
|
||||
|
||||
Anchor = Anchor.CentreLeft;
|
||||
Origin = Anchor.CentreLeft;
|
||||
Origin = Anchor.Custom;
|
||||
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
RelativePositionAxes = Axes.X;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2;
|
||||
AddInternal(bodyContainer = new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
{
|
||||
MainPiece = CreateMainPiece()
|
||||
}
|
||||
});
|
||||
|
||||
base.LoadComplete();
|
||||
MainPiece.KiaiMode = HitObject.Kiai;
|
||||
|
||||
LifetimeStart = HitObject.StartTime - HitObject.ScrollTime * 2;
|
||||
}
|
||||
|
||||
protected override TaikoJudgement CreateJudgement() => new TaikoJudgement();
|
||||
|
||||
protected virtual TaikoPiece CreateMainPiece() => new CirclePiece(HitObject.IsStrong);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the scroll position of the DrawableHitObject relative to the offset between
|
||||
/// a time value and the HitObject's StartTime.
|
||||
/// </summary>
|
||||
/// <param name="time"></param>
|
||||
protected virtual void UpdateScrollPosition(double time)
|
||||
{
|
||||
MoveToX((float)((HitObject.StartTime - time) / HitObject.PreEmpt));
|
||||
}
|
||||
protected virtual void UpdateScrollPosition(double time) => X = (float)((HitObject.StartTime - time) / HitObject.ScrollTime);
|
||||
|
||||
protected override void Update()
|
||||
{
|
@ -1,12 +1,12 @@
|
||||
// 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.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces
|
||||
{
|
||||
/// <summary>
|
||||
/// The symbol used for centre hit pieces.
|
153
osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs
Normal file
153
osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs
Normal file
@ -0,0 +1,153 @@
|
||||
// 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.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces
|
||||
{
|
||||
/// <summary>
|
||||
/// A circle piece which is used uniformly through osu!taiko to visualise hitobjects.
|
||||
/// <para>
|
||||
/// Note that this can actually be non-circle if the width is changed. See <see cref="ElongatedCirclePiece"/>
|
||||
/// for a usage example.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public class CirclePiece : TaikoPiece
|
||||
{
|
||||
public const float SYMBOL_SIZE = TaikoHitObject.CIRCLE_RADIUS * 2f * 0.45f;
|
||||
public const float SYMBOL_BORDER = 8;
|
||||
public const float SYMBOL_INNER_SIZE = SYMBOL_SIZE - 2 * SYMBOL_BORDER;
|
||||
|
||||
/// <summary>
|
||||
/// The amount to scale up the base circle to show it as a "strong" piece.
|
||||
/// </summary>
|
||||
private const float strong_scale = 1.5f;
|
||||
|
||||
/// <summary>
|
||||
/// The colour of the inner circle and outer glows.
|
||||
/// </summary>
|
||||
public override Color4 AccentColour
|
||||
{
|
||||
get { return base.AccentColour; }
|
||||
set
|
||||
{
|
||||
base.AccentColour = value;
|
||||
|
||||
background.Colour = AccentColour;
|
||||
|
||||
resetEdgeEffects();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether Kiai mode effects are enabled for this circle piece.
|
||||
/// </summary>
|
||||
public override bool KiaiMode
|
||||
{
|
||||
get { return base.KiaiMode; }
|
||||
set
|
||||
{
|
||||
base.KiaiMode = value;
|
||||
|
||||
resetEdgeEffects();
|
||||
}
|
||||
}
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
private readonly Container content;
|
||||
|
||||
private readonly Container background;
|
||||
|
||||
public CirclePiece(bool isStrong = false)
|
||||
{
|
||||
AddInternal(new Drawable[]
|
||||
{
|
||||
background = new CircularContainer
|
||||
{
|
||||
Name = "Background",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new Triangles
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ColourLight = Color4.White,
|
||||
ColourDark = Color4.White.Darken(0.1f)
|
||||
}
|
||||
}
|
||||
},
|
||||
new CircularContainer
|
||||
{
|
||||
Name = "Ring",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
BorderThickness = 8,
|
||||
BorderColour = Color4.White,
|
||||
Masking = true,
|
||||
Children = new[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
AlwaysPresent = true
|
||||
}
|
||||
}
|
||||
},
|
||||
content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Name = "Content",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
}
|
||||
});
|
||||
|
||||
if (isStrong)
|
||||
{
|
||||
Size *= strong_scale;
|
||||
|
||||
//default for symbols etc.
|
||||
Content.Scale *= strong_scale;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
//we want to allow for width of content to remain mapped to the area inside us, regardless of the scale applied above.
|
||||
Content.Width = 1 / Content.Scale.X;
|
||||
}
|
||||
|
||||
private void resetEdgeEffects()
|
||||
{
|
||||
background.EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Glow,
|
||||
Colour = AccentColour,
|
||||
Radius = KiaiMode ? 50 : 8
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Game.Modes.Taiko.UI;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces
|
||||
{
|
||||
public class ElongatedCirclePiece : CirclePiece
|
||||
{
|
||||
/// <summary>
|
||||
/// As we are being used to define the absolute size of hits, we need to be given a relative reference of our containing <see cref="TaikoPlayfield"/>.
|
||||
/// </summary>
|
||||
public Func<float> PlayfieldLengthReference;
|
||||
|
||||
/// <summary>
|
||||
/// The length of this piece as a multiple of the value returned by <see cref="PlayfieldLengthReference"/>
|
||||
/// </summary>
|
||||
public float Length;
|
||||
|
||||
public ElongatedCirclePiece(bool isStrong = false) : base(isStrong)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
var padding = Content.DrawHeight * Content.Width / 2;
|
||||
|
||||
Content.Padding = new MarginPadding
|
||||
{
|
||||
Left = padding,
|
||||
Right = padding,
|
||||
};
|
||||
|
||||
Width = (PlayfieldLengthReference?.Invoke() ?? 0) * Length + DrawHeight;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
// 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.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces
|
||||
{
|
||||
/// <summary>
|
||||
/// The symbol used for rim hit pieces.
|
@ -1,10 +1,10 @@
|
||||
// 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.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>
|
||||
/// The symbol used for swell pieces.
|
45
osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs
Normal file
45
osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs
Normal file
@ -0,0 +1,45 @@
|
||||
// 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.Containers;
|
||||
using osu.Game.Graphics;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces
|
||||
{
|
||||
public class TaikoPiece : Container, IHasAccentColour
|
||||
{
|
||||
private Color4 accentColour;
|
||||
/// <summary>
|
||||
/// The colour of the inner circle and outer glows.
|
||||
/// </summary>
|
||||
public virtual Color4 AccentColour
|
||||
{
|
||||
get { return accentColour; }
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool kiaiMode;
|
||||
/// <summary>
|
||||
/// Whether Kiai mode effects are enabled for this circle piece.
|
||||
/// </summary>
|
||||
public virtual bool KiaiMode
|
||||
{
|
||||
get { return kiaiMode; }
|
||||
set
|
||||
{
|
||||
kiaiMode = value;
|
||||
}
|
||||
}
|
||||
|
||||
public TaikoPiece()
|
||||
{
|
||||
//just a default
|
||||
Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2);
|
||||
}
|
||||
}
|
||||
}
|
60
osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TickPiece.cs
Normal file
60
osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TickPiece.cs
Normal file
@ -0,0 +1,60 @@
|
||||
// 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;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces
|
||||
{
|
||||
public class TickPiece : TaikoPiece
|
||||
{
|
||||
/// <summary>
|
||||
/// Any tick that is not the first for a drumroll is not filled, but is instead displayed
|
||||
/// as a hollow circle. This is what controls the border width of that circle.
|
||||
/// </summary>
|
||||
private const float tick_border_width = TaikoHitObject.CIRCLE_RADIUS / 2 / 4;
|
||||
|
||||
/// <summary>
|
||||
/// The size of a tick.
|
||||
/// </summary>
|
||||
private const float tick_size = TaikoHitObject.CIRCLE_RADIUS / 2;
|
||||
|
||||
private bool filled;
|
||||
public bool Filled
|
||||
{
|
||||
get { return filled; }
|
||||
set
|
||||
{
|
||||
filled = value;
|
||||
fillBox.Alpha = filled ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Box fillBox;
|
||||
|
||||
public TickPiece()
|
||||
{
|
||||
Size = new Vector2(tick_size);
|
||||
|
||||
Add(new CircularContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
BorderThickness = tick_border_width,
|
||||
BorderColour = Color4.White,
|
||||
Children = new[]
|
||||
{
|
||||
fillBox = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
AlwaysPresent = true
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -11,26 +11,16 @@ using osu.Game.Audio;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects
|
||||
{
|
||||
public class DrumRoll : TaikoHitObject, IHasDistance
|
||||
public class DrumRoll : TaikoHitObject, IHasEndTime
|
||||
{
|
||||
/// <summary>
|
||||
/// Drum roll distance that results in a duration of 1 speed-adjusted beat length.
|
||||
/// </summary>
|
||||
private const float base_distance = 100;
|
||||
|
||||
public double EndTime => StartTime + Distance / Velocity;
|
||||
public double EndTime => StartTime + Duration;
|
||||
|
||||
public double Duration => EndTime - StartTime;
|
||||
|
||||
/// <summary>
|
||||
/// Raw length of the drum roll in positional length units.
|
||||
/// </summary>
|
||||
public double Distance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Velocity of the drum roll in positional length units per millisecond.
|
||||
/// </summary>
|
||||
public double Velocity { get; protected set; } = 5;
|
||||
public double Duration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Numer of ticks per beat length.
|
||||
@ -69,9 +59,6 @@ namespace osu.Game.Modes.Taiko.Objects
|
||||
{
|
||||
base.ApplyDefaults(timing, difficulty);
|
||||
|
||||
double speedAdjutedBeatLength = timing.SpeedMultiplierAt(StartTime) * timing.BeatLengthAt(StartTime);
|
||||
|
||||
Velocity = base_distance * difficulty.SliderMultiplier / speedAdjutedBeatLength * VelocityMultiplier;
|
||||
tickSpacing = timing.BeatLengthAt(StartTime) / TickRate;
|
||||
|
||||
RequiredGoodHits = TotalTicks * Math.Min(0.15, 0.05 + 0.10 / 6 * difficulty.OverallDifficulty);
|
||||
@ -86,12 +73,12 @@ namespace osu.Game.Modes.Taiko.Objects
|
||||
return ret;
|
||||
|
||||
bool first = true;
|
||||
for (double t = StartTime; t < EndTime + (int)tickSpacing; t += tickSpacing)
|
||||
for (double t = StartTime; t < EndTime + tickSpacing / 2; t += tickSpacing)
|
||||
{
|
||||
ret.Add(new DrumRollTick
|
||||
{
|
||||
FirstTick = first,
|
||||
PreEmpt = PreEmpt,
|
||||
ScrollTime = ScrollTime,
|
||||
TickSpacing = tickSpacing,
|
||||
StartTime = t,
|
||||
IsStrong = IsStrong,
|
||||
|
@ -7,9 +7,9 @@ namespace osu.Game.Modes.Taiko.Objects
|
||||
{
|
||||
public class Swell : TaikoHitObject, IHasEndTime
|
||||
{
|
||||
public double EndTime { get; set; }
|
||||
public double EndTime => StartTime + Duration;
|
||||
|
||||
public double Duration => EndTime - StartTime;
|
||||
public double Duration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of hits required to complete the swell successfully.
|
||||
|
@ -15,19 +15,14 @@ namespace osu.Game.Modes.Taiko.Objects
|
||||
public const float CIRCLE_RADIUS = 42f;
|
||||
|
||||
/// <summary>
|
||||
/// Time (in milliseconds) to scroll in the hit object with a speed-adjusted beat length of 1 second.
|
||||
/// The time taken from the initial (off-screen) spawn position to the centre of the hit target for a <see cref="ControlPoint.BeatLength"/> of 1000ms.
|
||||
/// </summary>
|
||||
private const double base_scroll_time = 6000;
|
||||
private const double scroll_time = 6000;
|
||||
|
||||
/// <summary>
|
||||
/// The velocity multiplier applied to this hit object.
|
||||
/// Our adjusted <see cref="scroll_time"/> taking into consideration local <see cref="ControlPoint.BeatLength"/> and other speed multipliers.
|
||||
/// </summary>
|
||||
public float VelocityMultiplier = 1;
|
||||
|
||||
/// <summary>
|
||||
/// The time to scroll in the HitObject.
|
||||
/// </summary>
|
||||
public double PreEmpt;
|
||||
public double ScrollTime;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this HitObject is a "strong" type.
|
||||
@ -44,7 +39,7 @@ namespace osu.Game.Modes.Taiko.Objects
|
||||
{
|
||||
base.ApplyDefaults(timing, difficulty);
|
||||
|
||||
PreEmpt = base_scroll_time / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / VelocityMultiplier / 1000;
|
||||
ScrollTime = scroll_time * (timing.BeatLengthAt(StartTime) / 1000) / (difficulty.SliderMultiplier * timing.SpeedMultiplierAt(StartTime));
|
||||
|
||||
ControlPoint overridePoint;
|
||||
Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode;
|
||||
|
Reference in New Issue
Block a user