@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
|
@@ -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/ExportUtility.ts
|
|
@@ -341,8 +367,6 @@ function getMemoryContainer(element) {
|
|
|
341
367
|
};
|
|
342
368
|
}
|
|
343
369
|
function setMemoryContainer(element, memory) {
|
|
344
|
-
memory.width && (element.width = memory.width);
|
|
345
|
-
memory.height && (element.height = memory.height);
|
|
346
370
|
memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
|
|
347
371
|
memory.blendMode && (element.blendMode = memory.blendMode);
|
|
348
372
|
memory.tint && (element.tint = memory.tint);
|
|
@@ -375,6 +399,8 @@ function setMemoryContainer(element, memory) {
|
|
|
375
399
|
memory.interactive && (element.interactive = memory.interactive);
|
|
376
400
|
memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
|
|
377
401
|
memory.hitArea && (element.hitArea = memory.hitArea);
|
|
402
|
+
memory.width && (element.width = memory.width);
|
|
403
|
+
memory.height && (element.height = memory.height);
|
|
378
404
|
}
|
|
379
405
|
function getTexture(imageUrl) {
|
|
380
406
|
return __async(this, null, function* () {
|
|
@@ -1507,16 +1533,105 @@ var GameWindowManager = _GameWindowManager;
|
|
|
1507
1533
|
// src/types/CloseType.ts
|
|
1508
1534
|
var Close = "close";
|
|
1509
1535
|
|
|
1510
|
-
// src/
|
|
1511
|
-
var
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1536
|
+
// src/classes/ChoiceMenuOption.ts
|
|
1537
|
+
var ChoiceMenuOption = class {
|
|
1538
|
+
/**
|
|
1539
|
+
* @param text Text to be displayed in the menu
|
|
1540
|
+
* @param label Label to be opened when the option is selected or the id of the label
|
|
1541
|
+
* @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.
|
|
1542
|
+
* @param type Type of the label to be opened. @default "call"
|
|
1543
|
+
*/
|
|
1544
|
+
constructor(text, label, props, type = "call") {
|
|
1545
|
+
/**
|
|
1546
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
1547
|
+
* @example
|
|
1548
|
+
* ```tsx
|
|
1549
|
+
* setChoiceMenuOptions([
|
|
1550
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
1551
|
+
* ])
|
|
1552
|
+
* return <List>
|
|
1553
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
1554
|
+
* return (
|
|
1555
|
+
* <ChoiceButton
|
|
1556
|
+
* disabled={item.props.disabled}
|
|
1557
|
+
* onClick={() => {
|
|
1558
|
+
* afterSelectChoice(item)
|
|
1559
|
+
* }}
|
|
1560
|
+
* >
|
|
1561
|
+
* {item.text}
|
|
1562
|
+
* </ChoiceButton>
|
|
1563
|
+
* )
|
|
1564
|
+
* })}
|
|
1565
|
+
* </List>
|
|
1566
|
+
* ```
|
|
1567
|
+
*/
|
|
1568
|
+
this.props = {};
|
|
1569
|
+
this.text = text;
|
|
1570
|
+
this._label = label;
|
|
1571
|
+
this.type = type;
|
|
1572
|
+
if (props) {
|
|
1573
|
+
this.props = props;
|
|
1574
|
+
}
|
|
1517
1575
|
}
|
|
1518
|
-
|
|
1519
|
-
|
|
1576
|
+
/**
|
|
1577
|
+
* Label to be opened when the option is selected
|
|
1578
|
+
*/
|
|
1579
|
+
get label() {
|
|
1580
|
+
let label = this._label;
|
|
1581
|
+
if (typeof label === "string") {
|
|
1582
|
+
let res = getLabelById(label);
|
|
1583
|
+
if (res) {
|
|
1584
|
+
label = res;
|
|
1585
|
+
} else {
|
|
1586
|
+
console.error(`Label ${label} not found, so it will be closed`);
|
|
1587
|
+
label = newCloseLabel();
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
return label;
|
|
1591
|
+
}
|
|
1592
|
+
};
|
|
1593
|
+
var ChoiceMenuOptionClose = class {
|
|
1594
|
+
/**
|
|
1595
|
+
* @param text Text to be displayed in the menu
|
|
1596
|
+
* @param closeCurrentLabel If true, the current label will be closed. @default false
|
|
1597
|
+
*/
|
|
1598
|
+
constructor(text, closeCurrentLabel = false) {
|
|
1599
|
+
/**
|
|
1600
|
+
* Label to be opened when the option is selected
|
|
1601
|
+
*/
|
|
1602
|
+
this.label = newCloseLabel();
|
|
1603
|
+
/**
|
|
1604
|
+
* Type of the label to be opened
|
|
1605
|
+
*/
|
|
1606
|
+
this.type = Close;
|
|
1607
|
+
/**
|
|
1608
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
1609
|
+
* @example
|
|
1610
|
+
* ```tsx
|
|
1611
|
+
* setChoiceMenuOptions([
|
|
1612
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
1613
|
+
* ])
|
|
1614
|
+
* return <List>
|
|
1615
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
1616
|
+
* return (
|
|
1617
|
+
* <ChoiceButton
|
|
1618
|
+
* disabled={item.props.disabled}
|
|
1619
|
+
* onClick={() => {
|
|
1620
|
+
* afterSelectChoice(item)
|
|
1621
|
+
* }}
|
|
1622
|
+
* >
|
|
1623
|
+
* {item.text}
|
|
1624
|
+
* </ChoiceButton>
|
|
1625
|
+
* )
|
|
1626
|
+
* })}
|
|
1627
|
+
* </List>
|
|
1628
|
+
* ```
|
|
1629
|
+
*/
|
|
1630
|
+
this.props = {};
|
|
1631
|
+
this.text = text;
|
|
1632
|
+
this.closeCurrentLabel = closeCurrentLabel;
|
|
1633
|
+
}
|
|
1634
|
+
};
|
|
1520
1635
|
|
|
1521
1636
|
// src/functions/DialogueUtility.ts
|
|
1522
1637
|
function getDialogue() {
|
|
@@ -1529,21 +1644,18 @@ function getChoiceMenuOptions() {
|
|
|
1529
1644
|
d.forEach((option, index) => {
|
|
1530
1645
|
if (option.type === Close) {
|
|
1531
1646
|
let itemLabel = newCloseLabel(index);
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
type: Close,
|
|
1536
|
-
closeCurrentLabel: option.closeCurrentLabel,
|
|
1537
|
-
props: {}
|
|
1538
|
-
});
|
|
1647
|
+
let choice = new ChoiceMenuOptionClose(option.text, option.closeCurrentLabel);
|
|
1648
|
+
choice.label = itemLabel;
|
|
1649
|
+
options.push(choice);
|
|
1539
1650
|
return;
|
|
1540
1651
|
}
|
|
1541
1652
|
let label = getLabelById(option.label);
|
|
1542
1653
|
if (label) {
|
|
1543
|
-
let itemLabel = new Label(label.id, label.steps,
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
})
|
|
1654
|
+
let itemLabel = new Label(label.id, label.steps, {
|
|
1655
|
+
onStepStart: label.onStepStart,
|
|
1656
|
+
choiseIndex: index
|
|
1657
|
+
});
|
|
1658
|
+
options.push(new ChoiceMenuOption(option.text, itemLabel, option.props, option.type));
|
|
1547
1659
|
}
|
|
1548
1660
|
});
|
|
1549
1661
|
return options;
|
|
@@ -1599,8 +1711,9 @@ FadeAlphaTicker = __decorateClass([
|
|
|
1599
1711
|
], FadeAlphaTicker);
|
|
1600
1712
|
|
|
1601
1713
|
// src/functions/TickerUtility.ts
|
|
1602
|
-
function updateTickerProgression(args, propertyName, progression) {
|
|
1603
|
-
|
|
1714
|
+
function updateTickerProgression(args, propertyName, progression, valueConvert) {
|
|
1715
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
1716
|
+
if (args[propertyName] === void 0 || !progression || args[propertyName] === limit) {
|
|
1604
1717
|
return;
|
|
1605
1718
|
}
|
|
1606
1719
|
if (typeof args[propertyName] === "number") {
|
|
@@ -1619,22 +1732,25 @@ function updateTickerProgression(args, propertyName, progression) {
|
|
|
1619
1732
|
}
|
|
1620
1733
|
}
|
|
1621
1734
|
}
|
|
1622
|
-
function getLinearProgression(number, progression) {
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
return
|
|
1735
|
+
function getLinearProgression(number, progression, valueConvert) {
|
|
1736
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
1737
|
+
let amt = valueConvert ? valueConvert(progression.amt) : progression.amt;
|
|
1738
|
+
if (limit !== void 0) {
|
|
1739
|
+
if (number > limit && amt > 0) {
|
|
1740
|
+
return limit;
|
|
1741
|
+
} else if (number < limit && amt < 0) {
|
|
1742
|
+
return limit;
|
|
1628
1743
|
}
|
|
1629
1744
|
}
|
|
1630
|
-
return number +
|
|
1745
|
+
return number + amt;
|
|
1631
1746
|
}
|
|
1632
|
-
function getExponentialProgression(number, progression) {
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1747
|
+
function getExponentialProgression(number, progression, valueConvert) {
|
|
1748
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
1749
|
+
if (limit !== void 0) {
|
|
1750
|
+
if (number > limit && progression.percentage > 0) {
|
|
1751
|
+
return limit;
|
|
1752
|
+
} else if (number < limit && progression.percentage < 0) {
|
|
1753
|
+
return limit;
|
|
1638
1754
|
}
|
|
1639
1755
|
}
|
|
1640
1756
|
return number + number * progression.percentage;
|
|
@@ -1647,15 +1763,13 @@ var MoveTicker = class extends TickerBase {
|
|
|
1647
1763
|
let ySpeed = 1;
|
|
1648
1764
|
if (args.speed) {
|
|
1649
1765
|
if (typeof args.speed === "number") {
|
|
1650
|
-
xSpeed = args.speed;
|
|
1651
|
-
ySpeed = args.speed;
|
|
1766
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1767
|
+
ySpeed = this.speedConvert(args.speed);
|
|
1652
1768
|
} else {
|
|
1653
|
-
xSpeed = args.speed.x;
|
|
1654
|
-
ySpeed = args.speed.y;
|
|
1769
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1770
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
1655
1771
|
}
|
|
1656
1772
|
}
|
|
1657
|
-
xSpeed /= 60;
|
|
1658
|
-
ySpeed /= 60;
|
|
1659
1773
|
let destination = args.destination;
|
|
1660
1774
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
1661
1775
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -1695,7 +1809,10 @@ var MoveTicker = class extends TickerBase {
|
|
|
1695
1809
|
}
|
|
1696
1810
|
});
|
|
1697
1811
|
if (args.speedProgression)
|
|
1698
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1812
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1813
|
+
}
|
|
1814
|
+
speedConvert(speed) {
|
|
1815
|
+
return speed / 6;
|
|
1699
1816
|
}
|
|
1700
1817
|
};
|
|
1701
1818
|
MoveTicker = __decorateClass([
|
|
@@ -1703,7 +1820,7 @@ MoveTicker = __decorateClass([
|
|
|
1703
1820
|
], MoveTicker);
|
|
1704
1821
|
var RotateTicker = class extends TickerBase {
|
|
1705
1822
|
fn(ticker, args, tags, tickerId) {
|
|
1706
|
-
let speed = (args.speed === void 0 ? 1 : args.speed)
|
|
1823
|
+
let speed = this.speedConvert(args.speed === void 0 ? 1 : args.speed);
|
|
1707
1824
|
let clockwise = args.clockwise === void 0 ? true : args.clockwise;
|
|
1708
1825
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
1709
1826
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -1731,7 +1848,10 @@ var RotateTicker = class extends TickerBase {
|
|
|
1731
1848
|
}
|
|
1732
1849
|
});
|
|
1733
1850
|
if (args.speedProgression)
|
|
1734
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1851
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1852
|
+
}
|
|
1853
|
+
speedConvert(speed) {
|
|
1854
|
+
return speed / 60;
|
|
1735
1855
|
}
|
|
1736
1856
|
};
|
|
1737
1857
|
RotateTicker = __decorateClass([
|
|
@@ -1743,15 +1863,13 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1743
1863
|
let ySpeed = 0.1;
|
|
1744
1864
|
if (args.speed) {
|
|
1745
1865
|
if (typeof args.speed === "number") {
|
|
1746
|
-
xSpeed = args.speed;
|
|
1747
|
-
ySpeed = args.speed;
|
|
1866
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1867
|
+
ySpeed = this.speedConvert(args.speed);
|
|
1748
1868
|
} else {
|
|
1749
|
-
xSpeed = args.speed.x;
|
|
1750
|
-
ySpeed = args.speed.y;
|
|
1869
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1870
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
1751
1871
|
}
|
|
1752
1872
|
}
|
|
1753
|
-
xSpeed /= 60;
|
|
1754
|
-
ySpeed /= 60;
|
|
1755
1873
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
1756
1874
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
1757
1875
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
@@ -1818,7 +1936,10 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1818
1936
|
}
|
|
1819
1937
|
});
|
|
1820
1938
|
if (args.speedProgression)
|
|
1821
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1939
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1940
|
+
}
|
|
1941
|
+
speedConvert(speed) {
|
|
1942
|
+
return speed / 60;
|
|
1822
1943
|
}
|
|
1823
1944
|
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
1824
1945
|
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
@@ -1828,6 +1949,17 @@ ZoomTicker = __decorateClass([
|
|
|
1828
1949
|
tickerDecorator()
|
|
1829
1950
|
], ZoomTicker);
|
|
1830
1951
|
|
|
1952
|
+
// src/decorators/LabelDecorator.ts
|
|
1953
|
+
var registeredLabels = {};
|
|
1954
|
+
function getLabelById(id) {
|
|
1955
|
+
let label = registeredLabels[id];
|
|
1956
|
+
if (!label) {
|
|
1957
|
+
console.error(`[Pixi'VN] Label ${id} not found`);
|
|
1958
|
+
return;
|
|
1959
|
+
}
|
|
1960
|
+
return label;
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1831
1963
|
// src/functions/DiffUtility.ts
|
|
1832
1964
|
function restoreDeepDiffChanges(data, differences) {
|
|
1833
1965
|
let result = createExportableElement(data);
|
|
@@ -1945,6 +2077,16 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1945
2077
|
static set originalStepData(value) {
|
|
1946
2078
|
_GameStepManager._originalStepData = createExportableElement(value);
|
|
1947
2079
|
}
|
|
2080
|
+
static get currentStepData() {
|
|
2081
|
+
let currentStepData = {
|
|
2082
|
+
path: window.location.pathname,
|
|
2083
|
+
storage: GameStorageManager.export(),
|
|
2084
|
+
canvas: GameWindowManager.export(),
|
|
2085
|
+
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2086
|
+
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2087
|
+
};
|
|
2088
|
+
return currentStepData;
|
|
2089
|
+
}
|
|
1948
2090
|
/* Edit History Methods */
|
|
1949
2091
|
/**
|
|
1950
2092
|
* Add a label to the history.
|
|
@@ -1952,19 +2094,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1952
2094
|
*/
|
|
1953
2095
|
static addStepHistory(step, choiseMade) {
|
|
1954
2096
|
let stepHistory = getStepSha1(step);
|
|
1955
|
-
let
|
|
1956
|
-
path: window.location.pathname,
|
|
1957
|
-
storage: GameStorageManager.export(),
|
|
1958
|
-
canvas: GameWindowManager.export(),
|
|
1959
|
-
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
1960
|
-
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
1961
|
-
};
|
|
2097
|
+
let currentStepData = _GameStepManager.currentStepData;
|
|
1962
2098
|
if (_GameStepManager.originalStepData) {
|
|
1963
|
-
if (_GameStepManager.originalStepData.openedLabels.length ===
|
|
2099
|
+
if (_GameStepManager.originalStepData.openedLabels.length === currentStepData.openedLabels.length) {
|
|
1964
2100
|
try {
|
|
1965
2101
|
let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
|
|
1966
|
-
let historyStepOpenedLabelsString = JSON.stringify(
|
|
1967
|
-
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path ===
|
|
2102
|
+
let historyStepOpenedLabelsString = JSON.stringify(currentStepData.openedLabels);
|
|
2103
|
+
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === currentStepData.path && _GameStepManager.originalStepData.labelIndex === currentStepData.labelIndex) {
|
|
1968
2104
|
return;
|
|
1969
2105
|
}
|
|
1970
2106
|
} catch (e) {
|
|
@@ -1972,7 +2108,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1972
2108
|
}
|
|
1973
2109
|
}
|
|
1974
2110
|
}
|
|
1975
|
-
let data = diff(_GameStepManager.originalStepData,
|
|
2111
|
+
let data = diff(_GameStepManager.originalStepData, currentStepData);
|
|
1976
2112
|
if (data) {
|
|
1977
2113
|
let dialoge = void 0;
|
|
1978
2114
|
let requiredChoices = void 0;
|
|
@@ -1991,7 +2127,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1991
2127
|
index: _GameStepManager.lastStepIndex,
|
|
1992
2128
|
choiceIndexMade: choiseMade
|
|
1993
2129
|
});
|
|
1994
|
-
_GameStepManager.originalStepData =
|
|
2130
|
+
_GameStepManager.originalStepData = currentStepData;
|
|
1995
2131
|
}
|
|
1996
2132
|
_GameStepManager.increaseLastStepIndex();
|
|
1997
2133
|
}
|
|
@@ -2082,6 +2218,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2082
2218
|
console.warn("[Pixi'VN] The player must make a choice");
|
|
2083
2219
|
return;
|
|
2084
2220
|
}
|
|
2221
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2222
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2223
|
+
}
|
|
2085
2224
|
_GameStepManager.increaseCurrentStepIndex();
|
|
2086
2225
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2087
2226
|
});
|
|
@@ -2106,6 +2245,10 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2106
2245
|
return;
|
|
2107
2246
|
}
|
|
2108
2247
|
if (currentLabel.steps.length > currentLabelStepIndex) {
|
|
2248
|
+
let onStepRun = currentLabel.onStepStart;
|
|
2249
|
+
if (onStepRun) {
|
|
2250
|
+
yield onStepRun(currentLabelStepIndex, currentLabel);
|
|
2251
|
+
}
|
|
2109
2252
|
let step = currentLabel.steps[currentLabelStepIndex];
|
|
2110
2253
|
let result = yield step(props);
|
|
2111
2254
|
_GameStepManager.addStepHistory(step, choiseMade);
|
|
@@ -2170,6 +2313,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2170
2313
|
if (!tempLabel) {
|
|
2171
2314
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2172
2315
|
}
|
|
2316
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2317
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2318
|
+
}
|
|
2173
2319
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2174
2320
|
} catch (e) {
|
|
2175
2321
|
console.error("[Pixi'VN] Error calling label", e);
|
|
@@ -2228,6 +2374,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2228
2374
|
if (!tempLabel) {
|
|
2229
2375
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2230
2376
|
}
|
|
2377
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2378
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2379
|
+
}
|
|
2231
2380
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2232
2381
|
} catch (e) {
|
|
2233
2382
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
@@ -2333,24 +2482,29 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2333
2482
|
* ```
|
|
2334
2483
|
*/
|
|
2335
2484
|
static goBack(navigate, steps = 1) {
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2485
|
+
return __async(this, null, function* () {
|
|
2486
|
+
if (steps <= 0) {
|
|
2487
|
+
console.warn("[Pixi'VN] Steps must be greater than 0");
|
|
2488
|
+
return;
|
|
2489
|
+
}
|
|
2490
|
+
if (_GameStepManager._stepsHistory.length <= 1) {
|
|
2491
|
+
console.warn("[Pixi'VN] No steps to go back");
|
|
2492
|
+
return;
|
|
2493
|
+
}
|
|
2494
|
+
let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
|
|
2495
|
+
if (restoredStep) {
|
|
2496
|
+
_GameStepManager._originalStepData = restoredStep;
|
|
2497
|
+
_GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
|
|
2498
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2499
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2500
|
+
}
|
|
2501
|
+
GameStorageManager.import(createExportableElement(restoredStep.storage));
|
|
2502
|
+
GameWindowManager.import(createExportableElement(restoredStep.canvas));
|
|
2503
|
+
navigate(restoredStep.path);
|
|
2504
|
+
} else {
|
|
2505
|
+
console.error("[Pixi'VN] Error going back");
|
|
2506
|
+
}
|
|
2507
|
+
});
|
|
2354
2508
|
}
|
|
2355
2509
|
static goBackInternal(steps, restoredStep) {
|
|
2356
2510
|
if (steps <= 0) {
|
|
@@ -2412,38 +2566,45 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2412
2566
|
* @param dataString The history in a JSON string.
|
|
2413
2567
|
*/
|
|
2414
2568
|
static importJson(dataString) {
|
|
2415
|
-
|
|
2569
|
+
return __async(this, null, function* () {
|
|
2570
|
+
yield _GameStepManager.import(JSON.parse(dataString));
|
|
2571
|
+
});
|
|
2416
2572
|
}
|
|
2417
2573
|
/**
|
|
2418
2574
|
* Import the history from an object.
|
|
2419
2575
|
* @param data The history in an object.
|
|
2420
2576
|
*/
|
|
2421
2577
|
static import(data) {
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2578
|
+
return __async(this, null, function* () {
|
|
2579
|
+
_GameStepManager.clear();
|
|
2580
|
+
try {
|
|
2581
|
+
if (data.hasOwnProperty("stepsHistory")) {
|
|
2582
|
+
_GameStepManager._stepsHistory = data["stepsHistory"];
|
|
2583
|
+
} else {
|
|
2584
|
+
console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
|
|
2585
|
+
}
|
|
2586
|
+
if (data.hasOwnProperty("openedLabels")) {
|
|
2587
|
+
_GameStepManager._openedLabels = data["openedLabels"];
|
|
2588
|
+
} else {
|
|
2589
|
+
console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
|
|
2590
|
+
}
|
|
2591
|
+
if (data.hasOwnProperty("lastStepIndex")) {
|
|
2592
|
+
_GameStepManager._lastStepIndex = data["lastStepIndex"];
|
|
2593
|
+
} else {
|
|
2594
|
+
console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
|
|
2595
|
+
}
|
|
2596
|
+
if (data.hasOwnProperty("originalStepData")) {
|
|
2597
|
+
_GameStepManager._originalStepData = data["originalStepData"];
|
|
2598
|
+
} else {
|
|
2599
|
+
console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
|
|
2600
|
+
}
|
|
2601
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2602
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2603
|
+
}
|
|
2604
|
+
} catch (e) {
|
|
2605
|
+
console.error("[Pixi'VN] Error importing data", e);
|
|
2443
2606
|
}
|
|
2444
|
-
}
|
|
2445
|
-
console.error("[Pixi'VN] Error importing data", e);
|
|
2446
|
-
}
|
|
2607
|
+
});
|
|
2447
2608
|
}
|
|
2448
2609
|
};
|
|
2449
2610
|
/**
|