@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.mjs
CHANGED
|
@@ -58,19 +58,18 @@ function checkIfStepsIsEqual(step1, step2) {
|
|
|
58
58
|
return step1 === step2;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
// src/classes/
|
|
62
|
-
var
|
|
61
|
+
// src/classes/LabelAbstract.ts
|
|
62
|
+
var LabelAbstract = class {
|
|
63
63
|
/**
|
|
64
64
|
* @param id is the id of the label
|
|
65
|
-
* @param
|
|
66
|
-
* @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
|
|
67
|
-
* @param choiseIndex is the index of the choice that the label will perform
|
|
65
|
+
* @param props is the properties of the label
|
|
68
66
|
*/
|
|
69
|
-
constructor(id,
|
|
67
|
+
constructor(id, props) {
|
|
70
68
|
this._id = id;
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
73
|
-
this.
|
|
69
|
+
this._onStepStart = props == null ? void 0 : props.onStepStart;
|
|
70
|
+
this._onLoadStep = props == null ? void 0 : props.onLoadStep;
|
|
71
|
+
this._onStepEnd = props == null ? void 0 : props.onStepEnd;
|
|
72
|
+
this._choiseIndex = props == null ? void 0 : props.choiseIndex;
|
|
74
73
|
}
|
|
75
74
|
/**
|
|
76
75
|
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
@@ -78,17 +77,6 @@ var Label = class {
|
|
|
78
77
|
get id() {
|
|
79
78
|
return this._id;
|
|
80
79
|
}
|
|
81
|
-
/**
|
|
82
|
-
* Get the steps of the label.
|
|
83
|
-
* This class should be extended and the steps method should be overridden.
|
|
84
|
-
* Every time you update this list will also be updated when the other game versions load.
|
|
85
|
-
*/
|
|
86
|
-
get steps() {
|
|
87
|
-
if (typeof this._steps === "function") {
|
|
88
|
-
return this._steps();
|
|
89
|
-
}
|
|
90
|
-
return this._steps;
|
|
91
|
-
}
|
|
92
80
|
/**
|
|
93
81
|
* Get the corresponding steps number
|
|
94
82
|
* @param externalSteps
|
|
@@ -107,28 +95,66 @@ var Label = class {
|
|
|
107
95
|
return res;
|
|
108
96
|
}
|
|
109
97
|
/**
|
|
110
|
-
*
|
|
98
|
+
* 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.
|
|
111
99
|
* @returns Promise<void> or void
|
|
112
|
-
* @example
|
|
113
|
-
* ```typescript
|
|
114
|
-
* newLabel("id", [], () => {
|
|
115
|
-
* Assets.load('path/to/image1.png')
|
|
116
|
-
* Assets.load('path/to/image2.png')
|
|
117
|
-
* })
|
|
118
|
-
* ```
|
|
119
100
|
*/
|
|
120
|
-
get
|
|
121
|
-
return this
|
|
101
|
+
get onStepStart() {
|
|
102
|
+
return (stepIndex, label) => __async(this, null, function* () {
|
|
103
|
+
if (this._onLoadStep) {
|
|
104
|
+
yield this._onLoadStep(stepIndex, label);
|
|
105
|
+
}
|
|
106
|
+
if (this._onStepStart) {
|
|
107
|
+
return yield this._onStepStart(stepIndex, label);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* 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.
|
|
113
|
+
* @returns Promise<void> or void
|
|
114
|
+
*/
|
|
115
|
+
get onLoadStep() {
|
|
116
|
+
return this._onLoadStep;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Is a function that will be executed when the step ends.
|
|
120
|
+
* @returns Promise<void> or void
|
|
121
|
+
*/
|
|
122
|
+
get onStepEnd() {
|
|
123
|
+
return this._onStepEnd;
|
|
122
124
|
}
|
|
123
125
|
get choiseIndex() {
|
|
124
126
|
return this._choiseIndex;
|
|
125
127
|
}
|
|
126
128
|
};
|
|
127
129
|
|
|
130
|
+
// src/classes/Label.ts
|
|
131
|
+
var Label = class extends LabelAbstract {
|
|
132
|
+
/**
|
|
133
|
+
* @param id is the id of the label
|
|
134
|
+
* @param steps is the list of steps that the label will perform
|
|
135
|
+
* @param props is the properties of the label
|
|
136
|
+
*/
|
|
137
|
+
constructor(id, steps, props) {
|
|
138
|
+
super(id, props);
|
|
139
|
+
this._steps = steps;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Get the steps of the label.
|
|
143
|
+
*/
|
|
144
|
+
get steps() {
|
|
145
|
+
if (typeof this._steps === "function") {
|
|
146
|
+
return this._steps();
|
|
147
|
+
}
|
|
148
|
+
return this._steps;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
128
152
|
// src/classes/CloseLabel.ts
|
|
129
153
|
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
130
154
|
function newCloseLabel(choiseIndex) {
|
|
131
|
-
return new Label(CLOSE_LABEL_ID, [],
|
|
155
|
+
return new Label(CLOSE_LABEL_ID, [], {
|
|
156
|
+
choiseIndex
|
|
157
|
+
});
|
|
132
158
|
}
|
|
133
159
|
|
|
134
160
|
// src/functions/CanvasUtility.ts
|
|
@@ -207,8 +233,6 @@ function getMemoryContainer(element) {
|
|
|
207
233
|
};
|
|
208
234
|
}
|
|
209
235
|
function setMemoryContainer(element, memory) {
|
|
210
|
-
memory.width && (element.width = memory.width);
|
|
211
|
-
memory.height && (element.height = memory.height);
|
|
212
236
|
memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
|
|
213
237
|
memory.blendMode && (element.blendMode = memory.blendMode);
|
|
214
238
|
memory.tint && (element.tint = memory.tint);
|
|
@@ -241,6 +265,8 @@ function setMemoryContainer(element, memory) {
|
|
|
241
265
|
memory.interactive && (element.interactive = memory.interactive);
|
|
242
266
|
memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
|
|
243
267
|
memory.hitArea && (element.hitArea = memory.hitArea);
|
|
268
|
+
memory.width && (element.width = memory.width);
|
|
269
|
+
memory.height && (element.height = memory.height);
|
|
244
270
|
}
|
|
245
271
|
function getTexture(imageUrl) {
|
|
246
272
|
return __async(this, null, function* () {
|
|
@@ -644,16 +670,105 @@ function geTickerInstanceById(tickerId, args, duration, priority) {
|
|
|
644
670
|
// src/types/CloseType.ts
|
|
645
671
|
var Close = "close";
|
|
646
672
|
|
|
647
|
-
// src/
|
|
648
|
-
var
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
673
|
+
// src/classes/ChoiceMenuOption.ts
|
|
674
|
+
var ChoiceMenuOption = class {
|
|
675
|
+
/**
|
|
676
|
+
* @param text Text to be displayed in the menu
|
|
677
|
+
* @param label Label to be opened when the option is selected or the id of the label
|
|
678
|
+
* @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.
|
|
679
|
+
* @param type Type of the label to be opened. @default "call"
|
|
680
|
+
*/
|
|
681
|
+
constructor(text, label, props, type = "call") {
|
|
682
|
+
/**
|
|
683
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
684
|
+
* @example
|
|
685
|
+
* ```tsx
|
|
686
|
+
* setChoiceMenuOptions([
|
|
687
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
688
|
+
* ])
|
|
689
|
+
* return <List>
|
|
690
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
691
|
+
* return (
|
|
692
|
+
* <ChoiceButton
|
|
693
|
+
* disabled={item.props.disabled}
|
|
694
|
+
* onClick={() => {
|
|
695
|
+
* afterSelectChoice(item)
|
|
696
|
+
* }}
|
|
697
|
+
* >
|
|
698
|
+
* {item.text}
|
|
699
|
+
* </ChoiceButton>
|
|
700
|
+
* )
|
|
701
|
+
* })}
|
|
702
|
+
* </List>
|
|
703
|
+
* ```
|
|
704
|
+
*/
|
|
705
|
+
this.props = {};
|
|
706
|
+
this.text = text;
|
|
707
|
+
this._label = label;
|
|
708
|
+
this.type = type;
|
|
709
|
+
if (props) {
|
|
710
|
+
this.props = props;
|
|
711
|
+
}
|
|
654
712
|
}
|
|
655
|
-
|
|
656
|
-
|
|
713
|
+
/**
|
|
714
|
+
* Label to be opened when the option is selected
|
|
715
|
+
*/
|
|
716
|
+
get label() {
|
|
717
|
+
let label = this._label;
|
|
718
|
+
if (typeof label === "string") {
|
|
719
|
+
let res = getLabelById(label);
|
|
720
|
+
if (res) {
|
|
721
|
+
label = res;
|
|
722
|
+
} else {
|
|
723
|
+
console.error(`Label ${label} not found, so it will be closed`);
|
|
724
|
+
label = newCloseLabel();
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
return label;
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
var ChoiceMenuOptionClose = class {
|
|
731
|
+
/**
|
|
732
|
+
* @param text Text to be displayed in the menu
|
|
733
|
+
* @param closeCurrentLabel If true, the current label will be closed. @default false
|
|
734
|
+
*/
|
|
735
|
+
constructor(text, closeCurrentLabel = false) {
|
|
736
|
+
/**
|
|
737
|
+
* Label to be opened when the option is selected
|
|
738
|
+
*/
|
|
739
|
+
this.label = newCloseLabel();
|
|
740
|
+
/**
|
|
741
|
+
* Type of the label to be opened
|
|
742
|
+
*/
|
|
743
|
+
this.type = Close;
|
|
744
|
+
/**
|
|
745
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
746
|
+
* @example
|
|
747
|
+
* ```tsx
|
|
748
|
+
* setChoiceMenuOptions([
|
|
749
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
750
|
+
* ])
|
|
751
|
+
* return <List>
|
|
752
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
753
|
+
* return (
|
|
754
|
+
* <ChoiceButton
|
|
755
|
+
* disabled={item.props.disabled}
|
|
756
|
+
* onClick={() => {
|
|
757
|
+
* afterSelectChoice(item)
|
|
758
|
+
* }}
|
|
759
|
+
* >
|
|
760
|
+
* {item.text}
|
|
761
|
+
* </ChoiceButton>
|
|
762
|
+
* )
|
|
763
|
+
* })}
|
|
764
|
+
* </List>
|
|
765
|
+
* ```
|
|
766
|
+
*/
|
|
767
|
+
this.props = {};
|
|
768
|
+
this.text = text;
|
|
769
|
+
this.closeCurrentLabel = closeCurrentLabel;
|
|
770
|
+
}
|
|
771
|
+
};
|
|
657
772
|
|
|
658
773
|
// src/functions/DialogueUtility.ts
|
|
659
774
|
function getDialogue() {
|
|
@@ -666,21 +781,18 @@ function getChoiceMenuOptions() {
|
|
|
666
781
|
d.forEach((option, index) => {
|
|
667
782
|
if (option.type === Close) {
|
|
668
783
|
let itemLabel = newCloseLabel(index);
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
type: Close,
|
|
673
|
-
closeCurrentLabel: option.closeCurrentLabel,
|
|
674
|
-
props: {}
|
|
675
|
-
});
|
|
784
|
+
let choice = new ChoiceMenuOptionClose(option.text, option.closeCurrentLabel);
|
|
785
|
+
choice.label = itemLabel;
|
|
786
|
+
options.push(choice);
|
|
676
787
|
return;
|
|
677
788
|
}
|
|
678
789
|
let label = getLabelById(option.label);
|
|
679
790
|
if (label) {
|
|
680
|
-
let itemLabel = new Label(label.id, label.steps,
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
})
|
|
791
|
+
let itemLabel = new Label(label.id, label.steps, {
|
|
792
|
+
onStepStart: label.onStepStart,
|
|
793
|
+
choiseIndex: index
|
|
794
|
+
});
|
|
795
|
+
options.push(new ChoiceMenuOption(option.text, itemLabel, option.props, option.type));
|
|
684
796
|
}
|
|
685
797
|
});
|
|
686
798
|
return options;
|
|
@@ -768,8 +880,9 @@ FadeAlphaTicker = __decorateClass([
|
|
|
768
880
|
], FadeAlphaTicker);
|
|
769
881
|
|
|
770
882
|
// src/functions/TickerUtility.ts
|
|
771
|
-
function updateTickerProgression(args, propertyName, progression) {
|
|
772
|
-
|
|
883
|
+
function updateTickerProgression(args, propertyName, progression, valueConvert) {
|
|
884
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
885
|
+
if (args[propertyName] === void 0 || !progression || args[propertyName] === limit) {
|
|
773
886
|
return;
|
|
774
887
|
}
|
|
775
888
|
if (typeof args[propertyName] === "number") {
|
|
@@ -788,22 +901,25 @@ function updateTickerProgression(args, propertyName, progression) {
|
|
|
788
901
|
}
|
|
789
902
|
}
|
|
790
903
|
}
|
|
791
|
-
function getLinearProgression(number, progression) {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
return
|
|
904
|
+
function getLinearProgression(number, progression, valueConvert) {
|
|
905
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
906
|
+
let amt = valueConvert ? valueConvert(progression.amt) : progression.amt;
|
|
907
|
+
if (limit !== void 0) {
|
|
908
|
+
if (number > limit && amt > 0) {
|
|
909
|
+
return limit;
|
|
910
|
+
} else if (number < limit && amt < 0) {
|
|
911
|
+
return limit;
|
|
797
912
|
}
|
|
798
913
|
}
|
|
799
|
-
return number +
|
|
914
|
+
return number + amt;
|
|
800
915
|
}
|
|
801
|
-
function getExponentialProgression(number, progression) {
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
916
|
+
function getExponentialProgression(number, progression, valueConvert) {
|
|
917
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
918
|
+
if (limit !== void 0) {
|
|
919
|
+
if (number > limit && progression.percentage > 0) {
|
|
920
|
+
return limit;
|
|
921
|
+
} else if (number < limit && progression.percentage < 0) {
|
|
922
|
+
return limit;
|
|
807
923
|
}
|
|
808
924
|
}
|
|
809
925
|
return number + number * progression.percentage;
|
|
@@ -816,15 +932,13 @@ var MoveTicker = class extends TickerBase {
|
|
|
816
932
|
let ySpeed = 1;
|
|
817
933
|
if (args.speed) {
|
|
818
934
|
if (typeof args.speed === "number") {
|
|
819
|
-
xSpeed = args.speed;
|
|
820
|
-
ySpeed = args.speed;
|
|
935
|
+
xSpeed = this.speedConvert(args.speed);
|
|
936
|
+
ySpeed = this.speedConvert(args.speed);
|
|
821
937
|
} else {
|
|
822
|
-
xSpeed = args.speed.x;
|
|
823
|
-
ySpeed = args.speed.y;
|
|
938
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
939
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
824
940
|
}
|
|
825
941
|
}
|
|
826
|
-
xSpeed /= 60;
|
|
827
|
-
ySpeed /= 60;
|
|
828
942
|
let destination = args.destination;
|
|
829
943
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
830
944
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -864,7 +978,10 @@ var MoveTicker = class extends TickerBase {
|
|
|
864
978
|
}
|
|
865
979
|
});
|
|
866
980
|
if (args.speedProgression)
|
|
867
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
981
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
982
|
+
}
|
|
983
|
+
speedConvert(speed) {
|
|
984
|
+
return speed / 6;
|
|
868
985
|
}
|
|
869
986
|
};
|
|
870
987
|
MoveTicker = __decorateClass([
|
|
@@ -872,7 +989,7 @@ MoveTicker = __decorateClass([
|
|
|
872
989
|
], MoveTicker);
|
|
873
990
|
var RotateTicker = class extends TickerBase {
|
|
874
991
|
fn(ticker, args, tags, tickerId) {
|
|
875
|
-
let speed = (args.speed === void 0 ? 1 : args.speed)
|
|
992
|
+
let speed = this.speedConvert(args.speed === void 0 ? 1 : args.speed);
|
|
876
993
|
let clockwise = args.clockwise === void 0 ? true : args.clockwise;
|
|
877
994
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
878
995
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -900,7 +1017,10 @@ var RotateTicker = class extends TickerBase {
|
|
|
900
1017
|
}
|
|
901
1018
|
});
|
|
902
1019
|
if (args.speedProgression)
|
|
903
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1020
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1021
|
+
}
|
|
1022
|
+
speedConvert(speed) {
|
|
1023
|
+
return speed / 60;
|
|
904
1024
|
}
|
|
905
1025
|
};
|
|
906
1026
|
RotateTicker = __decorateClass([
|
|
@@ -912,15 +1032,13 @@ var ZoomTicker = class extends TickerBase {
|
|
|
912
1032
|
let ySpeed = 0.1;
|
|
913
1033
|
if (args.speed) {
|
|
914
1034
|
if (typeof args.speed === "number") {
|
|
915
|
-
xSpeed = args.speed;
|
|
916
|
-
ySpeed = args.speed;
|
|
1035
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1036
|
+
ySpeed = this.speedConvert(args.speed);
|
|
917
1037
|
} else {
|
|
918
|
-
xSpeed = args.speed.x;
|
|
919
|
-
ySpeed = args.speed.y;
|
|
1038
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1039
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
920
1040
|
}
|
|
921
1041
|
}
|
|
922
|
-
xSpeed /= 60;
|
|
923
|
-
ySpeed /= 60;
|
|
924
1042
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
925
1043
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
926
1044
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
@@ -987,7 +1105,10 @@ var ZoomTicker = class extends TickerBase {
|
|
|
987
1105
|
}
|
|
988
1106
|
});
|
|
989
1107
|
if (args.speedProgression)
|
|
990
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1108
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1109
|
+
}
|
|
1110
|
+
speedConvert(speed) {
|
|
1111
|
+
return speed / 60;
|
|
991
1112
|
}
|
|
992
1113
|
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
993
1114
|
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
@@ -1000,6 +1121,17 @@ ZoomTicker = __decorateClass([
|
|
|
1000
1121
|
// src/constants.ts
|
|
1001
1122
|
var Repeat = "repeat";
|
|
1002
1123
|
|
|
1124
|
+
// src/decorators/LabelDecorator.ts
|
|
1125
|
+
var registeredLabels = {};
|
|
1126
|
+
function getLabelById(id) {
|
|
1127
|
+
let label = registeredLabels[id];
|
|
1128
|
+
if (!label) {
|
|
1129
|
+
console.error(`[Pixi'VN] Label ${id} not found`);
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
return label;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1003
1135
|
// src/functions/ExportUtility.ts
|
|
1004
1136
|
function createExportableElement(element) {
|
|
1005
1137
|
try {
|
|
@@ -1949,6 +2081,16 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1949
2081
|
static set originalStepData(value) {
|
|
1950
2082
|
_GameStepManager._originalStepData = createExportableElement(value);
|
|
1951
2083
|
}
|
|
2084
|
+
static get currentStepData() {
|
|
2085
|
+
let currentStepData = {
|
|
2086
|
+
path: window.location.pathname,
|
|
2087
|
+
storage: GameStorageManager.export(),
|
|
2088
|
+
canvas: GameWindowManager.export(),
|
|
2089
|
+
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2090
|
+
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2091
|
+
};
|
|
2092
|
+
return currentStepData;
|
|
2093
|
+
}
|
|
1952
2094
|
/* Edit History Methods */
|
|
1953
2095
|
/**
|
|
1954
2096
|
* Add a label to the history.
|
|
@@ -1956,19 +2098,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1956
2098
|
*/
|
|
1957
2099
|
static addStepHistory(step, choiseMade) {
|
|
1958
2100
|
let stepHistory = getStepSha1(step);
|
|
1959
|
-
let
|
|
1960
|
-
path: window.location.pathname,
|
|
1961
|
-
storage: GameStorageManager.export(),
|
|
1962
|
-
canvas: GameWindowManager.export(),
|
|
1963
|
-
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
1964
|
-
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
1965
|
-
};
|
|
2101
|
+
let currentStepData = _GameStepManager.currentStepData;
|
|
1966
2102
|
if (_GameStepManager.originalStepData) {
|
|
1967
|
-
if (_GameStepManager.originalStepData.openedLabels.length ===
|
|
2103
|
+
if (_GameStepManager.originalStepData.openedLabels.length === currentStepData.openedLabels.length) {
|
|
1968
2104
|
try {
|
|
1969
2105
|
let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
|
|
1970
|
-
let historyStepOpenedLabelsString = JSON.stringify(
|
|
1971
|
-
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path ===
|
|
2106
|
+
let historyStepOpenedLabelsString = JSON.stringify(currentStepData.openedLabels);
|
|
2107
|
+
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === currentStepData.path && _GameStepManager.originalStepData.labelIndex === currentStepData.labelIndex) {
|
|
1972
2108
|
return;
|
|
1973
2109
|
}
|
|
1974
2110
|
} catch (e) {
|
|
@@ -1976,7 +2112,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1976
2112
|
}
|
|
1977
2113
|
}
|
|
1978
2114
|
}
|
|
1979
|
-
let data = diff(_GameStepManager.originalStepData,
|
|
2115
|
+
let data = diff(_GameStepManager.originalStepData, currentStepData);
|
|
1980
2116
|
if (data) {
|
|
1981
2117
|
let dialoge = void 0;
|
|
1982
2118
|
let requiredChoices = void 0;
|
|
@@ -1995,7 +2131,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1995
2131
|
index: _GameStepManager.lastStepIndex,
|
|
1996
2132
|
choiceIndexMade: choiseMade
|
|
1997
2133
|
});
|
|
1998
|
-
_GameStepManager.originalStepData =
|
|
2134
|
+
_GameStepManager.originalStepData = currentStepData;
|
|
1999
2135
|
}
|
|
2000
2136
|
_GameStepManager.increaseLastStepIndex();
|
|
2001
2137
|
}
|
|
@@ -2086,6 +2222,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2086
2222
|
console.warn("[Pixi'VN] The player must make a choice");
|
|
2087
2223
|
return;
|
|
2088
2224
|
}
|
|
2225
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2226
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2227
|
+
}
|
|
2089
2228
|
_GameStepManager.increaseCurrentStepIndex();
|
|
2090
2229
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2091
2230
|
});
|
|
@@ -2110,6 +2249,10 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2110
2249
|
return;
|
|
2111
2250
|
}
|
|
2112
2251
|
if (currentLabel.steps.length > currentLabelStepIndex) {
|
|
2252
|
+
let onStepRun = currentLabel.onStepStart;
|
|
2253
|
+
if (onStepRun) {
|
|
2254
|
+
yield onStepRun(currentLabelStepIndex, currentLabel);
|
|
2255
|
+
}
|
|
2113
2256
|
let step = currentLabel.steps[currentLabelStepIndex];
|
|
2114
2257
|
let result = yield step(props);
|
|
2115
2258
|
_GameStepManager.addStepHistory(step, choiseMade);
|
|
@@ -2174,6 +2317,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2174
2317
|
if (!tempLabel) {
|
|
2175
2318
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2176
2319
|
}
|
|
2320
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2321
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2322
|
+
}
|
|
2177
2323
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2178
2324
|
} catch (e) {
|
|
2179
2325
|
console.error("[Pixi'VN] Error calling label", e);
|
|
@@ -2232,6 +2378,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2232
2378
|
if (!tempLabel) {
|
|
2233
2379
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2234
2380
|
}
|
|
2381
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2382
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2383
|
+
}
|
|
2235
2384
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2236
2385
|
} catch (e) {
|
|
2237
2386
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
@@ -2337,24 +2486,29 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2337
2486
|
* ```
|
|
2338
2487
|
*/
|
|
2339
2488
|
static goBack(navigate, steps = 1) {
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2489
|
+
return __async(this, null, function* () {
|
|
2490
|
+
if (steps <= 0) {
|
|
2491
|
+
console.warn("[Pixi'VN] Steps must be greater than 0");
|
|
2492
|
+
return;
|
|
2493
|
+
}
|
|
2494
|
+
if (_GameStepManager._stepsHistory.length <= 1) {
|
|
2495
|
+
console.warn("[Pixi'VN] No steps to go back");
|
|
2496
|
+
return;
|
|
2497
|
+
}
|
|
2498
|
+
let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
|
|
2499
|
+
if (restoredStep) {
|
|
2500
|
+
_GameStepManager._originalStepData = restoredStep;
|
|
2501
|
+
_GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
|
|
2502
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2503
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2504
|
+
}
|
|
2505
|
+
GameStorageManager.import(createExportableElement(restoredStep.storage));
|
|
2506
|
+
GameWindowManager.import(createExportableElement(restoredStep.canvas));
|
|
2507
|
+
navigate(restoredStep.path);
|
|
2508
|
+
} else {
|
|
2509
|
+
console.error("[Pixi'VN] Error going back");
|
|
2510
|
+
}
|
|
2511
|
+
});
|
|
2358
2512
|
}
|
|
2359
2513
|
static goBackInternal(steps, restoredStep) {
|
|
2360
2514
|
if (steps <= 0) {
|
|
@@ -2416,38 +2570,45 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2416
2570
|
* @param dataString The history in a JSON string.
|
|
2417
2571
|
*/
|
|
2418
2572
|
static importJson(dataString) {
|
|
2419
|
-
|
|
2573
|
+
return __async(this, null, function* () {
|
|
2574
|
+
yield _GameStepManager.import(JSON.parse(dataString));
|
|
2575
|
+
});
|
|
2420
2576
|
}
|
|
2421
2577
|
/**
|
|
2422
2578
|
* Import the history from an object.
|
|
2423
2579
|
* @param data The history in an object.
|
|
2424
2580
|
*/
|
|
2425
2581
|
static import(data) {
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2582
|
+
return __async(this, null, function* () {
|
|
2583
|
+
_GameStepManager.clear();
|
|
2584
|
+
try {
|
|
2585
|
+
if (data.hasOwnProperty("stepsHistory")) {
|
|
2586
|
+
_GameStepManager._stepsHistory = data["stepsHistory"];
|
|
2587
|
+
} else {
|
|
2588
|
+
console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
|
|
2589
|
+
}
|
|
2590
|
+
if (data.hasOwnProperty("openedLabels")) {
|
|
2591
|
+
_GameStepManager._openedLabels = data["openedLabels"];
|
|
2592
|
+
} else {
|
|
2593
|
+
console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
|
|
2594
|
+
}
|
|
2595
|
+
if (data.hasOwnProperty("lastStepIndex")) {
|
|
2596
|
+
_GameStepManager._lastStepIndex = data["lastStepIndex"];
|
|
2597
|
+
} else {
|
|
2598
|
+
console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
|
|
2599
|
+
}
|
|
2600
|
+
if (data.hasOwnProperty("originalStepData")) {
|
|
2601
|
+
_GameStepManager._originalStepData = data["originalStepData"];
|
|
2602
|
+
} else {
|
|
2603
|
+
console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
|
|
2604
|
+
}
|
|
2605
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2606
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2607
|
+
}
|
|
2608
|
+
} catch (e) {
|
|
2609
|
+
console.error("[Pixi'VN] Error importing data", e);
|
|
2447
2610
|
}
|
|
2448
|
-
}
|
|
2449
|
-
console.error("[Pixi'VN] Error importing data", e);
|
|
2450
|
-
}
|
|
2611
|
+
});
|
|
2451
2612
|
}
|
|
2452
2613
|
};
|
|
2453
2614
|
/**
|