@drincs/pixi-vn 0.6.4 → 0.6.6
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 +56 -7
- package/dist/classes/CharacterBaseModel.js +99 -90
- package/dist/classes/CharacterBaseModel.js.map +1 -1
- package/dist/classes/CharacterBaseModel.mjs +99 -90
- package/dist/classes/CharacterBaseModel.mjs.map +1 -1
- package/dist/classes/ChoiceMenuOption.d.mts +71 -8
- package/dist/classes/ChoiceMenuOption.d.ts +71 -8
- package/dist/classes/ChoiceMenuOption.js +160 -77
- package/dist/classes/ChoiceMenuOption.js.map +1 -1
- package/dist/classes/ChoiceMenuOption.mjs +160 -77
- 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 +77 -32
- package/dist/classes/CloseLabel.js.map +1 -1
- package/dist/classes/CloseLabel.mjs +77 -32
- package/dist/classes/CloseLabel.mjs.map +1 -1
- package/dist/classes/Label.d.mts +6 -33
- package/dist/classes/Label.d.ts +6 -33
- package/dist/classes/Label.js +74 -31
- package/dist/classes/Label.js.map +1 -1
- package/dist/classes/Label.mjs +74 -31
- 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 +42 -33
- package/dist/classes/StoredClassModel.js.map +1 -1
- package/dist/classes/StoredClassModel.mjs +42 -33
- package/dist/classes/StoredClassModel.mjs.map +1 -1
- package/dist/classes/canvas/CanvasContainer.js +2 -2
- package/dist/classes/canvas/CanvasContainer.js.map +1 -1
- package/dist/classes/canvas/CanvasContainer.mjs +2 -2
- package/dist/classes/canvas/CanvasContainer.mjs.map +1 -1
- package/dist/classes/canvas/CanvasImage.js +2 -2
- package/dist/classes/canvas/CanvasImage.js.map +1 -1
- package/dist/classes/canvas/CanvasImage.mjs +2 -2
- package/dist/classes/canvas/CanvasImage.mjs.map +1 -1
- package/dist/classes/canvas/CanvasSprite.js +2 -2
- package/dist/classes/canvas/CanvasSprite.js.map +1 -1
- package/dist/classes/canvas/CanvasSprite.mjs +2 -2
- package/dist/classes/canvas/CanvasSprite.mjs.map +1 -1
- package/dist/classes/canvas/CanvasText.js +2 -2
- package/dist/classes/canvas/CanvasText.js.map +1 -1
- package/dist/classes/canvas/CanvasText.mjs +2 -2
- package/dist/classes/canvas/CanvasText.mjs.map +1 -1
- package/dist/classes/canvas/index.js +2 -2
- package/dist/classes/canvas/index.js.map +1 -1
- package/dist/classes/canvas/index.mjs +2 -2
- package/dist/classes/canvas/index.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 +945 -78
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +945 -79
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/ticker/FadeAlphaTicker.js +42 -33
- package/dist/classes/ticker/FadeAlphaTicker.js.map +1 -1
- package/dist/classes/ticker/FadeAlphaTicker.mjs +42 -33
- package/dist/classes/ticker/FadeAlphaTicker.mjs.map +1 -1
- package/dist/classes/ticker/MoveTicker.d.mts +1 -0
- package/dist/classes/ticker/MoveTicker.d.ts +1 -0
- package/dist/classes/ticker/MoveTicker.js +42 -33
- package/dist/classes/ticker/MoveTicker.js.map +1 -1
- package/dist/classes/ticker/MoveTicker.mjs +42 -33
- package/dist/classes/ticker/MoveTicker.mjs.map +1 -1
- package/dist/classes/ticker/RotateTicker.d.mts +1 -0
- package/dist/classes/ticker/RotateTicker.d.ts +1 -0
- package/dist/classes/ticker/RotateTicker.js +42 -33
- package/dist/classes/ticker/RotateTicker.js.map +1 -1
- package/dist/classes/ticker/RotateTicker.mjs +42 -33
- package/dist/classes/ticker/RotateTicker.mjs.map +1 -1
- package/dist/classes/ticker/ZoomTicker.d.mts +1 -0
- package/dist/classes/ticker/ZoomTicker.d.ts +1 -0
- package/dist/classes/ticker/ZoomTicker.js +42 -33
- package/dist/classes/ticker/ZoomTicker.js.map +1 -1
- package/dist/classes/ticker/ZoomTicker.mjs +42 -33
- package/dist/classes/ticker/ZoomTicker.mjs.map +1 -1
- package/dist/classes/ticker/index.js +42 -33
- package/dist/classes/ticker/index.js.map +1 -1
- package/dist/classes/ticker/index.mjs +42 -33
- 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/CanvasElementDecorator.js +2 -2
- package/dist/decorators/CanvasElementDecorator.js.map +1 -1
- package/dist/decorators/CanvasElementDecorator.mjs +2 -2
- package/dist/decorators/CanvasElementDecorator.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 +102 -65
- package/dist/decorators/LabelDecorator.js.map +1 -1
- package/dist/decorators/LabelDecorator.mjs +102 -66
- 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 +98 -65
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +98 -65
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/CanvasUtility.js +2 -2
- package/dist/functions/CanvasUtility.js.map +1 -1
- package/dist/functions/CanvasUtility.mjs +2 -2
- package/dist/functions/CanvasUtility.mjs.map +1 -1
- package/dist/functions/DialogueUtility.d.mts +10 -8
- package/dist/functions/DialogueUtility.d.ts +10 -8
- package/dist/functions/DialogueUtility.js +268 -131
- package/dist/functions/DialogueUtility.js.map +1 -1
- package/dist/functions/DialogueUtility.mjs +268 -131
- package/dist/functions/DialogueUtility.mjs.map +1 -1
- package/dist/functions/FlagsUtility.js +42 -33
- package/dist/functions/FlagsUtility.js.map +1 -1
- package/dist/functions/FlagsUtility.mjs +42 -33
- package/dist/functions/FlagsUtility.mjs.map +1 -1
- package/dist/functions/GameUtility.js +42 -33
- package/dist/functions/GameUtility.js.map +1 -1
- package/dist/functions/GameUtility.mjs +42 -33
- package/dist/functions/GameUtility.mjs.map +1 -1
- package/dist/functions/ImageUtility.js +45 -36
- package/dist/functions/ImageUtility.js.map +1 -1
- package/dist/functions/ImageUtility.mjs +45 -36
- 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 +5 -3
- package/dist/functions/SavesUtility.d.ts +5 -3
- package/dist/functions/SavesUtility.js +310 -145
- package/dist/functions/SavesUtility.js.map +1 -1
- package/dist/functions/SavesUtility.mjs +310 -145
- package/dist/functions/SavesUtility.mjs.map +1 -1
- package/dist/functions/TickerUtility.d.mts +2 -1
- package/dist/functions/TickerUtility.d.ts +2 -1
- package/dist/functions/TickerUtility.js +19 -15
- package/dist/functions/TickerUtility.js.map +1 -1
- package/dist/functions/TickerUtility.mjs +19 -15
- package/dist/functions/TickerUtility.mjs.map +1 -1
- package/dist/functions/index.d.mts +7 -2
- package/dist/functions/index.d.ts +7 -2
- package/dist/functions/index.js +364 -140
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +364 -141
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +453 -219
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +453 -221
- 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 -0
- package/dist/interface/LabelProps.d.ts +38 -0
- package/dist/interface/LabelProps.js +4 -0
- package/dist/interface/LabelProps.js.map +1 -0
- package/dist/interface/LabelProps.mjs +3 -0
- package/dist/interface/LabelProps.mjs.map +1 -0
- 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 +3 -1
- package/dist/interface/index.d.ts +3 -1
- package/dist/labels/BaseCanvasElementTestLabel.d.mts +3 -1
- package/dist/labels/BaseCanvasElementTestLabel.d.ts +3 -1
- package/dist/labels/BaseCanvasElementTestLabel.js +303 -136
- package/dist/labels/BaseCanvasElementTestLabel.js.map +1 -1
- package/dist/labels/BaseCanvasElementTestLabel.mjs +304 -137
- package/dist/labels/BaseCanvasElementTestLabel.mjs.map +1 -1
- package/dist/labels/CanvasEventsTestLabel.d.mts +4 -5
- package/dist/labels/CanvasEventsTestLabel.d.ts +4 -5
- package/dist/labels/CanvasEventsTestLabel.js +313 -148
- package/dist/labels/CanvasEventsTestLabel.js.map +1 -1
- package/dist/labels/CanvasEventsTestLabel.mjs +314 -149
- 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 +294 -133
- package/dist/labels/CustomTickerCanvasElementTestLabel.js.map +1 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs +295 -134
- 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 +298 -181
- package/dist/labels/ImagesAnimationsTestLabel.js.map +1 -1
- package/dist/labels/ImagesAnimationsTestLabel.mjs +299 -182
- 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 +294 -133
- package/dist/labels/MarkdownTest.js.map +1 -1
- package/dist/labels/MarkdownTest.mjs +294 -133
- 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 +360 -213
- package/dist/labels/StartLabel.js.map +1 -1
- package/dist/labels/StartLabel.mjs +361 -214
- package/dist/labels/StartLabel.mjs.map +1 -1
- package/dist/labels/StepLabelTest.d.mts +11 -0
- package/dist/labels/StepLabelTest.d.ts +11 -0
- package/dist/labels/StepLabelTest.js +2861 -0
- package/dist/labels/StepLabelTest.js.map +1 -0
- package/dist/labels/StepLabelTest.mjs +2855 -0
- package/dist/labels/StepLabelTest.mjs.map +1 -0
- package/dist/labels/TestConstant.js +43 -34
- package/dist/labels/TestConstant.js.map +1 -1
- package/dist/labels/TestConstant.mjs +43 -34
- 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 +360 -213
- package/dist/labels/index.js.map +1 -1
- package/dist/labels/index.mjs +361 -214
- package/dist/labels/index.mjs.map +1 -1
- package/dist/managers/StepManager.d.mts +10 -7
- package/dist/managers/StepManager.d.ts +10 -7
- package/dist/managers/StepManager.js +300 -139
- package/dist/managers/StepManager.js.map +1 -1
- package/dist/managers/StepManager.mjs +300 -139
- package/dist/managers/StepManager.mjs.map +1 -1
- package/dist/managers/WindowManager.js +2 -2
- package/dist/managers/WindowManager.js.map +1 -1
- package/dist/managers/WindowManager.mjs +2 -2
- 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 +300 -139
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +300 -139
- 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 +4 -0
- package/dist/types/index.d.ts +4 -0
- package/package.json +7 -6
package/dist/managers/index.js
CHANGED
|
@@ -64,19 +64,18 @@ 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
|
|
72
|
-
* @param onStepRun is a function that will be executed before any step is executed, is useful for example to make sure all images used have been cached
|
|
73
|
-
* @param choiseIndex is the index of the choice that the label will perform
|
|
71
|
+
* @param props is the properties of the label
|
|
74
72
|
*/
|
|
75
|
-
constructor(id,
|
|
73
|
+
constructor(id, props) {
|
|
76
74
|
this._id = id;
|
|
77
|
-
this.
|
|
78
|
-
this.
|
|
79
|
-
this.
|
|
75
|
+
this._onStepStart = props == null ? void 0 : props.onStepStart;
|
|
76
|
+
this._onLoadStep = props == null ? void 0 : props.onLoadStep;
|
|
77
|
+
this._onStepEnd = props == null ? void 0 : props.onStepEnd;
|
|
78
|
+
this._choiseIndex = props == null ? void 0 : props.choiseIndex;
|
|
80
79
|
}
|
|
81
80
|
/**
|
|
82
81
|
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
@@ -84,17 +83,6 @@ var Label = class {
|
|
|
84
83
|
get id() {
|
|
85
84
|
return this._id;
|
|
86
85
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Get the steps of the label.
|
|
89
|
-
* This class should be extended and the steps method should be overridden.
|
|
90
|
-
* Every time you update this list will also be updated when the other game versions load.
|
|
91
|
-
*/
|
|
92
|
-
get steps() {
|
|
93
|
-
if (typeof this._steps === "function") {
|
|
94
|
-
return this._steps();
|
|
95
|
-
}
|
|
96
|
-
return this._steps;
|
|
97
|
-
}
|
|
98
86
|
/**
|
|
99
87
|
* Get the corresponding steps number
|
|
100
88
|
* @param externalSteps
|
|
@@ -113,28 +101,66 @@ var Label = class {
|
|
|
113
101
|
return res;
|
|
114
102
|
}
|
|
115
103
|
/**
|
|
116
|
-
*
|
|
104
|
+
* Is a function that will be executed in {@link Label#onStepStart} and when the user goes back to it or when the user laods a save file.
|
|
117
105
|
* @returns Promise<void> or void
|
|
118
|
-
* @example
|
|
119
|
-
* ```typescript
|
|
120
|
-
* newLabel("id", [], () => {
|
|
121
|
-
* Assets.load('path/to/image1.png')
|
|
122
|
-
* Assets.load('path/to/image2.png')
|
|
123
|
-
* })
|
|
124
|
-
* ```
|
|
125
106
|
*/
|
|
126
|
-
get
|
|
127
|
-
return this
|
|
107
|
+
get onStepStart() {
|
|
108
|
+
return (stepIndex, label) => __async(this, null, function* () {
|
|
109
|
+
if (this._onLoadStep) {
|
|
110
|
+
yield this._onLoadStep(stepIndex, label);
|
|
111
|
+
}
|
|
112
|
+
if (this._onStepStart) {
|
|
113
|
+
return yield this._onStepStart(stepIndex, label);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Get the function that will be executed a old step is reloaded. A step is reloaded when the user goes back to it or when the user laods a save file.
|
|
119
|
+
* @returns Promise<void> or void
|
|
120
|
+
*/
|
|
121
|
+
get onLoadStep() {
|
|
122
|
+
return this._onLoadStep;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Is a function that will be executed when the step ends.
|
|
126
|
+
* @returns Promise<void> or void
|
|
127
|
+
*/
|
|
128
|
+
get onStepEnd() {
|
|
129
|
+
return this._onStepEnd;
|
|
128
130
|
}
|
|
129
131
|
get choiseIndex() {
|
|
130
132
|
return this._choiseIndex;
|
|
131
133
|
}
|
|
132
134
|
};
|
|
133
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
|
+
|
|
134
158
|
// src/classes/CloseLabel.ts
|
|
135
159
|
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
136
160
|
function newCloseLabel(choiseIndex) {
|
|
137
|
-
return new Label(CLOSE_LABEL_ID, [],
|
|
161
|
+
return new Label(CLOSE_LABEL_ID, [], {
|
|
162
|
+
choiseIndex
|
|
163
|
+
});
|
|
138
164
|
}
|
|
139
165
|
|
|
140
166
|
// src/functions/CanvasUtility.ts
|
|
@@ -213,8 +239,6 @@ function getMemoryContainer(element) {
|
|
|
213
239
|
};
|
|
214
240
|
}
|
|
215
241
|
function setMemoryContainer(element, memory) {
|
|
216
|
-
memory.width && (element.width = memory.width);
|
|
217
|
-
memory.height && (element.height = memory.height);
|
|
218
242
|
memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
|
|
219
243
|
memory.blendMode && (element.blendMode = memory.blendMode);
|
|
220
244
|
memory.tint && (element.tint = memory.tint);
|
|
@@ -247,6 +271,8 @@ function setMemoryContainer(element, memory) {
|
|
|
247
271
|
memory.interactive && (element.interactive = memory.interactive);
|
|
248
272
|
memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
|
|
249
273
|
memory.hitArea && (element.hitArea = memory.hitArea);
|
|
274
|
+
memory.width && (element.width = memory.width);
|
|
275
|
+
memory.height && (element.height = memory.height);
|
|
250
276
|
}
|
|
251
277
|
function getTexture(imageUrl) {
|
|
252
278
|
return __async(this, null, function* () {
|
|
@@ -650,16 +676,105 @@ function geTickerInstanceById(tickerId, args, duration, priority) {
|
|
|
650
676
|
// src/types/CloseType.ts
|
|
651
677
|
var Close = "close";
|
|
652
678
|
|
|
653
|
-
// src/
|
|
654
|
-
var
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
679
|
+
// src/classes/ChoiceMenuOption.ts
|
|
680
|
+
var ChoiceMenuOption = class {
|
|
681
|
+
/**
|
|
682
|
+
* @param text Text to be displayed in the menu
|
|
683
|
+
* @param label Label to be opened when the option is selected or the id of the label
|
|
684
|
+
* @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.
|
|
685
|
+
* @param type Type of the label to be opened. @default "call"
|
|
686
|
+
*/
|
|
687
|
+
constructor(text, label, props, type = "call") {
|
|
688
|
+
/**
|
|
689
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
690
|
+
* @example
|
|
691
|
+
* ```tsx
|
|
692
|
+
* setChoiceMenuOptions([
|
|
693
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
694
|
+
* ])
|
|
695
|
+
* return <List>
|
|
696
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
697
|
+
* return (
|
|
698
|
+
* <ChoiceButton
|
|
699
|
+
* disabled={item.props.disabled}
|
|
700
|
+
* onClick={() => {
|
|
701
|
+
* afterSelectChoice(item)
|
|
702
|
+
* }}
|
|
703
|
+
* >
|
|
704
|
+
* {item.text}
|
|
705
|
+
* </ChoiceButton>
|
|
706
|
+
* )
|
|
707
|
+
* })}
|
|
708
|
+
* </List>
|
|
709
|
+
* ```
|
|
710
|
+
*/
|
|
711
|
+
this.props = {};
|
|
712
|
+
this.text = text;
|
|
713
|
+
this._label = label;
|
|
714
|
+
this.type = type;
|
|
715
|
+
if (props) {
|
|
716
|
+
this.props = props;
|
|
717
|
+
}
|
|
660
718
|
}
|
|
661
|
-
|
|
662
|
-
|
|
719
|
+
/**
|
|
720
|
+
* Label to be opened when the option is selected
|
|
721
|
+
*/
|
|
722
|
+
get label() {
|
|
723
|
+
let label = this._label;
|
|
724
|
+
if (typeof label === "string") {
|
|
725
|
+
let res = getLabelById(label);
|
|
726
|
+
if (res) {
|
|
727
|
+
label = res;
|
|
728
|
+
} else {
|
|
729
|
+
console.error(`Label ${label} not found, so it will be closed`);
|
|
730
|
+
label = newCloseLabel();
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
return label;
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
var ChoiceMenuOptionClose = class {
|
|
737
|
+
/**
|
|
738
|
+
* @param text Text to be displayed in the menu
|
|
739
|
+
* @param closeCurrentLabel If true, the current label will be closed. @default false
|
|
740
|
+
*/
|
|
741
|
+
constructor(text, closeCurrentLabel = false) {
|
|
742
|
+
/**
|
|
743
|
+
* Label to be opened when the option is selected
|
|
744
|
+
*/
|
|
745
|
+
this.label = newCloseLabel();
|
|
746
|
+
/**
|
|
747
|
+
* Type of the label to be opened
|
|
748
|
+
*/
|
|
749
|
+
this.type = Close;
|
|
750
|
+
/**
|
|
751
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
752
|
+
* @example
|
|
753
|
+
* ```tsx
|
|
754
|
+
* setChoiceMenuOptions([
|
|
755
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
756
|
+
* ])
|
|
757
|
+
* return <List>
|
|
758
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
759
|
+
* return (
|
|
760
|
+
* <ChoiceButton
|
|
761
|
+
* disabled={item.props.disabled}
|
|
762
|
+
* onClick={() => {
|
|
763
|
+
* afterSelectChoice(item)
|
|
764
|
+
* }}
|
|
765
|
+
* >
|
|
766
|
+
* {item.text}
|
|
767
|
+
* </ChoiceButton>
|
|
768
|
+
* )
|
|
769
|
+
* })}
|
|
770
|
+
* </List>
|
|
771
|
+
* ```
|
|
772
|
+
*/
|
|
773
|
+
this.props = {};
|
|
774
|
+
this.text = text;
|
|
775
|
+
this.closeCurrentLabel = closeCurrentLabel;
|
|
776
|
+
}
|
|
777
|
+
};
|
|
663
778
|
|
|
664
779
|
// src/functions/DialogueUtility.ts
|
|
665
780
|
function getDialogue() {
|
|
@@ -672,21 +787,18 @@ function getChoiceMenuOptions() {
|
|
|
672
787
|
d.forEach((option, index) => {
|
|
673
788
|
if (option.type === Close) {
|
|
674
789
|
let itemLabel = newCloseLabel(index);
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
type: Close,
|
|
679
|
-
closeCurrentLabel: option.closeCurrentLabel,
|
|
680
|
-
props: {}
|
|
681
|
-
});
|
|
790
|
+
let choice = new ChoiceMenuOptionClose(option.text, option.closeCurrentLabel);
|
|
791
|
+
choice.label = itemLabel;
|
|
792
|
+
options.push(choice);
|
|
682
793
|
return;
|
|
683
794
|
}
|
|
684
795
|
let label = getLabelById(option.label);
|
|
685
796
|
if (label) {
|
|
686
|
-
let itemLabel = new Label(label.id, label.steps,
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
})
|
|
797
|
+
let itemLabel = new Label(label.id, label.steps, {
|
|
798
|
+
onStepStart: label.onStepStart,
|
|
799
|
+
choiseIndex: index
|
|
800
|
+
});
|
|
801
|
+
options.push(new ChoiceMenuOption(option.text, itemLabel, option.props, option.type));
|
|
690
802
|
}
|
|
691
803
|
});
|
|
692
804
|
return options;
|
|
@@ -774,8 +886,9 @@ FadeAlphaTicker = __decorateClass([
|
|
|
774
886
|
], FadeAlphaTicker);
|
|
775
887
|
|
|
776
888
|
// src/functions/TickerUtility.ts
|
|
777
|
-
function updateTickerProgression(args, propertyName, progression) {
|
|
778
|
-
|
|
889
|
+
function updateTickerProgression(args, propertyName, progression, valueConvert) {
|
|
890
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
891
|
+
if (args[propertyName] === void 0 || !progression || args[propertyName] === limit) {
|
|
779
892
|
return;
|
|
780
893
|
}
|
|
781
894
|
if (typeof args[propertyName] === "number") {
|
|
@@ -794,22 +907,25 @@ function updateTickerProgression(args, propertyName, progression) {
|
|
|
794
907
|
}
|
|
795
908
|
}
|
|
796
909
|
}
|
|
797
|
-
function getLinearProgression(number, progression) {
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
return
|
|
910
|
+
function getLinearProgression(number, progression, valueConvert) {
|
|
911
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
912
|
+
let amt = valueConvert ? valueConvert(progression.amt) : progression.amt;
|
|
913
|
+
if (limit !== void 0) {
|
|
914
|
+
if (number > limit && amt > 0) {
|
|
915
|
+
return limit;
|
|
916
|
+
} else if (number < limit && amt < 0) {
|
|
917
|
+
return limit;
|
|
803
918
|
}
|
|
804
919
|
}
|
|
805
|
-
return number +
|
|
920
|
+
return number + amt;
|
|
806
921
|
}
|
|
807
|
-
function getExponentialProgression(number, progression) {
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
922
|
+
function getExponentialProgression(number, progression, valueConvert) {
|
|
923
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
924
|
+
if (limit !== void 0) {
|
|
925
|
+
if (number > limit && progression.percentage > 0) {
|
|
926
|
+
return limit;
|
|
927
|
+
} else if (number < limit && progression.percentage < 0) {
|
|
928
|
+
return limit;
|
|
813
929
|
}
|
|
814
930
|
}
|
|
815
931
|
return number + number * progression.percentage;
|
|
@@ -822,15 +938,13 @@ var MoveTicker = class extends TickerBase {
|
|
|
822
938
|
let ySpeed = 1;
|
|
823
939
|
if (args.speed) {
|
|
824
940
|
if (typeof args.speed === "number") {
|
|
825
|
-
xSpeed = args.speed;
|
|
826
|
-
ySpeed = args.speed;
|
|
941
|
+
xSpeed = this.speedConvert(args.speed);
|
|
942
|
+
ySpeed = this.speedConvert(args.speed);
|
|
827
943
|
} else {
|
|
828
|
-
xSpeed = args.speed.x;
|
|
829
|
-
ySpeed = args.speed.y;
|
|
944
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
945
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
830
946
|
}
|
|
831
947
|
}
|
|
832
|
-
xSpeed /= 60;
|
|
833
|
-
ySpeed /= 60;
|
|
834
948
|
let destination = args.destination;
|
|
835
949
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
836
950
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -870,7 +984,10 @@ var MoveTicker = class extends TickerBase {
|
|
|
870
984
|
}
|
|
871
985
|
});
|
|
872
986
|
if (args.speedProgression)
|
|
873
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
987
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
988
|
+
}
|
|
989
|
+
speedConvert(speed) {
|
|
990
|
+
return speed / 6;
|
|
874
991
|
}
|
|
875
992
|
};
|
|
876
993
|
MoveTicker = __decorateClass([
|
|
@@ -878,7 +995,7 @@ MoveTicker = __decorateClass([
|
|
|
878
995
|
], MoveTicker);
|
|
879
996
|
var RotateTicker = class extends TickerBase {
|
|
880
997
|
fn(ticker, args, tags, tickerId) {
|
|
881
|
-
let speed = (args.speed === void 0 ? 1 : args.speed)
|
|
998
|
+
let speed = this.speedConvert(args.speed === void 0 ? 1 : args.speed);
|
|
882
999
|
let clockwise = args.clockwise === void 0 ? true : args.clockwise;
|
|
883
1000
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
884
1001
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -906,7 +1023,10 @@ var RotateTicker = class extends TickerBase {
|
|
|
906
1023
|
}
|
|
907
1024
|
});
|
|
908
1025
|
if (args.speedProgression)
|
|
909
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1026
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1027
|
+
}
|
|
1028
|
+
speedConvert(speed) {
|
|
1029
|
+
return speed / 60;
|
|
910
1030
|
}
|
|
911
1031
|
};
|
|
912
1032
|
RotateTicker = __decorateClass([
|
|
@@ -918,15 +1038,13 @@ var ZoomTicker = class extends TickerBase {
|
|
|
918
1038
|
let ySpeed = 0.1;
|
|
919
1039
|
if (args.speed) {
|
|
920
1040
|
if (typeof args.speed === "number") {
|
|
921
|
-
xSpeed = args.speed;
|
|
922
|
-
ySpeed = args.speed;
|
|
1041
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1042
|
+
ySpeed = this.speedConvert(args.speed);
|
|
923
1043
|
} else {
|
|
924
|
-
xSpeed = args.speed.x;
|
|
925
|
-
ySpeed = args.speed.y;
|
|
1044
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1045
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
926
1046
|
}
|
|
927
1047
|
}
|
|
928
|
-
xSpeed /= 60;
|
|
929
|
-
ySpeed /= 60;
|
|
930
1048
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
931
1049
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
932
1050
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
@@ -993,7 +1111,10 @@ var ZoomTicker = class extends TickerBase {
|
|
|
993
1111
|
}
|
|
994
1112
|
});
|
|
995
1113
|
if (args.speedProgression)
|
|
996
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1114
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1115
|
+
}
|
|
1116
|
+
speedConvert(speed) {
|
|
1117
|
+
return speed / 60;
|
|
997
1118
|
}
|
|
998
1119
|
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
999
1120
|
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
@@ -1006,6 +1127,17 @@ ZoomTicker = __decorateClass([
|
|
|
1006
1127
|
// src/constants.ts
|
|
1007
1128
|
var Repeat = "repeat";
|
|
1008
1129
|
|
|
1130
|
+
// src/decorators/LabelDecorator.ts
|
|
1131
|
+
var registeredLabels = {};
|
|
1132
|
+
function getLabelById(id) {
|
|
1133
|
+
let label = registeredLabels[id];
|
|
1134
|
+
if (!label) {
|
|
1135
|
+
console.error(`[Pixi'VN] Label ${id} not found`);
|
|
1136
|
+
return;
|
|
1137
|
+
}
|
|
1138
|
+
return label;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1009
1141
|
// src/functions/ExportUtility.ts
|
|
1010
1142
|
function createExportableElement(element) {
|
|
1011
1143
|
try {
|
|
@@ -1955,6 +2087,16 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1955
2087
|
static set originalStepData(value) {
|
|
1956
2088
|
_GameStepManager._originalStepData = createExportableElement(value);
|
|
1957
2089
|
}
|
|
2090
|
+
static get currentStepData() {
|
|
2091
|
+
let currentStepData = {
|
|
2092
|
+
path: window.location.pathname,
|
|
2093
|
+
storage: GameStorageManager.export(),
|
|
2094
|
+
canvas: GameWindowManager.export(),
|
|
2095
|
+
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2096
|
+
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2097
|
+
};
|
|
2098
|
+
return currentStepData;
|
|
2099
|
+
}
|
|
1958
2100
|
/* Edit History Methods */
|
|
1959
2101
|
/**
|
|
1960
2102
|
* Add a label to the history.
|
|
@@ -1962,19 +2104,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1962
2104
|
*/
|
|
1963
2105
|
static addStepHistory(step, choiseMade) {
|
|
1964
2106
|
let stepHistory = getStepSha1(step);
|
|
1965
|
-
let
|
|
1966
|
-
path: window.location.pathname,
|
|
1967
|
-
storage: GameStorageManager.export(),
|
|
1968
|
-
canvas: GameWindowManager.export(),
|
|
1969
|
-
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
1970
|
-
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
1971
|
-
};
|
|
2107
|
+
let currentStepData = _GameStepManager.currentStepData;
|
|
1972
2108
|
if (_GameStepManager.originalStepData) {
|
|
1973
|
-
if (_GameStepManager.originalStepData.openedLabels.length ===
|
|
2109
|
+
if (_GameStepManager.originalStepData.openedLabels.length === currentStepData.openedLabels.length) {
|
|
1974
2110
|
try {
|
|
1975
2111
|
let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
|
|
1976
|
-
let historyStepOpenedLabelsString = JSON.stringify(
|
|
1977
|
-
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path ===
|
|
2112
|
+
let historyStepOpenedLabelsString = JSON.stringify(currentStepData.openedLabels);
|
|
2113
|
+
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === currentStepData.path && _GameStepManager.originalStepData.labelIndex === currentStepData.labelIndex) {
|
|
1978
2114
|
return;
|
|
1979
2115
|
}
|
|
1980
2116
|
} catch (e) {
|
|
@@ -1982,7 +2118,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1982
2118
|
}
|
|
1983
2119
|
}
|
|
1984
2120
|
}
|
|
1985
|
-
let data = deepDiff.diff(_GameStepManager.originalStepData,
|
|
2121
|
+
let data = deepDiff.diff(_GameStepManager.originalStepData, currentStepData);
|
|
1986
2122
|
if (data) {
|
|
1987
2123
|
let dialoge = void 0;
|
|
1988
2124
|
let requiredChoices = void 0;
|
|
@@ -2001,7 +2137,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2001
2137
|
index: _GameStepManager.lastStepIndex,
|
|
2002
2138
|
choiceIndexMade: choiseMade
|
|
2003
2139
|
});
|
|
2004
|
-
_GameStepManager.originalStepData =
|
|
2140
|
+
_GameStepManager.originalStepData = currentStepData;
|
|
2005
2141
|
}
|
|
2006
2142
|
_GameStepManager.increaseLastStepIndex();
|
|
2007
2143
|
}
|
|
@@ -2092,6 +2228,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2092
2228
|
console.warn("[Pixi'VN] The player must make a choice");
|
|
2093
2229
|
return;
|
|
2094
2230
|
}
|
|
2231
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2232
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2233
|
+
}
|
|
2095
2234
|
_GameStepManager.increaseCurrentStepIndex();
|
|
2096
2235
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2097
2236
|
});
|
|
@@ -2116,6 +2255,10 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2116
2255
|
return;
|
|
2117
2256
|
}
|
|
2118
2257
|
if (currentLabel.steps.length > currentLabelStepIndex) {
|
|
2258
|
+
let onStepRun = currentLabel.onStepStart;
|
|
2259
|
+
if (onStepRun) {
|
|
2260
|
+
yield onStepRun(currentLabelStepIndex, currentLabel);
|
|
2261
|
+
}
|
|
2119
2262
|
let step = currentLabel.steps[currentLabelStepIndex];
|
|
2120
2263
|
let result = yield step(props);
|
|
2121
2264
|
_GameStepManager.addStepHistory(step, choiseMade);
|
|
@@ -2180,6 +2323,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2180
2323
|
if (!tempLabel) {
|
|
2181
2324
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2182
2325
|
}
|
|
2326
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2327
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2328
|
+
}
|
|
2183
2329
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2184
2330
|
} catch (e) {
|
|
2185
2331
|
console.error("[Pixi'VN] Error calling label", e);
|
|
@@ -2238,6 +2384,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2238
2384
|
if (!tempLabel) {
|
|
2239
2385
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2240
2386
|
}
|
|
2387
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2388
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2389
|
+
}
|
|
2241
2390
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2242
2391
|
} catch (e) {
|
|
2243
2392
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
@@ -2343,24 +2492,29 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2343
2492
|
* ```
|
|
2344
2493
|
*/
|
|
2345
2494
|
static goBack(navigate, steps = 1) {
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2495
|
+
return __async(this, null, function* () {
|
|
2496
|
+
if (steps <= 0) {
|
|
2497
|
+
console.warn("[Pixi'VN] Steps must be greater than 0");
|
|
2498
|
+
return;
|
|
2499
|
+
}
|
|
2500
|
+
if (_GameStepManager._stepsHistory.length <= 1) {
|
|
2501
|
+
console.warn("[Pixi'VN] No steps to go back");
|
|
2502
|
+
return;
|
|
2503
|
+
}
|
|
2504
|
+
let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
|
|
2505
|
+
if (restoredStep) {
|
|
2506
|
+
_GameStepManager._originalStepData = restoredStep;
|
|
2507
|
+
_GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
|
|
2508
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2509
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2510
|
+
}
|
|
2511
|
+
GameStorageManager.import(createExportableElement(restoredStep.storage));
|
|
2512
|
+
GameWindowManager.import(createExportableElement(restoredStep.canvas));
|
|
2513
|
+
navigate(restoredStep.path);
|
|
2514
|
+
} else {
|
|
2515
|
+
console.error("[Pixi'VN] Error going back");
|
|
2516
|
+
}
|
|
2517
|
+
});
|
|
2364
2518
|
}
|
|
2365
2519
|
static goBackInternal(steps, restoredStep) {
|
|
2366
2520
|
if (steps <= 0) {
|
|
@@ -2422,38 +2576,45 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2422
2576
|
* @param dataString The history in a JSON string.
|
|
2423
2577
|
*/
|
|
2424
2578
|
static importJson(dataString) {
|
|
2425
|
-
|
|
2579
|
+
return __async(this, null, function* () {
|
|
2580
|
+
yield _GameStepManager.import(JSON.parse(dataString));
|
|
2581
|
+
});
|
|
2426
2582
|
}
|
|
2427
2583
|
/**
|
|
2428
2584
|
* Import the history from an object.
|
|
2429
2585
|
* @param data The history in an object.
|
|
2430
2586
|
*/
|
|
2431
2587
|
static import(data) {
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2588
|
+
return __async(this, null, function* () {
|
|
2589
|
+
_GameStepManager.clear();
|
|
2590
|
+
try {
|
|
2591
|
+
if (data.hasOwnProperty("stepsHistory")) {
|
|
2592
|
+
_GameStepManager._stepsHistory = data["stepsHistory"];
|
|
2593
|
+
} else {
|
|
2594
|
+
console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
|
|
2595
|
+
}
|
|
2596
|
+
if (data.hasOwnProperty("openedLabels")) {
|
|
2597
|
+
_GameStepManager._openedLabels = data["openedLabels"];
|
|
2598
|
+
} else {
|
|
2599
|
+
console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
|
|
2600
|
+
}
|
|
2601
|
+
if (data.hasOwnProperty("lastStepIndex")) {
|
|
2602
|
+
_GameStepManager._lastStepIndex = data["lastStepIndex"];
|
|
2603
|
+
} else {
|
|
2604
|
+
console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
|
|
2605
|
+
}
|
|
2606
|
+
if (data.hasOwnProperty("originalStepData")) {
|
|
2607
|
+
_GameStepManager._originalStepData = data["originalStepData"];
|
|
2608
|
+
} else {
|
|
2609
|
+
console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
|
|
2610
|
+
}
|
|
2611
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2612
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2613
|
+
}
|
|
2614
|
+
} catch (e) {
|
|
2615
|
+
console.error("[Pixi'VN] Error importing data", e);
|
|
2453
2616
|
}
|
|
2454
|
-
}
|
|
2455
|
-
console.error("[Pixi'VN] Error importing data", e);
|
|
2456
|
-
}
|
|
2617
|
+
});
|
|
2457
2618
|
}
|
|
2458
2619
|
};
|
|
2459
2620
|
/**
|