Abstract Class: LabelAbstract<TLabel, TProps, StepIdType>
Defined in: src/narration/classes/LabelAbstract.ts:6
Extended by
Type Parameters
TLabel
TLabel
TProps
TProps extends object = { }
StepIdType
StepIdType = number
Implements
LabelProps<TLabel,StepIdType>
Constructors
Constructor
> new LabelAbstract<TLabel, TProps, StepIdType>(id, props?): LabelAbstract<TLabel, TProps, StepIdType>
Defined in: src/narration/classes/LabelAbstract.ts:13
Parameters
id
string
is the id of the label
props?
LabelProps<TLabel, StepIdType>
is the properties of the label
Returns
LabelAbstract<TLabel, TProps, StepIdType>
Properties
id
> readonly id: string
Defined in: src/narration/classes/LabelAbstract.ts:23
Get the id of the label. This variable is used in the system to get the label by id, RegisteredLabels.get
Accessors
onLoadingLabel
Get Signature
> get onLoadingLabel(): ((stepId, label) => void | Promise<void>) | undefined
Defined in: src/narration/classes/LabelAbstract.ts:61
Is a function that will be executed in Label.onStepStart if the id of the step is 0 and when the user laods a save file. When you load a save file, will be executed all onLoadingLabel functions of the narration.openedLabels. It is useful for example to make sure all images used have been cached
Example
newLabel("id", [], {
onLoadingLabel: async (stepId, label) => {
await Assets.load('path/to/image1.png')
await Assets.load('path/to/image2.png')
}
})
Returns
((stepId, label) => void | Promise<void>) | undefined
Is a function that will be executed in Label.onStepStart if the id of the step is 0 and when the user laods a save file. When you load a save file, will be executed all onLoadingLabel functions of the narration.openedLabels. It is useful for example to make sure all images used have been cached
Example
newLabel("id", [], {
onLoadingLabel: async (stepId, label) => {
await Assets.load('path/to/image1.png')
await Assets.load('path/to/image2.png')
}
})
Implementation of
onStepEnd
Get Signature
> get onStepEnd(): ((stepId, label) => void | Promise<void>) | undefined
Defined in: src/narration/classes/LabelAbstract.ts:68
Is a function that will be executed when the step ends.
Returns
((stepId, label) => void | Promise<void>) | undefined
Is a function that will be executed when the step ends.
Implementation of
onStepStart
Get Signature
> get onStepStart(): ((stepId, label) => void | Promise<void>) | undefined
Defined in: src/narration/classes/LabelAbstract.ts:45
Is a function that will be executed before any step is executed.
Returns
((stepId, label) => void | Promise<void>) | undefined
Is a function that will be executed before any step is executed.
Implementation of
stepCount
Get Signature
> get abstract stepCount(): number
Defined in: src/narration/classes/LabelAbstract.ts:29
Get the number of steps in the label. This variable is used in the system to get the number of steps in the label.
Returns
number
The number of steps in the label
Methods
getStepById()
> abstract getStepById(stepId): StepLabelType<TProps> | undefined
Defined in: src/narration/classes/LabelAbstract.ts:42
Get the step by id
Parameters
stepId
StepIdType
Id of the step
Returns
StepLabelType<TProps> | undefined
The step or undefined if it does not exist
getStepSha()
> abstract getStepSha(stepId): string | undefined
Defined in: src/narration/classes/LabelAbstract.ts:35
Get the sha of the step
Parameters
stepId
StepIdType
Returns
string | undefined