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