ReplayRecorder class
Record play session data and event to be used during a future play of the module that "challenges" this session.
Signature:
export declare class ReplayRecorder extends ExternalObject
Extends: ExternalObject
Remarks
Use Runtime.createReplayRecorder() to create an instance of this class.
Methods
Method | Modifiers | Description |
---|---|---|
addAggregateIncrementProperty(key, increment) | Increments an aggregation property by N server side. | |
addAggregateSetIfGreaterProperty(key, value) | Set the aggregation property server side if the new value is larger then the existing value. | |
addProperty(key, value) | Add a single property to this replay. | |
addReplayEvent(data) | Add data to the replay recording at the current recording time. | |
getRandomSeed() | The random seed to use when generating data for this replay sequence. | |
getReplayData() | Get the replay data recorded for this session. You must call ITimer.stop() on the underlying timer to finalize the recording before calling this. | |
pause() | Pause the recording of this replay. Pauses the internal time tracking. | |
resume() | Resume the recording of this replay. Resumes the internal time tracking. | |
setProperties(properties) | Set all of the properties object for this replay, overwriting any existing values. | |
start() | Start recording this replay. Begins the internal time tracking. Should only be called once per object. | |
stop() | Stop recording this replay. Finalizes the ReplayRecorder object, must be called when you've finished recording data and may only be called once per object. |
ReplayRecorder.addAggregateIncrementProperty() method
Increments an aggregation property by N server side.
Signature:
addAggregateIncrementProperty(key: string, increment?: number): void;
Parameters
Parameter | Type | Description |
---|---|---|
key | string | The property key. |
increment | number | (Optional) The amount to increment. (Default is 1) |
Returns:
void
Remarks
Aggregating the same property using ReplayRecorder.addAggregateSetIfGreaterProperty() and ReplayRecorder.addAggregateIncrementProperty() in combination can lead to unexpected results. Only use one kind of aggregation per property.
ReplayRecorder.addAggregateSetIfGreaterProperty() method
Set the aggregation property server side if the new value is larger then the existing value.
Signature:
addAggregateSetIfGreaterProperty(key: string, value: number): void;
Parameters
Parameter | Type | Description |
---|---|---|
key | string | The property key |
value | number | The integer candidate for the largest value |
Returns:
void
Remarks
Aggregating the same property using ReplayRecorder.addAggregateSetIfGreaterProperty() and ReplayRecorder.addAggregateIncrementProperty() in combination can lead to unexpected results. Only use one kind of aggregation per property.
ReplayRecorder.addProperty() method
Add a single property to this replay.
Signature:
addProperty(key: string, value: unknown): void;
Parameters
Parameter | Type | Description |
---|---|---|
key | string | The property key. |
value | unknown | The property value. |
Returns:
void
Remarks
Replay properties are time independent values that can be accessed during the play back of a replay.
ReplayRecorder.addReplayEvent() method
Add data to the replay recording at the current recording time.
Signature:
addReplayEvent(data: unknown): void;
Parameters
Parameter | Type | Description |
---|---|---|
data | unknown | The replay data to record. |
Returns:
void
Remarks
Recorded data must be serializable but the format of the data is up to the module.
ReplayRecorder.getRandomSeed() method
The random seed to use when generating data for this replay sequence.
Signature:
getRandomSeed(): Promise<number>;
Returns:
Promise<number>
Resolving to the random seed number.
Remarks
This same seed will be used in future replays so it's important that any random numbers that affect game play are seeded with this number in both play sessions.
ReplayRecorder.getReplayData() method
Get the replay data recorded for this session. You must call ITimer.stop() on the underlying timer to finalize the recording before calling this.
Signature:
getReplayData(): Promise<ReplayData>;
Returns:
Promise<ReplayData>
The replay data asset created from this recording session
ReplayRecorder.pause() method
Warning: This API is now obsolete.
Use ITimer.pause()
Pause the recording of this replay. Pauses the internal time tracking.
Signature:
pause(): void;
Returns:
void
ReplayRecorder.resume() method
Warning: This API is now obsolete.
Use ITimer.resume()
Resume the recording of this replay. Resumes the internal time tracking.
Signature:
resume(): void;
Returns:
void
ReplayRecorder.setProperties() method
Set all of the properties object for this replay, overwriting any existing values.
Signature:
setProperties(properties: ReadonlyObjectMap<unknown>): void;
Parameters
Parameter | Type | Description |
---|---|---|
properties | ReadonlyObjectMap<unknown> | Object containing all replay properties. |
Returns:
void
Remarks
Replay properties are time independent values that can be accessed during the play back of a replay.
ReplayRecorder.start() method
Warning: This API is now obsolete.
Use ITimer.start()
Start recording this replay. Begins the internal time tracking. Should only be called once per object.
Signature:
start(): void;
Returns:
void
ReplayRecorder.stop() method
Warning: This API is now obsolete.
Use ITimer.stop() followed by ReplayRecorder.getReplayData() instead.
Stop recording this replay. Finalizes the ReplayRecorder object, must be called when you've finished recording data and may only be called once per object.
Signature:
stop(): Promise<ReplayData>;
Returns:
Promise<ReplayData>
The replay data asset created from this recording session
Updated 7 months ago