mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:33:20 +08:00
Rename to IHasDuration
This commit is contained in:
parent
534dccc0c3
commit
dd7dbfd548
@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
|
||||
LegacyLastTickOffset = (obj as IHasLegacyLastTickOffset)?.LegacyLastTickOffset ?? 0
|
||||
}.Yield();
|
||||
|
||||
case IHasEndTime endTime:
|
||||
case IHasDuration endTime:
|
||||
return new BananaShower
|
||||
{
|
||||
StartTime = obj.StartTime,
|
||||
|
@ -7,7 +7,7 @@ using osu.Game.Rulesets.Objects.Types;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Objects
|
||||
{
|
||||
public class BananaShower : CatchHitObject, IHasEndTime
|
||||
public class BananaShower : CatchHitObject, IHasDuration
|
||||
{
|
||||
public override FruitVisualRepresentation VisualRepresentation => FruitVisualRepresentation.Banana;
|
||||
|
||||
|
@ -156,7 +156,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
|
||||
foreach (var obj in content.OfType<DrawableHitObject>())
|
||||
{
|
||||
if (!(obj.HitObject is IHasEndTime endTime))
|
||||
if (!(obj.HitObject is IHasDuration endTime))
|
||||
continue;
|
||||
|
||||
foreach (var nested in obj.NestedHitObjects)
|
||||
|
@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
||||
}
|
||||
else
|
||||
{
|
||||
float percentSliderOrSpinner = (float)beatmap.HitObjects.Count(h => h is IHasEndTime) / beatmap.HitObjects.Count;
|
||||
float percentSliderOrSpinner = (float)beatmap.HitObjects.Count(h => h is IHasDuration) / beatmap.HitObjects.Count;
|
||||
if (percentSliderOrSpinner < 0.2)
|
||||
TargetColumns = 7;
|
||||
else if (percentSliderOrSpinner < 0.3 || roundedCircleSize >= 5)
|
||||
@ -175,7 +175,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
||||
break;
|
||||
}
|
||||
|
||||
case IHasEndTime endTimeData:
|
||||
case IHasDuration endTimeData:
|
||||
{
|
||||
conversion = new EndTimeObjectPatternGenerator(Random, original, beatmap, originalBeatmap);
|
||||
|
||||
@ -231,7 +231,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
||||
|
||||
var pattern = new Pattern();
|
||||
|
||||
if (HitObject is IHasEndTime endTimeData)
|
||||
if (HitObject is IHasDuration endTimeData)
|
||||
{
|
||||
pattern.Add(new HoldNote
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
||||
public EndTimeObjectPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, IBeatmap originalBeatmap)
|
||||
: base(random, hitObject, beatmap, new Pattern(), originalBeatmap)
|
||||
{
|
||||
endTime = (HitObject as IHasEndTime)?.EndTime ?? 0;
|
||||
endTime = (HitObject as IHasDuration)?.EndTime ?? 0;
|
||||
}
|
||||
|
||||
public override IEnumerable<Pattern> Generate()
|
||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Mania.Objects
|
||||
/// <summary>
|
||||
/// Represents a hit object which requires pressing, holding, and releasing a key.
|
||||
/// </summary>
|
||||
public class HoldNote : ManiaHitObject, IHasEndTime
|
||||
public class HoldNote : ManiaHitObject, IHasDuration
|
||||
{
|
||||
public double EndTime
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
|
||||
TickDistanceMultiplier = beatmap.BeatmapInfo.BeatmapVersion < 8 ? 1f / beatmap.ControlPointInfo.DifficultyPointAt(original.StartTime).SpeedMultiplier : 1
|
||||
}.Yield();
|
||||
|
||||
case IHasEndTime endTimeData:
|
||||
case IHasDuration endTimeData:
|
||||
return new Spinner
|
||||
{
|
||||
StartTime = original.StartTime,
|
||||
|
@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
break;
|
||||
|
||||
// already hit or beyond the hittable end time.
|
||||
if (h.IsHit || (h.HitObject is IHasEndTime hasEnd && time > hasEnd.EndTime))
|
||||
if (h.IsHit || (h.HitObject is IHasDuration hasEnd && time > hasEnd.EndTime))
|
||||
continue;
|
||||
|
||||
switch (h)
|
||||
|
@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
}
|
||||
|
||||
// Keep wiggling sliders and spinners for their duration
|
||||
if (!(osuObject is IHasEndTime endTime))
|
||||
if (!(osuObject is IHasDuration endTime))
|
||||
return;
|
||||
|
||||
amountWiggles = (int)(endTime.Duration / wiggle_duration);
|
||||
|
@ -11,7 +11,7 @@ using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Objects
|
||||
{
|
||||
public class Spinner : OsuHitObject, IHasEndTime
|
||||
public class Spinner : OsuHitObject, IHasDuration
|
||||
{
|
||||
public double EndTime
|
||||
{
|
||||
|
@ -150,7 +150,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
|
||||
break;
|
||||
}
|
||||
|
||||
case IHasEndTime endTimeData:
|
||||
case IHasDuration endTimeData:
|
||||
{
|
||||
double hitMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty, 3, 5, 7.5) * swell_hit_multiplier;
|
||||
|
||||
|
@ -9,7 +9,7 @@ using osu.Game.Rulesets.Taiko.Judgements;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects
|
||||
{
|
||||
public class Swell : TaikoHitObject, IHasEndTime
|
||||
public class Swell : TaikoHitObject, IHasDuration
|
||||
{
|
||||
public double EndTime
|
||||
{
|
||||
|
@ -281,7 +281,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
yield return new TestHitObject
|
||||
{
|
||||
StartTime = original.StartTime,
|
||||
Duration = (original as IHasEndTime)?.Duration ?? 100
|
||||
Duration = (original as IHasDuration)?.Duration ?? 100
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -290,7 +290,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
#region HitObject
|
||||
|
||||
private class TestHitObject : ConvertHitObject, IHasEndTime
|
||||
private class TestHitObject : ConvertHitObject, IHasDuration
|
||||
{
|
||||
public double EndTime => StartTime + Duration;
|
||||
|
||||
|
@ -240,7 +240,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hitObject is IHasEndTime)
|
||||
if (hitObject is IHasDuration)
|
||||
addEndTimeData(writer, hitObject);
|
||||
|
||||
writer.Write(getSampleBank(hitObject.Samples));
|
||||
@ -267,7 +267,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
type |= LegacyHitObjectType.Slider;
|
||||
break;
|
||||
|
||||
case IHasEndTime _:
|
||||
case IHasDuration _:
|
||||
if (beatmap.BeatmapInfo.RulesetID == 3)
|
||||
type |= LegacyHitObjectType.Hold;
|
||||
else
|
||||
@ -352,7 +352,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
private void addEndTimeData(TextWriter writer, HitObject hitObject)
|
||||
{
|
||||
var endTimeData = (IHasEndTime)hitObject;
|
||||
var endTimeData = (IHasDuration)hitObject;
|
||||
var type = getObjectType(hitObject);
|
||||
|
||||
char suffix = ',';
|
||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Beatmaps
|
||||
length = emptyLength;
|
||||
break;
|
||||
|
||||
case IHasEndTime endTime:
|
||||
case IHasDuration endTime:
|
||||
length = endTime.EndTime + excess_length;
|
||||
break;
|
||||
|
||||
|
@ -175,10 +175,10 @@ namespace osu.Game.Rulesets.Objects
|
||||
/// Returns the end time of this object.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This returns the <see cref="IHasEndTime.EndTime"/> where available, falling back to <see cref="HitObject.StartTime"/> otherwise.
|
||||
/// This returns the <see cref="IHasDuration.EndTime"/> where available, falling back to <see cref="HitObject.StartTime"/> otherwise.
|
||||
/// </remarks>
|
||||
/// <param name="hitObject">The object.</param>
|
||||
/// <returns>The end time of this object.</returns>
|
||||
public static double GetEndTime(this HitObject hitObject) => (hitObject as IHasEndTime)?.EndTime ?? hitObject.StartTime;
|
||||
public static double GetEndTime(this HitObject hitObject) => (hitObject as IHasDuration)?.EndTime ?? hitObject.StartTime;
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
||||
/// <summary>
|
||||
/// Legacy osu!catch Spinner-type, used for parsing Beatmaps.
|
||||
/// </summary>
|
||||
internal sealed class ConvertSpinner : ConvertHitObject, IHasEndTime, IHasXPosition, IHasCombo
|
||||
internal sealed class ConvertSpinner : ConvertHitObject, IHasDuration, IHasXPosition, IHasCombo
|
||||
{
|
||||
public double EndTime => StartTime + Duration;
|
||||
|
||||
|
@ -5,7 +5,7 @@ using osu.Game.Rulesets.Objects.Types;
|
||||
|
||||
namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
||||
{
|
||||
internal sealed class ConvertHold : ConvertHitObject, IHasXPosition, IHasEndTime
|
||||
internal sealed class ConvertHold : ConvertHitObject, IHasXPosition, IHasDuration
|
||||
{
|
||||
public float X { get; set; }
|
||||
|
||||
|
@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
||||
/// <summary>
|
||||
/// Legacy osu!mania Spinner-type, used for parsing Beatmaps.
|
||||
/// </summary>
|
||||
internal sealed class ConvertSpinner : ConvertHitObject, IHasEndTime, IHasXPosition
|
||||
internal sealed class ConvertSpinner : ConvertHitObject, IHasDuration, IHasXPosition
|
||||
{
|
||||
public double Duration { get; set; }
|
||||
|
||||
|
@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
||||
/// <summary>
|
||||
/// Legacy osu! Spinner-type, used for parsing Beatmaps.
|
||||
/// </summary>
|
||||
internal sealed class ConvertSpinner : ConvertHitObject, IHasEndTime, IHasPosition, IHasCombo
|
||||
internal sealed class ConvertSpinner : ConvertHitObject, IHasDuration, IHasPosition, IHasCombo
|
||||
{
|
||||
public double Duration { get; set; }
|
||||
|
||||
|
@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
||||
/// <summary>
|
||||
/// Legacy osu!taiko Spinner-type, used for parsing Beatmaps.
|
||||
/// </summary>
|
||||
internal sealed class ConvertSpinner : ConvertHitObject, IHasEndTime
|
||||
internal sealed class ConvertSpinner : ConvertHitObject, IHasDuration
|
||||
{
|
||||
public double Duration { get; set; }
|
||||
|
||||
|
@ -6,7 +6,7 @@ namespace osu.Game.Rulesets.Objects.Types
|
||||
/// <summary>
|
||||
/// A HitObject that has a positional length.
|
||||
/// </summary>
|
||||
public interface IHasDistance : IHasEndTime
|
||||
public interface IHasDistance : IHasDuration
|
||||
{
|
||||
/// <summary>
|
||||
/// The positional length of the HitObject.
|
||||
|
24
osu.Game/Rulesets/Objects/Types/IHasDuration.cs
Normal file
24
osu.Game/Rulesets/Objects/Types/IHasDuration.cs
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Rulesets.Objects.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// A HitObject that ends at a different time than its start time.
|
||||
/// </summary>
|
||||
public interface IHasDuration
|
||||
{
|
||||
/// <summary>
|
||||
/// The time at which the HitObject ends.
|
||||
/// </summary>
|
||||
double EndTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The duration of the HitObject.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
double Duration { get; set; }
|
||||
}
|
||||
}
|
@ -1,24 +1,12 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Rulesets.Objects.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// A HitObject that ends at a different time than its start time.
|
||||
/// </summary>
|
||||
public interface IHasEndTime
|
||||
[Obsolete("Use IHasDuration instead.")] // can be removed 20201126
|
||||
public interface IHasEndTime : IHasDuration
|
||||
{
|
||||
/// <summary>
|
||||
/// The time at which the HitObject ends.
|
||||
/// </summary>
|
||||
double EndTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The duration of the HitObject.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
double Duration { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Objects.Types
|
||||
/// <summary>
|
||||
/// A HitObject that spans some length.
|
||||
/// </summary>
|
||||
public interface IHasRepeats : IHasEndTime
|
||||
public interface IHasRepeats : IHasDuration
|
||||
{
|
||||
/// <summary>
|
||||
/// The amount of times the HitObject repeats.
|
||||
|
@ -270,7 +270,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
// Cant use AddOnce() since the delegate is re-constructed every invocation
|
||||
private void computeInitialStateRecursive(DrawableHitObject hitObject) => hitObject.Schedule(() =>
|
||||
{
|
||||
if (hitObject.HitObject is IHasEndTime e)
|
||||
if (hitObject.HitObject is IHasDuration e)
|
||||
{
|
||||
switch (direction.Value)
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
|
||||
shadowComponents.Add(circle);
|
||||
|
||||
if (hitObject is IHasEndTime)
|
||||
if (hitObject is IHasDuration)
|
||||
{
|
||||
DragBar dragBarUnderlay;
|
||||
Container extensionBar;
|
||||
@ -290,7 +290,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
repeatHitObject.RepeatCount = proposedCount;
|
||||
break;
|
||||
|
||||
case IHasEndTime endTimeHitObject:
|
||||
case IHasDuration endTimeHitObject:
|
||||
var snappedTime = Math.Max(hitObject.StartTime, beatSnapProvider.SnapTime(time));
|
||||
|
||||
if (endTimeHitObject.EndTime == snappedTime)
|
||||
|
Loading…
Reference in New Issue
Block a user