Skip to content

Commit

Permalink
Change signature of ModChartTimeline.Set to Set(int id, Segment segment)
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamQiufeng committed May 21, 2024
1 parent 98fed4b commit 2d47e38
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,14 @@ private void CallOnKeyRelease(GameplayHitObjectKeysInfo info, int pressTime, Jud
/// <param name="eventType"></param>
/// <param name="closure"></param>
/// <example>
/// The following lua code subscribes a closure to a category:
/// <code language="lua">
/// <![CDATA[
/// function noteEvents(type, args)
/// print("Some note related events are triggered, namely " .. type)
/// end
/// events.subscribe(event_types.note, noteEvents)
/// ]]>
/// </code>
/// The following lua code subscribes a closure to a specific type of event, under a specified category:
/// <code language="lua">
/// <![CDATA[
/// function onNoteEntry(type, args)
/// hitObject = args[1]
/// function onNoteEntry(args)
/// hitObject = args.hitObject
/// print("A note has become visible in the playfield at " .. hitObject.startTime)
/// end
/// events.subscribe(event_types.noteEntry, onNoteEntry)
/// Events.Subscribe(EventType.NoteEntry, onNoteEntry)
/// ]]>
/// </code>
/// </example>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ public bool RemoveSegment(int id)
return Shortcut.ModChartScript.SegmentManager.TryGetSegment(id, out var segment) && Remove(segment);
}

public int Set(Segment segment)
public int Set(int id, Segment segment)
{
if (segment.Id == -1) segment.Id = GenerateSegmentId();
segment.Id = id == -1 ? GenerateSegmentId() : id;
Shortcut.ModChartEvents.Enqueue(ModChartEventType.TimelineUpdateSegment, segment);
return segment.Id;
}
Expand All @@ -152,9 +152,9 @@ public bool RemoveTrigger(int id)
return Shortcut.ModChartScript.TriggerManager.TryGetVertex(id, out var vertex) && Remove(vertex);
}

public int Set(ValueVertex<ITriggerPayload> trigger)
public int Set(int id, ValueVertex<ITriggerPayload> trigger)
{
if (trigger.Id == -1) trigger.Id = GenerateTriggerId();
trigger.Id = id == -1 ? GenerateTriggerId() : id;
Shortcut.ModChartEvents.Enqueue(ModChartEventType.TimelineUpdateTrigger, trigger);
return trigger.Id;
}
Expand Down

0 comments on commit 2d47e38

Please sign in to comment.