1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:07:25 +08:00

General cleanup + more xmldocs.

This commit is contained in:
smoogipooo 2017-05-24 21:57:38 +09:00
parent a5b79b2192
commit 946cd4bfa3
10 changed files with 86 additions and 55 deletions

View File

@ -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<TimingChange> { new TimingChange { BeatLength = 200 } })
@ -83,7 +83,7 @@ namespace osu.Desktop.VisualTests.Tests
{
StartTime = t,
Column = 0
}, new Bindable<Key>(Key.J)));
}, new Bindable<Key>(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)

View File

@ -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;
}

View File

@ -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;
}

View File

@ -15,15 +15,19 @@ using osu.Framework.Extensions.IEnumerableExtensions;
namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
/// <summary>
/// Visualises a <see cref="HoldNote"/> hit object.
/// </summary>
public class DrawableHoldNote : DrawableManiaHitObject<HoldNote>
{
private readonly DrawableNote headNote;
private readonly DrawableNote tailNote;
private readonly DrawableNote head;
private readonly DrawableNote tail;
private readonly BodyPiece bodyPiece;
private readonly Container<DrawableHoldNoteTick> tickContainer;
/// <summary>
/// Relative time at which the user started holding this note.
/// Time at which the user started holding this hold note.
/// </summary>
private double holdStartTime;
@ -34,7 +38,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
private bool _holding;
/// <summary>
/// Whether the user is holding the hold note.
/// Whether the user is currently holding the hold note.
/// </summary>
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
/// <summary>
/// The head note of a hold.
/// </summary>
private class HeadNote : DrawableNote
{
private readonly DrawableHoldNote holdNote;
public DrawableHoldNoteHead(DrawableHoldNote holdNote, Bindable<Key> key = null)
: base(holdNote.HitObject.HeadNote, key)
public HeadNote(DrawableHoldNote holdNote, Bindable<Key> 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
/// <summary>
/// The tail note of a hold.
/// </summary>
private class TailNote : DrawableNote
{
private readonly DrawableHoldNote holdNote;
public DrawableHoldNoteTail(DrawableHoldNote holdNote, Bindable<Key> key = null)
: base(holdNote.HitObject.TailNote, key)
public TailNote(DrawableHoldNote holdNote, Bindable<Key> key = null)
: base(holdNote.HitObject.Tail, key)
{
this.holdNote = holdNote;

View File

@ -13,9 +13,19 @@ using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
/// <summary>
/// Visualises a <see cref="HoldNoteTick"/> hit object.
/// </summary>
public class DrawableHoldNoteTick : DrawableManiaHitObject<HoldNoteTick>
{
/// <summary>
/// References the time at which the user started holding the hold note.
/// </summary>
public Func<double> HoldStartTime;
/// <summary>
/// References whether the user is currently holding the hold note.
/// </summary>
public Func<bool> IsHolding;
private readonly Container glowContainer;
@ -49,6 +59,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
}
};
// Set the default glow
AccentColour = Color4.White;
}

View File

@ -13,6 +13,9 @@ using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
/// <summary>
/// Visualises a <see cref="Note"/> hit object.
/// </summary>
public class DrawableNote : DrawableManiaHitObject<Note>
{
private readonly NotePiece headPiece;

View File

@ -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;
/// <summary>
/// The head note of the hold.
/// </summary>
public Note Head => head ?? (head = new Note { StartTime = StartTime });
private Note tailNote;
public Note TailNote => tailNote ?? (tailNote = new HoldNoteTail { StartTime = EndTime });
private Note tail;
/// <summary>
/// The tail note of the hold.
/// </summary>
public Note Tail => tail ?? (tail = new TailNote { StartTime = EndTime });
/// <summary>
/// The length (in milliseconds) between ticks of this hold.
/// The time between ticks of this hold.
/// </summary>
private double tickSpacing = 50;
@ -35,6 +41,9 @@ namespace osu.Game.Rulesets.Mania.Objects
tickSpacing = timingPoint.BeatLength / difficulty.SliderTickRate;
}
/// <summary>
/// The scoring scoring ticks of the hold note.
/// </summary>
public IEnumerable<HoldNoteTick> Ticks => ticks ?? (ticks = createTicks());
private List<HoldNoteTick> 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;
}
/// <summary>
/// The tail of the hold note.
/// </summary>
private class TailNote : Note
{
/// <summary>
/// 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.
/// </summary>
private const double release_window_lenience = 1.5;
public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
base.ApplyDefaults(controlPointInfo, difficulty);
HitWindows *= release_window_lenience;
}
}
}
}

View File

@ -1,24 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Database;
namespace osu.Game.Rulesets.Mania.Objects
{
public class HoldNoteTail : Note
{
/// <summary>
/// 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.
/// </summary>
private const double release_window_lenience = 1.5;
public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
base.ApplyDefaults(controlPointInfo, difficulty);
HitWindows *= release_window_lenience;
}
}
}

View File

@ -3,6 +3,9 @@
namespace osu.Game.Rulesets.Mania.Objects
{
/// <summary>
/// A scoring tick of a hold note.
/// </summary>
public class HoldNoteTick : ManiaHitObject
{
}

View File

@ -71,7 +71,6 @@
<Compile Include="Objects\Types\IHasColumn.cs" />
<Compile Include="Scoring\ManiaScoreProcessor.cs" />
<Compile Include="Objects\HoldNote.cs" />
<Compile Include="Objects\HoldNoteTail.cs" />
<Compile Include="Objects\HoldNoteTick.cs" />
<Compile Include="Objects\ManiaHitObject.cs" />
<Compile Include="Objects\Note.cs" />