@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
|
@@ -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/ExportUtility.ts
|
|
@@ -347,8 +373,6 @@ function getMemoryContainer(element) {
|
|
|
347
373
|
};
|
|
348
374
|
}
|
|
349
375
|
function setMemoryContainer(element, memory) {
|
|
350
|
-
memory.width && (element.width = memory.width);
|
|
351
|
-
memory.height && (element.height = memory.height);
|
|
352
376
|
memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
|
|
353
377
|
memory.blendMode && (element.blendMode = memory.blendMode);
|
|
354
378
|
memory.tint && (element.tint = memory.tint);
|
|
@@ -381,6 +405,8 @@ function setMemoryContainer(element, memory) {
|
|
|
381
405
|
memory.interactive && (element.interactive = memory.interactive);
|
|
382
406
|
memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
|
|
383
407
|
memory.hitArea && (element.hitArea = memory.hitArea);
|
|
408
|
+
memory.width && (element.width = memory.width);
|
|
409
|
+
memory.height && (element.height = memory.height);
|
|
384
410
|
}
|
|
385
411
|
function getTexture(imageUrl) {
|
|
386
412
|
return __async(this, null, function* () {
|
|
@@ -1513,16 +1539,105 @@ var GameWindowManager = _GameWindowManager;
|
|
|
1513
1539
|
// src/types/CloseType.ts
|
|
1514
1540
|
var Close = "close";
|
|
1515
1541
|
|
|
1516
|
-
// src/
|
|
1517
|
-
var
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1542
|
+
// src/classes/ChoiceMenuOption.ts
|
|
1543
|
+
var ChoiceMenuOption = class {
|
|
1544
|
+
/**
|
|
1545
|
+
* @param text Text to be displayed in the menu
|
|
1546
|
+
* @param label Label to be opened when the option is selected or the id of the label
|
|
1547
|
+
* @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.
|
|
1548
|
+
* @param type Type of the label to be opened. @default "call"
|
|
1549
|
+
*/
|
|
1550
|
+
constructor(text, label, props, type = "call") {
|
|
1551
|
+
/**
|
|
1552
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
1553
|
+
* @example
|
|
1554
|
+
* ```tsx
|
|
1555
|
+
* setChoiceMenuOptions([
|
|
1556
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
1557
|
+
* ])
|
|
1558
|
+
* return <List>
|
|
1559
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
1560
|
+
* return (
|
|
1561
|
+
* <ChoiceButton
|
|
1562
|
+
* disabled={item.props.disabled}
|
|
1563
|
+
* onClick={() => {
|
|
1564
|
+
* afterSelectChoice(item)
|
|
1565
|
+
* }}
|
|
1566
|
+
* >
|
|
1567
|
+
* {item.text}
|
|
1568
|
+
* </ChoiceButton>
|
|
1569
|
+
* )
|
|
1570
|
+
* })}
|
|
1571
|
+
* </List>
|
|
1572
|
+
* ```
|
|
1573
|
+
*/
|
|
1574
|
+
this.props = {};
|
|
1575
|
+
this.text = text;
|
|
1576
|
+
this._label = label;
|
|
1577
|
+
this.type = type;
|
|
1578
|
+
if (props) {
|
|
1579
|
+
this.props = props;
|
|
1580
|
+
}
|
|
1523
1581
|
}
|
|
1524
|
-
|
|
1525
|
-
|
|
1582
|
+
/**
|
|
1583
|
+
* Label to be opened when the option is selected
|
|
1584
|
+
*/
|
|
1585
|
+
get label() {
|
|
1586
|
+
let label = this._label;
|
|
1587
|
+
if (typeof label === "string") {
|
|
1588
|
+
let res = getLabelById(label);
|
|
1589
|
+
if (res) {
|
|
1590
|
+
label = res;
|
|
1591
|
+
} else {
|
|
1592
|
+
console.error(`Label ${label} not found, so it will be closed`);
|
|
1593
|
+
label = newCloseLabel();
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
return label;
|
|
1597
|
+
}
|
|
1598
|
+
};
|
|
1599
|
+
var ChoiceMenuOptionClose = class {
|
|
1600
|
+
/**
|
|
1601
|
+
* @param text Text to be displayed in the menu
|
|
1602
|
+
* @param closeCurrentLabel If true, the current label will be closed. @default false
|
|
1603
|
+
*/
|
|
1604
|
+
constructor(text, closeCurrentLabel = false) {
|
|
1605
|
+
/**
|
|
1606
|
+
* Label to be opened when the option is selected
|
|
1607
|
+
*/
|
|
1608
|
+
this.label = newCloseLabel();
|
|
1609
|
+
/**
|
|
1610
|
+
* Type of the label to be opened
|
|
1611
|
+
*/
|
|
1612
|
+
this.type = Close;
|
|
1613
|
+
/**
|
|
1614
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
1615
|
+
* @example
|
|
1616
|
+
* ```tsx
|
|
1617
|
+
* setChoiceMenuOptions([
|
|
1618
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
1619
|
+
* ])
|
|
1620
|
+
* return <List>
|
|
1621
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
1622
|
+
* return (
|
|
1623
|
+
* <ChoiceButton
|
|
1624
|
+
* disabled={item.props.disabled}
|
|
1625
|
+
* onClick={() => {
|
|
1626
|
+
* afterSelectChoice(item)
|
|
1627
|
+
* }}
|
|
1628
|
+
* >
|
|
1629
|
+
* {item.text}
|
|
1630
|
+
* </ChoiceButton>
|
|
1631
|
+
* )
|
|
1632
|
+
* })}
|
|
1633
|
+
* </List>
|
|
1634
|
+
* ```
|
|
1635
|
+
*/
|
|
1636
|
+
this.props = {};
|
|
1637
|
+
this.text = text;
|
|
1638
|
+
this.closeCurrentLabel = closeCurrentLabel;
|
|
1639
|
+
}
|
|
1640
|
+
};
|
|
1526
1641
|
|
|
1527
1642
|
// src/functions/DialogueUtility.ts
|
|
1528
1643
|
function getDialogue() {
|
|
@@ -1535,21 +1650,18 @@ function getChoiceMenuOptions() {
|
|
|
1535
1650
|
d.forEach((option, index) => {
|
|
1536
1651
|
if (option.type === Close) {
|
|
1537
1652
|
let itemLabel = newCloseLabel(index);
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
type: Close,
|
|
1542
|
-
closeCurrentLabel: option.closeCurrentLabel,
|
|
1543
|
-
props: {}
|
|
1544
|
-
});
|
|
1653
|
+
let choice = new ChoiceMenuOptionClose(option.text, option.closeCurrentLabel);
|
|
1654
|
+
choice.label = itemLabel;
|
|
1655
|
+
options.push(choice);
|
|
1545
1656
|
return;
|
|
1546
1657
|
}
|
|
1547
1658
|
let label = getLabelById(option.label);
|
|
1548
1659
|
if (label) {
|
|
1549
|
-
let itemLabel = new Label(label.id, label.steps,
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
})
|
|
1660
|
+
let itemLabel = new Label(label.id, label.steps, {
|
|
1661
|
+
onStepStart: label.onStepStart,
|
|
1662
|
+
choiseIndex: index
|
|
1663
|
+
});
|
|
1664
|
+
options.push(new ChoiceMenuOption(option.text, itemLabel, option.props, option.type));
|
|
1553
1665
|
}
|
|
1554
1666
|
});
|
|
1555
1667
|
return options;
|
|
@@ -1605,8 +1717,9 @@ FadeAlphaTicker = __decorateClass([
|
|
|
1605
1717
|
], FadeAlphaTicker);
|
|
1606
1718
|
|
|
1607
1719
|
// src/functions/TickerUtility.ts
|
|
1608
|
-
function updateTickerProgression(args, propertyName, progression) {
|
|
1609
|
-
|
|
1720
|
+
function updateTickerProgression(args, propertyName, progression, valueConvert) {
|
|
1721
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
1722
|
+
if (args[propertyName] === void 0 || !progression || args[propertyName] === limit) {
|
|
1610
1723
|
return;
|
|
1611
1724
|
}
|
|
1612
1725
|
if (typeof args[propertyName] === "number") {
|
|
@@ -1625,22 +1738,25 @@ function updateTickerProgression(args, propertyName, progression) {
|
|
|
1625
1738
|
}
|
|
1626
1739
|
}
|
|
1627
1740
|
}
|
|
1628
|
-
function getLinearProgression(number, progression) {
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
return
|
|
1741
|
+
function getLinearProgression(number, progression, valueConvert) {
|
|
1742
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
1743
|
+
let amt = valueConvert ? valueConvert(progression.amt) : progression.amt;
|
|
1744
|
+
if (limit !== void 0) {
|
|
1745
|
+
if (number > limit && amt > 0) {
|
|
1746
|
+
return limit;
|
|
1747
|
+
} else if (number < limit && amt < 0) {
|
|
1748
|
+
return limit;
|
|
1634
1749
|
}
|
|
1635
1750
|
}
|
|
1636
|
-
return number +
|
|
1751
|
+
return number + amt;
|
|
1637
1752
|
}
|
|
1638
|
-
function getExponentialProgression(number, progression) {
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1753
|
+
function getExponentialProgression(number, progression, valueConvert) {
|
|
1754
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
1755
|
+
if (limit !== void 0) {
|
|
1756
|
+
if (number > limit && progression.percentage > 0) {
|
|
1757
|
+
return limit;
|
|
1758
|
+
} else if (number < limit && progression.percentage < 0) {
|
|
1759
|
+
return limit;
|
|
1644
1760
|
}
|
|
1645
1761
|
}
|
|
1646
1762
|
return number + number * progression.percentage;
|
|
@@ -1653,15 +1769,13 @@ var MoveTicker = class extends TickerBase {
|
|
|
1653
1769
|
let ySpeed = 1;
|
|
1654
1770
|
if (args.speed) {
|
|
1655
1771
|
if (typeof args.speed === "number") {
|
|
1656
|
-
xSpeed = args.speed;
|
|
1657
|
-
ySpeed = args.speed;
|
|
1772
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1773
|
+
ySpeed = this.speedConvert(args.speed);
|
|
1658
1774
|
} else {
|
|
1659
|
-
xSpeed = args.speed.x;
|
|
1660
|
-
ySpeed = args.speed.y;
|
|
1775
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1776
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
1661
1777
|
}
|
|
1662
1778
|
}
|
|
1663
|
-
xSpeed /= 60;
|
|
1664
|
-
ySpeed /= 60;
|
|
1665
1779
|
let destination = args.destination;
|
|
1666
1780
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
1667
1781
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -1701,7 +1815,10 @@ var MoveTicker = class extends TickerBase {
|
|
|
1701
1815
|
}
|
|
1702
1816
|
});
|
|
1703
1817
|
if (args.speedProgression)
|
|
1704
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1818
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1819
|
+
}
|
|
1820
|
+
speedConvert(speed) {
|
|
1821
|
+
return speed / 6;
|
|
1705
1822
|
}
|
|
1706
1823
|
};
|
|
1707
1824
|
MoveTicker = __decorateClass([
|
|
@@ -1709,7 +1826,7 @@ MoveTicker = __decorateClass([
|
|
|
1709
1826
|
], MoveTicker);
|
|
1710
1827
|
var RotateTicker = class extends TickerBase {
|
|
1711
1828
|
fn(ticker, args, tags, tickerId) {
|
|
1712
|
-
let speed = (args.speed === void 0 ? 1 : args.speed)
|
|
1829
|
+
let speed = this.speedConvert(args.speed === void 0 ? 1 : args.speed);
|
|
1713
1830
|
let clockwise = args.clockwise === void 0 ? true : args.clockwise;
|
|
1714
1831
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
1715
1832
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -1737,7 +1854,10 @@ var RotateTicker = class extends TickerBase {
|
|
|
1737
1854
|
}
|
|
1738
1855
|
});
|
|
1739
1856
|
if (args.speedProgression)
|
|
1740
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1857
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1858
|
+
}
|
|
1859
|
+
speedConvert(speed) {
|
|
1860
|
+
return speed / 60;
|
|
1741
1861
|
}
|
|
1742
1862
|
};
|
|
1743
1863
|
RotateTicker = __decorateClass([
|
|
@@ -1749,15 +1869,13 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1749
1869
|
let ySpeed = 0.1;
|
|
1750
1870
|
if (args.speed) {
|
|
1751
1871
|
if (typeof args.speed === "number") {
|
|
1752
|
-
xSpeed = args.speed;
|
|
1753
|
-
ySpeed = args.speed;
|
|
1872
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1873
|
+
ySpeed = this.speedConvert(args.speed);
|
|
1754
1874
|
} else {
|
|
1755
|
-
xSpeed = args.speed.x;
|
|
1756
|
-
ySpeed = args.speed.y;
|
|
1875
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1876
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
1757
1877
|
}
|
|
1758
1878
|
}
|
|
1759
|
-
xSpeed /= 60;
|
|
1760
|
-
ySpeed /= 60;
|
|
1761
1879
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
1762
1880
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
1763
1881
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
@@ -1824,7 +1942,10 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1824
1942
|
}
|
|
1825
1943
|
});
|
|
1826
1944
|
if (args.speedProgression)
|
|
1827
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1945
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1946
|
+
}
|
|
1947
|
+
speedConvert(speed) {
|
|
1948
|
+
return speed / 60;
|
|
1828
1949
|
}
|
|
1829
1950
|
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
1830
1951
|
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
@@ -1834,6 +1955,17 @@ ZoomTicker = __decorateClass([
|
|
|
1834
1955
|
tickerDecorator()
|
|
1835
1956
|
], ZoomTicker);
|
|
1836
1957
|
|
|
1958
|
+
// src/decorators/LabelDecorator.ts
|
|
1959
|
+
var registeredLabels = {};
|
|
1960
|
+
function getLabelById(id) {
|
|
1961
|
+
let label = registeredLabels[id];
|
|
1962
|
+
if (!label) {
|
|
1963
|
+
console.error(`[Pixi'VN] Label ${id} not found`);
|
|
1964
|
+
return;
|
|
1965
|
+
}
|
|
1966
|
+
return label;
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1837
1969
|
// src/functions/DiffUtility.ts
|
|
1838
1970
|
function restoreDeepDiffChanges(data, differences) {
|
|
1839
1971
|
let result = createExportableElement(data);
|
|
@@ -1951,6 +2083,16 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1951
2083
|
static set originalStepData(value) {
|
|
1952
2084
|
_GameStepManager._originalStepData = createExportableElement(value);
|
|
1953
2085
|
}
|
|
2086
|
+
static get currentStepData() {
|
|
2087
|
+
let currentStepData = {
|
|
2088
|
+
path: window.location.pathname,
|
|
2089
|
+
storage: GameStorageManager.export(),
|
|
2090
|
+
canvas: GameWindowManager.export(),
|
|
2091
|
+
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2092
|
+
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2093
|
+
};
|
|
2094
|
+
return currentStepData;
|
|
2095
|
+
}
|
|
1954
2096
|
/* Edit History Methods */
|
|
1955
2097
|
/**
|
|
1956
2098
|
* Add a label to the history.
|
|
@@ -1958,19 +2100,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1958
2100
|
*/
|
|
1959
2101
|
static addStepHistory(step, choiseMade) {
|
|
1960
2102
|
let stepHistory = getStepSha1(step);
|
|
1961
|
-
let
|
|
1962
|
-
path: window.location.pathname,
|
|
1963
|
-
storage: GameStorageManager.export(),
|
|
1964
|
-
canvas: GameWindowManager.export(),
|
|
1965
|
-
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
1966
|
-
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
1967
|
-
};
|
|
2103
|
+
let currentStepData = _GameStepManager.currentStepData;
|
|
1968
2104
|
if (_GameStepManager.originalStepData) {
|
|
1969
|
-
if (_GameStepManager.originalStepData.openedLabels.length ===
|
|
2105
|
+
if (_GameStepManager.originalStepData.openedLabels.length === currentStepData.openedLabels.length) {
|
|
1970
2106
|
try {
|
|
1971
2107
|
let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
|
|
1972
|
-
let historyStepOpenedLabelsString = JSON.stringify(
|
|
1973
|
-
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path ===
|
|
2108
|
+
let historyStepOpenedLabelsString = JSON.stringify(currentStepData.openedLabels);
|
|
2109
|
+
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === currentStepData.path && _GameStepManager.originalStepData.labelIndex === currentStepData.labelIndex) {
|
|
1974
2110
|
return;
|
|
1975
2111
|
}
|
|
1976
2112
|
} catch (e) {
|
|
@@ -1978,7 +2114,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1978
2114
|
}
|
|
1979
2115
|
}
|
|
1980
2116
|
}
|
|
1981
|
-
let data = deepDiff.diff(_GameStepManager.originalStepData,
|
|
2117
|
+
let data = deepDiff.diff(_GameStepManager.originalStepData, currentStepData);
|
|
1982
2118
|
if (data) {
|
|
1983
2119
|
let dialoge = void 0;
|
|
1984
2120
|
let requiredChoices = void 0;
|
|
@@ -1997,7 +2133,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1997
2133
|
index: _GameStepManager.lastStepIndex,
|
|
1998
2134
|
choiceIndexMade: choiseMade
|
|
1999
2135
|
});
|
|
2000
|
-
_GameStepManager.originalStepData =
|
|
2136
|
+
_GameStepManager.originalStepData = currentStepData;
|
|
2001
2137
|
}
|
|
2002
2138
|
_GameStepManager.increaseLastStepIndex();
|
|
2003
2139
|
}
|
|
@@ -2088,6 +2224,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2088
2224
|
console.warn("[Pixi'VN] The player must make a choice");
|
|
2089
2225
|
return;
|
|
2090
2226
|
}
|
|
2227
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2228
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2229
|
+
}
|
|
2091
2230
|
_GameStepManager.increaseCurrentStepIndex();
|
|
2092
2231
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2093
2232
|
});
|
|
@@ -2112,6 +2251,10 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2112
2251
|
return;
|
|
2113
2252
|
}
|
|
2114
2253
|
if (currentLabel.steps.length > currentLabelStepIndex) {
|
|
2254
|
+
let onStepRun = currentLabel.onStepStart;
|
|
2255
|
+
if (onStepRun) {
|
|
2256
|
+
yield onStepRun(currentLabelStepIndex, currentLabel);
|
|
2257
|
+
}
|
|
2115
2258
|
let step = currentLabel.steps[currentLabelStepIndex];
|
|
2116
2259
|
let result = yield step(props);
|
|
2117
2260
|
_GameStepManager.addStepHistory(step, choiseMade);
|
|
@@ -2176,6 +2319,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2176
2319
|
if (!tempLabel) {
|
|
2177
2320
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2178
2321
|
}
|
|
2322
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2323
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2324
|
+
}
|
|
2179
2325
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2180
2326
|
} catch (e) {
|
|
2181
2327
|
console.error("[Pixi'VN] Error calling label", e);
|
|
@@ -2234,6 +2380,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2234
2380
|
if (!tempLabel) {
|
|
2235
2381
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2236
2382
|
}
|
|
2383
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2384
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2385
|
+
}
|
|
2237
2386
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2238
2387
|
} catch (e) {
|
|
2239
2388
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
@@ -2339,24 +2488,29 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2339
2488
|
* ```
|
|
2340
2489
|
*/
|
|
2341
2490
|
static goBack(navigate, steps = 1) {
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2491
|
+
return __async(this, null, function* () {
|
|
2492
|
+
if (steps <= 0) {
|
|
2493
|
+
console.warn("[Pixi'VN] Steps must be greater than 0");
|
|
2494
|
+
return;
|
|
2495
|
+
}
|
|
2496
|
+
if (_GameStepManager._stepsHistory.length <= 1) {
|
|
2497
|
+
console.warn("[Pixi'VN] No steps to go back");
|
|
2498
|
+
return;
|
|
2499
|
+
}
|
|
2500
|
+
let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
|
|
2501
|
+
if (restoredStep) {
|
|
2502
|
+
_GameStepManager._originalStepData = restoredStep;
|
|
2503
|
+
_GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
|
|
2504
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2505
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2506
|
+
}
|
|
2507
|
+
GameStorageManager.import(createExportableElement(restoredStep.storage));
|
|
2508
|
+
GameWindowManager.import(createExportableElement(restoredStep.canvas));
|
|
2509
|
+
navigate(restoredStep.path);
|
|
2510
|
+
} else {
|
|
2511
|
+
console.error("[Pixi'VN] Error going back");
|
|
2512
|
+
}
|
|
2513
|
+
});
|
|
2360
2514
|
}
|
|
2361
2515
|
static goBackInternal(steps, restoredStep) {
|
|
2362
2516
|
if (steps <= 0) {
|
|
@@ -2418,38 +2572,45 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2418
2572
|
* @param dataString The history in a JSON string.
|
|
2419
2573
|
*/
|
|
2420
2574
|
static importJson(dataString) {
|
|
2421
|
-
|
|
2575
|
+
return __async(this, null, function* () {
|
|
2576
|
+
yield _GameStepManager.import(JSON.parse(dataString));
|
|
2577
|
+
});
|
|
2422
2578
|
}
|
|
2423
2579
|
/**
|
|
2424
2580
|
* Import the history from an object.
|
|
2425
2581
|
* @param data The history in an object.
|
|
2426
2582
|
*/
|
|
2427
2583
|
static import(data) {
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2584
|
+
return __async(this, null, function* () {
|
|
2585
|
+
_GameStepManager.clear();
|
|
2586
|
+
try {
|
|
2587
|
+
if (data.hasOwnProperty("stepsHistory")) {
|
|
2588
|
+
_GameStepManager._stepsHistory = data["stepsHistory"];
|
|
2589
|
+
} else {
|
|
2590
|
+
console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
|
|
2591
|
+
}
|
|
2592
|
+
if (data.hasOwnProperty("openedLabels")) {
|
|
2593
|
+
_GameStepManager._openedLabels = data["openedLabels"];
|
|
2594
|
+
} else {
|
|
2595
|
+
console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
|
|
2596
|
+
}
|
|
2597
|
+
if (data.hasOwnProperty("lastStepIndex")) {
|
|
2598
|
+
_GameStepManager._lastStepIndex = data["lastStepIndex"];
|
|
2599
|
+
} else {
|
|
2600
|
+
console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
|
|
2601
|
+
}
|
|
2602
|
+
if (data.hasOwnProperty("originalStepData")) {
|
|
2603
|
+
_GameStepManager._originalStepData = data["originalStepData"];
|
|
2604
|
+
} else {
|
|
2605
|
+
console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
|
|
2606
|
+
}
|
|
2607
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2608
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2609
|
+
}
|
|
2610
|
+
} catch (e) {
|
|
2611
|
+
console.error("[Pixi'VN] Error importing data", e);
|
|
2449
2612
|
}
|
|
2450
|
-
}
|
|
2451
|
-
console.error("[Pixi'VN] Error importing data", e);
|
|
2452
|
-
}
|
|
2613
|
+
});
|
|
2453
2614
|
}
|
|
2454
2615
|
};
|
|
2455
2616
|
/**
|