From dcf879687d30fba36c5e7a1f19213ed63e84de27 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 20:45:01 +0900 Subject: [PATCH 01/47] Implement basic hold note + tick input. --- .../Tests/TestCaseManiaPlayfield.cs | 47 +++++ .../Legacy/DistanceObjectPatternGenerator.cs | 9 +- .../Legacy/EndTimeObjectPatternGenerator.cs | 9 +- .../Judgements/HoldNoteTailJudgement.cs | 13 ++ .../Judgements/HoldNoteTickJudgement.cs | 9 + .../Objects/Drawables/DrawableHoldNote.cs | 198 ++++++++++++++++-- .../Objects/Drawables/DrawableHoldNoteTick.cs | 75 +++++++ osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 42 ++-- .../Objects/HoldNoteTail.cs | 24 +++ .../Objects/HoldNoteTick.cs | 9 + .../osu.Game.Rulesets.Mania.csproj | 5 + 11 files changed, 406 insertions(+), 34 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs create mode 100644 osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs create mode 100644 osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs create mode 100644 osu.Game.Rulesets.Mania/Objects/HoldNoteTail.cs create mode 100644 osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs index 9dcba02849..27ad39fb1e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs @@ -11,6 +11,9 @@ using OpenTK; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Timing; +using osu.Framework.Configuration; +using OpenTK.Input; +using osu.Framework.Timing; namespace osu.Desktop.VisualTests.Tests { @@ -59,6 +62,48 @@ namespace osu.Desktop.VisualTests.Tests } }; + Action createPlayfieldWithNotesAcceptingInput = () => + { + Clear(); + + var rateAdjustClock = new StopwatchClock(true) { Rate = 0.2 }; + + ManiaPlayfield playField; + Add(playField = new ManiaPlayfield(4, new List { new TimingChange { BeatLength = 200 } }) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Scale = new Vector2(1, -1), + Clock = new FramedClock(rateAdjustClock) + }); + + playField.Add(new DrawableNote(new Note + { + StartTime = 1000, + Column = 0 + }, new Bindable(Key.D))); + + playField.Add(new DrawableHoldNote(new HoldNote + { + StartTime = 1000, + Duration = 2000, + Column = 1 + }, new Bindable(Key.F))); + + playField.Add(new DrawableHoldNote(new HoldNote + { + StartTime = 1000, + Duration = 2000, + Column = 2 + }, new Bindable(Key.J))); + + playField.Add(new DrawableNote(new Note + { + StartTime = 1000, + Column = 3 + }, new Bindable(Key.K))); + }; + AddStep("1 column", () => createPlayfield(1, SpecialColumnPosition.Normal)); AddStep("4 columns", () => createPlayfield(4, SpecialColumnPosition.Normal)); AddStep("Left special style", () => createPlayfield(4, SpecialColumnPosition.Left)); @@ -76,6 +121,8 @@ namespace osu.Desktop.VisualTests.Tests AddWaitStep(10); AddStep("Right special style", () => createPlayfieldWithNotes(4, SpecialColumnPosition.Right)); AddWaitStep(10); + + AddStep("Test", () => createPlayfieldWithNotesAcceptingInput()); } private void triggerKeyDown(Column column) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 718e0967da..279ac868f1 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -471,14 +471,17 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy } else { - newObject = new HoldNote + var holdNote = new HoldNote { StartTime = startTime, - Samples = sampleInfoListAt(startTime), - EndSamples = sampleInfoListAt(endTime), Column = column, Duration = endTime - startTime }; + + holdNote.HeadNote.Samples = sampleInfoListAt(startTime); + holdNote.TailNote.Samples = sampleInfoListAt(endTime); + + newObject = holdNote; } pattern.Add(newObject); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs index 8f438f9ff4..ddc7d77c0c 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs @@ -69,18 +69,21 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (holdNote) { - newObject = new HoldNote + var hold = new HoldNote { StartTime = HitObject.StartTime, - EndSamples = HitObject.Samples, Column = column, Duration = endTime - HitObject.StartTime }; - newObject.Samples.Add(new SampleInfo + hold.HeadNote.Samples.Add(new SampleInfo { Name = SampleInfo.HIT_NORMAL }); + + hold.TailNote.Samples = HitObject.Samples; + + newObject = hold; } else { diff --git a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs new file mode 100644 index 0000000000..df2f7e9e63 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs @@ -0,0 +1,13 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Rulesets.Mania.Judgements +{ + public class HoldNoteTailJudgement : ManiaJudgement + { + /// + /// Whether the hold note has been released too early and shouldn't give full score for the release. + /// + public bool HasBroken; + } +} \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs new file mode 100644 index 0000000000..bead455c13 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs @@ -0,0 +1,9 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Rulesets.Mania.Judgements +{ + public class HoldNoteTickJudgement : ManiaJudgement + { + } +} \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index f9d027e7ce..a8efe5d2f8 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -7,14 +7,47 @@ using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; using OpenTK.Graphics; using osu.Framework.Configuration; using OpenTK.Input; +using osu.Framework.Input; +using OpenTK; +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Mania.Judgements; namespace osu.Game.Rulesets.Mania.Objects.Drawables { public class DrawableHoldNote : DrawableManiaHitObject { - private readonly NotePiece headPiece; + private readonly DrawableNote headNote; + private readonly DrawableNote tailNote; private readonly BodyPiece bodyPiece; - private readonly NotePiece tailPiece; + private readonly Container tickContainer; + + /// + /// Relative time at which the user started holding this note. + /// + private double holdStartTime; + + /// + /// Whether the hold note has been released too early and shouldn't give full score for the release. + /// + private bool hasBroken; + + private bool _holding; + /// + /// Whether the user is holding the hold note. + /// + private bool holding + { + get { return _holding; } + set + { + if (_holding == value) + return; + _holding = value; + + if (holding) + holdStartTime = Time.Current; + } + } public DrawableHoldNote(HoldNote hitObject, Bindable key = null) : base(hitObject, key) @@ -32,17 +65,39 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, - headPiece = new NotePiece + tickContainer = new Container + { + RelativeSizeAxes = Axes.Both, + RelativeCoordinateSpace = new Vector2(1, (float)HitObject.Duration) + }, + headNote = new DrawableHoldNoteHead(this, key) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre }, - tailPiece = new NotePiece + tailNote = new DrawableHoldNoteTail(this, key) { Anchor = Anchor.BottomCentre, Origin = Anchor.TopCentre } }); + + foreach (var tick in HitObject.Ticks) + { + var drawableTick = new DrawableHoldNoteTick(tick) + { + IsHolding = () => holding, + HoldStartTime = () => holdStartTime + }; + + drawableTick.Y -= (float)HitObject.StartTime; + + tickContainer.Add(drawableTick); + AddNested(drawableTick); + } + + AddNested(headNote); + AddNested(tailNote); } public override Color4 AccentColour @@ -54,9 +109,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables return; base.AccentColour = value; - headPiece.AccentColour = value; bodyPiece.AccentColour = value; - tailPiece.AccentColour = value; + headNote.AccentColour = value; + tailNote.AccentColour = value; } } @@ -64,14 +119,133 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables { } - protected override void Update() + /// + /// Handles key down events on the body of the hold note. + /// + /// The input state. + /// The key down args. + /// Whether the key press was handled. + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { - if (Time.Current > HitObject.StartTime) - headPiece.Colour = Color4.Green; - if (Time.Current > HitObject.EndTime) + // Make sure the keypress happened within reasonable bounds of the hold note + if (Time.Current < HitObject.StartTime || Time.Current > HitObject.EndTime) + return false; + + if (args.Key != Key) + return false; + + if (args.Repeat) + return false; + + holding = true; + + return true; + } + + /// + /// Handles key up events on the body of the hold note. + /// + /// The input state. + /// The key down args. + /// Whether the key press was handled. + protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) + { + // Make sure that the user started holding the key during the hold note + if (!holding) + return false; + + if (args.Key != Key) + return false; + + holding = false; + + // If the key has been released too early, they should not receive full score for the release + if (!tailNote.Judged) + hasBroken = true; + + return true; + } + + private class DrawableHoldNoteHead : DrawableNote + { + private readonly DrawableHoldNote holdNote; + + public DrawableHoldNoteHead(DrawableHoldNote holdNote, Bindable key = null) + : base(holdNote.HitObject.HeadNote, key) { - bodyPiece.Colour = Color4.Green; - tailPiece.Colour = Color4.Green; + this.holdNote = holdNote; + + RelativePositionAxes = Axes.None; + Y = 0; + } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (!base.OnKeyDown(state, args)) + return false; + + // We only want to trigger a holding state from the head if the head has received a judgement + if (Judgement.Result == HitResult.None) + return false; + + // If the head has been missed, make sure the user also can't receive a full score for the release + if (Judgement.Result == HitResult.Miss) + holdNote.hasBroken = true; + + holdNote.holding = true; + + return true; + } + } + + private class DrawableHoldNoteTail : DrawableNote + { + private readonly DrawableHoldNote holdNote; + + public DrawableHoldNoteTail(DrawableHoldNote holdNote, Bindable key = null) + : base(holdNote.HitObject.TailNote, key) + { + this.holdNote = holdNote; + + RelativePositionAxes = Axes.None; + Y = 0; + } + + protected override ManiaJudgement CreateJudgement() => new HoldNoteTailJudgement(); + + protected override void CheckJudgement(bool userTriggered) + { + base.CheckJudgement(userTriggered); + + var tailJudgement = Judgement as HoldNoteTailJudgement; + if (tailJudgement == null) + return; + + tailJudgement.HasBroken = holdNote.hasBroken; + } + + protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) + { + // Make sure that the user started holding the key during the hold note + if (!holdNote.holding) + return false; + + if (Judgement.Result != HitResult.None) + return false; + + if (args.Key != Key) + return false; + + UpdateJudgement(true); + + // Handled by the hold note, which will set holding = false + return false; + } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + // Tail doesn't handle key down + return false; } } } diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs new file mode 100644 index 0000000000..13fde29bc2 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs @@ -0,0 +1,75 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using OpenTK.Graphics; +using OpenTK.Input; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using osu.Game.Rulesets.Mania.Judgements; +using osu.Game.Rulesets.Objects.Drawables; + +namespace osu.Game.Rulesets.Mania.Objects.Drawables +{ + public class DrawableHoldNoteTick : DrawableManiaHitObject + { + public Func HoldStartTime; + public Func IsHolding; + + public DrawableHoldNoteTick(HoldNoteTick hitObject) + : base(hitObject, null) + { + RelativeSizeAxes = Axes.X; + + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.X, + Height = 1 + } + }; + } + + protected override ManiaJudgement CreateJudgement() => new HoldNoteTickJudgement(); + + protected override void CheckJudgement(bool userTriggered) + { + if (!userTriggered) + return; + + if (Time.Current < HitObject.StartTime) + return; + + + if (HoldStartTime?.Invoke() > HitObject.StartTime) + return; + + Judgement.ManiaResult = ManiaHitResult.Perfect; + Judgement.Result = HitResult.Hit; + } + + protected override void UpdateState(ArmedState state) + { + switch (State) + { + case ArmedState.Hit: + Colour = Color4.Green; + break; + } + } + + protected override void Update() + { + if (Judgement.Result != HitResult.None) + return; + + if (IsHolding?.Invoke() != true) + return; + + UpdateJudgement(true); + } + } +} \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index 30e71aeb5d..926f434015 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using osu.Game.Audio; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Database; @@ -12,32 +13,41 @@ namespace osu.Game.Rulesets.Mania.Objects /// /// Represents a hit object which requires pressing, holding, and releasing a key. /// - public class HoldNote : Note, IHasEndTime + public class HoldNote : ManiaHitObject, IHasEndTime { - /// - /// Lenience of release hit windows. This is to make cases where the hold note release - /// is timed alongside presses of other hit objects less awkward. - /// - private const double release_window_lenience = 1.5; - public double Duration { get; set; } public double EndTime => StartTime + Duration; - /// - /// The samples to be played when this hold note is released. - /// - public SampleInfoList EndSamples = new SampleInfoList(); + private Note headNote; + public Note HeadNote => headNote ?? (headNote = new Note { StartTime = StartTime }); + + private Note tailNote; + public Note TailNote => tailNote ?? (tailNote = new HoldNoteTail { StartTime = EndTime }); /// - /// The key-release hit windows for this hold note. + /// The length (in milliseconds) between ticks of this hold. /// - public HitWindows ReleaseHitWindows { get; protected set; } = new HitWindows(); + private double tickSpacing = 50; - public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) + public IEnumerable Ticks => ticks ?? (ticks = createTicks()); + private List ticks; + + private List createTicks() { - base.ApplyDefaults(controlPointInfo, difficulty); + var ret = new List(); - ReleaseHitWindows = HitWindows * release_window_lenience; + if (tickSpacing == 0) + return ret; + + for (double t = StartTime + HeadNote.HitWindows.Great / 2; t <= EndTime - TailNote.HitWindows.Great / 2; t+= tickSpacing) + { + ret.Add(new HoldNoteTick + { + StartTime = t + }); + } + + return ret; } } } diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNoteTail.cs b/osu.Game.Rulesets.Mania/Objects/HoldNoteTail.cs new file mode 100644 index 0000000000..6399277a2b --- /dev/null +++ b/osu.Game.Rulesets.Mania/Objects/HoldNoteTail.cs @@ -0,0 +1,24 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Database; + +namespace osu.Game.Rulesets.Mania.Objects +{ + public class HoldNoteTail : Note + { + /// + /// Lenience of release hit windows. This is to make cases where the hold note release + /// is timed alongside presses of other hit objects less awkward. + /// + private const double release_window_lenience = 1.5; + + public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) + { + base.ApplyDefaults(controlPointInfo, difficulty); + + HitWindows *= release_window_lenience; + } + } +} \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs new file mode 100644 index 0000000000..805b2a0938 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs @@ -0,0 +1,9 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Rulesets.Mania.Objects +{ + public class HoldNoteTick : ManiaHitObject + { + } +} \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index 9442d7cf8f..91cb551414 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -57,10 +57,13 @@ + + + @@ -68,6 +71,8 @@ + + From 78067e085c858f8e6d8ab70ac9bf2699a3d0e3ca Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 20:53:47 +0900 Subject: [PATCH 02/47] Fix note input ordering. --- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index ff763f87c4..495959b061 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -189,7 +189,12 @@ namespace osu.Game.Rulesets.Mania.UI } } - public override void Add(DrawableHitObject h) => Columns.ElementAt(h.HitObject.Column).Add(h); + public override void Add(DrawableHitObject h) + { + h.Depth = (float)h.HitObject.StartTime; + + Columns.ElementAt(h.HitObject.Column).Add(h); + } protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { From 4ef18ff135fd91e3e40274f507a545f438bfa590 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 20:54:01 +0900 Subject: [PATCH 03/47] Test case improvements. --- .../Tests/TestCaseManiaPlayfield.cs | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs index 27ad39fb1e..8d0a87ae9d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs @@ -77,31 +77,34 @@ namespace osu.Desktop.VisualTests.Tests Clock = new FramedClock(rateAdjustClock) }); - playField.Add(new DrawableNote(new Note + for (int t = 1000; t <= 2000; t += 100) { - StartTime = 1000, - Column = 0 - }, new Bindable(Key.D))); + playField.Add(new DrawableNote(new Note + { + StartTime = t, + Column = 0 + }, new Bindable(Key.J))); + + playField.Add(new DrawableNote(new Note + { + StartTime = t, + Column = 3 + }, new Bindable(Key.K))); + } playField.Add(new DrawableHoldNote(new HoldNote { StartTime = 1000, - Duration = 2000, + Duration = 1000, Column = 1 }, new Bindable(Key.F))); playField.Add(new DrawableHoldNote(new HoldNote { StartTime = 1000, - Duration = 2000, + Duration = 1000, Column = 2 }, new Bindable(Key.J))); - - playField.Add(new DrawableNote(new Note - { - StartTime = 1000, - Column = 3 - }, new Bindable(Key.K))); }; AddStep("1 column", () => createPlayfield(1, SpecialColumnPosition.Normal)); From d6b104d794d2fdebcd46949115c581f1b8d7565e Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 21:24:18 +0900 Subject: [PATCH 04/47] Minor visual change for DrawableHoldNoteTick. --- .../Objects/Drawables/DrawableHoldNote.cs | 3 ++ .../Objects/Drawables/DrawableHoldNoteTick.cs | 50 ++++++++++++++++--- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index a8efe5d2f8..ee371b61ca 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -11,6 +11,7 @@ using osu.Framework.Input; using OpenTK; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Mania.Judgements; +using osu.Framework.Extensions.IEnumerableExtensions; namespace osu.Game.Rulesets.Mania.Objects.Drawables { @@ -109,6 +110,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables return; base.AccentColour = value; + tickContainer.Children.ForEach(t => t.AccentColour = value); + bodyPiece.AccentColour = value; headNote.AccentColour = value; tailNote.AccentColour = value; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs index 13fde29bc2..7a8f25e098 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs @@ -2,12 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using OpenTK; using OpenTK.Graphics; -using OpenTK.Input; -using osu.Framework.Configuration; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Objects.Drawables; @@ -18,19 +18,55 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables public Func HoldStartTime; public Func IsHolding; + private readonly Container glowContainer; + public DrawableHoldNoteTick(HoldNoteTick hitObject) : base(hitObject, null) { + Anchor = Anchor.TopCentre; + Origin = Anchor.TopCentre; + RelativeSizeAxes = Axes.X; + Size = new Vector2(1); Children = new[] { - new Box + glowContainer = new CircularContainer { - RelativeSizeAxes = Axes.X, - Height = 1 + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.Both, + Masking = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + } + } } }; + + AccentColour = Color4.White; + } + + public override Color4 AccentColour + { + get { return base.AccentColour; } + set + { + base.AccentColour = value; + + glowContainer.EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Glow, + Radius = 2f, + Roundness = 15f, + Colour = value.Opacity(0.3f) + }; + } } protected override ManiaJudgement CreateJudgement() => new HoldNoteTickJudgement(); @@ -56,7 +92,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables switch (State) { case ArmedState.Hit: - Colour = Color4.Green; + AccentColour = Color4.Green; break; } } From 21cdee02f3cfce00771a10bc3ee89ef7421fbbd2 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 21:24:33 +0900 Subject: [PATCH 05/47] Get tickSpacing from beatmap. --- osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index 926f434015..b3e2482908 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -2,10 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using osu.Game.Audio; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Database; -using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Mania.Objects @@ -29,6 +27,14 @@ namespace osu.Game.Rulesets.Mania.Objects /// private double tickSpacing = 50; + public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) + { + base.ApplyDefaults(controlPointInfo, difficulty); + + TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime); + tickSpacing = timingPoint.BeatLength / difficulty.SliderTickRate; + } + public IEnumerable Ticks => ticks ?? (ticks = createTicks()); private List ticks; From ed65b3559a72b27dc904268f36643d68a589983c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 21:25:01 +0900 Subject: [PATCH 06/47] CI fix. --- .../Objects/Drawables/DrawableHoldNoteTick.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs index 7a8f25e098..7c84157c26 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables private readonly Container glowContainer; public DrawableHoldNoteTick(HoldNoteTick hitObject) - : base(hitObject, null) + : base(hitObject) { Anchor = Anchor.TopCentre; Origin = Anchor.TopCentre; From a5b79b2192b5d34fb8f1d69363fe03495dcd77a9 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 21:56:49 +0900 Subject: [PATCH 07/47] Fix notes not getting accent colours. --- osu.Game.Rulesets.Mania/UI/Column.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index c8cb5f6387..6dfd5000d4 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - using OpenTK; using OpenTK.Graphics; using OpenTK.Input; @@ -188,7 +187,11 @@ namespace osu.Game.Rulesets.Mania.UI } } - public void Add(DrawableHitObject hitObject) => ControlPointContainer.Add(hitObject); + public void Add(DrawableHitObject hitObject) + { + hitObject.AccentColour = AccentColour; + ControlPointContainer.Add(hitObject); + } private bool onKeyDown(InputState state, KeyDownEventArgs args) { From 946cd4bfa380ca4a3684f1375f11ee94d708ef1c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 21:57:38 +0900 Subject: [PATCH 08/47] General cleanup + more xmldocs. --- .../Tests/TestCaseManiaPlayfield.cs | 6 +-- .../Legacy/DistanceObjectPatternGenerator.cs | 4 +- .../Legacy/EndTimeObjectPatternGenerator.cs | 4 +- .../Objects/Drawables/DrawableHoldNote.cs | 45 ++++++++++++------- .../Objects/Drawables/DrawableHoldNoteTick.cs | 11 +++++ .../Objects/Drawables/DrawableNote.cs | 3 ++ osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 40 ++++++++++++++--- .../Objects/HoldNoteTail.cs | 24 ---------- .../Objects/HoldNoteTick.cs | 3 ++ .../osu.Game.Rulesets.Mania.csproj | 1 - 10 files changed, 86 insertions(+), 55 deletions(-) delete mode 100644 osu.Game.Rulesets.Mania/Objects/HoldNoteTail.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs index 8d0a87ae9d..857c2c0ca7 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs @@ -66,7 +66,7 @@ namespace osu.Desktop.VisualTests.Tests { Clear(); - var rateAdjustClock = new StopwatchClock(true) { Rate = 0.2 }; + var rateAdjustClock = new StopwatchClock(true) { Rate = 0.5 }; ManiaPlayfield playField; Add(playField = new ManiaPlayfield(4, new List { new TimingChange { BeatLength = 200 } }) @@ -83,7 +83,7 @@ namespace osu.Desktop.VisualTests.Tests { StartTime = t, Column = 0 - }, new Bindable(Key.J))); + }, new Bindable(Key.D))); playField.Add(new DrawableNote(new Note { @@ -125,7 +125,7 @@ namespace osu.Desktop.VisualTests.Tests AddStep("Right special style", () => createPlayfieldWithNotes(4, SpecialColumnPosition.Right)); AddWaitStep(10); - AddStep("Test", () => createPlayfieldWithNotesAcceptingInput()); + AddStep("Notes with input", () => createPlayfieldWithNotesAcceptingInput()); } private void triggerKeyDown(Column column) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 279ac868f1..076bcdfaab 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -478,8 +478,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy Duration = endTime - startTime }; - holdNote.HeadNote.Samples = sampleInfoListAt(startTime); - holdNote.TailNote.Samples = sampleInfoListAt(endTime); + holdNote.Head.Samples = sampleInfoListAt(startTime); + holdNote.Tail.Samples = sampleInfoListAt(endTime); newObject = holdNote; } diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs index ddc7d77c0c..6ad7489e0f 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs @@ -76,12 +76,12 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy Duration = endTime - HitObject.StartTime }; - hold.HeadNote.Samples.Add(new SampleInfo + hold.Head.Samples.Add(new SampleInfo { Name = SampleInfo.HIT_NORMAL }); - hold.TailNote.Samples = HitObject.Samples; + hold.Tail.Samples = HitObject.Samples; newObject = hold; } diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index ee371b61ca..cef4eecd38 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -15,15 +15,19 @@ using osu.Framework.Extensions.IEnumerableExtensions; namespace osu.Game.Rulesets.Mania.Objects.Drawables { + /// + /// Visualises a hit object. + /// public class DrawableHoldNote : DrawableManiaHitObject { - private readonly DrawableNote headNote; - private readonly DrawableNote tailNote; + private readonly DrawableNote head; + private readonly DrawableNote tail; + private readonly BodyPiece bodyPiece; private readonly Container tickContainer; /// - /// Relative time at which the user started holding this note. + /// Time at which the user started holding this hold note. /// private double holdStartTime; @@ -34,7 +38,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables private bool _holding; /// - /// Whether the user is holding the hold note. + /// Whether the user is currently holding the hold note. /// private bool holding { @@ -71,12 +75,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables RelativeSizeAxes = Axes.Both, RelativeCoordinateSpace = new Vector2(1, (float)HitObject.Duration) }, - headNote = new DrawableHoldNoteHead(this, key) + head = new HeadNote(this, key) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre }, - tailNote = new DrawableHoldNoteTail(this, key) + tail = new TailNote(this, key) { Anchor = Anchor.BottomCentre, Origin = Anchor.TopCentre @@ -91,14 +95,15 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables HoldStartTime = () => holdStartTime }; + // To make the ticks relative to ourselves we need to offset them backwards drawableTick.Y -= (float)HitObject.StartTime; tickContainer.Add(drawableTick); AddNested(drawableTick); } - AddNested(headNote); - AddNested(tailNote); + AddNested(head); + AddNested(tail); } public override Color4 AccentColour @@ -113,8 +118,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables tickContainer.Children.ForEach(t => t.AccentColour = value); bodyPiece.AccentColour = value; - headNote.AccentColour = value; - tailNote.AccentColour = value; + head.AccentColour = value; + tail.AccentColour = value; } } @@ -163,18 +168,21 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables holding = false; // If the key has been released too early, they should not receive full score for the release - if (!tailNote.Judged) + if (!tail.Judged) hasBroken = true; return true; } - private class DrawableHoldNoteHead : DrawableNote + /// + /// The head note of a hold. + /// + private class HeadNote : DrawableNote { private readonly DrawableHoldNote holdNote; - public DrawableHoldNoteHead(DrawableHoldNote holdNote, Bindable key = null) - : base(holdNote.HitObject.HeadNote, key) + public HeadNote(DrawableHoldNote holdNote, Bindable key = null) + : base(holdNote.HitObject.Head, key) { this.holdNote = holdNote; @@ -201,12 +209,15 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables } } - private class DrawableHoldNoteTail : DrawableNote + /// + /// The tail note of a hold. + /// + private class TailNote : DrawableNote { private readonly DrawableHoldNote holdNote; - public DrawableHoldNoteTail(DrawableHoldNote holdNote, Bindable key = null) - : base(holdNote.HitObject.TailNote, key) + public TailNote(DrawableHoldNote holdNote, Bindable key = null) + : base(holdNote.HitObject.Tail, key) { this.holdNote = holdNote; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs index 7c84157c26..8cd60e9901 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs @@ -13,9 +13,19 @@ using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Mania.Objects.Drawables { + /// + /// Visualises a hit object. + /// public class DrawableHoldNoteTick : DrawableManiaHitObject { + /// + /// References the time at which the user started holding the hold note. + /// public Func HoldStartTime; + + /// + /// References whether the user is currently holding the hold note. + /// public Func IsHolding; private readonly Container glowContainer; @@ -49,6 +59,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables } }; + // Set the default glow AccentColour = Color4.White; } diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs index 42bb371975..658d409bb8 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs @@ -13,6 +13,9 @@ using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Mania.Objects.Drawables { + /// + /// Visualises a hit object. + /// public class DrawableNote : DrawableManiaHitObject { private readonly NotePiece headPiece; diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index b3e2482908..db317ddf7b 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -16,14 +16,20 @@ namespace osu.Game.Rulesets.Mania.Objects public double Duration { get; set; } public double EndTime => StartTime + Duration; - private Note headNote; - public Note HeadNote => headNote ?? (headNote = new Note { StartTime = StartTime }); + private Note head; + /// + /// The head note of the hold. + /// + public Note Head => head ?? (head = new Note { StartTime = StartTime }); - private Note tailNote; - public Note TailNote => tailNote ?? (tailNote = new HoldNoteTail { StartTime = EndTime }); + private Note tail; + /// + /// The tail note of the hold. + /// + public Note Tail => tail ?? (tail = new TailNote { StartTime = EndTime }); /// - /// The length (in milliseconds) between ticks of this hold. + /// The time between ticks of this hold. /// private double tickSpacing = 50; @@ -35,6 +41,9 @@ namespace osu.Game.Rulesets.Mania.Objects tickSpacing = timingPoint.BeatLength / difficulty.SliderTickRate; } + /// + /// The scoring scoring ticks of the hold note. + /// public IEnumerable Ticks => ticks ?? (ticks = createTicks()); private List ticks; @@ -45,7 +54,7 @@ namespace osu.Game.Rulesets.Mania.Objects if (tickSpacing == 0) return ret; - for (double t = StartTime + HeadNote.HitWindows.Great / 2; t <= EndTime - TailNote.HitWindows.Great / 2; t+= tickSpacing) + for (double t = StartTime + Head.HitWindows.Great / 2; t <= EndTime - Tail.HitWindows.Great / 2; t+= tickSpacing) { ret.Add(new HoldNoteTick { @@ -55,5 +64,24 @@ namespace osu.Game.Rulesets.Mania.Objects return ret; } + + /// + /// The tail of the hold note. + /// + private class TailNote : Note + { + /// + /// Lenience of release hit windows. This is to make cases where the hold note release + /// is timed alongside presses of other hit objects less awkward. + /// + private const double release_window_lenience = 1.5; + + public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) + { + base.ApplyDefaults(controlPointInfo, difficulty); + + HitWindows *= release_window_lenience; + } + } } } diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNoteTail.cs b/osu.Game.Rulesets.Mania/Objects/HoldNoteTail.cs deleted file mode 100644 index 6399277a2b..0000000000 --- a/osu.Game.Rulesets.Mania/Objects/HoldNoteTail.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Database; - -namespace osu.Game.Rulesets.Mania.Objects -{ - public class HoldNoteTail : Note - { - /// - /// Lenience of release hit windows. This is to make cases where the hold note release - /// is timed alongside presses of other hit objects less awkward. - /// - private const double release_window_lenience = 1.5; - - public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) - { - base.ApplyDefaults(controlPointInfo, difficulty); - - HitWindows *= release_window_lenience; - } - } -} \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs index 805b2a0938..6c4cf127f3 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs @@ -3,6 +3,9 @@ namespace osu.Game.Rulesets.Mania.Objects { + /// + /// A scoring tick of a hold note. + /// public class HoldNoteTick : ManiaHitObject { } diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index 91cb551414..7a8ec25fe4 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -71,7 +71,6 @@ - From 181648515b433c56006d1a8d9b2685e20c08fa63 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 24 May 2017 16:05:24 +0300 Subject: [PATCH 09/47] Moving icon to the beat on the TwoLayerButton --- .../Graphics/UserInterface/TwoLayerButton.cs | 118 +++++++++++------- 1 file changed, 71 insertions(+), 47 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 237aaa44a6..4aeaf6965d 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -5,18 +5,21 @@ using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using OpenTK; using OpenTK.Graphics; using osu.Game.Graphics.Sprites; using osu.Framework.Extensions.Color4Extensions; +using osu.Game.Graphics.Containers; +using osu.Game.Beatmaps.ControlPoints; +using osu.Framework.Audio.Track; +using System; namespace osu.Game.Graphics.UserInterface { public class TwoLayerButton : ClickableContainer { - private readonly TextAwesome icon; + private readonly IconBeatSyncedContainer iconBeatSyncedContainer; public Box IconLayer; public Box TextLayer; @@ -95,11 +98,10 @@ namespace osu.Game.Graphics.UserInterface }, } }, - icon = new TextAwesome + iconBeatSyncedContainer = new IconBeatSyncedContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, - TextSize = 25, }, } }, @@ -146,7 +148,7 @@ namespace osu.Game.Graphics.UserInterface { set { - icon.Icon = value; + iconBeatSyncedContainer.Icon = value; } } @@ -162,58 +164,16 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnHover(InputState state) { - icon.ClearTransforms(); - ResizeTo(SIZE_EXTENDED, transform_time, EasingTypes.OutElastic); - - int duration = 0; //(int)(Game.Audio.BeatLength / 2); - if (duration == 0) duration = pulse_length; - IconLayer.FadeColour(HoverColour, transform_time, EasingTypes.OutElastic); - const double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration; - double startTime = Time.Current + offset; - - // basic pulse - icon.Transforms.Add(new TransformScale - { - StartValue = new Vector2(1.1f), - EndValue = Vector2.One, - StartTime = startTime, - EndTime = startTime + duration, - Easing = EasingTypes.Out, - LoopCount = -1, - LoopDelay = duration - }); - return true; } protected override void OnHoverLost(InputState state) { - icon.ClearTransforms(); - ResizeTo(SIZE_RETRACTED, transform_time, EasingTypes.OutElastic); - IconLayer.FadeColour(TextLayer.Colour, transform_time, EasingTypes.OutElastic); - - int duration = 0; //(int)(Game.Audio.BeatLength); - if (duration == 0) duration = pulse_length * 2; - - const double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration; - double startTime = Time.Current + offset; - - // slow pulse - icon.Transforms.Add(new TransformScale - { - StartValue = new Vector2(1.1f), - EndValue = Vector2.One, - StartTime = startTime, - EndTime = startTime + duration, - Easing = EasingTypes.Out, - LoopCount = -1, - LoopDelay = duration - }); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) @@ -239,5 +199,69 @@ namespace osu.Game.Graphics.UserInterface return base.OnClick(state); } + + private class IconBeatSyncedContainer : BeatSyncedContainer + { + private const double beat_in_time = 60; + + private readonly TextAwesome icon; + private readonly Container amplitudeContainer; + + public FontAwesome Icon { set { icon.Icon = value; } } + + public IconBeatSyncedContainer() + { + EarlyActivationMilliseconds = beat_in_time; + AutoSizeAxes = Axes.Both; + + Children = new Drawable[] + { + amplitudeContainer = new Container + { + AutoSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + icon = new TextAwesome + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + TextSize = 25 + } + } + }, + }; + } + + private int lastBeatIndex; + + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) + { + base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); + + lastBeatIndex = beatIndex; + + var beatLength = timingPoint.BeatLength; + + float amplitudeAdjust = Math.Min(1, 0.4f + amplitudes.Maximum); + + if (beatIndex < 0) return; + + icon.ScaleTo(1 - 0.1f * amplitudeAdjust, beat_in_time, EasingTypes.Out); + using (icon.BeginDelayedSequence(beat_in_time)) + icon.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); + } + + protected override void Update() + { + base.Update(); + + const float scale_adjust_cutoff = 0.4f; + + var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value?.Track?.CurrentAmplitudes.Maximum ?? 0 : 0; + amplitudeContainer.ScaleTo(1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.1f, 75, EasingTypes.OutQuint); + } + } } } \ No newline at end of file From 9ea70b849b3ab88ffb8afade1d271487799ac934 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Thu, 25 May 2017 14:16:51 +0200 Subject: [PATCH 10/47] Fix initialize beatmap change animation of the music controller --- osu.Game/Overlays/MusicController.cs | 46 +++++++++++++++------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 4faa339bed..ff6b581480 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -264,32 +264,36 @@ namespace osu.Game.Overlays private void beatmapChanged(WorkingBeatmap beatmap) { - progressBar.IsEnabled = beatmap != null; - - bool audioEquals = beatmapBacking.Value?.BeatmapInfo?.AudioEquals(current?.BeatmapInfo) ?? false; - - TransformDirection direction; - - if (audioEquals) - direction = TransformDirection.None; - else if (queuedDirection.HasValue) + if (current != null) { - direction = queuedDirection.Value; + progressBar.IsEnabled = beatmap != null; + + bool audioEquals = beatmapBacking.Value?.BeatmapInfo?.AudioEquals(current.BeatmapInfo) ?? false; + + TransformDirection direction; + + if (audioEquals) + direction = TransformDirection.None; + else if (queuedDirection.HasValue) + { + direction = queuedDirection.Value; + queuedDirection = null; + } + else + { + //figure out the best direction based on order in playlist. + var last = playlist.BeatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo.ID).Count(); + var next = beatmapBacking.Value == null ? -1 : playlist.BeatmapSets.TakeWhile(b => b.ID != beatmapBacking.Value.BeatmapSetInfo.ID).Count(); + + direction = last > next ? TransformDirection.Prev : TransformDirection.Next; + } + + + updateDisplay(beatmapBacking, direction); queuedDirection = null; } - else - { - //figure out the best direction based on order in playlist. - var last = current == null ? -1 : playlist.BeatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo.ID).Count(); - var next = beatmapBacking.Value == null ? -1 : playlist.BeatmapSets.TakeWhile(b => b.ID != beatmapBacking.Value.BeatmapSetInfo.ID).Count(); - - direction = last > next ? TransformDirection.Prev : TransformDirection.Next; - } current = beatmapBacking.Value; - - updateDisplay(beatmapBacking, direction); - queuedDirection = null; } private ScheduledDelegate pendingBeatmapSwitch; From c32d816f9cb26c531cdd4b81dca360acdf464a6f Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Thu, 25 May 2017 14:19:04 +0200 Subject: [PATCH 11/47] Removed new line --- osu-framework | 2 +- osu.Game/Overlays/MusicController.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/osu-framework b/osu-framework index 777996fb97..4de8400d5b 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 777996fb9731ba1895a5ab1323cbbc97259ff741 +Subproject commit 4de8400d5b3169bddb9fea7b25ed2498a166c14d diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index ff6b581480..1ac189d8e2 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -288,7 +288,6 @@ namespace osu.Game.Overlays direction = last > next ? TransformDirection.Prev : TransformDirection.Next; } - updateDisplay(beatmapBacking, direction); queuedDirection = null; } From 9de7e7bc40617f7538e1b738e2e8c20f97a84129 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Thu, 25 May 2017 17:49:47 +0200 Subject: [PATCH 12/47] Fixes --- osu.Game/Overlays/MusicController.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 1ac189d8e2..f1be55801f 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -264,14 +264,14 @@ namespace osu.Game.Overlays private void beatmapChanged(WorkingBeatmap beatmap) { + progressBar.IsEnabled = beatmap != null; + + TransformDirection direction = TransformDirection.None; + if (current != null) { - progressBar.IsEnabled = beatmap != null; - bool audioEquals = beatmapBacking.Value?.BeatmapInfo?.AudioEquals(current.BeatmapInfo) ?? false; - TransformDirection direction; - if (audioEquals) direction = TransformDirection.None; else if (queuedDirection.HasValue) @@ -287,12 +287,12 @@ namespace osu.Game.Overlays direction = last > next ? TransformDirection.Prev : TransformDirection.Next; } - - updateDisplay(beatmapBacking, direction); - queuedDirection = null; } current = beatmapBacking.Value; + + updateDisplay(beatmapBacking, direction); + queuedDirection = null; } private ScheduledDelegate pendingBeatmapSwitch; From 79e731ec2a182cc5cb3032ad9c90aec0b9c2c6db Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Thu, 25 May 2017 20:20:30 +0200 Subject: [PATCH 13/47] Updated framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 4de8400d5b..8baad1b948 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 4de8400d5b3169bddb9fea7b25ed2498a166c14d +Subproject commit 8baad1b9484b9f35724e2f965c18cfe710907d80 From c2d3b6c05ad5c8dfacb6d47fdceed144409ef16e Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 15:53:49 +0900 Subject: [PATCH 14/47] Remove late initialization of head + tail, keep them updated with start time and end time. --- osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 29 +++++++++++++++++---- osu.Game/Rulesets/Objects/HitObject.cs | 2 +- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index db317ddf7b..5069b4f623 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -13,20 +13,39 @@ namespace osu.Game.Rulesets.Mania.Objects /// public class HoldNote : ManiaHitObject, IHasEndTime { - public double Duration { get; set; } public double EndTime => StartTime + Duration; - private Note head; + private double duration; + public double Duration + { + get { return duration; } + set + { + duration = value; + Tail.StartTime = EndTime; + } + } + + public override double StartTime + { + get { return base.StartTime; } + set + { + base.StartTime = value; + Head.StartTime = value; + Tail.StartTime = EndTime; + } + } + /// /// The head note of the hold. /// - public Note Head => head ?? (head = new Note { StartTime = StartTime }); + public Note Head = new Note(); - private Note tail; /// /// The tail note of the hold. /// - public Note Tail => tail ?? (tail = new TailNote { StartTime = EndTime }); + public Note Tail = new TailNote(); /// /// The time between ticks of this hold. diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index 5592681cab..b282965db8 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Objects /// /// The time at which the HitObject starts. /// - public double StartTime; + public virtual double StartTime { get; set; } /// /// The samples to be played when this hit object is hit. From d3206396e7b5474db47117541ce22487cfcbb38c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 16:10:04 +0900 Subject: [PATCH 15/47] Rewrite comments. --- .../Objects/Drawables/DrawableHoldNote.cs | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index cef4eecd38..cee2e103b9 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -127,15 +127,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables { } - /// - /// Handles key down events on the body of the hold note. - /// - /// The input state. - /// The key down args. - /// Whether the key press was handled. protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { - // Make sure the keypress happened within reasonable bounds of the hold note + // Make sure the keypress happened within the body of the hold note if (Time.Current < HitObject.StartTime || Time.Current > HitObject.EndTime) return false; @@ -145,17 +139,14 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables if (args.Repeat) return false; + // The user has pressed during the body of the hold note, after the head note and its hit windows have passed + // and within the limited range of the above if-statement. This state will be managed by the head note if the + // user has pressed during the hit windows of the head note. holding = true; return true; } - /// - /// Handles key up events on the body of the hold note. - /// - /// The input state. - /// The key down args. - /// Whether the key press was handled. protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) { // Make sure that the user started holding the key during the hold note @@ -167,7 +158,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables holding = false; - // If the key has been released too early, they should not receive full score for the release + // If the key has been released too early, the user should not receive full score for the release if (!tail.Judged) hasBroken = true; @@ -196,13 +187,15 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables return false; // We only want to trigger a holding state from the head if the head has received a judgement - if (Judgement.Result == HitResult.None) + if (!Judged) return false; - // If the head has been missed, make sure the user also can't receive a full score for the release + // If the key has been released too early, the user should not receive full score for the release if (Judgement.Result == HitResult.Miss) holdNote.hasBroken = true; + // The head note also handles early hits before the body, but we want accurate early hits to count as the body being held + // The body doesn't handle these early early hits, so we have to explicitly set the holding state here holdNote.holding = true; return true; From 47e1b7b389e9347b22c6a1d1e28139ad4e000e80 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 16:28:39 +0900 Subject: [PATCH 16/47] Fix tick construction loop. --- osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index 5069b4f623..c241c4cf41 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -40,12 +40,12 @@ namespace osu.Game.Rulesets.Mania.Objects /// /// The head note of the hold. /// - public Note Head = new Note(); + public readonly Note Head = new Note(); /// /// The tail note of the hold. /// - public Note Tail = new TailNote(); + public readonly Note Tail = new TailNote(); /// /// The time between ticks of this hold. @@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Mania.Objects if (tickSpacing == 0) return ret; - for (double t = StartTime + Head.HitWindows.Great / 2; t <= EndTime - Tail.HitWindows.Great / 2; t+= tickSpacing) + for (double t = StartTime + tickSpacing; t <= EndTime - tickSpacing; t += tickSpacing) { ret.Add(new HoldNoteTick { From 3f4cbd02cdaf2def643a4df6a4be4b79c63edd39 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 16:29:20 +0900 Subject: [PATCH 17/47] Fix warnings. --- .../Patterns/Legacy/DistanceObjectPatternGenerator.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 076bcdfaab..2d1f75e196 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -475,11 +475,11 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { StartTime = startTime, Column = column, - Duration = endTime - startTime + Duration = endTime - startTime, + Head = { Samples = sampleInfoListAt(startTime) }, + Tail = { Samples = sampleInfoListAt(endTime) } }; - holdNote.Head.Samples = sampleInfoListAt(startTime); - holdNote.Tail.Samples = sampleInfoListAt(endTime); newObject = holdNote; } From 871d44d6281cd6a795ce824645ee43f40aed1f6d Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 16:39:43 +0900 Subject: [PATCH 18/47] Renamings. --- .../Objects/Drawables/DrawableHoldNote.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index cee2e103b9..b9b94e7f45 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -75,12 +75,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables RelativeSizeAxes = Axes.Both, RelativeCoordinateSpace = new Vector2(1, (float)HitObject.Duration) }, - head = new HeadNote(this, key) + head = new DrawableHeadNote(this, key) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre }, - tail = new TailNote(this, key) + tail = new DrawableTailNote(this, key) { Anchor = Anchor.BottomCentre, Origin = Anchor.TopCentre @@ -168,11 +168,11 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables /// /// The head note of a hold. /// - private class HeadNote : DrawableNote + private class DrawableHeadNote : DrawableNote { private readonly DrawableHoldNote holdNote; - public HeadNote(DrawableHoldNote holdNote, Bindable key = null) + public DrawableHeadNote(DrawableHoldNote holdNote, Bindable key = null) : base(holdNote.HitObject.Head, key) { this.holdNote = holdNote; @@ -205,11 +205,11 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables /// /// The tail note of a hold. /// - private class TailNote : DrawableNote + private class DrawableTailNote : DrawableNote { private readonly DrawableHoldNote holdNote; - public TailNote(DrawableHoldNote holdNote, Bindable key = null) + public DrawableTailNote(DrawableHoldNote holdNote, Bindable key = null) : base(holdNote.HitObject.Tail, key) { this.holdNote = holdNote; From 5eab6112552ca9e972ac8d06567fd4de02d54cc5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 26 May 2017 17:33:50 +0900 Subject: [PATCH 19/47] Fix some possible nullrefs on beatmap load failure --- osu.Game/Screens/Play/Player.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index a39e7dbab2..707d026e2b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -293,7 +293,7 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(Screen next) { - if (HasFailed || !ValidForResume || pauseContainer.AllowExit || HitRenderer.HasReplayLoaded) + if (HasFailed || !ValidForResume || pauseContainer?.AllowExit != false || HitRenderer?.HasReplayLoaded != false) { fadeOut(); return base.OnExiting(next); @@ -310,7 +310,7 @@ namespace osu.Game.Screens.Play HitRenderer?.FadeOut(fade_out_duration); Content.FadeOut(fade_out_duration); - hudOverlay.ScaleTo(0.7f, fade_out_duration * 3, EasingTypes.In); + hudOverlay?.ScaleTo(0.7f, fade_out_duration * 3, EasingTypes.In); Background?.FadeTo(1f, fade_out_duration); } From 3ec41a313b548d59a89fbdbd1e1b89a03b05c74c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 18:48:18 +0900 Subject: [PATCH 20/47] Add base DrawableHitObject + HitObjectStartTimeComparer. --- .../Objects/Drawables/DrawableHitObject.cs | 49 ++++++++++++----- .../Objects/HitObjectStartTimeComparer.cs | 55 +++++++++++++++++++ 2 files changed, 89 insertions(+), 15 deletions(-) create mode 100644 osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index c5dbc27fd3..fcdcf672d5 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -15,28 +15,51 @@ using System.Linq; namespace osu.Game.Rulesets.Objects.Drawables { - public abstract class DrawableHitObject : Container - where TObject : HitObject - where TJudgement : Judgement + public abstract class DrawableHitObject : Container { - public event Action> OnJudgement; - - public TObject HitObject; + public readonly HitObject HitObject; /// /// The colour used for various elements of this DrawableHitObject. /// public virtual Color4 AccentColour { get; set; } + protected DrawableHitObject(HitObject hitObject) + { + HitObject = hitObject; + } + } + + public abstract class DrawableHitObject : DrawableHitObject + where TObject : HitObject + { + public new readonly TObject HitObject; + + protected DrawableHitObject(TObject hitObject) + : base(hitObject) + { + HitObject = hitObject; + } + } + + public abstract class DrawableHitObject : DrawableHitObject + where TObject : HitObject + where TJudgement : Judgement + { + public event Action> OnJudgement; + public override bool HandleInput => Interactive; public bool Interactive = true; public TJudgement Judgement; - protected abstract TJudgement CreateJudgement(); + protected List Samples = new List(); - protected abstract void UpdateState(ArmedState state); + protected DrawableHitObject(TObject hitObject) + : base(hitObject) + { + } private ArmedState state; public ArmedState State @@ -59,8 +82,6 @@ namespace osu.Game.Rulesets.Objects.Drawables } } - protected List Samples = new List(); - protected void PlaySamples() { Samples.ForEach(s => s?.Play()); @@ -79,11 +100,6 @@ namespace osu.Game.Rulesets.Objects.Drawables /// public bool Judged => (Judgement?.Result ?? HitResult.None) != HitResult.None && (NestedHitObjects?.All(h => h.Judged) ?? true); - protected DrawableHitObject(TObject hitObject) - { - HitObject = hitObject; - } - /// /// Process a hit of this hitobject. Carries out judgement. /// @@ -176,5 +192,8 @@ namespace osu.Game.Rulesets.Objects.Drawables h.OnJudgement += d => OnJudgement?.Invoke(d); nestedHitObjects.Add(h); } + + protected abstract TJudgement CreateJudgement(); + protected abstract void UpdateState(ArmedState state); } } diff --git a/osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs b/osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs new file mode 100644 index 0000000000..e65bc4a99f --- /dev/null +++ b/osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs @@ -0,0 +1,55 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Game.Rulesets.Objects.Drawables; + +namespace osu.Game.Rulesets.Objects +{ + /// + /// Compares two hit objects by their start time, falling back to creation order if their start time is equal. + /// + public class HitObjectStartTimeComparer : Drawable.CreationOrderDepthComparer + { + public override int Compare(Drawable x, Drawable y) + { + var hitObjectX = x as DrawableHitObject; + var hitObjectY = y as DrawableHitObject; + + // If either of the two drawables are not hit objects, fall back to the base comparer + if ((hitObjectX ?? hitObjectY) == null) + return base.Compare(x, y); + + // Compare by start time + int i = hitObjectX.HitObject.StartTime.CompareTo(hitObjectY.HitObject.StartTime); + if (i != 0) + return i; + + return base.Compare(x, y); + } + } + + /// + /// Compares two hit objects by their start time, falling back to creation order if their start time is equal. + /// This will compare the two hit objects in reverse order. + /// + public class HitObjectReverseStartTimeComparer : Drawable.ReverseCreationOrderDepthComparer + { + public override int Compare(Drawable x, Drawable y) + { + var hitObjectX = x as DrawableHitObject; + var hitObjectY = y as DrawableHitObject; + + // If either of the two drawables are not hit objects, fall back to the base comparer + if ((hitObjectX ?? hitObjectY) == null) + return base.Compare(x, y); + + // Compare by start time + int i = hitObjectY.HitObject.StartTime.CompareTo(hitObjectX.HitObject.StartTime); + if (i != 0) + return i; + + return base.Compare(x, y); + } + } +} \ No newline at end of file From e4b59314ea0735dc2607d3e56df6e2ec6a580d78 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 18:52:43 +0900 Subject: [PATCH 21/47] Use new HitObjectStartTimeComparer. --- osu-framework | 2 +- osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs | 3 +++ osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 7 +------ 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/osu-framework b/osu-framework index 777996fb97..ea5a2a7e1a 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 777996fb9731ba1895a5ab1323cbbc97259ff741 +Subproject commit ea5a2a7e1abffb1515c020fd017b583b71780316 diff --git a/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs b/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs index cc8897840e..636c84d9dc 100644 --- a/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs +++ b/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using OpenTK; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Mania.Timing { @@ -28,6 +29,8 @@ namespace osu.Game.Rulesets.Mania.Timing private readonly List drawableControlPoints; + protected override IComparer DepthComparer => new HitObjectStartTimeComparer(); + public ControlPointContainer(IEnumerable timingChanges) { drawableControlPoints = timingChanges.Select(t => new DrawableControlPoint(t)).ToList(); diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 495959b061..ff763f87c4 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -189,12 +189,7 @@ namespace osu.Game.Rulesets.Mania.UI } } - public override void Add(DrawableHitObject h) - { - h.Depth = (float)h.HitObject.StartTime; - - Columns.ElementAt(h.HitObject.Column).Add(h); - } + public override void Add(DrawableHitObject h) => Columns.ElementAt(h.HitObject.Column).Add(h); protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { From f294fef29bcaf1264639c7ffc952e12c2056b25d Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 18:56:21 +0900 Subject: [PATCH 22/47] Remove holding property in favor of a nullable hold start time. --- .../Objects/Drawables/DrawableHoldNote.cs | 33 ++++--------------- .../Objects/Drawables/DrawableHoldNoteTick.cs | 3 +- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index b9b94e7f45..5d7f3314cd 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -27,33 +27,15 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables private readonly Container tickContainer; /// - /// Time at which the user started holding this hold note. + /// Time at which the user started holding this hold note. Null if the user is not holding this hold note. /// - private double holdStartTime; + private double? holdStartTime; /// /// Whether the hold note has been released too early and shouldn't give full score for the release. /// private bool hasBroken; - private bool _holding; - /// - /// Whether the user is currently holding the hold note. - /// - private bool holding - { - get { return _holding; } - set - { - if (_holding == value) - return; - _holding = value; - - if (holding) - holdStartTime = Time.Current; - } - } - public DrawableHoldNote(HoldNote hitObject, Bindable key = null) : base(hitObject, key) { @@ -91,7 +73,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables { var drawableTick = new DrawableHoldNoteTick(tick) { - IsHolding = () => holding, HoldStartTime = () => holdStartTime }; @@ -142,7 +123,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables // The user has pressed during the body of the hold note, after the head note and its hit windows have passed // and within the limited range of the above if-statement. This state will be managed by the head note if the // user has pressed during the hit windows of the head note. - holding = true; + holdStartTime = Time.Current; return true; } @@ -150,13 +131,13 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) { // Make sure that the user started holding the key during the hold note - if (!holding) + if (!holdStartTime.HasValue) return false; if (args.Key != Key) return false; - holding = false; + holdStartTime = null; // If the key has been released too early, the user should not receive full score for the release if (!tail.Judged) @@ -196,7 +177,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables // The head note also handles early hits before the body, but we want accurate early hits to count as the body being held // The body doesn't handle these early early hits, so we have to explicitly set the holding state here - holdNote.holding = true; + holdNote.holdStartTime = Time.Current; return true; } @@ -234,7 +215,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) { // Make sure that the user started holding the key during the hold note - if (!holdNote.holding) + if (!holdNote.holdStartTime.HasValue) return false; if (Judgement.Result != HitResult.None) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs index 8cd60e9901..9ecc77d3fc 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables /// /// References the time at which the user started holding the hold note. /// - public Func HoldStartTime; + public Func HoldStartTime; /// /// References whether the user is currently holding the hold note. @@ -90,7 +90,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables if (Time.Current < HitObject.StartTime) return; - if (HoldStartTime?.Invoke() > HitObject.StartTime) return; From 9517bfc2f18d948226d2a37649d73aea1771f48b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 19:33:23 +0900 Subject: [PATCH 23/47] Add file to csproj. --- osu.Game/osu.Game.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 25b692151f..c669ac1981 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -176,6 +176,7 @@ + From 2c23703ca6f85f7c792c9dca1392d3cf015212d1 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 26 May 2017 13:46:44 +0300 Subject: [PATCH 24/47] Removed amplitude container --- .../Graphics/UserInterface/TwoLayerButton.cs | 40 ++++--------------- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 4aeaf6965d..209d9fb468 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -19,7 +19,7 @@ namespace osu.Game.Graphics.UserInterface { public class TwoLayerButton : ClickableContainer { - private readonly IconBeatSyncedContainer iconBeatSyncedContainer; + private readonly BouncingIcon bouncingIcon; public Box IconLayer; public Box TextLayer; @@ -98,7 +98,7 @@ namespace osu.Game.Graphics.UserInterface }, } }, - iconBeatSyncedContainer = new IconBeatSyncedContainer + bouncingIcon = new BouncingIcon { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -148,7 +148,7 @@ namespace osu.Game.Graphics.UserInterface { set { - iconBeatSyncedContainer.Icon = value; + bouncingIcon.Icon = value; } } @@ -200,48 +200,34 @@ namespace osu.Game.Graphics.UserInterface return base.OnClick(state); } - private class IconBeatSyncedContainer : BeatSyncedContainer + private class BouncingIcon : BeatSyncedContainer { private const double beat_in_time = 60; private readonly TextAwesome icon; - private readonly Container amplitudeContainer; public FontAwesome Icon { set { icon.Icon = value; } } - public IconBeatSyncedContainer() + public BouncingIcon() { EarlyActivationMilliseconds = beat_in_time; AutoSizeAxes = Axes.Both; Children = new Drawable[] { - amplitudeContainer = new Container + icon = new TextAwesome { - AutoSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Children = new Drawable[] - { - icon = new TextAwesome - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - TextSize = 25 - } - } - }, + TextSize = 25 + } }; } - private int lastBeatIndex; - protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) { base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); - lastBeatIndex = beatIndex; - var beatLength = timingPoint.BeatLength; float amplitudeAdjust = Math.Min(1, 0.4f + amplitudes.Maximum); @@ -252,16 +238,6 @@ namespace osu.Game.Graphics.UserInterface using (icon.BeginDelayedSequence(beat_in_time)) icon.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); } - - protected override void Update() - { - base.Update(); - - const float scale_adjust_cutoff = 0.4f; - - var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value?.Track?.CurrentAmplitudes.Maximum ?? 0 : 0; - amplitudeContainer.ScaleTo(1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.1f, 75, EasingTypes.OutQuint); - } } } } \ No newline at end of file From cbe36259c3eea9bd422aeaea816e22d400893ba6 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 07:49:45 -0300 Subject: [PATCH 25/47] Add BreadcrumbControl --- .../Tests/TestCaseBreadcrumbs.cs | 39 ++++++++++++ .../osu.Desktop.VisualTests.csproj | 1 + .../UserInterface/BreadcrumbControl.cs | 63 +++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 4 files changed, 104 insertions(+) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseBreadcrumbs.cs create mode 100644 osu.Game/Graphics/UserInterface/BreadcrumbControl.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBreadcrumbs.cs b/osu.Desktop.VisualTests/Tests/TestCaseBreadcrumbs.cs new file mode 100644 index 0000000000..658d2f92b1 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseBreadcrumbs.cs @@ -0,0 +1,39 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Testing; +using osu.Game.Graphics.UserInterface; +using osu.Framework.Graphics; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseBreadcrumbs : TestCase + { + public override string Description => @"breadcrumb > control"; + + public override void Reset() + { + base.Reset(); + + BreadcrumbControl c; + Add(c = new BreadcrumbControl + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + Width = 0.5f, + }); + + AddStep(@"first", () => c.Current.Value = BreadcrumbTab.Click); + AddStep(@"second", () => c.Current.Value = BreadcrumbTab.The); + AddStep(@"third", () => c.Current.Value = BreadcrumbTab.Circles); + } + + private enum BreadcrumbTab + { + Click, + The, + Circles, + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 7b7997063b..5a532d7234 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -223,6 +223,7 @@ + diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs new file mode 100644 index 0000000000..be3933f362 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -0,0 +1,63 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.UserInterface; + +namespace osu.Game.Graphics.UserInterface +{ + public class BreadcrumbControl : OsuTabControl + { + public static readonly float padding = 10; + + protected override TabItem CreateTabItem(T value) => new BreadcrumbTabItem(value); + + public BreadcrumbControl() + { + Height = 28; + TabContainer.Spacing = new Vector2(padding, 0f); + Current.ValueChanged += tab => + { + foreach (TabItem t in TabContainer.Children) + { + if (!(t is BreadcrumbTabItem)) return; + + var tIndex = TabContainer.IndexOf(t); + var tabIndex = TabContainer.IndexOf(TabMap[tab]); + var hide = tIndex < tabIndex; + var hideChevron = tIndex <= tabIndex; + + t.FadeTo(hide ? 0f : 1f, 500, EasingTypes.OutQuint); + t.ScaleTo(new Vector2(hide ? 0.8f : 1f, 1f), 500, EasingTypes.OutQuint); + (t as BreadcrumbTabItem).Chevron.FadeTo(hideChevron ? 0f : 1f, 500, EasingTypes.OutQuint); + } + }; + } + + private class BreadcrumbTabItem : OsuTabItem + { + public readonly TextAwesome Chevron; + + //don't allow clicking between transitions and don't make the chevron clickable + protected override bool InternalContains(Vector2 screenSpacePos) => Alpha < 1f ? false : Text.Contains(screenSpacePos); + + public BreadcrumbTabItem(T value) : base(value) + { + Text.TextSize = 18; + Padding = new MarginPadding { Right = padding + 9 }; + Add(Chevron = new TextAwesome + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreLeft, + TextSize = 12, + Icon = FontAwesome.fa_chevron_right, + Margin = new MarginPadding { Left = 10 }, + Alpha = 0f, + }); + } + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 25b692151f..4d1b1a1b11 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -450,6 +450,7 @@ + From d052f093d5984e45ef7fbd45165f939231375c29 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 26 May 2017 14:29:45 +0300 Subject: [PATCH 26/47] Scaling on hover --- osu.Game/Graphics/UserInterface/TwoLayerButton.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 209d9fb468..ebaef661c4 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -167,6 +167,8 @@ namespace osu.Game.Graphics.UserInterface ResizeTo(SIZE_EXTENDED, transform_time, EasingTypes.OutElastic); IconLayer.FadeColour(HoverColour, transform_time, EasingTypes.OutElastic); + bouncingIcon.ScaleTo(1.1f, transform_time, EasingTypes.OutElastic); + return true; } @@ -174,6 +176,8 @@ namespace osu.Game.Graphics.UserInterface { ResizeTo(SIZE_RETRACTED, transform_time, EasingTypes.OutElastic); IconLayer.FadeColour(TextLayer.Colour, transform_time, EasingTypes.OutElastic); + + bouncingIcon.ScaleTo(1, transform_time, EasingTypes.OutElastic); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) From fb6ed159ca0042dc11ec2e33e22a030c97e00dba Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 16:03:51 -0300 Subject: [PATCH 27/47] Use padding for chevron margin --- osu.Game/Graphics/UserInterface/BreadcrumbControl.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index be3933f362..a54823e042 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -47,14 +47,14 @@ namespace osu.Game.Graphics.UserInterface public BreadcrumbTabItem(T value) : base(value) { Text.TextSize = 18; - Padding = new MarginPadding { Right = padding + 9 }; + Padding = new MarginPadding { Right = padding + 9 }; //padding + chevron width Add(Chevron = new TextAwesome { Anchor = Anchor.CentreRight, Origin = Anchor.CentreLeft, TextSize = 12, Icon = FontAwesome.fa_chevron_right, - Margin = new MarginPadding { Left = 10 }, + Margin = new MarginPadding { Left = padding }, Alpha = 0f, }); } From 352d3d247bec1cd5be22715f3894d9aa37b74f94 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 16:21:37 -0300 Subject: [PATCH 28/47] Fix incorrect sizes --- osu.Game/Graphics/UserInterface/BreadcrumbControl.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index a54823e042..4ee0ba9e5e 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -17,7 +17,7 @@ namespace osu.Game.Graphics.UserInterface public BreadcrumbControl() { - Height = 28; + Height = 26; TabContainer.Spacing = new Vector2(padding, 0f); Current.ValueChanged += tab => { @@ -46,8 +46,8 @@ namespace osu.Game.Graphics.UserInterface public BreadcrumbTabItem(T value) : base(value) { - Text.TextSize = 18; - Padding = new MarginPadding { Right = padding + 9 }; //padding + chevron width + Text.TextSize = 16; + Padding = new MarginPadding { Right = padding + 8 }; //padding + chevron width Add(Chevron = new TextAwesome { Anchor = Anchor.CentreRight, From 4c127a6130368c87f85b98af2e10ca6218f2c0b2 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 16:29:20 -0300 Subject: [PATCH 29/47] CI fixes --- osu.Game/Graphics/UserInterface/BreadcrumbControl.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index 4ee0ba9e5e..3bc94da07b 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -1,17 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Linq; using OpenTK; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; namespace osu.Game.Graphics.UserInterface { public class BreadcrumbControl : OsuTabControl { - public static readonly float padding = 10; + public const float padding = 10; protected override TabItem CreateTabItem(T value) => new BreadcrumbTabItem(value); @@ -23,8 +21,6 @@ namespace osu.Game.Graphics.UserInterface { foreach (TabItem t in TabContainer.Children) { - if (!(t is BreadcrumbTabItem)) return; - var tIndex = TabContainer.IndexOf(t); var tabIndex = TabContainer.IndexOf(TabMap[tab]); var hide = tIndex < tabIndex; @@ -32,7 +28,7 @@ namespace osu.Game.Graphics.UserInterface t.FadeTo(hide ? 0f : 1f, 500, EasingTypes.OutQuint); t.ScaleTo(new Vector2(hide ? 0.8f : 1f, 1f), 500, EasingTypes.OutQuint); - (t as BreadcrumbTabItem).Chevron.FadeTo(hideChevron ? 0f : 1f, 500, EasingTypes.OutQuint); + ((BreadcrumbTabItem)t).Chevron.FadeTo(hideChevron ? 0f : 1f, 500, EasingTypes.OutQuint); } }; } @@ -42,7 +38,7 @@ namespace osu.Game.Graphics.UserInterface public readonly TextAwesome Chevron; //don't allow clicking between transitions and don't make the chevron clickable - protected override bool InternalContains(Vector2 screenSpacePos) => Alpha < 1f ? false : Text.Contains(screenSpacePos); + protected override bool InternalContains(Vector2 screenSpacePos) => Alpha == 1f && Text.Contains(screenSpacePos); public BreadcrumbTabItem(T value) : base(value) { From c9971bb490a60714279b3b965b4ee4734a8f02c5 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 16:32:46 -0300 Subject: [PATCH 30/47] Don't store hideChevron --- osu.Game/Graphics/UserInterface/BreadcrumbControl.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index 3bc94da07b..b19b1c805e 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -24,11 +24,10 @@ namespace osu.Game.Graphics.UserInterface var tIndex = TabContainer.IndexOf(t); var tabIndex = TabContainer.IndexOf(TabMap[tab]); var hide = tIndex < tabIndex; - var hideChevron = tIndex <= tabIndex; t.FadeTo(hide ? 0f : 1f, 500, EasingTypes.OutQuint); t.ScaleTo(new Vector2(hide ? 0.8f : 1f, 1f), 500, EasingTypes.OutQuint); - ((BreadcrumbTabItem)t).Chevron.FadeTo(hideChevron ? 0f : 1f, 500, EasingTypes.OutQuint); + ((BreadcrumbTabItem)t).Chevron.FadeTo(tIndex <= tabIndex ? 0f : 1f, 500, EasingTypes.OutQuint); } }; } From 33d6b718be955c16a41d9e15b364eb9fae20aceb Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 16:36:00 -0300 Subject: [PATCH 31/47] padding -> PADDING --- osu.Game/Graphics/UserInterface/BreadcrumbControl.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index b19b1c805e..53e8275b56 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -9,14 +9,14 @@ namespace osu.Game.Graphics.UserInterface { public class BreadcrumbControl : OsuTabControl { - public const float padding = 10; + public const float PADDING = 10; protected override TabItem CreateTabItem(T value) => new BreadcrumbTabItem(value); public BreadcrumbControl() { Height = 26; - TabContainer.Spacing = new Vector2(padding, 0f); + TabContainer.Spacing = new Vector2(PADDING, 0f); Current.ValueChanged += tab => { foreach (TabItem t in TabContainer.Children) @@ -42,14 +42,14 @@ namespace osu.Game.Graphics.UserInterface public BreadcrumbTabItem(T value) : base(value) { Text.TextSize = 16; - Padding = new MarginPadding { Right = padding + 8 }; //padding + chevron width + Padding = new MarginPadding { Right = PADDING + 8 }; //padding + chevron width Add(Chevron = new TextAwesome { Anchor = Anchor.CentreRight, Origin = Anchor.CentreLeft, TextSize = 12, Icon = FontAwesome.fa_chevron_right, - Margin = new MarginPadding { Left = padding }, + Margin = new MarginPadding { Left = PADDING }, Alpha = 0f, }); } From 3699c399679a6273d710c33c436d55da5d0b7898 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 16:46:09 -0300 Subject: [PATCH 32/47] PADDING -> padding, make private --- osu.Game/Graphics/UserInterface/BreadcrumbControl.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index 53e8275b56..8fb0affe8d 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -9,14 +9,14 @@ namespace osu.Game.Graphics.UserInterface { public class BreadcrumbControl : OsuTabControl { - public const float PADDING = 10; + private const float padding = 10; protected override TabItem CreateTabItem(T value) => new BreadcrumbTabItem(value); public BreadcrumbControl() { Height = 26; - TabContainer.Spacing = new Vector2(PADDING, 0f); + TabContainer.Spacing = new Vector2(padding, 0f); Current.ValueChanged += tab => { foreach (TabItem t in TabContainer.Children) @@ -42,14 +42,14 @@ namespace osu.Game.Graphics.UserInterface public BreadcrumbTabItem(T value) : base(value) { Text.TextSize = 16; - Padding = new MarginPadding { Right = PADDING + 8 }; //padding + chevron width + Padding = new MarginPadding { Right = padding + 8 }; //padding + chevron width Add(Chevron = new TextAwesome { Anchor = Anchor.CentreRight, Origin = Anchor.CentreLeft, TextSize = 12, Icon = FontAwesome.fa_chevron_right, - Margin = new MarginPadding { Left = PADDING }, + Margin = new MarginPadding { Left = padding }, Alpha = 0f, }); } From 731c15f91afa2cccfce8355b9f872c020202d639 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 27 May 2017 13:24:02 +0900 Subject: [PATCH 33/47] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index ea5a2a7e1a..16da101e76 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit ea5a2a7e1abffb1515c020fd017b583b71780316 +Subproject commit 16da101e76389f6b227fde511ddda8c8783f55ec From 330bd4e11dc48205c11aff8f2839c6efe791a1b4 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 27 May 2017 20:22:19 +0900 Subject: [PATCH 34/47] Fix osu!direct hotkey overriding drawings hotkey (for now). --- osu.Game/OsuGame.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 886ff4f8d1..2c952ee514 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -255,6 +255,9 @@ namespace osu.Game settings.ToggleVisibility(); return true; case Key.D: + if (state.Keyboard.ShiftPressed || state.Keyboard.AltPressed) + return false; + direct.ToggleVisibility(); return true; } From e7087f22ea73394382f154ae6d24572feaf443a3 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 27 May 2017 17:27:11 -0300 Subject: [PATCH 35/47] Change UserPanel test case data to use always available covers --- osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs index 513bf24e0d..92d58c10c9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs @@ -32,14 +32,14 @@ namespace osu.Desktop.VisualTests.Tests Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" }, - CoverUrl = @"https://assets.ppy.sh/user-profile-covers/3103765/5b012e13611d5761caa7e24fecb3d3a16e1cf48fc2a3032cfd43dd444af83d82.jpeg" + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" }) { Width = 300 }, peppy = new UserPanel(new User { Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" }, - CoverUrl = @"https://assets.ppy.sh/user-profile-covers/2/08cad88747c235a64fca5f1b770e100f120827ded1ffe3b66bfcd19c940afa65.jpeg" + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg" }) { Width = 300 }, }, }); From d4a9813af9cbd12b04df6d5b4f5e81ef16b41028 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 27 May 2017 18:19:09 -0300 Subject: [PATCH 36/47] Cleanup BreadcrumbTabItem visibility code --- .../UserInterface/BreadcrumbControl.cs | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index 8fb0affe8d..1c303ee175 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -2,7 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; +using osu.Framework; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; namespace osu.Game.Graphics.UserInterface @@ -23,21 +25,44 @@ namespace osu.Game.Graphics.UserInterface { var tIndex = TabContainer.IndexOf(t); var tabIndex = TabContainer.IndexOf(TabMap[tab]); - var hide = tIndex < tabIndex; - t.FadeTo(hide ? 0f : 1f, 500, EasingTypes.OutQuint); - t.ScaleTo(new Vector2(hide ? 0.8f : 1f, 1f), 500, EasingTypes.OutQuint); + ((BreadcrumbTabItem)t).State = tIndex < tabIndex ? Visibility.Hidden : Visibility.Visible; ((BreadcrumbTabItem)t).Chevron.FadeTo(tIndex <= tabIndex ? 0f : 1f, 500, EasingTypes.OutQuint); } }; } - private class BreadcrumbTabItem : OsuTabItem + private class BreadcrumbTabItem : OsuTabItem, IStateful { public readonly TextAwesome Chevron; //don't allow clicking between transitions and don't make the chevron clickable protected override bool InternalContains(Vector2 screenSpacePos) => Alpha == 1f && Text.Contains(screenSpacePos); + public override bool HandleInput => State == Visibility.Visible; + + private Visibility state; + public Visibility State + { + get { return state; } + set + { + if (value == state) return; + state = value; + + const float transition_duration = 500; + + if (State == Visibility.Visible) + { + FadeIn(transition_duration, EasingTypes.OutQuint); + ScaleTo(new Vector2(1f), transition_duration, EasingTypes.OutQuint); + } + else + { + FadeOut(transition_duration, EasingTypes.OutQuint); + ScaleTo(new Vector2(0.8f, 1f), transition_duration, EasingTypes.OutQuint); + } + } + } public BreadcrumbTabItem(T value) : base(value) { From ed8b34d5edf45e132ada94c6f5f96310955dcf20 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 28 May 2017 21:11:46 +0900 Subject: [PATCH 37/47] Fix drift when dragging chat beyond bounds --- osu.Game/Overlays/ChatOverlay.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 686a1d513a..fec5f11129 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -135,17 +135,20 @@ namespace osu.Game.Overlays channelTabs.Current.ValueChanged += newChannel => CurrentChannel = newChannel; } + private double startDragChatHeight; + protected override bool OnDragStart(InputState state) { - if (channelTabs.Hovering) - return true; + if (!channelTabs.Hovering) + return base.OnDragStart(state); - return base.OnDragStart(state); + startDragChatHeight = chatHeight.Value; + return true; } protected override bool OnDrag(InputState state) { - chatHeight.Value = Height - state.Mouse.Delta.Y / Parent.DrawSize.Y; + chatHeight.Value = startDragChatHeight - (state.Mouse.Position.Y - state.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y; return base.OnDrag(state); } From bc47dedf27d5119243da88c340aebd7231973c74 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 28 May 2017 21:34:15 +0900 Subject: [PATCH 38/47] Add non-null assertion --- osu.Game/Overlays/ChatOverlay.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index fec5f11129..d442fe5db0 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -148,6 +148,8 @@ namespace osu.Game.Overlays protected override bool OnDrag(InputState state) { + Trace.Assert(state.Mouse.PositionMouseDown != null); + chatHeight.Value = startDragChatHeight - (state.Mouse.Position.Y - state.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y; return base.OnDrag(state); } From 9e5a53aae7c6d3909744303005b0369a761e12b7 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 29 May 2017 10:53:55 +0900 Subject: [PATCH 39/47] Fix possible nullrefs. --- osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs b/osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs index e65bc4a99f..10f8e846ed 100644 --- a/osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs +++ b/osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Objects var hitObjectY = y as DrawableHitObject; // If either of the two drawables are not hit objects, fall back to the base comparer - if ((hitObjectX ?? hitObjectY) == null) + if ((hitObjectX?.HitObject ?? hitObjectY?.HitObject) == null) return base.Compare(x, y); // Compare by start time @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Objects var hitObjectY = y as DrawableHitObject; // If either of the two drawables are not hit objects, fall back to the base comparer - if ((hitObjectX ?? hitObjectY) == null) + if ((hitObjectX?.HitObject ?? hitObjectY?.HitObject) == null) return base.Compare(x, y); // Compare by start time From cf3743f698c84aca72f19ef9349963b03420b299 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 29 May 2017 10:56:42 +0900 Subject: [PATCH 40/47] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 16da101e76..aa3e296968 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 16da101e76389f6b227fde511ddda8c8783f55ec +Subproject commit aa3e296968873208ca4460b00c0b82fe3aa8ff5c From cdf4fcea023d994839d5d2f0582229379e4464e2 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 29 May 2017 11:07:17 +0900 Subject: [PATCH 41/47] Fix input being reversed. --- osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs b/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs index 636c84d9dc..0a8bc2d44a 100644 --- a/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs +++ b/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs @@ -29,8 +29,6 @@ namespace osu.Game.Rulesets.Mania.Timing private readonly List drawableControlPoints; - protected override IComparer DepthComparer => new HitObjectStartTimeComparer(); - public ControlPointContainer(IEnumerable timingChanges) { drawableControlPoints = timingChanges.Select(t => new DrawableControlPoint(t)).ToList(); @@ -131,6 +129,8 @@ namespace osu.Game.Rulesets.Mania.Timing /// private class AutoTimeRelativeContainer : Container { + protected override IComparer DepthComparer => new HitObjectReverseStartTimeComparer(); + public override void InvalidateFromChild(Invalidation invalidation) { // We only want to re-compute our size when a child's size or position has changed From cd1da469c743784433187adf80a7efe08c7f3fc8 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 29 May 2017 11:09:26 +0900 Subject: [PATCH 42/47] Cleanup + actually fix possible nullrefs. --- osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs b/osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs index 10f8e846ed..b089856dcb 100644 --- a/osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs +++ b/osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Objects var hitObjectY = y as DrawableHitObject; // If either of the two drawables are not hit objects, fall back to the base comparer - if ((hitObjectX?.HitObject ?? hitObjectY?.HitObject) == null) + if (hitObjectX?.HitObject == null || hitObjectY?.HitObject == null) return base.Compare(x, y); // Compare by start time @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Objects var hitObjectY = y as DrawableHitObject; // If either of the two drawables are not hit objects, fall back to the base comparer - if ((hitObjectX?.HitObject ?? hitObjectY?.HitObject) == null) + if (hitObjectX?.HitObject == null || hitObjectY?.HitObject == null) return base.Compare(x, y); // Compare by start time From 6101fe98e1df4a7cf2e3f1dae39aae021facccf5 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 29 May 2017 12:10:29 +0900 Subject: [PATCH 43/47] Always ApplyDefaults after parsing beatmaps to make sure hit objects are in their most loaded state. --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 3 ++ .../Rulesets/Objects/Legacy/ConvertSlider.cs | 34 +++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index cb1d9d2fcd..c6aac3bb71 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -428,6 +428,9 @@ namespace osu.Game.Beatmaps.Formats break; } } + + foreach (var hitObject in beatmap.HitObjects) + hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.Difficulty); } internal enum LegacySampleBank diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs index 7580404e81..ddee0c3154 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs @@ -6,20 +6,36 @@ using System; using System.Collections.Generic; using OpenTK; using osu.Game.Audio; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Database; namespace osu.Game.Rulesets.Objects.Legacy { internal abstract class ConvertSlider : HitObject, IHasCurve { + /// + /// Scoring distance with a speed-adjusted beat length of 1 second. + /// + private const float base_scoring_distance = 100; + + public readonly SliderCurve Curve = new SliderCurve(); + public List ControlPoints { get; set; } public CurveType CurveType { get; set; } - public double Distance { get; set; } + + public double Distance + { + get { return Curve.Distance; } + set { Curve.Distance = value; } + } public List RepeatSamples { get; set; } public int RepeatCount { get; set; } = 1; - public double EndTime { get; set; } - public double Duration { get; set; } + public double EndTime => StartTime + RepeatCount * Curve.Distance / Velocity; + public double Duration => EndTime - StartTime; + + public double Velocity; public Vector2 PositionAt(double progress) { @@ -35,5 +51,17 @@ namespace osu.Game.Rulesets.Objects.Legacy { throw new NotImplementedException(); } + + public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) + { + base.ApplyDefaults(controlPointInfo, difficulty); + + TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime); + DifficultyControlPoint difficultyPoint = controlPointInfo.DifficultyPointAt(StartTime); + + double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier / difficultyPoint.SpeedMultiplier; + + Velocity = scoringDistance / timingPoint.BeatLength; + } } } From 231b1ae6102f18651a45120c69888c31b22246af Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 29 May 2017 12:19:38 +0900 Subject: [PATCH 44/47] We don't need a curve. --- osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs index ddee0c3154..b42cd47abb 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs @@ -18,21 +18,15 @@ namespace osu.Game.Rulesets.Objects.Legacy /// private const float base_scoring_distance = 100; - public readonly SliderCurve Curve = new SliderCurve(); - public List ControlPoints { get; set; } public CurveType CurveType { get; set; } - public double Distance - { - get { return Curve.Distance; } - set { Curve.Distance = value; } - } + public double Distance { get; set; } public List RepeatSamples { get; set; } public int RepeatCount { get; set; } = 1; - public double EndTime => StartTime + RepeatCount * Curve.Distance / Velocity; + public double EndTime => StartTime + RepeatCount * Distance / Velocity; public double Duration => EndTime - StartTime; public double Velocity; From c137ee822c98529d3590fdc14f53a976b4bb6fca Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 29 May 2017 12:19:51 +0900 Subject: [PATCH 45/47] Give velocity a sane default value. --- osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs index b42cd47abb..8c2aead5ff 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Objects.Legacy public double EndTime => StartTime + RepeatCount * Distance / Velocity; public double Duration => EndTime - StartTime; - public double Velocity; + public double Velocity = 1; public Vector2 PositionAt(double progress) { From 79d249e5ad428e0fc784e1eaf2a363fcf0873219 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 29 May 2017 13:48:31 +0900 Subject: [PATCH 46/47] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index aa3e296968..0f3db5da09 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit aa3e296968873208ca4460b00c0b82fe3aa8ff5c +Subproject commit 0f3db5da09d0e7c4d2ef3057030e018f34ba536e From 718eeb6df8e0ef6be1cfd78f66f9e52461806fb0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 29 May 2017 16:18:07 +0900 Subject: [PATCH 47/47] Use linq to tidy up casting --- osu.Game/Graphics/UserInterface/BreadcrumbControl.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index 1c303ee175..8d113f4918 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -6,6 +6,7 @@ using osu.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; +using System.Linq; namespace osu.Game.Graphics.UserInterface { @@ -21,13 +22,13 @@ namespace osu.Game.Graphics.UserInterface TabContainer.Spacing = new Vector2(padding, 0f); Current.ValueChanged += tab => { - foreach (TabItem t in TabContainer.Children) + foreach (var t in TabContainer.Children.OfType()) { var tIndex = TabContainer.IndexOf(t); var tabIndex = TabContainer.IndexOf(TabMap[tab]); - ((BreadcrumbTabItem)t).State = tIndex < tabIndex ? Visibility.Hidden : Visibility.Visible; - ((BreadcrumbTabItem)t).Chevron.FadeTo(tIndex <= tabIndex ? 0f : 1f, 500, EasingTypes.OutQuint); + t.State = tIndex < tabIndex ? Visibility.Hidden : Visibility.Visible; + t.Chevron.FadeTo(tIndex <= tabIndex ? 0f : 1f, 500, EasingTypes.OutQuint); } }; }