From 946cd4bfa380ca4a3684f1375f11ee94d708ef1c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 21:57:38 +0900 Subject: [PATCH] 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 @@ -