@drincs/pixi-vn-json 1.12.1 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -29
- package/dist/{importer.d.cts → PixiVNJsonLabelStep-C-9WKwTo.d.cts} +479 -77
- package/dist/{importer.d.ts → PixiVNJsonLabelStep-C-9WKwTo.d.ts} +479 -77
- package/dist/PixiVNJsonLabelStep-DQx6TBvZ.d.cts +999 -0
- package/dist/PixiVNJsonLabelStep-DQx6TBvZ.d.ts +999 -0
- package/dist/actions.cjs +3 -0
- package/dist/actions.d.cts +127 -0
- package/dist/actions.d.ts +127 -0
- package/dist/actions.mjs +3 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +33 -541
- package/dist/core.d.ts +33 -541
- package/dist/core.mjs +1 -1
- package/dist/index.cjs +2 -3
- package/dist/index.d.cts +557 -21
- package/dist/index.d.ts +557 -21
- package/dist/index.mjs +2 -3
- package/dist/interpreter.cjs +1 -0
- package/dist/interpreter.d.cts +96 -0
- package/dist/interpreter.d.ts +96 -0
- package/dist/interpreter.mjs +1 -0
- package/dist/schema.cjs +1 -0
- package/dist/schema.d.cts +41 -0
- package/dist/schema.d.ts +41 -0
- package/dist/schema.mjs +0 -0
- package/dist/translator.cjs +1 -1
- package/dist/translator.d.cts +513 -13
- package/dist/translator.d.ts +513 -13
- package/dist/translator.mjs +1 -1
- package/package.json +33 -4
- package/dist/importer.cjs +0 -1
- package/dist/importer.mjs +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,71 @@
|
|
|
1
|
+
import { StorageElementType, StepLabelPropsType, CanvasBaseInterface, ImageSprite, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptionsWithChannel, MediaInterface, LabelRunModeType, StorageObjectType } from '@drincs/pixi-vn';
|
|
1
2
|
export * from '@drincs/pixi-vn-json/core';
|
|
2
|
-
export * from '@drincs/pixi-vn-json/
|
|
3
|
-
export * from '@drincs/pixi-vn-json/translator';
|
|
4
|
-
import { StorageElementType, CanvasBaseInterface, ImageSprite, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptionsWithChannel, MediaInterface, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
|
|
3
|
+
export * from '@drincs/pixi-vn-json/interpreter';
|
|
5
4
|
import { KeyframesType, AnimationOptions, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions } from '@drincs/pixi-vn/motion';
|
|
6
5
|
import { UPDATE_PRIORITY } from 'pixi.js';
|
|
6
|
+
export * from '@drincs/pixi-vn-json/translator';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* A middleware handler that can intercept and transform a logic value before it is
|
|
10
|
+
* returned by {@link VariableGetter.getLogichValue}.
|
|
11
|
+
*
|
|
12
|
+
* Handlers are called in registration order, each receiving the current value and a
|
|
13
|
+
* `next` function to invoke the rest of the chain (including the built-in resolver).
|
|
14
|
+
* Return `undefined` to fall through to `next`.
|
|
15
|
+
*/
|
|
16
|
+
type VariableGetterHandler = <T = StorageElementType>(value: T, next: (value: T) => T | undefined) => T | undefined;
|
|
17
|
+
declare namespace VariableGetter {
|
|
18
|
+
/**
|
|
19
|
+
* Registers a new middleware handler into the resolution chain.
|
|
20
|
+
* Handlers are invoked in the order they were added.
|
|
21
|
+
*
|
|
22
|
+
* @param handler - The middleware handler to register.
|
|
23
|
+
*/
|
|
24
|
+
function add(handler: VariableGetterHandler): void;
|
|
25
|
+
/**
|
|
26
|
+
* Removes all registered middleware handlers, restoring the default resolution behaviour.
|
|
27
|
+
*/
|
|
28
|
+
function clear(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Resolves a JSON logic value, running it through all registered middleware handlers
|
|
31
|
+
* before falling back to the built-in storage/arithmetic/condition evaluator.
|
|
32
|
+
*
|
|
33
|
+
* @param value - The value or logic expression to resolve.
|
|
34
|
+
* @param props - The current step label props passed to each handler.
|
|
35
|
+
* @returns The resolved value, or `undefined`.
|
|
36
|
+
*/
|
|
37
|
+
function getLogichValue<T = StorageElementType>(value: any, props?: StepLabelPropsType): T | undefined;
|
|
38
|
+
}
|
|
9
39
|
|
|
40
|
+
/**
|
|
41
|
+
* A single element that can appear inside a step-switch, which may be a direct value,
|
|
42
|
+
* a conditional statement, or a result-to-combine.
|
|
43
|
+
*/
|
|
10
44
|
type PixiVNJsonStepSwitchElementType<Then> = Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>;
|
|
45
|
+
/**
|
|
46
|
+
* The elements collection of a step-switch — either a plain array or a conditional that produces an array.
|
|
47
|
+
*/
|
|
11
48
|
type PixiVNJsonStepSwitchElementsType<Then> = PixiVNJsonStepSwitchElementType<Then>[] | PixiVNJsonConditionalStatements<Then[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Picks one element at random each time the step is visited.
|
|
51
|
+
*/
|
|
12
52
|
interface PixiVNJsonRandom<Then> {
|
|
13
53
|
type: "stepswitch";
|
|
14
54
|
choiceType: "random";
|
|
55
|
+
/**
|
|
56
|
+
* The pool of elements to choose from randomly.
|
|
57
|
+
*/
|
|
15
58
|
elements: PixiVNJsonStepSwitchElementsType<Then>;
|
|
16
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Picks elements in a random order, advancing through the list across visits (no repeats until exhausted).
|
|
62
|
+
*/
|
|
17
63
|
interface PixiVNJsonSequentialRandom<Then> {
|
|
18
64
|
type: "stepswitch";
|
|
19
65
|
choiceType: "sequentialrandom";
|
|
66
|
+
/**
|
|
67
|
+
* The pool of elements to iterate through in randomised order.
|
|
68
|
+
*/
|
|
20
69
|
elements: PixiVNJsonStepSwitchElementsType<Then>;
|
|
21
70
|
/**
|
|
22
71
|
* When the sequential ends, what should be the value? If undefined, it will return undefined.
|
|
@@ -24,13 +73,19 @@ interface PixiVNJsonSequentialRandom<Then> {
|
|
|
24
73
|
*/
|
|
25
74
|
end: undefined | "lastItem";
|
|
26
75
|
/**
|
|
27
|
-
* The subId is used for
|
|
76
|
+
* The subId is used for managing nested switches
|
|
28
77
|
*/
|
|
29
78
|
nestedId?: string;
|
|
30
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Advances through the elements list one by one on each visit (in order).
|
|
82
|
+
*/
|
|
31
83
|
interface PixiVNJsonSequential<Then> {
|
|
32
84
|
type: "stepswitch";
|
|
33
85
|
choiceType: "sequential";
|
|
86
|
+
/**
|
|
87
|
+
* The ordered list of elements to iterate through.
|
|
88
|
+
*/
|
|
34
89
|
elements: PixiVNJsonStepSwitchElementsType<Then>;
|
|
35
90
|
/**
|
|
36
91
|
* When the sequential ends, what should be the value? If undefined, it will return undefined.
|
|
@@ -38,16 +93,28 @@ interface PixiVNJsonSequential<Then> {
|
|
|
38
93
|
*/
|
|
39
94
|
end: undefined | "lastItem";
|
|
40
95
|
/**
|
|
41
|
-
* The subId is used for
|
|
96
|
+
* The subId is used for managing nested switches
|
|
42
97
|
*/
|
|
43
98
|
nestedId?: string;
|
|
44
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Loops through the elements list indefinitely, cycling back to the first element after the last.
|
|
102
|
+
*/
|
|
45
103
|
interface PixiVNJsonLoop<Then> {
|
|
46
104
|
type: "stepswitch";
|
|
47
105
|
choiceType: "loop";
|
|
106
|
+
/**
|
|
107
|
+
* The list of elements to cycle through.
|
|
108
|
+
*/
|
|
48
109
|
elements: PixiVNJsonStepSwitchElementsType<Then>;
|
|
110
|
+
/**
|
|
111
|
+
* The subId is used for managing nested switches
|
|
112
|
+
*/
|
|
49
113
|
nestedId?: string;
|
|
50
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* A step-switch selects one element from a list using a defined strategy (random, sequential, loop, or sequential-random).
|
|
117
|
+
*/
|
|
51
118
|
type PixiVNJsonStepSwitch<Then> = PixiVNJsonRandom<Then> | PixiVNJsonSequential<Then> | PixiVNJsonLoop<Then> | PixiVNJsonSequentialRandom<Then>;
|
|
52
119
|
|
|
53
120
|
/**
|
|
@@ -57,15 +124,33 @@ type PixiVNJsonStepSwitch<Then> = PixiVNJsonRandom<Then> | PixiVNJsonSequential<
|
|
|
57
124
|
type PixiVNJsonConditionalResultToCombine<T> = {
|
|
58
125
|
type: "resulttocombine";
|
|
59
126
|
/**
|
|
60
|
-
*
|
|
127
|
+
* Defines how the two results are combined:
|
|
128
|
+
* - `"cross"` — cartesian product / pairwise combination of both results
|
|
129
|
+
* - `"union"` — concatenation / merge of both results into a single collection
|
|
61
130
|
*/
|
|
62
131
|
combine: "cross" | "union";
|
|
132
|
+
/**
|
|
133
|
+
* The first (primary) result item, used as a fallback if the second conditional produces no result.
|
|
134
|
+
*/
|
|
63
135
|
firstItem?: T;
|
|
136
|
+
/**
|
|
137
|
+
* The second conditional item(s) whose result will be combined with {@link firstItem}.
|
|
138
|
+
*/
|
|
64
139
|
secondConditionalItem?: PixiVNJsonStepSwitchElementType<T>[];
|
|
65
140
|
};
|
|
66
141
|
|
|
142
|
+
/**
|
|
143
|
+
* A conditional statement that evaluates to a value of type `Then`.
|
|
144
|
+
* It can be either:
|
|
145
|
+
* - a {@link PixiVNJsonStepSwitch} — selects a result from a list based on a strategy (random, sequential, loop)
|
|
146
|
+
* - a {@link PixiVNJsonIfElse} — evaluates a condition and returns the matching branch result,
|
|
147
|
+
* which may itself be another conditional or a {@link PixiVNJsonConditionalResultToCombine}
|
|
148
|
+
*/
|
|
67
149
|
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
68
150
|
|
|
151
|
+
/**
|
|
152
|
+
* Retrieves a value from the persistent storage, flag storage, or temporary storage.
|
|
153
|
+
*/
|
|
69
154
|
type PixiVNJsonStorageGet = {
|
|
70
155
|
type: "value";
|
|
71
156
|
storageOperationType: "get";
|
|
@@ -83,11 +168,14 @@ type PixiVNJsonParamGet = {
|
|
|
83
168
|
type: "value";
|
|
84
169
|
storageOperationType: "get";
|
|
85
170
|
/**
|
|
86
|
-
*
|
|
171
|
+
* Index of the parameter in the params array.
|
|
87
172
|
*/
|
|
88
173
|
key: number;
|
|
89
174
|
storageType: "params";
|
|
90
175
|
};
|
|
176
|
+
/**
|
|
177
|
+
* Retrieves the number of times a label has been opened.
|
|
178
|
+
*/
|
|
91
179
|
type PixiVNJsonLabelGet = {
|
|
92
180
|
type: "value";
|
|
93
181
|
storageOperationType: "get";
|
|
@@ -100,6 +188,9 @@ type PixiVNJsonLabelGet = {
|
|
|
100
188
|
*/
|
|
101
189
|
storageType: "label";
|
|
102
190
|
};
|
|
191
|
+
/**
|
|
192
|
+
* Retrieves the number of times a specific choice has been selected.
|
|
193
|
+
*/
|
|
103
194
|
type PixiVNJsonChoiceGet = {
|
|
104
195
|
type: "value";
|
|
105
196
|
storageOperationType: "get";
|
|
@@ -112,13 +203,41 @@ type PixiVNJsonChoiceGet = {
|
|
|
112
203
|
*/
|
|
113
204
|
storageType: "choice";
|
|
114
205
|
};
|
|
206
|
+
/**
|
|
207
|
+
* Retrieves a value from the logic/arithmetic layer (result of a computation or condition).
|
|
208
|
+
*/
|
|
115
209
|
type PixiVNJsonLogicGet = {
|
|
116
210
|
type: "value";
|
|
117
211
|
storageOperationType: "get";
|
|
212
|
+
/**
|
|
213
|
+
* The arithmetic or conditional operation whose result is the retrieved value.
|
|
214
|
+
*/
|
|
118
215
|
operation: PixiVNJsonArithmeticOperations | PixiVNJsonConditions;
|
|
119
216
|
storageType: "logic";
|
|
120
217
|
};
|
|
121
|
-
|
|
218
|
+
/**
|
|
219
|
+
* Union of all "get value" operations — reads from storage, params, labels, choices, or a logic expression.
|
|
220
|
+
*/
|
|
221
|
+
type PixiVNJsonValueGet = PixiVNJsonStorageGet | PixiVNJsonParamGet | PixiVNJsonLabelGet | PixiVNJsonChoiceGet | PixiVNJsonLogicGet | PixiVNJsonFunction;
|
|
222
|
+
/**
|
|
223
|
+
* Invokes a named function and returns its result.
|
|
224
|
+
* Functions are registered in the Pixi'VN runtime and can receive typed arguments.
|
|
225
|
+
*/
|
|
226
|
+
type PixiVNJsonFunction = {
|
|
227
|
+
type: "function";
|
|
228
|
+
/**
|
|
229
|
+
* The name of the registered function to call.
|
|
230
|
+
*/
|
|
231
|
+
functionName: string;
|
|
232
|
+
/**
|
|
233
|
+
* Arguments to pass to the function. Each argument can be a condition, a raw value,
|
|
234
|
+
* a value-get operation, or an arithmetic expression.
|
|
235
|
+
*/
|
|
236
|
+
args: (PixiVNJsonConditions | StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations)[];
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* Sets a value in either the persistent storage or the temporary (session) storage.
|
|
240
|
+
*/
|
|
122
241
|
type PixiVNJsonOnlyStorageSet = {
|
|
123
242
|
type: "value";
|
|
124
243
|
storageOperationType: "set";
|
|
@@ -135,19 +254,26 @@ type PixiVNJsonOnlyStorageSet = {
|
|
|
135
254
|
*/
|
|
136
255
|
storageType: "storage" | "tempstorage";
|
|
137
256
|
};
|
|
257
|
+
/**
|
|
258
|
+
* Sets a positional parameter value in the params temporary storage.
|
|
259
|
+
*/
|
|
138
260
|
type PixiVNJsonOnlyParamSet = {
|
|
139
261
|
type: "value";
|
|
140
262
|
storageOperationType: "set";
|
|
141
263
|
/**
|
|
142
|
-
*
|
|
264
|
+
* Index of the parameter in the params array to set.
|
|
143
265
|
*/
|
|
144
266
|
key: number;
|
|
145
267
|
/**
|
|
146
|
-
* Value to be set
|
|
268
|
+
* Value to be set at the given param index.
|
|
147
269
|
*/
|
|
148
270
|
value: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType>;
|
|
149
271
|
storageType: "params";
|
|
150
272
|
};
|
|
273
|
+
/**
|
|
274
|
+
* Sets a boolean flag in the flag storage.
|
|
275
|
+
* Flag storage is a dedicated boolean key-value store queried with {@link getFlag}.
|
|
276
|
+
*/
|
|
151
277
|
type PixiVNJsonFlagSet = {
|
|
152
278
|
type: "value";
|
|
153
279
|
storageOperationType: "set";
|
|
@@ -164,8 +290,14 @@ type PixiVNJsonFlagSet = {
|
|
|
164
290
|
*/
|
|
165
291
|
storageType: "flagStorage";
|
|
166
292
|
};
|
|
293
|
+
/**
|
|
294
|
+
* Union of all "set value" operations — writes to storage, flag storage, or params.
|
|
295
|
+
*/
|
|
167
296
|
type PixiVNJsonValueSet = PixiVNJsonOnlyStorageSet | PixiVNJsonFlagSet | PixiVNJsonOnlyParamSet;
|
|
168
297
|
|
|
298
|
+
/**
|
|
299
|
+
* Binary arithmetic operation between two values (left OP right).
|
|
300
|
+
*/
|
|
169
301
|
interface PixiVNJsonArithmeticOperationsArithmetic {
|
|
170
302
|
type: "arithmetic";
|
|
171
303
|
/**
|
|
@@ -177,10 +309,21 @@ interface PixiVNJsonArithmeticOperationsArithmetic {
|
|
|
177
309
|
*/
|
|
178
310
|
rightValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
|
|
179
311
|
/**
|
|
180
|
-
* Operator of the arithmetic operation
|
|
312
|
+
* Operator of the arithmetic operation:
|
|
313
|
+
* - `"*"` multiplication
|
|
314
|
+
* - `"/"` division
|
|
315
|
+
* - `"+"` addition (concatenation for strings and arrays)
|
|
316
|
+
* - `"-"` subtraction (removal of elements for arrays)
|
|
317
|
+
* - `"%"` modulo
|
|
318
|
+
* - `"POW"` exponentiation
|
|
319
|
+
* - `"RANDOM"` random integer between leftValue and rightValue (inclusive)
|
|
320
|
+
* - `"INTERSECTION"` intersection of two arrays (only elements present in both arrays are included in the result)
|
|
181
321
|
*/
|
|
182
|
-
operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
|
|
322
|
+
operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM" | "INTERSECTION";
|
|
183
323
|
}
|
|
324
|
+
/**
|
|
325
|
+
* Unary arithmetic operation applied to a single value (e.g. INT, FLOOR, FLOAT).
|
|
326
|
+
*/
|
|
184
327
|
interface PixiVNJsonArithmeticOperationsArithmeticSingle {
|
|
185
328
|
type: "arithmeticsingle";
|
|
186
329
|
/**
|
|
@@ -188,7 +331,10 @@ interface PixiVNJsonArithmeticOperationsArithmeticSingle {
|
|
|
188
331
|
*/
|
|
189
332
|
leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
|
|
190
333
|
/**
|
|
191
|
-
* Operator of the arithmetic operation
|
|
334
|
+
* Operator of the arithmetic operation:
|
|
335
|
+
* - `"INT"` truncates the value to an integer (removes the decimal part)
|
|
336
|
+
* - `"FLOOR"` rounds down to the nearest integer
|
|
337
|
+
* - `"FLOAT"` converts the value to a floating-point number
|
|
192
338
|
*/
|
|
193
339
|
operator: "INT" | "FLOOR" | "FLOAT";
|
|
194
340
|
}
|
|
@@ -197,18 +343,48 @@ interface PixiVNJsonArithmeticOperationsArithmeticSingle {
|
|
|
197
343
|
*/
|
|
198
344
|
type PixiVNJsonArithmeticOperations = PixiVNJsonArithmeticOperationsArithmeticSingle | PixiVNJsonArithmeticOperationsArithmetic;
|
|
199
345
|
|
|
346
|
+
/**
|
|
347
|
+
* Combines multiple conditions with a logical AND or OR.
|
|
348
|
+
*/
|
|
200
349
|
type PixiVNJsonUnionConditionAndOr = {
|
|
201
350
|
type: "union";
|
|
351
|
+
/**
|
|
352
|
+
* The list of conditions to combine.
|
|
353
|
+
*/
|
|
202
354
|
conditions: PixiVNJsonConditions[];
|
|
355
|
+
/**
|
|
356
|
+
* - `"and"` — all conditions must be true
|
|
357
|
+
* - `"or"` — at least one condition must be true
|
|
358
|
+
*/
|
|
203
359
|
unionType: "and" | "or";
|
|
204
360
|
};
|
|
361
|
+
/**
|
|
362
|
+
* Negates a single condition with a logical NOT.
|
|
363
|
+
*/
|
|
205
364
|
type PixiVNJsonUnionConditionNot = {
|
|
206
365
|
type: "union";
|
|
366
|
+
/**
|
|
367
|
+
* The condition to negate.
|
|
368
|
+
*/
|
|
207
369
|
condition: PixiVNJsonConditions;
|
|
208
370
|
unionType: "not";
|
|
209
371
|
};
|
|
372
|
+
/**
|
|
373
|
+
* Union of AND/OR and NOT logical operators over conditions.
|
|
374
|
+
*/
|
|
210
375
|
type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionConditionNot;
|
|
211
376
|
|
|
377
|
+
/**
|
|
378
|
+
* Supported comparison operators.
|
|
379
|
+
* - `"=="` equal
|
|
380
|
+
* - `"!="` not equal
|
|
381
|
+
* - `"<"` less than
|
|
382
|
+
* - `"<="` less than or equal
|
|
383
|
+
* - `">"` greater than
|
|
384
|
+
* - `">="` greater than or equal
|
|
385
|
+
* - `"CONTAINS"` checks whether the left string/array contains the right value, if left and right are arrays, checks if all items in right are included in left
|
|
386
|
+
*/
|
|
387
|
+
type PixiVNJsonComparationOperatorsType = "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
|
|
212
388
|
/**
|
|
213
389
|
* Comparation for PixiVNJson.
|
|
214
390
|
* In this comparation, the values to be converted to string and compared.
|
|
@@ -226,11 +402,18 @@ type PixiVNJsonComparation = {
|
|
|
226
402
|
/**
|
|
227
403
|
* Operator of the comparation
|
|
228
404
|
*/
|
|
229
|
-
operator:
|
|
405
|
+
operator: PixiVNJsonComparationOperatorsType;
|
|
230
406
|
};
|
|
407
|
+
/**
|
|
408
|
+
* A plain value condition — truthy/falsy evaluation of a raw value or a value-get result.
|
|
409
|
+
*/
|
|
231
410
|
type PixiVNJsonValueCondition = StorageElementType | PixiVNJsonValueGet;
|
|
232
411
|
/**
|
|
233
|
-
*
|
|
412
|
+
* Union of all condition types supported by PixiVNJson:
|
|
413
|
+
* - {@link PixiVNJsonComparation} — binary comparison between two values
|
|
414
|
+
* - {@link PixiVNJsonValueCondition} — truthy/falsy check on a plain value
|
|
415
|
+
* - {@link PixiVNJsonUnionCondition} — logical AND, OR, or NOT of other conditions
|
|
416
|
+
* - {@link PixiVNJsonArithmeticOperations} — arithmetic result used as a boolean (non-zero = true)
|
|
234
417
|
*/
|
|
235
418
|
type PixiVNJsonConditions = PixiVNJsonComparation | PixiVNJsonValueCondition | PixiVNJsonUnionCondition | PixiVNJsonArithmeticOperations;
|
|
236
419
|
|
|
@@ -241,6 +424,13 @@ interface PixiVNJsonIfElse<Then> {
|
|
|
241
424
|
type: "ifelse";
|
|
242
425
|
/**
|
|
243
426
|
* The list of conditions to be checked.
|
|
427
|
+
*
|
|
428
|
+
* if is a {@link StorageElementType} or a {@link PixiVNJsonValueGet}:
|
|
429
|
+
* - if is a array or object, the condition is true if not empty
|
|
430
|
+
* - if is a string, the condition is true if not empty
|
|
431
|
+
* - if is a number, the condition is true if not zero
|
|
432
|
+
* - if is a boolean, the condition is true if true
|
|
433
|
+
* - if is null or undefined, the condition is false
|
|
244
434
|
*/
|
|
245
435
|
condition: PixiVNJsonConditions;
|
|
246
436
|
/**
|
|
@@ -253,187 +443,470 @@ interface PixiVNJsonIfElse<Then> {
|
|
|
253
443
|
else?: Then | PixiVNJsonIfElse<Then>;
|
|
254
444
|
}
|
|
255
445
|
|
|
446
|
+
/**
|
|
447
|
+
* Animates one or more canvas elements simultaneously using keyframe-based animation.
|
|
448
|
+
*/
|
|
256
449
|
type PixiVNJsonAnimateBase<T extends CanvasBaseInterface<any>> = {
|
|
257
450
|
type: "animate";
|
|
451
|
+
/**
|
|
452
|
+
* Alias (or list of aliases) of the canvas elements to animate.
|
|
453
|
+
*/
|
|
258
454
|
alias: string | string[];
|
|
455
|
+
/**
|
|
456
|
+
* The keyframes that define the animation values over time.
|
|
457
|
+
*/
|
|
259
458
|
keyframes: KeyframesType<T>;
|
|
459
|
+
/**
|
|
460
|
+
* Additional options controlling the animation (duration, easing, repeat, etc.).
|
|
461
|
+
*/
|
|
260
462
|
options?: AnimationOptions;
|
|
463
|
+
/**
|
|
464
|
+
* Pixi.js update priority for this animation ticker callback.
|
|
465
|
+
*/
|
|
261
466
|
priority?: UPDATE_PRIORITY;
|
|
262
467
|
};
|
|
468
|
+
/**
|
|
469
|
+
* Animates a canvas element using a sequence of segments (timeline-based animation).
|
|
470
|
+
*/
|
|
263
471
|
type PixiVNJsonAnimateSequence<T extends CanvasBaseInterface<any>> = {
|
|
264
472
|
type: "animate-sequence";
|
|
473
|
+
/**
|
|
474
|
+
* Alias of the canvas element to animate.
|
|
475
|
+
*/
|
|
265
476
|
alias: string;
|
|
477
|
+
/**
|
|
478
|
+
* Ordered list of animation segments, each optionally including a transition.
|
|
479
|
+
*/
|
|
266
480
|
sequence: (ObjectSegment<T> | ObjectSegmentWithTransition<T>)[];
|
|
481
|
+
/**
|
|
482
|
+
* Additional options controlling the sequence playback.
|
|
483
|
+
*/
|
|
267
484
|
options?: SequenceOptions;
|
|
485
|
+
/**
|
|
486
|
+
* Pixi.js update priority for this animation ticker callback.
|
|
487
|
+
*/
|
|
268
488
|
priority?: UPDATE_PRIORITY;
|
|
269
489
|
};
|
|
490
|
+
/**
|
|
491
|
+
* Union of all canvas animation operations — keyframe-based or sequence-based.
|
|
492
|
+
*/
|
|
270
493
|
type PixiVNJsonCanvasAnimate<T extends CanvasBaseInterface<any> = ImageSprite> = PixiVNJsonAnimateBase<T> | PixiVNJsonAnimateSequence<T>;
|
|
271
494
|
|
|
495
|
+
/**
|
|
496
|
+
* Applies a shake effect to a canvas element.
|
|
497
|
+
*/
|
|
272
498
|
type PixiVNJsonEffectShake = {
|
|
273
499
|
type: "shake";
|
|
500
|
+
/**
|
|
501
|
+
* Alias of the canvas element to apply the shake effect to.
|
|
502
|
+
*/
|
|
274
503
|
alias: string;
|
|
504
|
+
/**
|
|
505
|
+
* Configuration properties for the shake effect (amplitude, duration, etc.).
|
|
506
|
+
*/
|
|
275
507
|
props: ShakeEffectProps;
|
|
508
|
+
/**
|
|
509
|
+
* Pixi.js update priority for the effect ticker callback.
|
|
510
|
+
*/
|
|
276
511
|
priority?: UPDATE_PRIORITY;
|
|
277
512
|
};
|
|
513
|
+
/**
|
|
514
|
+
* Union of all canvas visual effects.
|
|
515
|
+
*/
|
|
278
516
|
type PixiVNJsonCanvasEffect = PixiVNJsonEffectShake;
|
|
279
517
|
|
|
518
|
+
/**
|
|
519
|
+
* Cross-dissolve transition — blends the element in or out by gradually changing its opacity.
|
|
520
|
+
*/
|
|
280
521
|
type DissolveTransition = {
|
|
281
522
|
type: "dissolve";
|
|
523
|
+
/**
|
|
524
|
+
* Configuration options for the dissolve transition.
|
|
525
|
+
*/
|
|
282
526
|
props?: ShowWithDissolveTransitionProps;
|
|
527
|
+
/**
|
|
528
|
+
* Pixi.js update priority for the transition ticker callback.
|
|
529
|
+
*/
|
|
283
530
|
priority?: UPDATE_PRIORITY;
|
|
284
531
|
};
|
|
532
|
+
/**
|
|
533
|
+
* Fade transition — fades the element in or out by animating its alpha value.
|
|
534
|
+
*/
|
|
285
535
|
type FadeTransition = {
|
|
286
536
|
type: "fade";
|
|
537
|
+
/**
|
|
538
|
+
* Configuration options for the fade transition.
|
|
539
|
+
*/
|
|
287
540
|
props?: ShowWithFadeTransitionProps;
|
|
541
|
+
/**
|
|
542
|
+
* Pixi.js update priority for the transition ticker callback.
|
|
543
|
+
*/
|
|
288
544
|
priority?: UPDATE_PRIORITY;
|
|
289
545
|
};
|
|
546
|
+
/**
|
|
547
|
+
* Move-in / Move-out transition — slides the element into or out of the viewport.
|
|
548
|
+
*/
|
|
290
549
|
type MoveInOutTransition = {
|
|
291
550
|
type: "movein" | "moveout";
|
|
551
|
+
/**
|
|
552
|
+
* Configuration options for the move transition (direction, duration, easing, etc.).
|
|
553
|
+
*/
|
|
292
554
|
props?: MoveInOutProps;
|
|
555
|
+
/**
|
|
556
|
+
* Pixi.js update priority for the transition ticker callback.
|
|
557
|
+
*/
|
|
293
558
|
priority?: UPDATE_PRIORITY;
|
|
294
559
|
};
|
|
560
|
+
/**
|
|
561
|
+
* Zoom-in / Zoom-out transition — scales the element into or out of view.
|
|
562
|
+
*/
|
|
295
563
|
type ZoomInOutTransition = {
|
|
296
564
|
type: "zoomin" | "zoomout";
|
|
565
|
+
/**
|
|
566
|
+
* Configuration options for the zoom transition (scale, duration, easing, etc.).
|
|
567
|
+
*/
|
|
297
568
|
props?: ZoomInOutProps;
|
|
569
|
+
/**
|
|
570
|
+
* Pixi.js update priority for the transition ticker callback.
|
|
571
|
+
*/
|
|
298
572
|
priority?: UPDATE_PRIORITY;
|
|
299
573
|
};
|
|
574
|
+
/**
|
|
575
|
+
* Push-in / Push-out transition — pushes the element onto or off the viewport, displacing the current content.
|
|
576
|
+
*/
|
|
300
577
|
type PushInOutTransition = {
|
|
301
578
|
type: "pushin" | "pushout";
|
|
579
|
+
/**
|
|
580
|
+
* Configuration options for the push transition (direction, duration, easing, etc.).
|
|
581
|
+
*/
|
|
302
582
|
props?: PushInOutProps;
|
|
583
|
+
/**
|
|
584
|
+
* Pixi.js update priority for the transition ticker callback.
|
|
585
|
+
*/
|
|
303
586
|
priority?: UPDATE_PRIORITY;
|
|
304
587
|
};
|
|
588
|
+
/**
|
|
589
|
+
* Union of all supported canvas media transitions.
|
|
590
|
+
*/
|
|
305
591
|
type PixiVNJsonMediaTransiotions = DissolveTransition | FadeTransition | MoveInOutTransition | ZoomInOutTransition | PushInOutTransition;
|
|
306
592
|
|
|
593
|
+
/**
|
|
594
|
+
* Shows an image or video asset on the canvas.
|
|
595
|
+
*/
|
|
307
596
|
type PixiVNJsonCanvasImageVideoShow = {
|
|
308
597
|
type: "image" | "video";
|
|
309
598
|
operationType: "show";
|
|
599
|
+
/**
|
|
600
|
+
* Unique identifier (alias) used to reference this element on the canvas.
|
|
601
|
+
*/
|
|
310
602
|
alias: string;
|
|
311
603
|
/**
|
|
312
604
|
* The url of the image or video.
|
|
313
605
|
* If the url is not provided, the url will be set to the alias.
|
|
314
606
|
*/
|
|
315
607
|
url?: string;
|
|
608
|
+
/**
|
|
609
|
+
* Display options (position, scale, alpha, etc.) for the image or video sprite.
|
|
610
|
+
*/
|
|
316
611
|
props?: ImageSpriteOptions;
|
|
612
|
+
/**
|
|
613
|
+
* Optional transition effect applied when the element appears on screen.
|
|
614
|
+
*/
|
|
317
615
|
transition?: PixiVNJsonMediaTransiotions;
|
|
318
616
|
};
|
|
617
|
+
/**
|
|
618
|
+
* Shows an image container (a group of layered images) on the canvas.
|
|
619
|
+
*/
|
|
319
620
|
type PixiVNJsonCanvasImageContainerShow = {
|
|
320
621
|
type: "imagecontainer";
|
|
321
622
|
operationType: "show";
|
|
623
|
+
/**
|
|
624
|
+
* Unique identifier (alias) used to reference this element on the canvas.
|
|
625
|
+
*/
|
|
322
626
|
alias: string;
|
|
627
|
+
/**
|
|
628
|
+
* The ordered list of image URLs that compose the container layers.
|
|
629
|
+
*/
|
|
323
630
|
urls: string[];
|
|
631
|
+
/**
|
|
632
|
+
* Display options for the image container.
|
|
633
|
+
*/
|
|
324
634
|
props?: ImageContainerOptions<ImageSprite>;
|
|
635
|
+
/**
|
|
636
|
+
* Optional transition effect applied when the element appears on screen.
|
|
637
|
+
*/
|
|
325
638
|
transition?: PixiVNJsonMediaTransiotions;
|
|
326
639
|
};
|
|
640
|
+
/**
|
|
641
|
+
* Shows a text element on the canvas.
|
|
642
|
+
*/
|
|
327
643
|
type PixiVNJsonCanvasTextShow = {
|
|
328
644
|
type: "text";
|
|
329
645
|
operationType: "show";
|
|
646
|
+
/**
|
|
647
|
+
* Unique identifier (alias) used to reference this element on the canvas.
|
|
648
|
+
*/
|
|
330
649
|
alias: string;
|
|
650
|
+
/**
|
|
651
|
+
* The string content to display.
|
|
652
|
+
*/
|
|
331
653
|
text: string;
|
|
654
|
+
/**
|
|
655
|
+
* Display options (font, style, position, etc.) for the text element.
|
|
656
|
+
*/
|
|
332
657
|
props?: TextOptions;
|
|
658
|
+
/**
|
|
659
|
+
* Optional transition effect applied when the element appears on screen.
|
|
660
|
+
*/
|
|
333
661
|
transition?: PixiVNJsonMediaTransiotions;
|
|
334
662
|
};
|
|
663
|
+
/**
|
|
664
|
+
* Edits the properties of an existing image sprite on the canvas.
|
|
665
|
+
*/
|
|
335
666
|
type PixiVNJsonImageEdit = {
|
|
336
667
|
type: "image";
|
|
337
668
|
operationType: "edit";
|
|
669
|
+
/**
|
|
670
|
+
* Alias of the canvas element to edit.
|
|
671
|
+
*/
|
|
338
672
|
alias: string;
|
|
673
|
+
/**
|
|
674
|
+
* Partial memory/state properties to update on the image sprite.
|
|
675
|
+
*/
|
|
339
676
|
props?: Partial<ImageSpriteMemory>;
|
|
340
677
|
};
|
|
678
|
+
/**
|
|
679
|
+
* Edits the properties of an existing video sprite on the canvas.
|
|
680
|
+
*/
|
|
341
681
|
type PixiVNJsonVideoEdit = {
|
|
342
682
|
type: "video";
|
|
343
683
|
operationType: "edit";
|
|
684
|
+
/**
|
|
685
|
+
* Alias of the canvas element to edit.
|
|
686
|
+
*/
|
|
344
687
|
alias: string;
|
|
688
|
+
/**
|
|
689
|
+
* Partial memory/state properties to update on the video sprite.
|
|
690
|
+
*/
|
|
345
691
|
props?: Partial<VideoSpriteMemory>;
|
|
346
692
|
};
|
|
693
|
+
/**
|
|
694
|
+
* Edits the properties of an existing image container on the canvas.
|
|
695
|
+
*/
|
|
347
696
|
type PixiVNJsonImageContainerEdit = {
|
|
348
697
|
type: "imagecontainer";
|
|
349
698
|
operationType: "edit";
|
|
699
|
+
/**
|
|
700
|
+
* Alias of the canvas element to edit.
|
|
701
|
+
*/
|
|
350
702
|
alias: string;
|
|
703
|
+
/**
|
|
704
|
+
* Partial memory/state properties to update on the image container.
|
|
705
|
+
*/
|
|
351
706
|
props?: Partial<ImageContainerMemory>;
|
|
352
707
|
};
|
|
708
|
+
/**
|
|
709
|
+
* Edits the properties of an existing text element on the canvas.
|
|
710
|
+
*/
|
|
353
711
|
type PixiVNJsonTextEdit = {
|
|
354
712
|
type: "text";
|
|
355
713
|
operationType: "edit";
|
|
714
|
+
/**
|
|
715
|
+
* Alias of the canvas element to edit.
|
|
716
|
+
*/
|
|
356
717
|
alias: string;
|
|
718
|
+
/**
|
|
719
|
+
* Partial memory/state properties to update on the text element.
|
|
720
|
+
*/
|
|
357
721
|
props?: Partial<TextMemory>;
|
|
358
722
|
};
|
|
723
|
+
/**
|
|
724
|
+
* Edits the properties of an unknown/generic canvas element.
|
|
725
|
+
* Use this when the specific element type is not one of the built-in kinds.
|
|
726
|
+
*/
|
|
359
727
|
type PixiVNJsonUnknownEdit<T extends ContainerOptions<any>> = {
|
|
360
728
|
type: "canvaselement";
|
|
361
729
|
operationType: "edit";
|
|
730
|
+
/**
|
|
731
|
+
* Alias of the canvas element to edit.
|
|
732
|
+
*/
|
|
362
733
|
alias: string;
|
|
734
|
+
/**
|
|
735
|
+
* Partial options/properties to update on the canvas element.
|
|
736
|
+
*/
|
|
363
737
|
props?: Partial<T>;
|
|
364
738
|
};
|
|
739
|
+
/**
|
|
740
|
+
* Removes a canvas element from the stage, optionally with a transition.
|
|
741
|
+
*/
|
|
365
742
|
type PixiVNJsonCanvasRemove = {
|
|
366
743
|
type: "image" | "video" | "imagecontainer" | "canvaselement" | "text";
|
|
367
744
|
operationType: "remove";
|
|
745
|
+
/**
|
|
746
|
+
* Alias of the canvas element to remove.
|
|
747
|
+
*/
|
|
368
748
|
alias: string;
|
|
749
|
+
/**
|
|
750
|
+
* Optional transition effect applied while the element disappears.
|
|
751
|
+
*/
|
|
369
752
|
transition?: PixiVNJsonMediaTransiotions;
|
|
370
753
|
};
|
|
754
|
+
/**
|
|
755
|
+
* Pauses or resumes playback of a video sprite on the canvas.
|
|
756
|
+
*/
|
|
371
757
|
type PixiVNJsonVideoPauseResume = {
|
|
372
758
|
type: "video";
|
|
373
759
|
operationType: "pause" | "resume";
|
|
760
|
+
/**
|
|
761
|
+
* Alias of the video element to pause or resume.
|
|
762
|
+
*/
|
|
374
763
|
alias: string;
|
|
375
764
|
};
|
|
765
|
+
/**
|
|
766
|
+
* Loads or lazy-loads asset bundles or individual assets into memory.
|
|
767
|
+
*/
|
|
376
768
|
type PixiVNJsonAssetsLoad = {
|
|
377
769
|
type: "assets" | "bundle";
|
|
378
770
|
operationType: "load" | "lazyload";
|
|
771
|
+
/**
|
|
772
|
+
* List of asset aliases (or bundle names) to load.
|
|
773
|
+
*/
|
|
379
774
|
aliases: string[];
|
|
380
775
|
};
|
|
381
776
|
type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasTextShow;
|
|
777
|
+
/**
|
|
778
|
+
* Union of all canvas-element edit operations.
|
|
779
|
+
*/
|
|
382
780
|
type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonTextEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory | TextMemory>;
|
|
781
|
+
/**
|
|
782
|
+
* Union of all canvas operations — show, edit, remove, animate, apply effects, and asset loading.
|
|
783
|
+
*/
|
|
383
784
|
type PixiVNJsonCanvas = PixiVNJsonCanvasShow | PixiVNJsonCanvasEdit | PixiVNJsonCanvasRemove | PixiVNJsonVideoPauseResume | PixiVNJsonAssetsLoad | PixiVNJsonCanvasAnimate | PixiVNJsonCanvasEffect;
|
|
384
785
|
|
|
786
|
+
/**
|
|
787
|
+
* Requests user input during the narrative.
|
|
788
|
+
* When this operation is encountered, the engine pauses and waits for the player to provide a value.
|
|
789
|
+
*/
|
|
385
790
|
type PixiVNJsonInputRequest = {
|
|
386
791
|
type: "input";
|
|
387
792
|
operationType: "request";
|
|
793
|
+
/**
|
|
794
|
+
* The expected value type for the input (e.g. `"string"`, `"number"`, `"boolean"`).
|
|
795
|
+
* Used by the engine to validate or cast the player's answer.
|
|
796
|
+
*/
|
|
388
797
|
valueType?: string;
|
|
798
|
+
/**
|
|
799
|
+
* A default value that will be used if the player does not provide any input.
|
|
800
|
+
*/
|
|
389
801
|
defaultValue?: any;
|
|
390
802
|
};
|
|
803
|
+
/**
|
|
804
|
+
* Clears (resets) the current dialogue state.
|
|
805
|
+
* This is typically used to wipe any displayed text before showing new content.
|
|
806
|
+
*/
|
|
391
807
|
type PixiVNJsonDialogue = {
|
|
392
808
|
type: "dialogue";
|
|
393
809
|
operationType: "clean";
|
|
394
810
|
};
|
|
811
|
+
/**
|
|
812
|
+
* Narration operation — either a dialogue clear or a user-input request.
|
|
813
|
+
*/
|
|
395
814
|
type PixiVNJsonNarration = PixiVNJsonDialogue | PixiVNJsonInputRequest;
|
|
396
815
|
|
|
816
|
+
/**
|
|
817
|
+
* Starts playback of a sound asset.
|
|
818
|
+
*/
|
|
397
819
|
type PixiVNJsonSoundPlay = {
|
|
398
820
|
type: "sound";
|
|
399
821
|
operationType: "play";
|
|
822
|
+
/**
|
|
823
|
+
* Unique identifier (alias) used to reference this sound.
|
|
824
|
+
*/
|
|
400
825
|
alias: string;
|
|
826
|
+
/**
|
|
827
|
+
* URL of the sound file. If omitted, the alias is used as the URL.
|
|
828
|
+
*/
|
|
401
829
|
url?: string;
|
|
830
|
+
/**
|
|
831
|
+
* Playback options such as volume, loop, channel, and start offset.
|
|
832
|
+
*/
|
|
402
833
|
props?: SoundPlayOptionsWithChannel;
|
|
403
834
|
};
|
|
835
|
+
/**
|
|
836
|
+
* Stops a playing sound and removes it from the audio context.
|
|
837
|
+
*/
|
|
404
838
|
type PixiVNJsonSoundRemove = {
|
|
405
839
|
type: "sound";
|
|
406
840
|
operationType: "stop";
|
|
841
|
+
/**
|
|
842
|
+
* Alias of the sound to stop.
|
|
843
|
+
*/
|
|
407
844
|
alias: string;
|
|
408
845
|
};
|
|
846
|
+
/**
|
|
847
|
+
* Pauses or resumes a sound, a channel, or all audio.
|
|
848
|
+
*/
|
|
409
849
|
type PixiVNJsonSoundPauseResume = {
|
|
410
850
|
type: "sound" | "channel";
|
|
411
851
|
operationType: "pause" | "resume";
|
|
852
|
+
/**
|
|
853
|
+
* Alias of the sound or channel to pause/resume.
|
|
854
|
+
*/
|
|
412
855
|
alias: string;
|
|
413
856
|
} | {
|
|
414
857
|
type: "all";
|
|
415
858
|
operationType: "pause" | "resume" | "stop";
|
|
416
859
|
};
|
|
860
|
+
/**
|
|
861
|
+
* Edits the properties of a currently playing sound (volume, speed, muted, loop, etc.).
|
|
862
|
+
*/
|
|
417
863
|
type PixiVNJsonSoundEdit = {
|
|
418
864
|
type: "sound";
|
|
419
865
|
operationType: "edit";
|
|
866
|
+
/**
|
|
867
|
+
* Alias of the sound to edit.
|
|
868
|
+
*/
|
|
420
869
|
alias: string;
|
|
870
|
+
/**
|
|
871
|
+
* Partial set of properties to apply to the sound.
|
|
872
|
+
*/
|
|
421
873
|
props: Partial<Pick<MediaInterface, "speed" | "muted" | "loop" | "paused"> & Pick<SoundPlayOptionsWithChannel, "volume">>;
|
|
422
874
|
};
|
|
875
|
+
/**
|
|
876
|
+
* Union of all sound operations — play, stop, pause/resume, and edit.
|
|
877
|
+
*/
|
|
423
878
|
type PixiVNJsonSound = PixiVNJsonSoundPlay | PixiVNJsonSoundRemove | PixiVNJsonSoundPauseResume | PixiVNJsonSoundEdit;
|
|
424
879
|
|
|
880
|
+
/**
|
|
881
|
+
* An operation string that holds a list of string/value fragments to be concatenated at runtime.
|
|
882
|
+
* Used internally to represent string interpolation expressions before they are fully resolved.
|
|
883
|
+
*/
|
|
425
884
|
type PixiVNJsonOperationString = {
|
|
426
885
|
type: "operationtoconvert";
|
|
886
|
+
/**
|
|
887
|
+
* The ordered list of string fragments and/or value-get expressions to concatenate.
|
|
888
|
+
*/
|
|
427
889
|
values: (string | PixiVNJsonValueGet | PixiVNJsonConditionalStatements<string | PixiVNJsonValueGet>)[];
|
|
428
890
|
};
|
|
429
|
-
|
|
891
|
+
/**
|
|
892
|
+
* A single resolved operation — a value set, canvas operation, sound operation,
|
|
893
|
+
* narration operation, or function call — optionally annotated with an origin string.
|
|
894
|
+
*/
|
|
895
|
+
type PixiVNJsonOperation = (PixiVNJsonValueSet | PixiVNJsonCanvas | PixiVNJsonSound | PixiVNJsonNarration | PixiVNJsonFunction) & {
|
|
430
896
|
/**
|
|
431
897
|
* This value is used by the system to know where this operation is from, for example, if is generated from a string operation.
|
|
432
898
|
*/
|
|
433
899
|
$origin?: string;
|
|
434
900
|
};
|
|
901
|
+
/**
|
|
902
|
+
* A conditional operation — either a plain operation, an if-else that resolves to one,
|
|
903
|
+
* or an operation-string (string interpolation expression).
|
|
904
|
+
*/
|
|
435
905
|
type PixiVNJsonConditionalOperation = PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString;
|
|
436
906
|
|
|
907
|
+
/**
|
|
908
|
+
* A player-presentable choice in a menu.
|
|
909
|
+
*/
|
|
437
910
|
type PixiVNJsonChoice = {
|
|
438
911
|
/**
|
|
439
912
|
* The text to be displayed.
|
|
@@ -464,8 +937,20 @@ type PixiVNJsonChoice = {
|
|
|
464
937
|
*/
|
|
465
938
|
autoSelect?: boolean;
|
|
466
939
|
};
|
|
940
|
+
/**
|
|
941
|
+
* A list of choices (possibly conditional) that are shown to the player as a menu.
|
|
942
|
+
*/
|
|
467
943
|
type PixiVNJsonChoices = (PixiVNJsonChoice | PixiVNJsonConditionalStatements<PixiVNJsonChoice>)[];
|
|
944
|
+
/**
|
|
945
|
+
* The text content of a dialogue line.
|
|
946
|
+
* Can be a plain string, a dynamic value-get, a conditional expression, or an array of any of these
|
|
947
|
+
* (which will be concatenated into a single string at runtime).
|
|
948
|
+
*/
|
|
468
949
|
type PixiVNJsonDialogText = string | PixiVNJsonValueGet | PixiVNJsonConditionalStatements<string | PixiVNJsonValueGet | string[]> | (string | PixiVNJsonValueGet | PixiVNJsonConditionalStatements<string | PixiVNJsonValueGet | string[]>)[];
|
|
950
|
+
/**
|
|
951
|
+
* A dialogue line, optionally attributed to a character.
|
|
952
|
+
* When a plain `Text` value is used, no character attribution is included.
|
|
953
|
+
*/
|
|
469
954
|
type PixiVNJsonDialog<Text = string> = {
|
|
470
955
|
/**
|
|
471
956
|
* The character id that will speak.
|
|
@@ -476,6 +961,9 @@ type PixiVNJsonDialog<Text = string> = {
|
|
|
476
961
|
*/
|
|
477
962
|
text: Text;
|
|
478
963
|
} | Text;
|
|
964
|
+
/**
|
|
965
|
+
* Describes a label that should be opened (called or jumped to) during a step.
|
|
966
|
+
*/
|
|
479
967
|
type PixiVNJsonLabelToOpen<T extends {} = object> = {
|
|
480
968
|
/**
|
|
481
969
|
* The id of the label to open.
|
|
@@ -505,6 +993,9 @@ type PixiVNJsonLabelToOpen<T extends {} = object> = {
|
|
|
505
993
|
* 5. end the label if {@link PixiVNJsonLabelStep.end} is "label_end"
|
|
506
994
|
*/
|
|
507
995
|
type PixiVNJsonLabelStep = {
|
|
996
|
+
/**
|
|
997
|
+
* Operations to execute at the start of this step (storage writes, canvas updates, sound, etc.).
|
|
998
|
+
*/
|
|
508
999
|
operations?: PixiVNJsonConditionalOperation[];
|
|
509
1000
|
/**
|
|
510
1001
|
* Variable used to display a choice menu.
|
|
@@ -533,6 +1024,10 @@ type PixiVNJsonLabelStep = {
|
|
|
533
1024
|
* - label_end: ends the label
|
|
534
1025
|
*/
|
|
535
1026
|
end?: "game_end" | "label_end" | PixiVNJsonConditionalStatements<"game_end" | "label_end">;
|
|
1027
|
+
/**
|
|
1028
|
+
* If set, this step is replaced by the result of evaluating the given conditional statement.
|
|
1029
|
+
* Allows an entire step to be chosen at runtime based on a condition or step-switch strategy.
|
|
1030
|
+
*/
|
|
536
1031
|
conditionalStep?: PixiVNJsonConditionalStatements<PixiVNJsonLabelStep | PixiVNJsonLabelStep[]>;
|
|
537
1032
|
};
|
|
538
1033
|
|
|
@@ -547,6 +1042,17 @@ type PixiVNJsonLabels = {
|
|
|
547
1042
|
* PixiVNJson It can be defined as a programming language to write a narrative written in json.
|
|
548
1043
|
*/
|
|
549
1044
|
interface PixiVNJson {
|
|
1045
|
+
/**
|
|
1046
|
+
* The URI of the JSON Schema that describes and validates this document.
|
|
1047
|
+
*
|
|
1048
|
+
* You can point to a specific version of the schema, for example:
|
|
1049
|
+
* - `"https://pixi-vn.web.app/schemas/1.13.0/schema.json"` — pin to a specific version
|
|
1050
|
+
* - `"https://pixi-vn.web.app/schemas/latest/schema.json"` — always use the latest version
|
|
1051
|
+
*
|
|
1052
|
+
* Most editors (VS Code, WebStorm, etc.) use this field to provide
|
|
1053
|
+
* auto-completion, hover documentation, and validation for the document.
|
|
1054
|
+
*/
|
|
1055
|
+
$schema?: string;
|
|
550
1056
|
/**
|
|
551
1057
|
* The operations to be executed before the narrative starts.
|
|
552
1058
|
* For the set storage: They will be set only if there are no variables with the same key already.
|
|
@@ -559,8 +1065,38 @@ interface PixiVNJson {
|
|
|
559
1065
|
labels?: PixiVNJsonLabels;
|
|
560
1066
|
}
|
|
561
1067
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
1068
|
+
/**
|
|
1069
|
+
* Internal storage key prefix used to pass positional parameters to a called label.
|
|
1070
|
+
* The full key is `PIXIVNJSON_PARAM_ID + <label-depth-index>`.
|
|
1071
|
+
*
|
|
1072
|
+
* @internal
|
|
1073
|
+
*/
|
|
1074
|
+
declare const PIXIVNJSON_PARAM_ID = "___param___";
|
|
1075
|
+
/**
|
|
1076
|
+
* The URL of the JSON Schema for the current version of pixi-vn-json.
|
|
1077
|
+
*
|
|
1078
|
+
* You can use this constant as the value of the `$schema` field in your PixiVNJson documents
|
|
1079
|
+
* so that editors can validate and auto-complete the document.
|
|
1080
|
+
*
|
|
1081
|
+
* Example:
|
|
1082
|
+
* ```json
|
|
1083
|
+
* {
|
|
1084
|
+
* "$schema": "https://pixi-vn.web.app/schemas/1.13.0/schema.json"
|
|
1085
|
+
* }
|
|
1086
|
+
* ```
|
|
1087
|
+
*/
|
|
1088
|
+
declare const PIXIVNJSON_SCHEMA_URL: string;
|
|
1089
|
+
/**
|
|
1090
|
+
* All comparison operators supported by {@link PixiVNJsonConditions} expressions.
|
|
1091
|
+
*/
|
|
1092
|
+
declare const PixiVNJsonComparationOperators: PixiVNJsonComparationOperatorsType[];
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
* Initialises the pixi-vn-json system by registering all default operation handlers
|
|
1096
|
+
* (canvas, sound, assets, storage, narration, etc.) into the {@link JsonUnifier}.
|
|
1097
|
+
*
|
|
1098
|
+
* Call this function once at application startup, before importing any JSON labels.
|
|
1099
|
+
*/
|
|
1100
|
+
declare function init(): void;
|
|
565
1101
|
|
|
566
|
-
export { PIXIVNJSON_PARAM_ID, type PixiVNJson, type PixiVNJsonAnimateBase, type PixiVNJsonAnimateSequence, type PixiVNJsonArithmeticOperations, type PixiVNJsonArithmeticOperationsArithmetic, type PixiVNJsonArithmeticOperationsArithmeticSingle, type PixiVNJsonCanvas, type PixiVNJsonCanvasAnimate, type PixiVNJsonCanvasEdit, type PixiVNJsonCanvasEffect, type PixiVNJsonCanvasRemove, type PixiVNJsonCanvasShow, type PixiVNJsonChoice, type PixiVNJsonChoiceGet, type PixiVNJsonChoices, type PixiVNJsonComparation, type PixiVNJsonConditionalOperation, type PixiVNJsonConditionalResultToCombine, type PixiVNJsonConditionalStatements, type PixiVNJsonConditions, type PixiVNJsonDialog, type PixiVNJsonDialogText, type PixiVNJsonIfElse, type PixiVNJsonLabelGet, type PixiVNJsonLabelStep, type PixiVNJsonLabelToOpen, type PixiVNJsonLabels, type PixiVNJsonLogicGet, type PixiVNJsonMediaTransiotions, type PixiVNJsonNarration, type PixiVNJsonOperation, type PixiVNJsonOperationString, type PixiVNJsonParamGet, type PixiVNJsonSound, type PixiVNJsonStepSwitch, type PixiVNJsonStepSwitchElementType, type PixiVNJsonStepSwitchElementsType, type PixiVNJsonStorageGet, type PixiVNJsonUnionCondition, type PixiVNJsonValueGet, type PixiVNJsonValueSet, init };
|
|
1102
|
+
export { PIXIVNJSON_PARAM_ID, PIXIVNJSON_SCHEMA_URL, type PixiVNJson, type PixiVNJsonAnimateBase, type PixiVNJsonAnimateSequence, type PixiVNJsonArithmeticOperations, type PixiVNJsonArithmeticOperationsArithmetic, type PixiVNJsonArithmeticOperationsArithmeticSingle, type PixiVNJsonCanvas, type PixiVNJsonCanvasAnimate, type PixiVNJsonCanvasEdit, type PixiVNJsonCanvasEffect, type PixiVNJsonCanvasImageContainerShow, type PixiVNJsonCanvasImageVideoShow, type PixiVNJsonCanvasRemove, type PixiVNJsonCanvasShow, type PixiVNJsonCanvasTextShow, type PixiVNJsonChoice, type PixiVNJsonChoiceGet, type PixiVNJsonChoices, type PixiVNJsonComparation, PixiVNJsonComparationOperators, type PixiVNJsonComparationOperatorsType, type PixiVNJsonConditionalOperation, type PixiVNJsonConditionalResultToCombine, type PixiVNJsonConditionalStatements, type PixiVNJsonConditions, type PixiVNJsonDialog, type PixiVNJsonDialogText, type PixiVNJsonFunction, type PixiVNJsonIfElse, type PixiVNJsonImageContainerEdit, type PixiVNJsonImageEdit, type PixiVNJsonLabelGet, type PixiVNJsonLabelStep, type PixiVNJsonLabelToOpen, type PixiVNJsonLabels, type PixiVNJsonLogicGet, type PixiVNJsonMediaTransiotions, type PixiVNJsonNarration, type PixiVNJsonOnlyStorageSet, type PixiVNJsonOperation, type PixiVNJsonOperationString, type PixiVNJsonParamGet, type PixiVNJsonSound, type PixiVNJsonStepSwitch, type PixiVNJsonStepSwitchElementType, type PixiVNJsonStepSwitchElementsType, type PixiVNJsonStorageGet, type PixiVNJsonTextEdit, type PixiVNJsonUnionCondition, type PixiVNJsonUnknownEdit, type PixiVNJsonValueGet, type PixiVNJsonValueSet, type PixiVNJsonVideoEdit, type PixiVNJsonVideoPauseResume, VariableGetter, init };
|