@drincs/pixi-vn 0.6.5 → 0.6.7
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 +49 -3
- package/dist/classes/CharacterBaseModel.js +57 -57
- package/dist/classes/CharacterBaseModel.js.map +1 -1
- package/dist/classes/CharacterBaseModel.mjs +57 -57
- package/dist/classes/CharacterBaseModel.mjs.map +1 -1
- package/dist/classes/ChoiceMenuOption.d.mts +5 -2
- package/dist/classes/ChoiceMenuOption.d.ts +5 -2
- package/dist/classes/ChoiceMenuOption.js +42 -25
- package/dist/classes/ChoiceMenuOption.js.map +1 -1
- package/dist/classes/ChoiceMenuOption.mjs +42 -25
- package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
- package/dist/classes/CloseLabel.d.mts +3 -1
- package/dist/classes/CloseLabel.d.ts +3 -1
- package/dist/classes/CloseLabel.js +25 -16
- package/dist/classes/CloseLabel.js.map +1 -1
- package/dist/classes/CloseLabel.mjs +25 -16
- package/dist/classes/CloseLabel.mjs.map +1 -1
- package/dist/classes/Label.d.mts +45 -4
- package/dist/classes/Label.d.ts +45 -4
- package/dist/classes/Label.js +25 -16
- package/dist/classes/Label.js.map +1 -1
- package/dist/classes/Label.mjs +25 -16
- package/dist/classes/Label.mjs.map +1 -1
- package/dist/classes/LabelAbstract.d.mts +50 -0
- package/dist/classes/LabelAbstract.d.ts +50 -0
- package/dist/classes/LabelAbstract.js +100 -0
- package/dist/classes/LabelAbstract.js.map +1 -0
- package/dist/classes/LabelAbstract.mjs +98 -0
- package/dist/classes/LabelAbstract.mjs.map +1 -0
- package/dist/classes/LabelJson.d.mts +30 -0
- package/dist/classes/LabelJson.d.ts +30 -0
- package/dist/classes/LabelJson.js +2766 -0
- package/dist/classes/LabelJson.js.map +1 -0
- package/dist/classes/LabelJson.mjs +2760 -0
- package/dist/classes/LabelJson.mjs.map +1 -0
- package/dist/classes/StoredClassModel.js.map +1 -1
- package/dist/classes/StoredClassModel.mjs.map +1 -1
- package/dist/classes/index.d.mts +6 -1
- package/dist/classes/index.d.ts +6 -1
- package/dist/classes/index.js +827 -26
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +827 -27
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/ticker/FadeAlphaTicker.js.map +1 -1
- package/dist/classes/ticker/FadeAlphaTicker.mjs.map +1 -1
- package/dist/classes/ticker/MoveTicker.js.map +1 -1
- package/dist/classes/ticker/MoveTicker.mjs.map +1 -1
- package/dist/classes/ticker/RotateTicker.js.map +1 -1
- package/dist/classes/ticker/RotateTicker.mjs.map +1 -1
- package/dist/classes/ticker/ZoomTicker.js.map +1 -1
- package/dist/classes/ticker/ZoomTicker.mjs.map +1 -1
- package/dist/classes/ticker/index.js.map +1 -1
- package/dist/classes/ticker/index.mjs.map +1 -1
- package/dist/constants.d.mts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/constants.mjs.map +1 -1
- package/dist/decorators/LabelDecorator.d.mts +19 -5
- package/dist/decorators/LabelDecorator.d.ts +19 -5
- package/dist/decorators/LabelDecorator.js +29 -16
- package/dist/decorators/LabelDecorator.js.map +1 -1
- package/dist/decorators/LabelDecorator.mjs +29 -17
- package/dist/decorators/LabelDecorator.mjs.map +1 -1
- package/dist/decorators/index.d.mts +10 -2
- package/dist/decorators/index.d.ts +10 -2
- package/dist/decorators/index.js +25 -16
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +25 -16
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/DialogueUtility.d.mts +3 -1
- package/dist/functions/DialogueUtility.d.ts +3 -1
- package/dist/functions/DialogueUtility.js +85 -26
- package/dist/functions/DialogueUtility.js.map +1 -1
- package/dist/functions/DialogueUtility.mjs +85 -26
- package/dist/functions/DialogueUtility.mjs.map +1 -1
- package/dist/functions/FlagsUtility.js.map +1 -1
- package/dist/functions/FlagsUtility.mjs.map +1 -1
- package/dist/functions/GameUtility.js.map +1 -1
- package/dist/functions/GameUtility.mjs.map +1 -1
- package/dist/functions/ImageUtility.js.map +1 -1
- package/dist/functions/ImageUtility.mjs.map +1 -1
- package/dist/functions/Importer.d.mts +24 -0
- package/dist/functions/Importer.d.ts +24 -0
- package/dist/functions/Importer.js +2804 -0
- package/dist/functions/Importer.js.map +1 -0
- package/dist/functions/Importer.mjs +2798 -0
- package/dist/functions/Importer.mjs.map +1 -0
- package/dist/functions/SavesUtility.d.mts +3 -1
- package/dist/functions/SavesUtility.d.ts +3 -1
- package/dist/functions/SavesUtility.js +139 -36
- package/dist/functions/SavesUtility.js.map +1 -1
- package/dist/functions/SavesUtility.mjs +139 -36
- package/dist/functions/SavesUtility.mjs.map +1 -1
- package/dist/functions/index.d.mts +6 -1
- package/dist/functions/index.d.ts +6 -1
- package/dist/functions/index.js +169 -27
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +169 -28
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +131 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +130 -37
- package/dist/index.mjs.map +1 -1
- package/dist/interface/IHistoryStep.d.mts +3 -1
- package/dist/interface/IHistoryStep.d.ts +3 -1
- package/dist/interface/ISaveData.d.mts +3 -1
- package/dist/interface/ISaveData.d.ts +3 -1
- package/dist/interface/LabelProps.d.mts +38 -5
- package/dist/interface/LabelProps.d.ts +38 -5
- package/dist/interface/export/ExportedStep.d.mts +3 -1
- package/dist/interface/export/ExportedStep.d.ts +3 -1
- package/dist/interface/export/index.d.mts +3 -1
- package/dist/interface/export/index.d.ts +3 -1
- package/dist/interface/index.d.mts +6 -4
- package/dist/interface/index.d.ts +6 -4
- package/dist/labels/BaseCanvasElementTestLabel.d.mts +3 -1
- package/dist/labels/BaseCanvasElementTestLabel.d.ts +3 -1
- package/dist/labels/BaseCanvasElementTestLabel.js +129 -26
- package/dist/labels/BaseCanvasElementTestLabel.js.map +1 -1
- package/dist/labels/BaseCanvasElementTestLabel.mjs +130 -27
- package/dist/labels/BaseCanvasElementTestLabel.mjs.map +1 -1
- package/dist/labels/CanvasEventsTestLabel.d.mts +3 -1
- package/dist/labels/CanvasEventsTestLabel.d.ts +3 -1
- package/dist/labels/CanvasEventsTestLabel.js +129 -26
- package/dist/labels/CanvasEventsTestLabel.js.map +1 -1
- package/dist/labels/CanvasEventsTestLabel.mjs +129 -26
- package/dist/labels/CanvasEventsTestLabel.mjs.map +1 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.d.mts +3 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.d.ts +3 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.js +129 -26
- package/dist/labels/CustomTickerCanvasElementTestLabel.js.map +1 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs +130 -27
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs.map +1 -1
- package/dist/labels/ImagesAnimationsTestLabel.d.mts +3 -1
- package/dist/labels/ImagesAnimationsTestLabel.d.ts +3 -1
- package/dist/labels/ImagesAnimationsTestLabel.js +46 -35
- package/dist/labels/ImagesAnimationsTestLabel.js.map +1 -1
- package/dist/labels/ImagesAnimationsTestLabel.mjs +47 -36
- package/dist/labels/ImagesAnimationsTestLabel.mjs.map +1 -1
- package/dist/labels/MarkdownTest.d.mts +3 -1
- package/dist/labels/MarkdownTest.d.ts +3 -1
- package/dist/labels/MarkdownTest.js +129 -26
- package/dist/labels/MarkdownTest.js.map +1 -1
- package/dist/labels/MarkdownTest.mjs +129 -26
- package/dist/labels/MarkdownTest.mjs.map +1 -1
- package/dist/labels/StartLabel.d.mts +3 -1
- package/dist/labels/StartLabel.d.ts +3 -1
- package/dist/labels/StartLabel.js +47 -36
- package/dist/labels/StartLabel.js.map +1 -1
- package/dist/labels/StartLabel.mjs +47 -36
- package/dist/labels/StartLabel.mjs.map +1 -1
- package/dist/labels/StepLabelTest.d.mts +3 -1
- package/dist/labels/StepLabelTest.d.ts +3 -1
- package/dist/labels/StepLabelTest.js +129 -26
- package/dist/labels/StepLabelTest.js.map +1 -1
- package/dist/labels/StepLabelTest.mjs +129 -26
- package/dist/labels/StepLabelTest.mjs.map +1 -1
- package/dist/labels/TestConstant.js.map +1 -1
- package/dist/labels/TestConstant.mjs.map +1 -1
- package/dist/labels/index.d.mts +3 -1
- package/dist/labels/index.d.ts +3 -1
- package/dist/labels/index.js +47 -36
- package/dist/labels/index.js.map +1 -1
- package/dist/labels/index.mjs +47 -36
- package/dist/labels/index.mjs.map +1 -1
- package/dist/managers/StepManager.d.mts +5 -3
- package/dist/managers/StepManager.d.ts +5 -3
- package/dist/managers/StepManager.js +138 -35
- package/dist/managers/StepManager.js.map +1 -1
- package/dist/managers/StepManager.mjs +138 -35
- package/dist/managers/StepManager.mjs.map +1 -1
- package/dist/managers/WindowManager.js.map +1 -1
- package/dist/managers/WindowManager.mjs.map +1 -1
- package/dist/managers/index.d.mts +7 -5
- package/dist/managers/index.d.ts +7 -5
- package/dist/managers/index.js +138 -35
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +138 -35
- package/dist/managers/index.mjs.map +1 -1
- package/dist/types/ChoiceMenuOptionsType.d.mts +3 -1
- package/dist/types/ChoiceMenuOptionsType.d.ts +3 -1
- package/dist/types/LabelJsonType.d.mts +22 -0
- package/dist/types/LabelJsonType.d.ts +22 -0
- package/dist/types/LabelJsonType.js +4 -0
- package/dist/types/LabelJsonType.js.map +1 -0
- package/dist/types/LabelJsonType.mjs +3 -0
- package/dist/types/LabelJsonType.mjs.map +1 -0
- package/dist/types/StepLabelJsonType.d.mts +30 -0
- package/dist/types/StepLabelJsonType.d.ts +30 -0
- package/dist/types/StepLabelJsonType.js +4 -0
- package/dist/types/StepLabelJsonType.js.map +1 -0
- package/dist/types/StepLabelJsonType.mjs +3 -0
- package/dist/types/StepLabelJsonType.mjs.map +1 -0
- package/dist/types/index.d.mts +5 -1
- package/dist/types/index.d.ts +5 -1
- package/package.json +3 -2
- package/dist/LabelProps-CFV-zRjG.d.ts +0 -113
- package/dist/LabelProps-CmRpvUJm.d.mts +0 -113
|
@@ -2,16 +2,19 @@ export { clearChoiceMenuOptions, clearDialogue, getChoiceMenuOptions, getDialogu
|
|
|
2
2
|
export { getFlag, setFlag } from './FlagsUtility.mjs';
|
|
3
3
|
export { clearAllGameDatas } from './GameUtility.mjs';
|
|
4
4
|
export { addImage, loadImage, moveIn, moveOut, removeCanvasElement, removeWithDissolveTransition, removeWithFadeTransition, showImage, showWithDissolveTransition, showWithFadeTransition, zoomIn, zoomOut } from './ImageUtility.mjs';
|
|
5
|
+
export { importPixiVNJson } from './Importer.mjs';
|
|
5
6
|
export { getSaveData, getSaveJson, loadSaveData, loadSaveJson } from './SavesUtility.mjs';
|
|
6
7
|
export { getTexture } from './TextureUtility.mjs';
|
|
7
8
|
import '../types/ChoiceMenuOptionsType.mjs';
|
|
8
9
|
import '../classes/ChoiceMenuOption.mjs';
|
|
9
10
|
import '../types/LabelIdType.mjs';
|
|
10
11
|
import '../types/StorageElementType.mjs';
|
|
11
|
-
import '../
|
|
12
|
+
import '../classes/Label.mjs';
|
|
12
13
|
import '../types/StepLabelType.mjs';
|
|
13
14
|
import '@drincs/pixi-vn/dist/override';
|
|
15
|
+
import '../classes/LabelAbstract.mjs';
|
|
14
16
|
import '../types/StepHistoryDataType.mjs';
|
|
17
|
+
import '../interface/LabelProps.mjs';
|
|
15
18
|
import '../types/CloseType.mjs';
|
|
16
19
|
import '../types/LabelRunModeType.mjs';
|
|
17
20
|
import '../classes/CharacterBaseModel.mjs';
|
|
@@ -36,6 +39,8 @@ import '../types/ticker/MoveTickerProps.mjs';
|
|
|
36
39
|
import '../interface/TickerProgrationType.mjs';
|
|
37
40
|
import '../types/ticker/ZoomTickerProps.mjs';
|
|
38
41
|
import '../types/ticker/TagToRemoveAfterType.mjs';
|
|
42
|
+
import '../types/LabelJsonType.mjs';
|
|
43
|
+
import '../types/StepLabelJsonType.mjs';
|
|
39
44
|
import '../interface/ISaveData.mjs';
|
|
40
45
|
import '../interface/export/ExportedCanvas.mjs';
|
|
41
46
|
import '../interface/ITickersSteps.mjs';
|
|
@@ -2,16 +2,19 @@ export { clearChoiceMenuOptions, clearDialogue, getChoiceMenuOptions, getDialogu
|
|
|
2
2
|
export { getFlag, setFlag } from './FlagsUtility.js';
|
|
3
3
|
export { clearAllGameDatas } from './GameUtility.js';
|
|
4
4
|
export { addImage, loadImage, moveIn, moveOut, removeCanvasElement, removeWithDissolveTransition, removeWithFadeTransition, showImage, showWithDissolveTransition, showWithFadeTransition, zoomIn, zoomOut } from './ImageUtility.js';
|
|
5
|
+
export { importPixiVNJson } from './Importer.js';
|
|
5
6
|
export { getSaveData, getSaveJson, loadSaveData, loadSaveJson } from './SavesUtility.js';
|
|
6
7
|
export { getTexture } from './TextureUtility.js';
|
|
7
8
|
import '../types/ChoiceMenuOptionsType.js';
|
|
8
9
|
import '../classes/ChoiceMenuOption.js';
|
|
9
10
|
import '../types/LabelIdType.js';
|
|
10
11
|
import '../types/StorageElementType.js';
|
|
11
|
-
import '../
|
|
12
|
+
import '../classes/Label.js';
|
|
12
13
|
import '../types/StepLabelType.js';
|
|
13
14
|
import '@drincs/pixi-vn/dist/override';
|
|
15
|
+
import '../classes/LabelAbstract.js';
|
|
14
16
|
import '../types/StepHistoryDataType.js';
|
|
17
|
+
import '../interface/LabelProps.js';
|
|
15
18
|
import '../types/CloseType.js';
|
|
16
19
|
import '../types/LabelRunModeType.js';
|
|
17
20
|
import '../classes/CharacterBaseModel.js';
|
|
@@ -36,6 +39,8 @@ import '../types/ticker/MoveTickerProps.js';
|
|
|
36
39
|
import '../interface/TickerProgrationType.js';
|
|
37
40
|
import '../types/ticker/ZoomTickerProps.js';
|
|
38
41
|
import '../types/ticker/TagToRemoveAfterType.js';
|
|
42
|
+
import '../types/LabelJsonType.js';
|
|
43
|
+
import '../types/StepLabelJsonType.js';
|
|
39
44
|
import '../interface/ISaveData.js';
|
|
40
45
|
import '../interface/export/ExportedCanvas.js';
|
|
41
46
|
import '../interface/ITickersSteps.js';
|
package/dist/functions/index.js
CHANGED
|
@@ -64,16 +64,14 @@ function checkIfStepsIsEqual(step1, step2) {
|
|
|
64
64
|
return step1 === step2;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
// src/classes/
|
|
68
|
-
var
|
|
67
|
+
// src/classes/LabelAbstract.ts
|
|
68
|
+
var LabelAbstract = class {
|
|
69
69
|
/**
|
|
70
70
|
* @param id is the id of the label
|
|
71
|
-
* @param steps is the list of steps that the label will perform
|
|
72
71
|
* @param props is the properties of the label
|
|
73
72
|
*/
|
|
74
|
-
constructor(id,
|
|
73
|
+
constructor(id, props) {
|
|
75
74
|
this._id = id;
|
|
76
|
-
this._steps = steps;
|
|
77
75
|
this._onStepStart = props == null ? void 0 : props.onStepStart;
|
|
78
76
|
this._onLoadStep = props == null ? void 0 : props.onLoadStep;
|
|
79
77
|
this._onStepEnd = props == null ? void 0 : props.onStepEnd;
|
|
@@ -85,17 +83,6 @@ var Label = class {
|
|
|
85
83
|
get id() {
|
|
86
84
|
return this._id;
|
|
87
85
|
}
|
|
88
|
-
/**
|
|
89
|
-
* Get the steps of the label.
|
|
90
|
-
* This class should be extended and the steps method should be overridden.
|
|
91
|
-
* Every time you update this list will also be updated when the other game versions load.
|
|
92
|
-
*/
|
|
93
|
-
get steps() {
|
|
94
|
-
if (typeof this._steps === "function") {
|
|
95
|
-
return this._steps();
|
|
96
|
-
}
|
|
97
|
-
return this._steps;
|
|
98
|
-
}
|
|
99
86
|
/**
|
|
100
87
|
* Get the corresponding steps number
|
|
101
88
|
* @param externalSteps
|
|
@@ -146,6 +133,28 @@ var Label = class {
|
|
|
146
133
|
}
|
|
147
134
|
};
|
|
148
135
|
|
|
136
|
+
// src/classes/Label.ts
|
|
137
|
+
var Label = class extends LabelAbstract {
|
|
138
|
+
/**
|
|
139
|
+
* @param id is the id of the label
|
|
140
|
+
* @param steps is the list of steps that the label will perform
|
|
141
|
+
* @param props is the properties of the label
|
|
142
|
+
*/
|
|
143
|
+
constructor(id, steps, props) {
|
|
144
|
+
super(id, props);
|
|
145
|
+
this._steps = steps;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Get the steps of the label.
|
|
149
|
+
*/
|
|
150
|
+
get steps() {
|
|
151
|
+
if (typeof this._steps === "function") {
|
|
152
|
+
return this._steps();
|
|
153
|
+
}
|
|
154
|
+
return this._steps;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
149
158
|
// src/classes/CloseLabel.ts
|
|
150
159
|
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
151
160
|
function newCloseLabel(choiseIndex) {
|
|
@@ -164,6 +173,9 @@ function getLabelById(id) {
|
|
|
164
173
|
}
|
|
165
174
|
return label;
|
|
166
175
|
}
|
|
176
|
+
function saveLabel(label) {
|
|
177
|
+
registeredLabels[label.id] = label;
|
|
178
|
+
}
|
|
167
179
|
|
|
168
180
|
// src/functions/ExportUtility.ts
|
|
169
181
|
function createExportableElement(element) {
|
|
@@ -333,7 +345,7 @@ var TickerBase = class {
|
|
|
333
345
|
};
|
|
334
346
|
|
|
335
347
|
// src/constants.ts
|
|
336
|
-
var PIXIVN_VERSION = "0.6.
|
|
348
|
+
var PIXIVN_VERSION = "0.6.7";
|
|
337
349
|
var Repeat = "repeat";
|
|
338
350
|
function Pause(duration) {
|
|
339
351
|
return {
|
|
@@ -2205,6 +2217,62 @@ var GameStepManager = _GameStepManager;
|
|
|
2205
2217
|
var Close = "close";
|
|
2206
2218
|
|
|
2207
2219
|
// src/classes/ChoiceMenuOption.ts
|
|
2220
|
+
var ChoiceMenuOption = class {
|
|
2221
|
+
/**
|
|
2222
|
+
* @param text Text to be displayed in the menu
|
|
2223
|
+
* @param label Label to be opened when the option is selected or the id of the label
|
|
2224
|
+
* @param props Properties to be passed to the label and olther parameters that you can use when get all the choice menu options. It be converted to a JSON string, so it cannot contain functions or classes.
|
|
2225
|
+
* @param type Type of the label to be opened. @default "call"
|
|
2226
|
+
*/
|
|
2227
|
+
constructor(text, label, props, type = "call") {
|
|
2228
|
+
/**
|
|
2229
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
2230
|
+
* @example
|
|
2231
|
+
* ```tsx
|
|
2232
|
+
* setChoiceMenuOptions([
|
|
2233
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
2234
|
+
* ])
|
|
2235
|
+
* return <List>
|
|
2236
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
2237
|
+
* return (
|
|
2238
|
+
* <ChoiceButton
|
|
2239
|
+
* disabled={item.props.disabled}
|
|
2240
|
+
* onClick={() => {
|
|
2241
|
+
* afterSelectChoice(item)
|
|
2242
|
+
* }}
|
|
2243
|
+
* >
|
|
2244
|
+
* {item.text}
|
|
2245
|
+
* </ChoiceButton>
|
|
2246
|
+
* )
|
|
2247
|
+
* })}
|
|
2248
|
+
* </List>
|
|
2249
|
+
* ```
|
|
2250
|
+
*/
|
|
2251
|
+
this.props = {};
|
|
2252
|
+
this.text = text;
|
|
2253
|
+
this._label = label;
|
|
2254
|
+
this.type = type;
|
|
2255
|
+
if (props) {
|
|
2256
|
+
this.props = props;
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
/**
|
|
2260
|
+
* Label to be opened when the option is selected
|
|
2261
|
+
*/
|
|
2262
|
+
get label() {
|
|
2263
|
+
let label = this._label;
|
|
2264
|
+
if (typeof label === "string") {
|
|
2265
|
+
let res = getLabelById(label);
|
|
2266
|
+
if (res) {
|
|
2267
|
+
label = res;
|
|
2268
|
+
} else {
|
|
2269
|
+
console.error(`Label ${label} not found, so it will be closed`);
|
|
2270
|
+
label = newCloseLabel();
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
return label;
|
|
2274
|
+
}
|
|
2275
|
+
};
|
|
2208
2276
|
var ChoiceMenuOptionClose = class {
|
|
2209
2277
|
/**
|
|
2210
2278
|
* @param text Text to be displayed in the menu
|
|
@@ -2294,6 +2362,54 @@ var DialogueBaseModel = class {
|
|
|
2294
2362
|
}
|
|
2295
2363
|
};
|
|
2296
2364
|
|
|
2365
|
+
// src/classes/LabelJson.ts
|
|
2366
|
+
var LabelJson2 = class extends LabelAbstract {
|
|
2367
|
+
/**
|
|
2368
|
+
* @param id is the id of the label
|
|
2369
|
+
* @param steps is the list of steps that the label will perform
|
|
2370
|
+
* @param props is the properties of the label
|
|
2371
|
+
*/
|
|
2372
|
+
constructor(id, steps, props) {
|
|
2373
|
+
super(id, props);
|
|
2374
|
+
this._steps = steps;
|
|
2375
|
+
}
|
|
2376
|
+
/**
|
|
2377
|
+
* Get the steps of the label.
|
|
2378
|
+
*/
|
|
2379
|
+
get steps() {
|
|
2380
|
+
if (typeof this._steps === "function") {
|
|
2381
|
+
return this._steps().map(this.stepConverter);
|
|
2382
|
+
}
|
|
2383
|
+
return this._steps.map(this.stepConverter);
|
|
2384
|
+
}
|
|
2385
|
+
stepConverter(step) {
|
|
2386
|
+
return (props) => {
|
|
2387
|
+
if (step.currentChoiceMenuOptions) {
|
|
2388
|
+
setChoiceMenuOptions(step.currentChoiceMenuOptions);
|
|
2389
|
+
} else {
|
|
2390
|
+
clearChoiceMenuOptions();
|
|
2391
|
+
}
|
|
2392
|
+
if (step.dialog) {
|
|
2393
|
+
setDialogue(step.dialog);
|
|
2394
|
+
} else {
|
|
2395
|
+
clearDialogue();
|
|
2396
|
+
}
|
|
2397
|
+
if (step.labelToOpen) {
|
|
2398
|
+
if (step.labelToOpen.type === "jump") {
|
|
2399
|
+
GameStepManager.jumpLabel(step.labelToOpen.labelId, props);
|
|
2400
|
+
} else {
|
|
2401
|
+
GameStepManager.callLabel(step.labelToOpen.labelId, props);
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
if (step.end === "game_end") {
|
|
2405
|
+
console.warn("[Pixi'VN] Game end not implemented");
|
|
2406
|
+
} else if (step.end === "label_end") {
|
|
2407
|
+
GameStepManager.closeCurrentLabel();
|
|
2408
|
+
}
|
|
2409
|
+
};
|
|
2410
|
+
}
|
|
2411
|
+
};
|
|
2412
|
+
|
|
2297
2413
|
// src/functions/DialogueUtility.ts
|
|
2298
2414
|
function setDialogue(props) {
|
|
2299
2415
|
let text = "";
|
|
@@ -2347,13 +2463,9 @@ function getChoiceMenuOptions() {
|
|
|
2347
2463
|
d.forEach((option, index) => {
|
|
2348
2464
|
if (option.type === Close) {
|
|
2349
2465
|
let itemLabel = newCloseLabel(index);
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
type: Close,
|
|
2354
|
-
closeCurrentLabel: option.closeCurrentLabel,
|
|
2355
|
-
props: {}
|
|
2356
|
-
});
|
|
2466
|
+
let choice = new ChoiceMenuOptionClose(option.text, option.closeCurrentLabel);
|
|
2467
|
+
choice.label = itemLabel;
|
|
2468
|
+
options.push(choice);
|
|
2357
2469
|
return;
|
|
2358
2470
|
}
|
|
2359
2471
|
let label = getLabelById(option.label);
|
|
@@ -2362,9 +2474,7 @@ function getChoiceMenuOptions() {
|
|
|
2362
2474
|
onStepStart: label.onStepStart,
|
|
2363
2475
|
choiseIndex: index
|
|
2364
2476
|
});
|
|
2365
|
-
options.push(
|
|
2366
|
-
label: itemLabel
|
|
2367
|
-
}));
|
|
2477
|
+
options.push(new ChoiceMenuOption(option.text, itemLabel, option.props, option.type));
|
|
2368
2478
|
}
|
|
2369
2479
|
});
|
|
2370
2480
|
return options;
|
|
@@ -2991,6 +3101,37 @@ function zoomOut(tag, props = { direction: "right" }, priority) {
|
|
|
2991
3101
|
GameWindowManager.addTicker(tag, effect);
|
|
2992
3102
|
}
|
|
2993
3103
|
|
|
3104
|
+
// src/functions/Importer.ts
|
|
3105
|
+
function importPixiVNJson(data) {
|
|
3106
|
+
if (Array.isArray(data)) {
|
|
3107
|
+
data.forEach((label) => {
|
|
3108
|
+
importPixiVNJson(label);
|
|
3109
|
+
});
|
|
3110
|
+
return;
|
|
3111
|
+
}
|
|
3112
|
+
try {
|
|
3113
|
+
if (typeof data === "string") {
|
|
3114
|
+
data = JSON.parse(data);
|
|
3115
|
+
}
|
|
3116
|
+
} catch (e) {
|
|
3117
|
+
console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON", e);
|
|
3118
|
+
return;
|
|
3119
|
+
}
|
|
3120
|
+
if (typeof data !== "object") {
|
|
3121
|
+
console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON: data is not an object");
|
|
3122
|
+
return;
|
|
3123
|
+
}
|
|
3124
|
+
for (const labelId in data) {
|
|
3125
|
+
try {
|
|
3126
|
+
const steps = data[labelId];
|
|
3127
|
+
let label = new LabelJson2(labelId, steps);
|
|
3128
|
+
saveLabel(label);
|
|
3129
|
+
} catch (e) {
|
|
3130
|
+
console.error(`[Pixi'VN] Error creating JSON label ${labelId}`, e);
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
|
|
2994
3135
|
// src/functions/SavesUtility.ts
|
|
2995
3136
|
function getSaveData() {
|
|
2996
3137
|
return {
|
|
@@ -3033,6 +3174,7 @@ exports.getFlag = getFlag;
|
|
|
3033
3174
|
exports.getSaveData = getSaveData;
|
|
3034
3175
|
exports.getSaveJson = getSaveJson;
|
|
3035
3176
|
exports.getTexture = getTexture;
|
|
3177
|
+
exports.importPixiVNJson = importPixiVNJson;
|
|
3036
3178
|
exports.loadImage = loadImage;
|
|
3037
3179
|
exports.loadSaveData = loadSaveData;
|
|
3038
3180
|
exports.loadSaveJson = loadSaveJson;
|