mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 17:53:15 +08:00
General cleanup + more xmldocs.
This commit is contained in:
parent
a5b79b2192
commit
946cd4bfa3
@ -66,7 +66,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
var rateAdjustClock = new StopwatchClock(true) { Rate = 0.2 };
|
var rateAdjustClock = new StopwatchClock(true) { Rate = 0.5 };
|
||||||
|
|
||||||
ManiaPlayfield playField;
|
ManiaPlayfield playField;
|
||||||
Add(playField = new ManiaPlayfield(4, new List<TimingChange> { new TimingChange { BeatLength = 200 } })
|
Add(playField = new ManiaPlayfield(4, new List<TimingChange> { new TimingChange { BeatLength = 200 } })
|
||||||
@ -83,7 +83,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
{
|
{
|
||||||
StartTime = t,
|
StartTime = t,
|
||||||
Column = 0
|
Column = 0
|
||||||
}, new Bindable<Key>(Key.J)));
|
}, new Bindable<Key>(Key.D)));
|
||||||
|
|
||||||
playField.Add(new DrawableNote(new Note
|
playField.Add(new DrawableNote(new Note
|
||||||
{
|
{
|
||||||
@ -125,7 +125,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
AddStep("Right special style", () => createPlayfieldWithNotes(4, SpecialColumnPosition.Right));
|
AddStep("Right special style", () => createPlayfieldWithNotes(4, SpecialColumnPosition.Right));
|
||||||
AddWaitStep(10);
|
AddWaitStep(10);
|
||||||
|
|
||||||
AddStep("Test", () => createPlayfieldWithNotesAcceptingInput());
|
AddStep("Notes with input", () => createPlayfieldWithNotesAcceptingInput());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void triggerKeyDown(Column column)
|
private void triggerKeyDown(Column column)
|
||||||
|
@ -478,8 +478,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
Duration = endTime - startTime
|
Duration = endTime - startTime
|
||||||
};
|
};
|
||||||
|
|
||||||
holdNote.HeadNote.Samples = sampleInfoListAt(startTime);
|
holdNote.Head.Samples = sampleInfoListAt(startTime);
|
||||||
holdNote.TailNote.Samples = sampleInfoListAt(endTime);
|
holdNote.Tail.Samples = sampleInfoListAt(endTime);
|
||||||
|
|
||||||
newObject = holdNote;
|
newObject = holdNote;
|
||||||
}
|
}
|
||||||
|
@ -76,12 +76,12 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
Duration = endTime - HitObject.StartTime
|
Duration = endTime - HitObject.StartTime
|
||||||
};
|
};
|
||||||
|
|
||||||
hold.HeadNote.Samples.Add(new SampleInfo
|
hold.Head.Samples.Add(new SampleInfo
|
||||||
{
|
{
|
||||||
Name = SampleInfo.HIT_NORMAL
|
Name = SampleInfo.HIT_NORMAL
|
||||||
});
|
});
|
||||||
|
|
||||||
hold.TailNote.Samples = HitObject.Samples;
|
hold.Tail.Samples = HitObject.Samples;
|
||||||
|
|
||||||
newObject = hold;
|
newObject = hold;
|
||||||
}
|
}
|
||||||
|
@ -15,15 +15,19 @@ using osu.Framework.Extensions.IEnumerableExtensions;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Visualises a <see cref="HoldNote"/> hit object.
|
||||||
|
/// </summary>
|
||||||
public class DrawableHoldNote : DrawableManiaHitObject<HoldNote>
|
public class DrawableHoldNote : DrawableManiaHitObject<HoldNote>
|
||||||
{
|
{
|
||||||
private readonly DrawableNote headNote;
|
private readonly DrawableNote head;
|
||||||
private readonly DrawableNote tailNote;
|
private readonly DrawableNote tail;
|
||||||
|
|
||||||
private readonly BodyPiece bodyPiece;
|
private readonly BodyPiece bodyPiece;
|
||||||
private readonly Container<DrawableHoldNoteTick> tickContainer;
|
private readonly Container<DrawableHoldNoteTick> tickContainer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Relative time at which the user started holding this note.
|
/// Time at which the user started holding this hold note.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private double holdStartTime;
|
private double holdStartTime;
|
||||||
|
|
||||||
@ -34,7 +38,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
|
|
||||||
private bool _holding;
|
private bool _holding;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the user is holding the hold note.
|
/// Whether the user is currently holding the hold note.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool holding
|
private bool holding
|
||||||
{
|
{
|
||||||
@ -71,12 +75,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
RelativeCoordinateSpace = new Vector2(1, (float)HitObject.Duration)
|
RelativeCoordinateSpace = new Vector2(1, (float)HitObject.Duration)
|
||||||
},
|
},
|
||||||
headNote = new DrawableHoldNoteHead(this, key)
|
head = new HeadNote(this, key)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre
|
Origin = Anchor.TopCentre
|
||||||
},
|
},
|
||||||
tailNote = new DrawableHoldNoteTail(this, key)
|
tail = new TailNote(this, key)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Origin = Anchor.TopCentre
|
Origin = Anchor.TopCentre
|
||||||
@ -91,14 +95,15 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
HoldStartTime = () => holdStartTime
|
HoldStartTime = () => holdStartTime
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// To make the ticks relative to ourselves we need to offset them backwards
|
||||||
drawableTick.Y -= (float)HitObject.StartTime;
|
drawableTick.Y -= (float)HitObject.StartTime;
|
||||||
|
|
||||||
tickContainer.Add(drawableTick);
|
tickContainer.Add(drawableTick);
|
||||||
AddNested(drawableTick);
|
AddNested(drawableTick);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddNested(headNote);
|
AddNested(head);
|
||||||
AddNested(tailNote);
|
AddNested(tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Color4 AccentColour
|
public override Color4 AccentColour
|
||||||
@ -113,8 +118,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
tickContainer.Children.ForEach(t => t.AccentColour = value);
|
tickContainer.Children.ForEach(t => t.AccentColour = value);
|
||||||
|
|
||||||
bodyPiece.AccentColour = value;
|
bodyPiece.AccentColour = value;
|
||||||
headNote.AccentColour = value;
|
head.AccentColour = value;
|
||||||
tailNote.AccentColour = value;
|
tail.AccentColour = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,18 +168,21 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
holding = false;
|
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, they should not receive full score for the release
|
||||||
if (!tailNote.Judged)
|
if (!tail.Judged)
|
||||||
hasBroken = true;
|
hasBroken = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DrawableHoldNoteHead : DrawableNote
|
/// <summary>
|
||||||
|
/// The head note of a hold.
|
||||||
|
/// </summary>
|
||||||
|
private class HeadNote : DrawableNote
|
||||||
{
|
{
|
||||||
private readonly DrawableHoldNote holdNote;
|
private readonly DrawableHoldNote holdNote;
|
||||||
|
|
||||||
public DrawableHoldNoteHead(DrawableHoldNote holdNote, Bindable<Key> key = null)
|
public HeadNote(DrawableHoldNote holdNote, Bindable<Key> key = null)
|
||||||
: base(holdNote.HitObject.HeadNote, key)
|
: base(holdNote.HitObject.Head, key)
|
||||||
{
|
{
|
||||||
this.holdNote = holdNote;
|
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;
|
private readonly DrawableHoldNote holdNote;
|
||||||
|
|
||||||
public DrawableHoldNoteTail(DrawableHoldNote holdNote, Bindable<Key> key = null)
|
public TailNote(DrawableHoldNote holdNote, Bindable<Key> key = null)
|
||||||
: base(holdNote.HitObject.TailNote, key)
|
: base(holdNote.HitObject.Tail, key)
|
||||||
{
|
{
|
||||||
this.holdNote = holdNote;
|
this.holdNote = holdNote;
|
||||||
|
|
||||||
|
@ -13,9 +13,19 @@ using osu.Game.Rulesets.Objects.Drawables;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Visualises a <see cref="HoldNoteTick"/> hit object.
|
||||||
|
/// </summary>
|
||||||
public class DrawableHoldNoteTick : DrawableManiaHitObject<HoldNoteTick>
|
public class DrawableHoldNoteTick : DrawableManiaHitObject<HoldNoteTick>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// References the time at which the user started holding the hold note.
|
||||||
|
/// </summary>
|
||||||
public Func<double> HoldStartTime;
|
public Func<double> HoldStartTime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// References whether the user is currently holding the hold note.
|
||||||
|
/// </summary>
|
||||||
public Func<bool> IsHolding;
|
public Func<bool> IsHolding;
|
||||||
|
|
||||||
private readonly Container glowContainer;
|
private readonly Container glowContainer;
|
||||||
@ -49,6 +59,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Set the default glow
|
||||||
AccentColour = Color4.White;
|
AccentColour = Color4.White;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,9 @@ using osu.Game.Rulesets.Objects.Drawables;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Visualises a <see cref="Note"/> hit object.
|
||||||
|
/// </summary>
|
||||||
public class DrawableNote : DrawableManiaHitObject<Note>
|
public class DrawableNote : DrawableManiaHitObject<Note>
|
||||||
{
|
{
|
||||||
private readonly NotePiece headPiece;
|
private readonly NotePiece headPiece;
|
||||||
|
@ -16,14 +16,20 @@ namespace osu.Game.Rulesets.Mania.Objects
|
|||||||
public double Duration { get; set; }
|
public double Duration { get; set; }
|
||||||
public double EndTime => StartTime + Duration;
|
public double EndTime => StartTime + Duration;
|
||||||
|
|
||||||
private Note headNote;
|
private Note head;
|
||||||
public Note HeadNote => headNote ?? (headNote = new Note { StartTime = StartTime });
|
/// <summary>
|
||||||
|
/// The head note of the hold.
|
||||||
|
/// </summary>
|
||||||
|
public Note Head => head ?? (head = new Note { StartTime = StartTime });
|
||||||
|
|
||||||
private Note tailNote;
|
private Note tail;
|
||||||
public Note TailNote => tailNote ?? (tailNote = new HoldNoteTail { StartTime = EndTime });
|
/// <summary>
|
||||||
|
/// The tail note of the hold.
|
||||||
|
/// </summary>
|
||||||
|
public Note Tail => tail ?? (tail = new TailNote { StartTime = EndTime });
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The length (in milliseconds) between ticks of this hold.
|
/// The time between ticks of this hold.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private double tickSpacing = 50;
|
private double tickSpacing = 50;
|
||||||
|
|
||||||
@ -35,6 +41,9 @@ namespace osu.Game.Rulesets.Mania.Objects
|
|||||||
tickSpacing = timingPoint.BeatLength / difficulty.SliderTickRate;
|
tickSpacing = timingPoint.BeatLength / difficulty.SliderTickRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The scoring scoring ticks of the hold note.
|
||||||
|
/// </summary>
|
||||||
public IEnumerable<HoldNoteTick> Ticks => ticks ?? (ticks = createTicks());
|
public IEnumerable<HoldNoteTick> Ticks => ticks ?? (ticks = createTicks());
|
||||||
private List<HoldNoteTick> ticks;
|
private List<HoldNoteTick> ticks;
|
||||||
|
|
||||||
@ -45,7 +54,7 @@ namespace osu.Game.Rulesets.Mania.Objects
|
|||||||
if (tickSpacing == 0)
|
if (tickSpacing == 0)
|
||||||
return ret;
|
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
|
ret.Add(new HoldNoteTick
|
||||||
{
|
{
|
||||||
@ -55,5 +64,24 @@ namespace osu.Game.Rulesets.Mania.Objects
|
|||||||
|
|
||||||
return ret;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,6 +3,9 @@
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Objects
|
namespace osu.Game.Rulesets.Mania.Objects
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A scoring tick of a hold note.
|
||||||
|
/// </summary>
|
||||||
public class HoldNoteTick : ManiaHitObject
|
public class HoldNoteTick : ManiaHitObject
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,6 @@
|
|||||||
<Compile Include="Objects\Types\IHasColumn.cs" />
|
<Compile Include="Objects\Types\IHasColumn.cs" />
|
||||||
<Compile Include="Scoring\ManiaScoreProcessor.cs" />
|
<Compile Include="Scoring\ManiaScoreProcessor.cs" />
|
||||||
<Compile Include="Objects\HoldNote.cs" />
|
<Compile Include="Objects\HoldNote.cs" />
|
||||||
<Compile Include="Objects\HoldNoteTail.cs" />
|
|
||||||
<Compile Include="Objects\HoldNoteTick.cs" />
|
<Compile Include="Objects\HoldNoteTick.cs" />
|
||||||
<Compile Include="Objects\ManiaHitObject.cs" />
|
<Compile Include="Objects\ManiaHitObject.cs" />
|
||||||
<Compile Include="Objects\Note.cs" />
|
<Compile Include="Objects\Note.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user