ActivityEvent
Fired when an authored activity event executes. The activity is a writer-defined
mini-form (questions, sliders, choices) the host renders and the player fills in.
Collect player input via SetField(string, object), then call Complete()
to commit field values back into the runtime.
public class ActivityEvent : EventBase
Inheritance System.Object → EventBase → ActivityEvent
Properties
ActivityUuid
Uuid of the StoryBonsai.Runtime.Models.Activity definition this event came from.
public string ActivityUuid { get; }
Property Value
EstimatedDuration
Author-declared estimated duration in seconds (UI hint — not enforced).
public Nullable<float> EstimatedDuration { get; }
Property Value
System.Nullable<System.Single>
Fields
Form fields the player fills in. Bind each to a UI widget by Id.
public IReadOnlyList<ActivityField> Fields { get; }
Property Value
System.Collections.Generic.IReadOnlyList<ActivityField>
Groups
Group constraints over this activity’s bool fields. Empty when the activity declares none.
public IReadOnlyList<ActivityVariableGroupView> Groups { get; }
Property Value
System.Collections.Generic.IReadOnlyList<ActivityVariableGroupView>
IsResolved
True after Complete() has succeeded. A resolved activity cannot be completed again (blocking-activity spec “Runtime API surface”: without this latch, a double Complete() would double-apply Increment mutations and resume the paused commit twice).
public bool IsResolved { get; }
Property Value
Name
Author-defined activity name (the visible label).
public string Name { get; }
Property Value
PlayerIds
Multiplayer-only — which seats participate. Single-player projects: empty.
public IReadOnlyList<int> PlayerIds { get; }
Property Value
System.Collections.Generic.IReadOnlyList<System.Int32>
TimedDependentsOnEnd
Other events authored to fire when this activity is committed via Complete() (timeline end).
public IReadOnlyList<EventBase> TimedDependentsOnEnd { get; }
Property Value
System.Collections.Generic.IReadOnlyList<EventBase>
TimedDependentsOnStart
Other events authored to fire when this activity is presented (timeline start).
public IReadOnlyList<EventBase> TimedDependentsOnStart { get; }
Property Value
System.Collections.Generic.IReadOnlyList<EventBase>
Timeout
Optional time limit in seconds. Null when the activity has no timeout.
public Nullable<int> Timeout { get; }
Property Value
Type
Free-text hook label copied from the source StoryBonsai.Runtime.Models.Activity.Type. The runtime never inspects this; it is for the integrating studio to map activities to engine-side handlers (prefabs, minigames, scripts).
public string Type { get; }
Property Value
Uuid
Unique id for this firing — distinct per emission.
public string Uuid { get; }
Property Value
Methods
Accept(IEventQueueVisitor)
Dispatches to Visit(ActivityEvent).
public override void Accept(IEventQueueVisitor visitor);
Parameters
visitor IEventQueueVisitor
Visitor to dispatch this event to.
Complete()
Commit all field values. Throws if mandatory fields are not set or group constraints are violated. All data-model validation runs BEFORE the runtime touches anything — if this throws, no variable has been mutated.
public void Complete();
Exceptions
ActivityCompletionException
A mandatory field is missing, or a group min/max rule is violated.
System.InvalidOperationException
The activity is not connected to a runtime.
Remarks
Authored StoryBonsai.Runtime.Models.ActivityVariable.Default values surface via CurrentValue but are not auto-committed — studios decide whether to forward them by calling field.Value = field.CurrentValue before Complete().
SetField(string, object)
Set a field value. idOrUuid may be either the field’s Uuid (canonical) or Id (display label) — both resolve to the same field.
public void SetField(string idOrUuid, object value);
Parameters
idOrUuid System.String
Uuid or human-id of the ActivityField to set.
value System.Object
New value to assign; validated against the field’s Min/Max immediately.
Exceptions
System.ArgumentException
No ActivityField with the given idOrUuid exists on this activity.
System.InvalidOperationException
The targeted field is read-only.
System.ArgumentOutOfRangeException
value falls outside the field’s Min/Max range.
Inherited Properties
| Member | Source |
|---|---|
At | inherited from EventBase |
Timing | inherited from EventBase |