Move sett from EndTime to Duration

This commit is contained in:
Dean Herbert
2020-05-27 12:37:44 +09:00
parent ad10a7f0b2
commit b8e0a6f127
17 changed files with 50 additions and 50 deletions

View File

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

View File

@ -10,9 +10,9 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
/// </summary>
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

View File

@ -189,9 +189,9 @@ namespace osu.Game.Rulesets.Objects.Legacy
}
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)
readCustomSampleBanks(split[6], bankInfo);
@ -209,7 +209,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
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)
@ -321,9 +321,9 @@ namespace osu.Game.Rulesets.Objects.Legacy
/// <param name="position">The position of the hit object.</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="endTime">The spinner end time.</param>
/// <param name="duration">The spinner duration.</param>
/// <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>
/// 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="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="endTime">The hold end time.</param>
protected abstract HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime);
/// <param name="duration">The hold end time.</param>
protected abstract HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double duration);
private List<HitSampleInfo> convertSoundType(LegacyHitSoundType type, SampleBankInfo bankInfo)
{

View File

@ -26,13 +26,13 @@ namespace osu.Game.Rulesets.Objects.Legacy
public List<IList<HitSampleInfo>> NodeSamples { 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.
}
public double Duration => EndTime - StartTime;
public double EndTime => StartTime + Duration;
public double Velocity = 1;

View File

@ -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
{
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
{
X = position.X,
EndTime = endTime
Duration = duration
};
}
}

View File

@ -9,8 +9,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
{
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;
}
}

View File

@ -10,9 +10,9 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
/// </summary>
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; }
}

View File

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

View File

@ -11,9 +11,9 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
/// </summary>
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; }

View File

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

View File

@ -10,8 +10,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
/// </summary>
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;
}
}