1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Profiles - Fixed main segment repeat in combination with conditions

This commit is contained in:
Robert 2020-11-24 19:33:40 +01:00
parent 9e75131948
commit 81bb278abe

View File

@ -46,6 +46,12 @@ namespace Artemis.Core
_extraTimelines = new List<Timeline>(); _extraTimelines = new List<Timeline>();
} }
/// <inheritdoc />
public override string ToString()
{
return $"Progress: {Position}/{Length} - delta: {Delta}";
}
#region Extra timelines #region Extra timelines
/// <summary> /// <summary>
@ -95,7 +101,8 @@ namespace Artemis.Core
} }
/// <summary> /// <summary>
/// Gets the cumulative delta of all calls to <see cref="Update" /> that took place after the last call to <see cref="ClearDelta"/> /// Gets the cumulative delta of all calls to <see cref="Update" /> that took place after the last call to
/// <see cref="ClearDelta" />
/// <para> /// <para>
/// Note: If this is an extra timeline <see cref="Delta" /> is always equal to <see cref="DeltaToParent" /> /// Note: If this is an extra timeline <see cref="Delta" /> is always equal to <see cref="DeltaToParent" />
/// </para> /// </para>
@ -150,7 +157,7 @@ namespace Artemis.Core
public bool IsFinished => (Position > Length || Length == TimeSpan.Zero) && !ExtraTimelines.Any(); public bool IsFinished => (Position > Length || Length == TimeSpan.Zero) && !ExtraTimelines.Any();
/// <summary> /// <summary>
/// Gets a boolean indicating whether the timeline progress has been overridden /// Gets a boolean indicating whether the timeline progress has been overridden
/// </summary> /// </summary>
public bool IsOverridden { get; private set; } public bool IsOverridden { get; private set; }
@ -312,14 +319,14 @@ namespace Artemis.Core
Position += delta; Position += delta;
IsOverridden = false; IsOverridden = false;
if (stickToMainSegment && Position >= MainSegmentStartPosition) if (stickToMainSegment && Position >= MainSegmentEndPosition)
{ {
// If the main segment has no length, simply stick to the start of the segment // If the main segment has no length, simply stick to the start of the segment
if (MainSegmentLength == TimeSpan.Zero) if (MainSegmentLength == TimeSpan.Zero)
Position = MainSegmentStartPosition; Position = MainSegmentStartPosition;
// Ensure wrapping back around retains the delta time // Ensure wrapping back around retains the delta time
else else
Position = MainSegmentStartPosition + TimeSpan.FromMilliseconds(Position.TotalMilliseconds % MainSegmentLength.TotalMilliseconds); Position = MainSegmentStartPosition + TimeSpan.FromMilliseconds(delta.TotalMilliseconds % MainSegmentLength.TotalMilliseconds);
} }
_extraTimelines.RemoveAll(t => t.IsFinished); _extraTimelines.RemoveAll(t => t.IsFinished);
@ -436,12 +443,6 @@ namespace Artemis.Core
} }
#endregion #endregion
/// <inheritdoc />
public override string ToString()
{
return $"Progress: {Position}/{Length} - delta: {Delta}";
}
} }
internal enum TimelineSegment internal enum TimelineSegment