mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 07:42:55 +08:00
Move sett from EndTime to Duration
This commit is contained in:
parent
a953f9e422
commit
534dccc0c3
@ -115,15 +115,15 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double EndTime
|
public float EndX => X + this.CurvePositionAt(1).X / CatchPlayfield.BASE_WIDTH;
|
||||||
|
|
||||||
|
public double Duration
|
||||||
{
|
{
|
||||||
get => StartTime + this.SpanCount() * Path.Distance / Velocity;
|
get => this.SpanCount() * Path.Distance / Velocity;
|
||||||
set => throw new System.NotSupportedException($"Adjust via {nameof(RepeatCount)} instead"); // can be implemented if/when needed.
|
set => throw new System.NotSupportedException($"Adjust via {nameof(RepeatCount)} instead"); // can be implemented if/when needed.
|
||||||
}
|
}
|
||||||
|
|
||||||
public float EndX => X + this.CurvePositionAt(1).X / CatchPlayfield.BASE_WIDTH;
|
public double EndTime => StartTime + Duration;
|
||||||
|
|
||||||
public double Duration => EndTime - StartTime;
|
|
||||||
|
|
||||||
private readonly SliderPath path = new SliderPath();
|
private readonly SliderPath path = new SliderPath();
|
||||||
|
|
||||||
|
@ -19,14 +19,14 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
{
|
{
|
||||||
public class Slider : OsuHitObject, IHasPathWithRepeats
|
public class Slider : OsuHitObject, IHasPathWithRepeats
|
||||||
{
|
{
|
||||||
public double EndTime
|
public double EndTime => StartTime + this.SpanCount() * Path.Distance / Velocity;
|
||||||
|
|
||||||
|
public double Duration
|
||||||
{
|
{
|
||||||
get => StartTime + this.SpanCount() * Path.Distance / Velocity;
|
get => EndTime - StartTime;
|
||||||
set => throw new System.NotSupportedException($"Adjust via {nameof(RepeatCount)} instead"); // can be implemented if/when needed.
|
set => throw new System.NotSupportedException($"Adjust via {nameof(RepeatCount)} instead"); // can be implemented if/when needed.
|
||||||
}
|
}
|
||||||
|
|
||||||
public double Duration => EndTime - StartTime;
|
|
||||||
|
|
||||||
private readonly Cached<Vector2> endPositionCache = new Cached<Vector2>();
|
private readonly Cached<Vector2> endPositionCache = new Cached<Vector2>();
|
||||||
|
|
||||||
public override Vector2 EndPosition => endPositionCache.IsValid ? endPositionCache.Value : endPositionCache.Value = Position + this.CurvePositionAt(1);
|
public override Vector2 EndPosition => endPositionCache.IsValid ? endPositionCache.Value : endPositionCache.Value = Position + this.CurvePositionAt(1);
|
||||||
|
@ -237,7 +237,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
|
|
||||||
case ArmedState.Miss:
|
case ArmedState.Miss:
|
||||||
case ArmedState.Hit:
|
case ArmedState.Hit:
|
||||||
using (BeginAbsoluteSequence(Time.Current, true))
|
using (BeginDelayedSequence(HitObject.Duration, true))
|
||||||
{
|
{
|
||||||
this.FadeOut(transition_duration, Easing.Out);
|
this.FadeOut(transition_duration, Easing.Out);
|
||||||
bodyContainer.ScaleTo(1.4f, transition_duration);
|
bodyContainer.ScaleTo(1.4f, transition_duration);
|
||||||
|
@ -281,7 +281,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
yield return new TestHitObject
|
yield return new TestHitObject
|
||||||
{
|
{
|
||||||
StartTime = original.StartTime,
|
StartTime = original.StartTime,
|
||||||
EndTime = (original as IHasEndTime)?.EndTime ?? (original.StartTime + 100)
|
Duration = (original as IHasEndTime)?.Duration ?? 100
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -292,9 +292,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
private class TestHitObject : ConvertHitObject, IHasEndTime
|
private class TestHitObject : ConvertHitObject, IHasEndTime
|
||||||
{
|
{
|
||||||
public double EndTime { get; set; }
|
public double EndTime => StartTime + Duration;
|
||||||
|
|
||||||
public double Duration => EndTime - StartTime;
|
public double Duration { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DrawableTestHitObject : DrawableHitObject<TestHitObject>
|
private class DrawableTestHitObject : DrawableHitObject<TestHitObject>
|
||||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime)
|
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double duration)
|
||||||
{
|
{
|
||||||
// Convert spinners don't create the new combo themselves, but force the next non-spinner hitobject to create a new combo
|
// Convert spinners don't create the new combo themselves, but force the next non-spinner hitobject to create a new combo
|
||||||
// Their combo offset is still added to that next hitobject's combo index
|
// Their combo offset is still added to that next hitobject's combo index
|
||||||
@ -65,11 +65,11 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
|||||||
|
|
||||||
return new ConvertSpinner
|
return new ConvertSpinner
|
||||||
{
|
{
|
||||||
EndTime = endTime
|
Duration = duration
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime)
|
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double duration)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,9 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ConvertSpinner : ConvertHitObject, IHasEndTime, IHasXPosition, IHasCombo
|
internal sealed class ConvertSpinner : ConvertHitObject, IHasEndTime, IHasXPosition, IHasCombo
|
||||||
{
|
{
|
||||||
public double EndTime { get; set; }
|
public double EndTime => StartTime + Duration;
|
||||||
|
|
||||||
public double Duration => EndTime - StartTime;
|
public double Duration { get; set; }
|
||||||
|
|
||||||
public float X => 256; // Required for CatchBeatmapConverter
|
public float X => 256; // Required for CatchBeatmapConverter
|
||||||
|
|
||||||
|
@ -189,9 +189,9 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
}
|
}
|
||||||
else if (type.HasFlag(LegacyHitObjectType.Spinner))
|
else if (type.HasFlag(LegacyHitObjectType.Spinner))
|
||||||
{
|
{
|
||||||
double endTime = Math.Max(startTime, Parsing.ParseDouble(split[5]) + Offset);
|
double duration = Math.Max(0, Parsing.ParseDouble(split[5]) + Offset - startTime);
|
||||||
|
|
||||||
result = CreateSpinner(new Vector2(512, 384) / 2, combo, comboOffset, endTime);
|
result = CreateSpinner(new Vector2(512, 384) / 2, combo, comboOffset, duration);
|
||||||
|
|
||||||
if (split.Length > 6)
|
if (split.Length > 6)
|
||||||
readCustomSampleBanks(split[6], bankInfo);
|
readCustomSampleBanks(split[6], bankInfo);
|
||||||
@ -209,7 +209,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo);
|
readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = CreateHold(pos, combo, comboOffset, endTime + Offset);
|
result = CreateHold(pos, combo, comboOffset, endTime + Offset - startTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
@ -321,9 +321,9 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
/// <param name="position">The position of the hit object.</param>
|
/// <param name="position">The position of the hit object.</param>
|
||||||
/// <param name="newCombo">Whether the hit object creates a new combo.</param>
|
/// <param name="newCombo">Whether the hit object creates a new combo.</param>
|
||||||
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
|
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
|
||||||
/// <param name="endTime">The spinner end time.</param>
|
/// <param name="duration">The spinner duration.</param>
|
||||||
/// <returns>The hit object.</returns>
|
/// <returns>The hit object.</returns>
|
||||||
protected abstract HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime);
|
protected abstract HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double duration);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a legacy Hold-type hit object.
|
/// Creates a legacy Hold-type hit object.
|
||||||
@ -331,8 +331,8 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
/// <param name="position">The position of the hit object.</param>
|
/// <param name="position">The position of the hit object.</param>
|
||||||
/// <param name="newCombo">Whether the hit object creates a new combo.</param>
|
/// <param name="newCombo">Whether the hit object creates a new combo.</param>
|
||||||
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
|
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
|
||||||
/// <param name="endTime">The hold end time.</param>
|
/// <param name="duration">The hold end time.</param>
|
||||||
protected abstract HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime);
|
protected abstract HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double duration);
|
||||||
|
|
||||||
private List<HitSampleInfo> convertSoundType(LegacyHitSoundType type, SampleBankInfo bankInfo)
|
private List<HitSampleInfo> convertSoundType(LegacyHitSoundType type, SampleBankInfo bankInfo)
|
||||||
{
|
{
|
||||||
|
@ -26,13 +26,13 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
public List<IList<HitSampleInfo>> NodeSamples { get; set; }
|
public List<IList<HitSampleInfo>> NodeSamples { get; set; }
|
||||||
public int RepeatCount { get; set; }
|
public int RepeatCount { get; set; }
|
||||||
|
|
||||||
public double EndTime
|
public double Duration
|
||||||
{
|
{
|
||||||
get => StartTime + this.SpanCount() * Distance / Velocity;
|
get => this.SpanCount() * Distance / Velocity;
|
||||||
set => throw new System.NotSupportedException($"Adjust via {nameof(RepeatCount)} instead"); // can be implemented if/when needed.
|
set => throw new System.NotSupportedException($"Adjust via {nameof(RepeatCount)} instead"); // can be implemented if/when needed.
|
||||||
}
|
}
|
||||||
|
|
||||||
public double Duration => EndTime - StartTime;
|
public double EndTime => StartTime + Duration;
|
||||||
|
|
||||||
public double Velocity = 1;
|
public double Velocity = 1;
|
||||||
|
|
||||||
|
@ -37,21 +37,21 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime)
|
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double duration)
|
||||||
{
|
{
|
||||||
return new ConvertSpinner
|
return new ConvertSpinner
|
||||||
{
|
{
|
||||||
X = position.X,
|
X = position.X,
|
||||||
EndTime = endTime
|
Duration = duration
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime)
|
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double duration)
|
||||||
{
|
{
|
||||||
return new ConvertHold
|
return new ConvertHold
|
||||||
{
|
{
|
||||||
X = position.X,
|
X = position.X,
|
||||||
EndTime = endTime
|
Duration = duration
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
|||||||
{
|
{
|
||||||
public float X { get; set; }
|
public float X { get; set; }
|
||||||
|
|
||||||
public double EndTime { get; set; }
|
public double Duration { get; set; }
|
||||||
|
|
||||||
public double Duration => EndTime - StartTime;
|
public double EndTime => StartTime + Duration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,9 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ConvertSpinner : ConvertHitObject, IHasEndTime, IHasXPosition
|
internal sealed class ConvertSpinner : ConvertHitObject, IHasEndTime, IHasXPosition
|
||||||
{
|
{
|
||||||
public double EndTime { get; set; }
|
public double Duration { get; set; }
|
||||||
|
|
||||||
public double Duration => EndTime - StartTime;
|
public double EndTime => StartTime + Duration;
|
||||||
|
|
||||||
public float X { get; set; }
|
public float X { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime)
|
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double duration)
|
||||||
{
|
{
|
||||||
// Convert spinners don't create the new combo themselves, but force the next non-spinner hitobject to create a new combo
|
// Convert spinners don't create the new combo themselves, but force the next non-spinner hitobject to create a new combo
|
||||||
// Their combo offset is still added to that next hitobject's combo index
|
// Their combo offset is still added to that next hitobject's combo index
|
||||||
@ -66,11 +66,11 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
|||||||
return new ConvertSpinner
|
return new ConvertSpinner
|
||||||
{
|
{
|
||||||
Position = position,
|
Position = position,
|
||||||
EndTime = endTime
|
Duration = duration
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime)
|
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double duration)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,9 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ConvertSpinner : ConvertHitObject, IHasEndTime, IHasPosition, IHasCombo
|
internal sealed class ConvertSpinner : ConvertHitObject, IHasEndTime, IHasPosition, IHasCombo
|
||||||
{
|
{
|
||||||
public double EndTime { get; set; }
|
public double Duration { get; set; }
|
||||||
|
|
||||||
public double Duration => EndTime - StartTime;
|
public double EndTime => StartTime + Duration;
|
||||||
|
|
||||||
public Vector2 Position { get; set; }
|
public Vector2 Position { get; set; }
|
||||||
|
|
||||||
|
@ -33,15 +33,15 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime)
|
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double duration)
|
||||||
{
|
{
|
||||||
return new ConvertSpinner
|
return new ConvertSpinner
|
||||||
{
|
{
|
||||||
EndTime = endTime
|
Duration = duration
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime)
|
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double duration)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ConvertSpinner : ConvertHitObject, IHasEndTime
|
internal sealed class ConvertSpinner : ConvertHitObject, IHasEndTime
|
||||||
{
|
{
|
||||||
public double EndTime { get; set; }
|
public double Duration { get; set; }
|
||||||
|
|
||||||
public double Duration => EndTime - StartTime;
|
public double EndTime => StartTime + Duration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,12 @@ namespace osu.Game.Rulesets.Objects.Types
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The time at which the HitObject ends.
|
/// The time at which the HitObject ends.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
double EndTime { get; }
|
||||||
double EndTime { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The duration of the HitObject.
|
/// The duration of the HitObject.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double Duration { get; }
|
[JsonIgnore]
|
||||||
|
double Duration { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,7 +296,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
if (endTimeHitObject.EndTime == snappedTime)
|
if (endTimeHitObject.EndTime == snappedTime)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
endTimeHitObject.EndTime = snappedTime;
|
endTimeHitObject.Duration = snappedTime - hitObject.StartTime;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user