@drincs/pixi-vn-json 1.12.1 → 1.13.0
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-DgN7qF7j.d.cts} +469 -75
- package/dist/{importer.d.ts → PixiVNJsonLabelStep-DgN7qF7j.d.ts} +469 -75
- package/dist/PixiVNJsonLabelStep-dVwPLFMT.d.cts +991 -0
- package/dist/PixiVNJsonLabelStep-dVwPLFMT.d.ts +991 -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 +548 -20
- package/dist/index.d.ts +548 -20
- 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 +504 -12
- package/dist/translator.d.ts +504 -12
- 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/core.d.cts
CHANGED
|
@@ -1,537 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { ImageSpriteMemory, VideoSpriteMemory, ContainerMemory, ContainerChild, StepLabelPropsType, StorageElementType } from '@drincs/pixi-vn';
|
|
2
|
+
import { P as PixiVNJsonOperation, a as PixiVNJsonIfElse, b as PixiVNJsonOperationString, c as PixiVNJsonSound, d as PixiVNJsonCanvasImageVideoShow, e as PixiVNJsonImageEdit, f as PixiVNJsonCanvasRemove, g as PixiVNJsonVideoEdit, h as PixiVNJsonVideoPauseResume, i as PixiVNJsonCanvasImageContainerShow, j as PixiVNJsonImageContainerEdit, k as PixiVNJsonCanvasTextShow, l as PixiVNJsonTextEdit, m as PixiVNJsonUnknownEdit, n as PixiVNJsonValueSet, o as PixiVNJsonOnlyStorageSet, p as PixiVNJsonNarration, q as PixiVNJsonCanvasEffect, r as PixiVNJsonCanvasAnimate, s as PixiVNJsonValueGet, t as PixiVNJsonArithmeticOperations, u as PixiVNJsonConditions, v as PixiVNJsonConditionalStatements, w as PixiVNJsonLabelStep } from './PixiVNJsonLabelStep-dVwPLFMT.cjs';
|
|
3
|
+
import '@drincs/pixi-vn/motion';
|
|
4
|
+
import 'pixi.js';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
type PixiVNJsonStepSwitchElementsType<Then> = PixiVNJsonStepSwitchElementType<Then>[] | PixiVNJsonConditionalStatements<Then[]>;
|
|
7
|
-
interface PixiVNJsonRandom<Then> {
|
|
8
|
-
type: "stepswitch";
|
|
9
|
-
choiceType: "random";
|
|
10
|
-
elements: PixiVNJsonStepSwitchElementsType<Then>;
|
|
11
|
-
}
|
|
12
|
-
interface PixiVNJsonSequentialRandom<Then> {
|
|
13
|
-
type: "stepswitch";
|
|
14
|
-
choiceType: "sequentialrandom";
|
|
15
|
-
elements: PixiVNJsonStepSwitchElementsType<Then>;
|
|
16
|
-
/**
|
|
17
|
-
* When the sequential ends, what should be the value? If undefined, it will return undefined.
|
|
18
|
-
* If "lastItem", it will return the last item in the array.
|
|
19
|
-
*/
|
|
20
|
-
end: undefined | "lastItem";
|
|
21
|
-
/**
|
|
22
|
-
* The subId is used for manager nested switches
|
|
23
|
-
*/
|
|
24
|
-
nestedId?: string;
|
|
25
|
-
}
|
|
26
|
-
interface PixiVNJsonSequential<Then> {
|
|
27
|
-
type: "stepswitch";
|
|
28
|
-
choiceType: "sequential";
|
|
29
|
-
elements: PixiVNJsonStepSwitchElementsType<Then>;
|
|
30
|
-
/**
|
|
31
|
-
* When the sequential ends, what should be the value? If undefined, it will return undefined.
|
|
32
|
-
* If "lastItem", it will return the last item in the array.
|
|
33
|
-
*/
|
|
34
|
-
end: undefined | "lastItem";
|
|
35
|
-
/**
|
|
36
|
-
* The subId is used for manager nested switches
|
|
37
|
-
*/
|
|
38
|
-
nestedId?: string;
|
|
39
|
-
}
|
|
40
|
-
interface PixiVNJsonLoop<Then> {
|
|
41
|
-
type: "stepswitch";
|
|
42
|
-
choiceType: "loop";
|
|
43
|
-
elements: PixiVNJsonStepSwitchElementsType<Then>;
|
|
44
|
-
nestedId?: string;
|
|
45
|
-
}
|
|
46
|
-
type PixiVNJsonStepSwitch<Then> = PixiVNJsonRandom<Then> | PixiVNJsonSequential<Then> | PixiVNJsonLoop<Then> | PixiVNJsonSequentialRandom<Then>;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* This element is used in case a {@link PixiVNJsonConditionalStatements} gives a result that must be combined with another calculated through other {@link PixiVNJsonConditionalStatements}.
|
|
50
|
-
* in case this possibility is not managed, it will be taken into consideration {@link PixiVNJsonConditionalResultToCombine.firstItem}
|
|
51
|
-
*/
|
|
52
|
-
type PixiVNJsonConditionalResultToCombine<T> = {
|
|
53
|
-
type: "resulttocombine";
|
|
54
|
-
/**
|
|
55
|
-
* This variable is interpreted differently by Pixi'VN depending on the value
|
|
56
|
-
*/
|
|
57
|
-
combine: "cross" | "union";
|
|
58
|
-
firstItem?: T;
|
|
59
|
-
secondConditionalItem?: PixiVNJsonStepSwitchElementType<T>[];
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
63
|
-
|
|
64
|
-
type PixiVNJsonStorageGet = {
|
|
65
|
-
type: "value";
|
|
66
|
-
storageOperationType: "get";
|
|
67
|
-
/**
|
|
68
|
-
* Key of the storage
|
|
69
|
-
*/
|
|
70
|
-
key: string;
|
|
71
|
-
/**
|
|
72
|
-
* Type of the storage, if it is a flagStorage or a storage.
|
|
73
|
-
* If it is a flagStorage, the value will be get with the function {@link getFlag}
|
|
74
|
-
*/
|
|
75
|
-
storageType: "storage" | "flagStorage" | "tempstorage";
|
|
76
|
-
};
|
|
77
|
-
type PixiVNJsonParamGet = {
|
|
78
|
-
type: "value";
|
|
79
|
-
storageOperationType: "get";
|
|
80
|
-
/**
|
|
81
|
-
* Key of the storage
|
|
82
|
-
*/
|
|
83
|
-
key: number;
|
|
84
|
-
storageType: "params";
|
|
85
|
-
};
|
|
86
|
-
type PixiVNJsonLabelGet = {
|
|
87
|
-
type: "value";
|
|
88
|
-
storageOperationType: "get";
|
|
89
|
-
/**
|
|
90
|
-
* Id of the label
|
|
91
|
-
*/
|
|
92
|
-
label: string;
|
|
93
|
-
/**
|
|
94
|
-
* If it is a label, the value will be get with the function {@link narration.getTimesLabelOpened}
|
|
95
|
-
*/
|
|
96
|
-
storageType: "label";
|
|
97
|
-
};
|
|
98
|
-
type PixiVNJsonChoiceGet = {
|
|
99
|
-
type: "value";
|
|
100
|
-
storageOperationType: "get";
|
|
101
|
-
/**
|
|
102
|
-
* index of the choice
|
|
103
|
-
*/
|
|
104
|
-
index: number;
|
|
105
|
-
/**
|
|
106
|
-
* If it is a choice, the value will be get with the function {@link narration.getTimesChoiceOpened}
|
|
107
|
-
*/
|
|
108
|
-
storageType: "choice";
|
|
109
|
-
};
|
|
110
|
-
type PixiVNJsonLogicGet = {
|
|
111
|
-
type: "value";
|
|
112
|
-
storageOperationType: "get";
|
|
113
|
-
operation: PixiVNJsonArithmeticOperations | PixiVNJsonConditions;
|
|
114
|
-
storageType: "logic";
|
|
115
|
-
};
|
|
116
|
-
type PixiVNJsonValueGet = PixiVNJsonStorageGet | PixiVNJsonParamGet | PixiVNJsonLabelGet | PixiVNJsonChoiceGet | PixiVNJsonLogicGet;
|
|
117
|
-
type PixiVNJsonOnlyStorageSet = {
|
|
118
|
-
type: "value";
|
|
119
|
-
storageOperationType: "set";
|
|
120
|
-
/**
|
|
121
|
-
* Key of the storage
|
|
122
|
-
*/
|
|
123
|
-
key: string;
|
|
124
|
-
/**
|
|
125
|
-
* Value to be set in the storage
|
|
126
|
-
*/
|
|
127
|
-
value: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType>;
|
|
128
|
-
/**
|
|
129
|
-
* Type of the storage, if it is a flagStorage or a storage.
|
|
130
|
-
*/
|
|
131
|
-
storageType: "storage" | "tempstorage";
|
|
132
|
-
};
|
|
133
|
-
type PixiVNJsonOnlyParamSet = {
|
|
134
|
-
type: "value";
|
|
135
|
-
storageOperationType: "set";
|
|
136
|
-
/**
|
|
137
|
-
* Key of the storage
|
|
138
|
-
*/
|
|
139
|
-
key: number;
|
|
140
|
-
/**
|
|
141
|
-
* Value to be set in the storage
|
|
142
|
-
*/
|
|
143
|
-
value: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType>;
|
|
144
|
-
storageType: "params";
|
|
145
|
-
};
|
|
146
|
-
type PixiVNJsonFlagSet = {
|
|
147
|
-
type: "value";
|
|
148
|
-
storageOperationType: "set";
|
|
149
|
-
/**
|
|
150
|
-
* Key of the storage
|
|
151
|
-
*/
|
|
152
|
-
key: string;
|
|
153
|
-
/**
|
|
154
|
-
* Value to be set in the storage
|
|
155
|
-
*/
|
|
156
|
-
value: boolean;
|
|
157
|
-
/**
|
|
158
|
-
* Type of the storage, if it is a flagStorage or a storage.
|
|
159
|
-
*/
|
|
160
|
-
storageType: "flagStorage";
|
|
161
|
-
};
|
|
162
|
-
type PixiVNJsonValueSet = PixiVNJsonOnlyStorageSet | PixiVNJsonFlagSet | PixiVNJsonOnlyParamSet;
|
|
163
|
-
|
|
164
|
-
interface PixiVNJsonArithmeticOperationsArithmetic {
|
|
165
|
-
type: "arithmetic";
|
|
166
|
-
/**
|
|
167
|
-
* Left value of the arithmetic operation
|
|
168
|
-
*/
|
|
169
|
-
leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
|
|
170
|
-
/**
|
|
171
|
-
* Right value of the arithmetic operation
|
|
172
|
-
*/
|
|
173
|
-
rightValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
|
|
174
|
-
/**
|
|
175
|
-
* Operator of the arithmetic operation
|
|
176
|
-
*/
|
|
177
|
-
operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
|
|
178
|
-
}
|
|
179
|
-
interface PixiVNJsonArithmeticOperationsArithmeticSingle {
|
|
180
|
-
type: "arithmeticsingle";
|
|
181
|
-
/**
|
|
182
|
-
* Left value of the arithmetic operation
|
|
183
|
-
*/
|
|
184
|
-
leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
|
|
185
|
-
/**
|
|
186
|
-
* Operator of the arithmetic operation
|
|
187
|
-
*/
|
|
188
|
-
operator: "INT" | "FLOOR" | "FLOAT";
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Arithmetic operations for the PixiVNJson
|
|
192
|
-
*/
|
|
193
|
-
type PixiVNJsonArithmeticOperations = PixiVNJsonArithmeticOperationsArithmeticSingle | PixiVNJsonArithmeticOperationsArithmetic;
|
|
194
|
-
|
|
195
|
-
type PixiVNJsonUnionConditionAndOr = {
|
|
196
|
-
type: "union";
|
|
197
|
-
conditions: PixiVNJsonConditions[];
|
|
198
|
-
unionType: "and" | "or";
|
|
199
|
-
};
|
|
200
|
-
type PixiVNJsonUnionConditionNot = {
|
|
201
|
-
type: "union";
|
|
202
|
-
condition: PixiVNJsonConditions;
|
|
203
|
-
unionType: "not";
|
|
204
|
-
};
|
|
205
|
-
type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionConditionNot;
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Comparation for PixiVNJson.
|
|
209
|
-
* In this comparation, the values to be converted to string and compared.
|
|
210
|
-
*/
|
|
211
|
-
type PixiVNJsonComparation = {
|
|
212
|
-
type: "compare";
|
|
213
|
-
/**
|
|
214
|
-
* Left value of the comparation
|
|
215
|
-
*/
|
|
216
|
-
leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonConditions;
|
|
217
|
-
/**
|
|
218
|
-
* Right value of the comparation
|
|
219
|
-
*/
|
|
220
|
-
rightValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonConditions;
|
|
221
|
-
/**
|
|
222
|
-
* Operator of the comparation
|
|
223
|
-
*/
|
|
224
|
-
operator: "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
|
|
225
|
-
};
|
|
226
|
-
type PixiVNJsonValueCondition = StorageElementType | PixiVNJsonValueGet;
|
|
227
|
-
/**
|
|
228
|
-
* Conditions for PixiVNJson
|
|
229
|
-
*/
|
|
230
|
-
type PixiVNJsonConditions = PixiVNJsonComparation | PixiVNJsonValueCondition | PixiVNJsonUnionCondition | PixiVNJsonArithmeticOperations;
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* If-Else condition for PixiVNJson
|
|
234
|
-
*/
|
|
235
|
-
interface PixiVNJsonIfElse<Then> {
|
|
236
|
-
type: "ifelse";
|
|
237
|
-
/**
|
|
238
|
-
* The list of conditions to be checked.
|
|
239
|
-
*/
|
|
240
|
-
condition: PixiVNJsonConditions;
|
|
241
|
-
/**
|
|
242
|
-
* The value to be returned if the condition is true.
|
|
243
|
-
*/
|
|
244
|
-
then: Then | PixiVNJsonIfElse<Then>;
|
|
245
|
-
/**
|
|
246
|
-
* The value to be returned if the condition is false.
|
|
247
|
-
*/
|
|
248
|
-
else?: Then | PixiVNJsonIfElse<Then>;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
type PixiVNJsonAnimateBase<T extends CanvasBaseInterface<any>> = {
|
|
252
|
-
type: "animate";
|
|
253
|
-
alias: string | string[];
|
|
254
|
-
keyframes: KeyframesType<T>;
|
|
255
|
-
options?: AnimationOptions;
|
|
256
|
-
priority?: UPDATE_PRIORITY;
|
|
257
|
-
};
|
|
258
|
-
type PixiVNJsonAnimateSequence<T extends CanvasBaseInterface<any>> = {
|
|
259
|
-
type: "animate-sequence";
|
|
260
|
-
alias: string;
|
|
261
|
-
sequence: (ObjectSegment<T> | ObjectSegmentWithTransition<T>)[];
|
|
262
|
-
options?: SequenceOptions;
|
|
263
|
-
priority?: UPDATE_PRIORITY;
|
|
264
|
-
};
|
|
265
|
-
type PixiVNJsonCanvasAnimate<T extends CanvasBaseInterface<any> = ImageSprite> = PixiVNJsonAnimateBase<T> | PixiVNJsonAnimateSequence<T>;
|
|
266
|
-
|
|
267
|
-
type PixiVNJsonEffectShake = {
|
|
268
|
-
type: "shake";
|
|
269
|
-
alias: string;
|
|
270
|
-
props: ShakeEffectProps;
|
|
271
|
-
priority?: UPDATE_PRIORITY;
|
|
272
|
-
};
|
|
273
|
-
type PixiVNJsonCanvasEffect = PixiVNJsonEffectShake;
|
|
274
|
-
|
|
275
|
-
type DissolveTransition = {
|
|
276
|
-
type: "dissolve";
|
|
277
|
-
props?: ShowWithDissolveTransitionProps;
|
|
278
|
-
priority?: UPDATE_PRIORITY;
|
|
279
|
-
};
|
|
280
|
-
type FadeTransition = {
|
|
281
|
-
type: "fade";
|
|
282
|
-
props?: ShowWithFadeTransitionProps;
|
|
283
|
-
priority?: UPDATE_PRIORITY;
|
|
284
|
-
};
|
|
285
|
-
type MoveInOutTransition = {
|
|
286
|
-
type: "movein" | "moveout";
|
|
287
|
-
props?: MoveInOutProps;
|
|
288
|
-
priority?: UPDATE_PRIORITY;
|
|
289
|
-
};
|
|
290
|
-
type ZoomInOutTransition = {
|
|
291
|
-
type: "zoomin" | "zoomout";
|
|
292
|
-
props?: ZoomInOutProps;
|
|
293
|
-
priority?: UPDATE_PRIORITY;
|
|
294
|
-
};
|
|
295
|
-
type PushInOutTransition = {
|
|
296
|
-
type: "pushin" | "pushout";
|
|
297
|
-
props?: PushInOutProps;
|
|
298
|
-
priority?: UPDATE_PRIORITY;
|
|
299
|
-
};
|
|
300
|
-
type PixiVNJsonMediaTransiotions = DissolveTransition | FadeTransition | MoveInOutTransition | ZoomInOutTransition | PushInOutTransition;
|
|
301
|
-
|
|
302
|
-
type PixiVNJsonCanvasImageVideoShow = {
|
|
303
|
-
type: "image" | "video";
|
|
304
|
-
operationType: "show";
|
|
305
|
-
alias: string;
|
|
306
|
-
/**
|
|
307
|
-
* The url of the image or video.
|
|
308
|
-
* If the url is not provided, the url will be set to the alias.
|
|
309
|
-
*/
|
|
310
|
-
url?: string;
|
|
311
|
-
props?: ImageSpriteOptions;
|
|
312
|
-
transition?: PixiVNJsonMediaTransiotions;
|
|
313
|
-
};
|
|
314
|
-
type PixiVNJsonCanvasImageContainerShow = {
|
|
315
|
-
type: "imagecontainer";
|
|
316
|
-
operationType: "show";
|
|
317
|
-
alias: string;
|
|
318
|
-
urls: string[];
|
|
319
|
-
props?: ImageContainerOptions<ImageSprite>;
|
|
320
|
-
transition?: PixiVNJsonMediaTransiotions;
|
|
321
|
-
};
|
|
322
|
-
type PixiVNJsonCanvasTextShow = {
|
|
323
|
-
type: "text";
|
|
324
|
-
operationType: "show";
|
|
325
|
-
alias: string;
|
|
326
|
-
text: string;
|
|
327
|
-
props?: TextOptions;
|
|
328
|
-
transition?: PixiVNJsonMediaTransiotions;
|
|
329
|
-
};
|
|
330
|
-
type PixiVNJsonImageEdit = {
|
|
331
|
-
type: "image";
|
|
332
|
-
operationType: "edit";
|
|
333
|
-
alias: string;
|
|
334
|
-
props?: Partial<ImageSpriteMemory>;
|
|
335
|
-
};
|
|
336
|
-
type PixiVNJsonVideoEdit = {
|
|
337
|
-
type: "video";
|
|
338
|
-
operationType: "edit";
|
|
339
|
-
alias: string;
|
|
340
|
-
props?: Partial<VideoSpriteMemory>;
|
|
341
|
-
};
|
|
342
|
-
type PixiVNJsonImageContainerEdit = {
|
|
343
|
-
type: "imagecontainer";
|
|
344
|
-
operationType: "edit";
|
|
345
|
-
alias: string;
|
|
346
|
-
props?: Partial<ImageContainerMemory>;
|
|
347
|
-
};
|
|
348
|
-
type PixiVNJsonTextEdit = {
|
|
349
|
-
type: "text";
|
|
350
|
-
operationType: "edit";
|
|
351
|
-
alias: string;
|
|
352
|
-
props?: Partial<TextMemory>;
|
|
353
|
-
};
|
|
354
|
-
type PixiVNJsonUnknownEdit<T extends ContainerOptions<any>> = {
|
|
355
|
-
type: "canvaselement";
|
|
356
|
-
operationType: "edit";
|
|
357
|
-
alias: string;
|
|
358
|
-
props?: Partial<T>;
|
|
359
|
-
};
|
|
360
|
-
type PixiVNJsonCanvasRemove = {
|
|
361
|
-
type: "image" | "video" | "imagecontainer" | "canvaselement" | "text";
|
|
362
|
-
operationType: "remove";
|
|
363
|
-
alias: string;
|
|
364
|
-
transition?: PixiVNJsonMediaTransiotions;
|
|
365
|
-
};
|
|
366
|
-
type PixiVNJsonVideoPauseResume = {
|
|
367
|
-
type: "video";
|
|
368
|
-
operationType: "pause" | "resume";
|
|
369
|
-
alias: string;
|
|
370
|
-
};
|
|
371
|
-
type PixiVNJsonAssetsLoad = {
|
|
372
|
-
type: "assets" | "bundle";
|
|
373
|
-
operationType: "load" | "lazyload";
|
|
374
|
-
aliases: string[];
|
|
375
|
-
};
|
|
376
|
-
type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasTextShow;
|
|
377
|
-
type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonTextEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory | TextMemory>;
|
|
378
|
-
type PixiVNJsonCanvas = PixiVNJsonCanvasShow | PixiVNJsonCanvasEdit | PixiVNJsonCanvasRemove | PixiVNJsonVideoPauseResume | PixiVNJsonAssetsLoad | PixiVNJsonCanvasAnimate | PixiVNJsonCanvasEffect;
|
|
379
|
-
|
|
380
|
-
type PixiVNJsonInputRequest = {
|
|
381
|
-
type: "input";
|
|
382
|
-
operationType: "request";
|
|
383
|
-
valueType?: string;
|
|
384
|
-
defaultValue?: any;
|
|
385
|
-
};
|
|
386
|
-
type PixiVNJsonDialogue = {
|
|
387
|
-
type: "dialogue";
|
|
388
|
-
operationType: "clean";
|
|
389
|
-
};
|
|
390
|
-
type PixiVNJsonNarration = PixiVNJsonDialogue | PixiVNJsonInputRequest;
|
|
391
|
-
|
|
392
|
-
type PixiVNJsonSoundPlay = {
|
|
393
|
-
type: "sound";
|
|
394
|
-
operationType: "play";
|
|
395
|
-
alias: string;
|
|
396
|
-
url?: string;
|
|
397
|
-
props?: SoundPlayOptionsWithChannel;
|
|
398
|
-
};
|
|
399
|
-
type PixiVNJsonSoundRemove = {
|
|
400
|
-
type: "sound";
|
|
401
|
-
operationType: "stop";
|
|
402
|
-
alias: string;
|
|
403
|
-
};
|
|
404
|
-
type PixiVNJsonSoundPauseResume = {
|
|
405
|
-
type: "sound" | "channel";
|
|
406
|
-
operationType: "pause" | "resume";
|
|
407
|
-
alias: string;
|
|
408
|
-
} | {
|
|
409
|
-
type: "all";
|
|
410
|
-
operationType: "pause" | "resume" | "stop";
|
|
411
|
-
};
|
|
412
|
-
type PixiVNJsonSoundEdit = {
|
|
413
|
-
type: "sound";
|
|
414
|
-
operationType: "edit";
|
|
415
|
-
alias: string;
|
|
416
|
-
props: Partial<Pick<MediaInterface, "speed" | "muted" | "loop" | "paused"> & Pick<SoundPlayOptionsWithChannel, "volume">>;
|
|
417
|
-
};
|
|
418
|
-
type PixiVNJsonSound = PixiVNJsonSoundPlay | PixiVNJsonSoundRemove | PixiVNJsonSoundPauseResume | PixiVNJsonSoundEdit;
|
|
419
|
-
|
|
420
|
-
type PixiVNJsonOperationString = {
|
|
421
|
-
type: "operationtoconvert";
|
|
422
|
-
values: (string | PixiVNJsonValueGet | PixiVNJsonConditionalStatements<string | PixiVNJsonValueGet>)[];
|
|
423
|
-
};
|
|
424
|
-
type PixiVNJsonOperation = (PixiVNJsonValueSet | PixiVNJsonCanvas | PixiVNJsonSound | PixiVNJsonNarration) & {
|
|
425
|
-
/**
|
|
426
|
-
* This value is used by the system to know where this operation is from, for example, if is generated from a string operation.
|
|
427
|
-
*/
|
|
428
|
-
$origin?: string;
|
|
429
|
-
};
|
|
430
|
-
type PixiVNJsonConditionalOperation = PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString;
|
|
431
|
-
|
|
432
|
-
type PixiVNJsonChoice = {
|
|
433
|
-
/**
|
|
434
|
-
* The text to be displayed.
|
|
435
|
-
*/
|
|
436
|
-
text: PixiVNJsonDialogText;
|
|
437
|
-
/**
|
|
438
|
-
* The label id to be opened.
|
|
439
|
-
*/
|
|
440
|
-
label: string;
|
|
441
|
-
/**
|
|
442
|
-
* Label opening mode
|
|
443
|
-
*/
|
|
444
|
-
type: LabelRunModeType;
|
|
445
|
-
/**
|
|
446
|
-
* The properties to be passed to the label.
|
|
447
|
-
*/
|
|
448
|
-
props: StorageObjectType;
|
|
449
|
-
/**
|
|
450
|
-
* If this is true, the choice can only be made once.
|
|
451
|
-
*/
|
|
452
|
-
oneTime?: boolean;
|
|
453
|
-
/**
|
|
454
|
-
* If this is true, the choice can see only if there are no other choices. For example, all choices are one-time choices and they are already selected.
|
|
455
|
-
*/
|
|
456
|
-
onlyHaveNoChoice?: boolean;
|
|
457
|
-
/**
|
|
458
|
-
* If this is true and if is the only choice, it will be automatically selected, and call/jump to the label.
|
|
459
|
-
*/
|
|
460
|
-
autoSelect?: boolean;
|
|
461
|
-
};
|
|
462
|
-
type PixiVNJsonChoices = (PixiVNJsonChoice | PixiVNJsonConditionalStatements<PixiVNJsonChoice>)[];
|
|
463
|
-
type PixiVNJsonDialogText = string | PixiVNJsonValueGet | PixiVNJsonConditionalStatements<string | PixiVNJsonValueGet | string[]> | (string | PixiVNJsonValueGet | PixiVNJsonConditionalStatements<string | PixiVNJsonValueGet | string[]>)[];
|
|
464
|
-
type PixiVNJsonDialog<Text = string> = {
|
|
465
|
-
/**
|
|
466
|
-
* The character id that will speak.
|
|
467
|
-
*/
|
|
468
|
-
character: string;
|
|
469
|
-
/**
|
|
470
|
-
* The text to be displayed.
|
|
471
|
-
*/
|
|
472
|
-
text: Text;
|
|
473
|
-
} | Text;
|
|
474
|
-
type PixiVNJsonLabelToOpen<T extends {} = object> = {
|
|
475
|
-
/**
|
|
476
|
-
* The id of the label to open.
|
|
477
|
-
*/
|
|
478
|
-
label: string | PixiVNJsonValueGet;
|
|
479
|
-
/**
|
|
480
|
-
* Label opening mode
|
|
481
|
-
*/
|
|
482
|
-
type: LabelRunModeType;
|
|
483
|
-
/**
|
|
484
|
-
* The properties to be passed to the label. if you don't want to pass a object, but a list of parameters, you can use the {@link PixiVNJsonLabelToOpen.params} attribute.
|
|
485
|
-
*/
|
|
486
|
-
props?: StepLabelPropsType<T>;
|
|
487
|
-
/**
|
|
488
|
-
* **It is not recommended to use it, use it only if necessary**. The parameters to be passed to the label. If you want to pass an object, use the {@link PixiVNJsonLabelToOpen.props} attribute.
|
|
489
|
-
* "params" attribute will be stored in the temp storage with the key: {@link PIXIVNJSON_PARAM_ID} + ({@link narration.openedLabels.length} - 1).
|
|
490
|
-
*/
|
|
491
|
-
params?: unknown[];
|
|
492
|
-
};
|
|
493
|
-
/**
|
|
494
|
-
* Steps of a label.
|
|
495
|
-
* Order of operations:
|
|
496
|
-
* 1. run all {@link PixiVNJsonLabelStep.operations}
|
|
497
|
-
* 2. set {@link PixiVNJsonLabelStep.choices}, {@link PixiVNJsonLabelStep.dialogue}, {@link PixiVNJsonLabelStep.glueEnabled}
|
|
498
|
-
* 3. open {@link PixiVNJsonLabelStep.labelToOpen}
|
|
499
|
-
* 4. go to next step if {@link PixiVNJsonLabelStep.goNextStep} is true
|
|
500
|
-
* 5. end the label if {@link PixiVNJsonLabelStep.end} is "label_end"
|
|
501
|
-
*/
|
|
502
|
-
type PixiVNJsonLabelStep = {
|
|
503
|
-
operations?: PixiVNJsonConditionalOperation[];
|
|
504
|
-
/**
|
|
505
|
-
* Variable used to display a choice menu.
|
|
506
|
-
*/
|
|
507
|
-
choices?: PixiVNJsonChoices | PixiVNJsonConditionalStatements<PixiVNJsonChoices>;
|
|
508
|
-
/**
|
|
509
|
-
* Variable used to display a dialog.
|
|
510
|
-
*/
|
|
511
|
-
dialogue?: PixiVNJsonDialog<PixiVNJsonDialogText> | PixiVNJsonConditionalStatements<PixiVNJsonDialog<PixiVNJsonDialogText>>;
|
|
512
|
-
/**
|
|
513
|
-
* This variable is used to add the next dialog text into the current dialog memory.
|
|
514
|
-
* This value was added to introduce Ink Glue functionality https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#glue
|
|
515
|
-
*/
|
|
516
|
-
glueEnabled?: boolean | PixiVNJsonConditionalStatements<boolean>;
|
|
517
|
-
/**
|
|
518
|
-
* Variable used to open a label.
|
|
519
|
-
*/
|
|
520
|
-
labelToOpen?: PixiVNJsonLabelToOpen | PixiVNJsonConditionalStatements<PixiVNJsonLabelToOpen> | (PixiVNJsonLabelToOpen | PixiVNJsonConditionalStatements<PixiVNJsonLabelToOpen>)[];
|
|
521
|
-
/**
|
|
522
|
-
* If is true, the next step will be executed automatically.
|
|
523
|
-
*/
|
|
524
|
-
goNextStep?: boolean | PixiVNJsonConditionalStatements<boolean>;
|
|
6
|
+
declare class JsonUnifier {
|
|
525
7
|
/**
|
|
526
|
-
*
|
|
527
|
-
*
|
|
528
|
-
*
|
|
8
|
+
* Registers the operation handlers that pixi-vn-json will delegate to at runtime.
|
|
9
|
+
* Call this once at application startup (e.g. via {@link init}) before importing any labels.
|
|
10
|
+
*
|
|
11
|
+
* All parameters are optional except `setInitialStorageValue`, which is required because
|
|
12
|
+
* it must be available for initial-operation processing during label import.
|
|
529
13
|
*/
|
|
530
|
-
end?: "game_end" | "label_end" | PixiVNJsonConditionalStatements<"game_end" | "label_end">;
|
|
531
|
-
conditionalStep?: PixiVNJsonConditionalStatements<PixiVNJsonLabelStep | PixiVNJsonLabelStep[]>;
|
|
532
|
-
};
|
|
533
|
-
|
|
534
|
-
declare class JsonUnifier {
|
|
535
14
|
static init(options: {
|
|
536
15
|
loadAssets?: (origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString) => Promise<void> | void;
|
|
537
16
|
soundOperation?: (operation: PixiVNJsonSound) => void;
|
|
@@ -540,42 +19,55 @@ declare class JsonUnifier {
|
|
|
540
19
|
imageContainerOperation?: (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasImageContainerShow | PixiVNJsonImageContainerEdit) => Promise<void>;
|
|
541
20
|
textOperation?: (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasTextShow | PixiVNJsonTextEdit) => Promise<void>;
|
|
542
21
|
canvasElementOperation?: (operation: PixiVNJsonCanvasRemove | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory<ContainerChild>>) => Promise<void>;
|
|
543
|
-
setStorageValue?: (value: PixiVNJsonValueSet) => void;
|
|
544
|
-
setInitialStorageValue: (value: PixiVNJsonOnlyStorageSet) => void;
|
|
22
|
+
setStorageValue?: (value: PixiVNJsonValueSet, props?: StepLabelPropsType) => void;
|
|
23
|
+
setInitialStorageValue: (value: PixiVNJsonOnlyStorageSet, props?: StepLabelPropsType) => void;
|
|
545
24
|
narrationOperation?: (operation: PixiVNJsonNarration) => void;
|
|
546
25
|
effectOperation?: (operation: PixiVNJsonCanvasEffect) => Promise<void>;
|
|
547
26
|
animateOperation?: (operation: PixiVNJsonCanvasAnimate) => void;
|
|
548
|
-
getLogichValue?: <T = StorageElementType>(value: T | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditions | PixiVNJsonConditionalStatements<T | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditions
|
|
549
|
-
getConditionalStep?: (originalStep: PixiVNJsonLabelStep) => PixiVNJsonLabelStep;
|
|
27
|
+
getLogichValue?: <T = StorageElementType>(value: T | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditions | PixiVNJsonConditionalStatements<T | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditions>, props?: StepLabelPropsType) => T | undefined;
|
|
28
|
+
getConditionalStep?: (originalStep: PixiVNJsonLabelStep, props?: StepLabelPropsType) => PixiVNJsonLabelStep;
|
|
550
29
|
}): void;
|
|
551
30
|
private static _loadAssets;
|
|
31
|
+
/** Registered handler for loading/lazy-loading assets. */
|
|
552
32
|
static get loadAssets(): (origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString) => Promise<void> | void;
|
|
553
33
|
private static _soundOperation;
|
|
34
|
+
/** Registered handler for sound play/stop/pause/resume/edit operations. */
|
|
554
35
|
static get soundOperation(): (operation: PixiVNJsonSound) => void;
|
|
555
36
|
private static _imageOperation;
|
|
37
|
+
/** Registered handler for {@link ImageSprite} show/edit/remove operations. */
|
|
556
38
|
static get imageOperation(): (operation: PixiVNJsonCanvasImageVideoShow | PixiVNJsonImageEdit | PixiVNJsonCanvasRemove) => Promise<void>;
|
|
557
39
|
private static _videoOperation;
|
|
40
|
+
/** Registered handler for {@link VideoSprite} show/edit/remove/pause/resume operations. */
|
|
558
41
|
static get videoOperation(): (operation: PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasRemove | PixiVNJsonVideoEdit | PixiVNJsonVideoPauseResume) => Promise<void>;
|
|
559
42
|
private static _imageContainerOperation;
|
|
560
|
-
static get textOperation(): (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasTextShow | PixiVNJsonTextEdit) => Promise<void>;
|
|
561
|
-
private static _textOperation;
|
|
562
43
|
static get imageContainerOperation(): (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasImageContainerShow | PixiVNJsonImageContainerEdit) => Promise<void>;
|
|
44
|
+
private static _textOperation;
|
|
45
|
+
/** Registered handler for {@link Text} show/edit/remove operations. */
|
|
46
|
+
static get textOperation(): (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasTextShow | PixiVNJsonTextEdit) => Promise<void>;
|
|
563
47
|
private static _canvasElementOperation;
|
|
48
|
+
/** Registered handler for generic canvas-element edit/remove operations. */
|
|
564
49
|
static get canvasElementOperation(): (operation: PixiVNJsonCanvasRemove | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory<ContainerChild>>) => Promise<void>;
|
|
565
50
|
private static _setStorageValue;
|
|
566
|
-
|
|
51
|
+
/** Registered handler for setting a storage value during label execution. */
|
|
52
|
+
static get setStorageValue(): (value: PixiVNJsonValueSet, props?: StepLabelPropsType) => void;
|
|
567
53
|
private static _setInitialStorageValue;
|
|
568
|
-
|
|
54
|
+
/** Registered handler for setting a default (initial) storage value at import time. */
|
|
55
|
+
static get setInitialStorageValue(): (value: PixiVNJsonOnlyStorageSet, props?: StepLabelPropsType) => void;
|
|
569
56
|
private static _narrationOperation;
|
|
57
|
+
/** Registered handler for narration operations (input requests, dialogue resets). */
|
|
570
58
|
static get narrationOperation(): (operation: PixiVNJsonNarration) => void;
|
|
571
59
|
private static _effectOperation;
|
|
60
|
+
/** Registered handler for canvas visual effects (e.g. shake). */
|
|
572
61
|
static get effectOperation(): (operation: PixiVNJsonCanvasEffect) => Promise<void>;
|
|
573
62
|
private static _animateOperation;
|
|
63
|
+
/** Registered handler for keyframe animation operations. */
|
|
574
64
|
static get animateOperation(): (operation: PixiVNJsonCanvasAnimate) => void;
|
|
575
65
|
private static _getLogichValue;
|
|
576
|
-
|
|
66
|
+
/** Registered handler that evaluates a JSON logic expression to a plain value. */
|
|
67
|
+
static get getLogichValue(): <T = StorageElementType>(value: T | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditions | PixiVNJsonConditionalStatements<T | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditions>, props?: StepLabelPropsType) => T | undefined;
|
|
577
68
|
private static _getConditionalStep;
|
|
578
|
-
|
|
69
|
+
/** Registered handler that resolves a label step's `conditionalStep` field. */
|
|
70
|
+
static get getConditionalStep(): (originalStep: PixiVNJsonLabelStep, props?: StepLabelPropsType) => PixiVNJsonLabelStep;
|
|
579
71
|
}
|
|
580
72
|
|
|
581
73
|
export { JsonUnifier };
|