@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,7 +58,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
// src/constants.ts
|
|
61
|
-
var PIXIVN_VERSION = "0.6.
|
|
61
|
+
var PIXIVN_VERSION = "0.6.6";
|
|
62
62
|
var Repeat = "repeat";
|
|
63
63
|
function getStepSha1(step) {
|
|
64
64
|
let sha1String = sha1__default.default(step.toString().toLocaleLowerCase());
|
|
@@ -68,19 +68,18 @@ function checkIfStepsIsEqual(step1, step2) {
|
|
|
68
68
|
return step1 === step2;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
// src/classes/
|
|
72
|
-
var
|
|
71
|
+
// src/classes/LabelAbstract.ts
|
|
72
|
+
var LabelAbstract = class {
|
|
73
73
|
/**
|
|
74
74
|
* @param id is the id of the label
|
|
75
|
-
* @param
|
|
76
|
-
* @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
|
|
77
|
-
* @param choiseIndex is the index of the choice that the label will perform
|
|
75
|
+
* @param props is the properties of the label
|
|
78
76
|
*/
|
|
79
|
-
constructor(id,
|
|
77
|
+
constructor(id, props) {
|
|
80
78
|
this._id = id;
|
|
81
|
-
this.
|
|
82
|
-
this.
|
|
83
|
-
this.
|
|
79
|
+
this._onStepStart = props == null ? void 0 : props.onStepStart;
|
|
80
|
+
this._onLoadStep = props == null ? void 0 : props.onLoadStep;
|
|
81
|
+
this._onStepEnd = props == null ? void 0 : props.onStepEnd;
|
|
82
|
+
this._choiseIndex = props == null ? void 0 : props.choiseIndex;
|
|
84
83
|
}
|
|
85
84
|
/**
|
|
86
85
|
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
@@ -88,17 +87,6 @@ var Label = class {
|
|
|
88
87
|
get id() {
|
|
89
88
|
return this._id;
|
|
90
89
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Get the steps of the label.
|
|
93
|
-
* This class should be extended and the steps method should be overridden.
|
|
94
|
-
* Every time you update this list will also be updated when the other game versions load.
|
|
95
|
-
*/
|
|
96
|
-
get steps() {
|
|
97
|
-
if (typeof this._steps === "function") {
|
|
98
|
-
return this._steps();
|
|
99
|
-
}
|
|
100
|
-
return this._steps;
|
|
101
|
-
}
|
|
102
90
|
/**
|
|
103
91
|
* Get the corresponding steps number
|
|
104
92
|
* @param externalSteps
|
|
@@ -117,28 +105,66 @@ var Label = class {
|
|
|
117
105
|
return res;
|
|
118
106
|
}
|
|
119
107
|
/**
|
|
120
|
-
*
|
|
108
|
+
* 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.
|
|
109
|
+
* @returns Promise<void> or void
|
|
110
|
+
*/
|
|
111
|
+
get onStepStart() {
|
|
112
|
+
return (stepIndex, label) => __async(this, null, function* () {
|
|
113
|
+
if (this._onLoadStep) {
|
|
114
|
+
yield this._onLoadStep(stepIndex, label);
|
|
115
|
+
}
|
|
116
|
+
if (this._onStepStart) {
|
|
117
|
+
return yield this._onStepStart(stepIndex, label);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* 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.
|
|
123
|
+
* @returns Promise<void> or void
|
|
124
|
+
*/
|
|
125
|
+
get onLoadStep() {
|
|
126
|
+
return this._onLoadStep;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Is a function that will be executed when the step ends.
|
|
121
130
|
* @returns Promise<void> or void
|
|
122
|
-
* @example
|
|
123
|
-
* ```typescript
|
|
124
|
-
* newLabel("id", [], () => {
|
|
125
|
-
* Assets.load('path/to/image1.png')
|
|
126
|
-
* Assets.load('path/to/image2.png')
|
|
127
|
-
* })
|
|
128
|
-
* ```
|
|
129
131
|
*/
|
|
130
|
-
get
|
|
131
|
-
return this.
|
|
132
|
+
get onStepEnd() {
|
|
133
|
+
return this._onStepEnd;
|
|
132
134
|
}
|
|
133
135
|
get choiseIndex() {
|
|
134
136
|
return this._choiseIndex;
|
|
135
137
|
}
|
|
136
138
|
};
|
|
137
139
|
|
|
140
|
+
// src/classes/Label.ts
|
|
141
|
+
var Label = class extends LabelAbstract {
|
|
142
|
+
/**
|
|
143
|
+
* @param id is the id of the label
|
|
144
|
+
* @param steps is the list of steps that the label will perform
|
|
145
|
+
* @param props is the properties of the label
|
|
146
|
+
*/
|
|
147
|
+
constructor(id, steps, props) {
|
|
148
|
+
super(id, props);
|
|
149
|
+
this._steps = steps;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Get the steps of the label.
|
|
153
|
+
*/
|
|
154
|
+
get steps() {
|
|
155
|
+
if (typeof this._steps === "function") {
|
|
156
|
+
return this._steps();
|
|
157
|
+
}
|
|
158
|
+
return this._steps;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
138
162
|
// src/classes/CloseLabel.ts
|
|
139
163
|
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
140
164
|
function newCloseLabel(choiseIndex) {
|
|
141
|
-
return new Label(CLOSE_LABEL_ID, [],
|
|
165
|
+
return new Label(CLOSE_LABEL_ID, [], {
|
|
166
|
+
choiseIndex
|
|
167
|
+
});
|
|
142
168
|
}
|
|
143
169
|
|
|
144
170
|
// src/functions/CanvasUtility.ts
|
|
@@ -217,8 +243,6 @@ function getMemoryContainer(element) {
|
|
|
217
243
|
};
|
|
218
244
|
}
|
|
219
245
|
function setMemoryContainer(element, memory) {
|
|
220
|
-
memory.width && (element.width = memory.width);
|
|
221
|
-
memory.height && (element.height = memory.height);
|
|
222
246
|
memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
|
|
223
247
|
memory.blendMode && (element.blendMode = memory.blendMode);
|
|
224
248
|
memory.tint && (element.tint = memory.tint);
|
|
@@ -251,6 +275,8 @@ function setMemoryContainer(element, memory) {
|
|
|
251
275
|
memory.interactive && (element.interactive = memory.interactive);
|
|
252
276
|
memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
|
|
253
277
|
memory.hitArea && (element.hitArea = memory.hitArea);
|
|
278
|
+
memory.width && (element.width = memory.width);
|
|
279
|
+
memory.height && (element.height = memory.height);
|
|
254
280
|
}
|
|
255
281
|
function getTexture(imageUrl) {
|
|
256
282
|
return __async(this, null, function* () {
|
|
@@ -654,16 +680,105 @@ function geTickerInstanceById(tickerId, args, duration, priority) {
|
|
|
654
680
|
// src/types/CloseType.ts
|
|
655
681
|
var Close = "close";
|
|
656
682
|
|
|
657
|
-
// src/
|
|
658
|
-
var
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
683
|
+
// src/classes/ChoiceMenuOption.ts
|
|
684
|
+
var ChoiceMenuOption = class {
|
|
685
|
+
/**
|
|
686
|
+
* @param text Text to be displayed in the menu
|
|
687
|
+
* @param label Label to be opened when the option is selected or the id of the label
|
|
688
|
+
* @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.
|
|
689
|
+
* @param type Type of the label to be opened. @default "call"
|
|
690
|
+
*/
|
|
691
|
+
constructor(text, label, props, type = "call") {
|
|
692
|
+
/**
|
|
693
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
694
|
+
* @example
|
|
695
|
+
* ```tsx
|
|
696
|
+
* setChoiceMenuOptions([
|
|
697
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
698
|
+
* ])
|
|
699
|
+
* return <List>
|
|
700
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
701
|
+
* return (
|
|
702
|
+
* <ChoiceButton
|
|
703
|
+
* disabled={item.props.disabled}
|
|
704
|
+
* onClick={() => {
|
|
705
|
+
* afterSelectChoice(item)
|
|
706
|
+
* }}
|
|
707
|
+
* >
|
|
708
|
+
* {item.text}
|
|
709
|
+
* </ChoiceButton>
|
|
710
|
+
* )
|
|
711
|
+
* })}
|
|
712
|
+
* </List>
|
|
713
|
+
* ```
|
|
714
|
+
*/
|
|
715
|
+
this.props = {};
|
|
716
|
+
this.text = text;
|
|
717
|
+
this._label = label;
|
|
718
|
+
this.type = type;
|
|
719
|
+
if (props) {
|
|
720
|
+
this.props = props;
|
|
721
|
+
}
|
|
664
722
|
}
|
|
665
|
-
|
|
666
|
-
|
|
723
|
+
/**
|
|
724
|
+
* Label to be opened when the option is selected
|
|
725
|
+
*/
|
|
726
|
+
get label() {
|
|
727
|
+
let label = this._label;
|
|
728
|
+
if (typeof label === "string") {
|
|
729
|
+
let res = getLabelById(label);
|
|
730
|
+
if (res) {
|
|
731
|
+
label = res;
|
|
732
|
+
} else {
|
|
733
|
+
console.error(`Label ${label} not found, so it will be closed`);
|
|
734
|
+
label = newCloseLabel();
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
return label;
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
var ChoiceMenuOptionClose = class {
|
|
741
|
+
/**
|
|
742
|
+
* @param text Text to be displayed in the menu
|
|
743
|
+
* @param closeCurrentLabel If true, the current label will be closed. @default false
|
|
744
|
+
*/
|
|
745
|
+
constructor(text, closeCurrentLabel = false) {
|
|
746
|
+
/**
|
|
747
|
+
* Label to be opened when the option is selected
|
|
748
|
+
*/
|
|
749
|
+
this.label = newCloseLabel();
|
|
750
|
+
/**
|
|
751
|
+
* Type of the label to be opened
|
|
752
|
+
*/
|
|
753
|
+
this.type = Close;
|
|
754
|
+
/**
|
|
755
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
756
|
+
* @example
|
|
757
|
+
* ```tsx
|
|
758
|
+
* setChoiceMenuOptions([
|
|
759
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
760
|
+
* ])
|
|
761
|
+
* return <List>
|
|
762
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
763
|
+
* return (
|
|
764
|
+
* <ChoiceButton
|
|
765
|
+
* disabled={item.props.disabled}
|
|
766
|
+
* onClick={() => {
|
|
767
|
+
* afterSelectChoice(item)
|
|
768
|
+
* }}
|
|
769
|
+
* >
|
|
770
|
+
* {item.text}
|
|
771
|
+
* </ChoiceButton>
|
|
772
|
+
* )
|
|
773
|
+
* })}
|
|
774
|
+
* </List>
|
|
775
|
+
* ```
|
|
776
|
+
*/
|
|
777
|
+
this.props = {};
|
|
778
|
+
this.text = text;
|
|
779
|
+
this.closeCurrentLabel = closeCurrentLabel;
|
|
780
|
+
}
|
|
781
|
+
};
|
|
667
782
|
|
|
668
783
|
// src/functions/DialogueUtility.ts
|
|
669
784
|
function getDialogue() {
|
|
@@ -676,21 +791,18 @@ function getChoiceMenuOptions() {
|
|
|
676
791
|
d.forEach((option, index) => {
|
|
677
792
|
if (option.type === Close) {
|
|
678
793
|
let itemLabel = newCloseLabel(index);
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
type: Close,
|
|
683
|
-
closeCurrentLabel: option.closeCurrentLabel,
|
|
684
|
-
props: {}
|
|
685
|
-
});
|
|
794
|
+
let choice = new ChoiceMenuOptionClose(option.text, option.closeCurrentLabel);
|
|
795
|
+
choice.label = itemLabel;
|
|
796
|
+
options.push(choice);
|
|
686
797
|
return;
|
|
687
798
|
}
|
|
688
799
|
let label = getLabelById(option.label);
|
|
689
800
|
if (label) {
|
|
690
|
-
let itemLabel = new Label(label.id, label.steps,
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
})
|
|
801
|
+
let itemLabel = new Label(label.id, label.steps, {
|
|
802
|
+
onStepStart: label.onStepStart,
|
|
803
|
+
choiseIndex: index
|
|
804
|
+
});
|
|
805
|
+
options.push(new ChoiceMenuOption(option.text, itemLabel, option.props, option.type));
|
|
694
806
|
}
|
|
695
807
|
});
|
|
696
808
|
return options;
|
|
@@ -778,8 +890,9 @@ FadeAlphaTicker = __decorateClass([
|
|
|
778
890
|
], FadeAlphaTicker);
|
|
779
891
|
|
|
780
892
|
// src/functions/TickerUtility.ts
|
|
781
|
-
function updateTickerProgression(args, propertyName, progression) {
|
|
782
|
-
|
|
893
|
+
function updateTickerProgression(args, propertyName, progression, valueConvert) {
|
|
894
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
895
|
+
if (args[propertyName] === void 0 || !progression || args[propertyName] === limit) {
|
|
783
896
|
return;
|
|
784
897
|
}
|
|
785
898
|
if (typeof args[propertyName] === "number") {
|
|
@@ -798,22 +911,25 @@ function updateTickerProgression(args, propertyName, progression) {
|
|
|
798
911
|
}
|
|
799
912
|
}
|
|
800
913
|
}
|
|
801
|
-
function getLinearProgression(number, progression) {
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
return
|
|
914
|
+
function getLinearProgression(number, progression, valueConvert) {
|
|
915
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
916
|
+
let amt = valueConvert ? valueConvert(progression.amt) : progression.amt;
|
|
917
|
+
if (limit !== void 0) {
|
|
918
|
+
if (number > limit && amt > 0) {
|
|
919
|
+
return limit;
|
|
920
|
+
} else if (number < limit && amt < 0) {
|
|
921
|
+
return limit;
|
|
807
922
|
}
|
|
808
923
|
}
|
|
809
|
-
return number +
|
|
924
|
+
return number + amt;
|
|
810
925
|
}
|
|
811
|
-
function getExponentialProgression(number, progression) {
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
926
|
+
function getExponentialProgression(number, progression, valueConvert) {
|
|
927
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
928
|
+
if (limit !== void 0) {
|
|
929
|
+
if (number > limit && progression.percentage > 0) {
|
|
930
|
+
return limit;
|
|
931
|
+
} else if (number < limit && progression.percentage < 0) {
|
|
932
|
+
return limit;
|
|
817
933
|
}
|
|
818
934
|
}
|
|
819
935
|
return number + number * progression.percentage;
|
|
@@ -826,15 +942,13 @@ var MoveTicker = class extends TickerBase {
|
|
|
826
942
|
let ySpeed = 1;
|
|
827
943
|
if (args.speed) {
|
|
828
944
|
if (typeof args.speed === "number") {
|
|
829
|
-
xSpeed = args.speed;
|
|
830
|
-
ySpeed = args.speed;
|
|
945
|
+
xSpeed = this.speedConvert(args.speed);
|
|
946
|
+
ySpeed = this.speedConvert(args.speed);
|
|
831
947
|
} else {
|
|
832
|
-
xSpeed = args.speed.x;
|
|
833
|
-
ySpeed = args.speed.y;
|
|
948
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
949
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
834
950
|
}
|
|
835
951
|
}
|
|
836
|
-
xSpeed /= 60;
|
|
837
|
-
ySpeed /= 60;
|
|
838
952
|
let destination = args.destination;
|
|
839
953
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
840
954
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -874,7 +988,10 @@ var MoveTicker = class extends TickerBase {
|
|
|
874
988
|
}
|
|
875
989
|
});
|
|
876
990
|
if (args.speedProgression)
|
|
877
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
991
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
992
|
+
}
|
|
993
|
+
speedConvert(speed) {
|
|
994
|
+
return speed / 6;
|
|
878
995
|
}
|
|
879
996
|
};
|
|
880
997
|
MoveTicker = __decorateClass([
|
|
@@ -882,7 +999,7 @@ MoveTicker = __decorateClass([
|
|
|
882
999
|
], MoveTicker);
|
|
883
1000
|
var RotateTicker = class extends TickerBase {
|
|
884
1001
|
fn(ticker, args, tags, tickerId) {
|
|
885
|
-
let speed = (args.speed === void 0 ? 1 : args.speed)
|
|
1002
|
+
let speed = this.speedConvert(args.speed === void 0 ? 1 : args.speed);
|
|
886
1003
|
let clockwise = args.clockwise === void 0 ? true : args.clockwise;
|
|
887
1004
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
888
1005
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -910,7 +1027,10 @@ var RotateTicker = class extends TickerBase {
|
|
|
910
1027
|
}
|
|
911
1028
|
});
|
|
912
1029
|
if (args.speedProgression)
|
|
913
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1030
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1031
|
+
}
|
|
1032
|
+
speedConvert(speed) {
|
|
1033
|
+
return speed / 60;
|
|
914
1034
|
}
|
|
915
1035
|
};
|
|
916
1036
|
RotateTicker = __decorateClass([
|
|
@@ -922,15 +1042,13 @@ var ZoomTicker = class extends TickerBase {
|
|
|
922
1042
|
let ySpeed = 0.1;
|
|
923
1043
|
if (args.speed) {
|
|
924
1044
|
if (typeof args.speed === "number") {
|
|
925
|
-
xSpeed = args.speed;
|
|
926
|
-
ySpeed = args.speed;
|
|
1045
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1046
|
+
ySpeed = this.speedConvert(args.speed);
|
|
927
1047
|
} else {
|
|
928
|
-
xSpeed = args.speed.x;
|
|
929
|
-
ySpeed = args.speed.y;
|
|
1048
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1049
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
930
1050
|
}
|
|
931
1051
|
}
|
|
932
|
-
xSpeed /= 60;
|
|
933
|
-
ySpeed /= 60;
|
|
934
1052
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
935
1053
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
936
1054
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
@@ -997,7 +1115,10 @@ var ZoomTicker = class extends TickerBase {
|
|
|
997
1115
|
}
|
|
998
1116
|
});
|
|
999
1117
|
if (args.speedProgression)
|
|
1000
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1118
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1119
|
+
}
|
|
1120
|
+
speedConvert(speed) {
|
|
1121
|
+
return speed / 60;
|
|
1001
1122
|
}
|
|
1002
1123
|
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
1003
1124
|
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
@@ -1007,6 +1128,17 @@ ZoomTicker = __decorateClass([
|
|
|
1007
1128
|
tickerDecorator()
|
|
1008
1129
|
], ZoomTicker);
|
|
1009
1130
|
|
|
1131
|
+
// src/decorators/LabelDecorator.ts
|
|
1132
|
+
var registeredLabels = {};
|
|
1133
|
+
function getLabelById(id) {
|
|
1134
|
+
let label = registeredLabels[id];
|
|
1135
|
+
if (!label) {
|
|
1136
|
+
console.error(`[Pixi'VN] Label ${id} not found`);
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1139
|
+
return label;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1010
1142
|
// src/functions/ExportUtility.ts
|
|
1011
1143
|
function createExportableElement(element) {
|
|
1012
1144
|
try {
|
|
@@ -1956,6 +2088,16 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1956
2088
|
static set originalStepData(value) {
|
|
1957
2089
|
_GameStepManager._originalStepData = createExportableElement(value);
|
|
1958
2090
|
}
|
|
2091
|
+
static get currentStepData() {
|
|
2092
|
+
let currentStepData = {
|
|
2093
|
+
path: window.location.pathname,
|
|
2094
|
+
storage: GameStorageManager.export(),
|
|
2095
|
+
canvas: GameWindowManager.export(),
|
|
2096
|
+
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2097
|
+
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2098
|
+
};
|
|
2099
|
+
return currentStepData;
|
|
2100
|
+
}
|
|
1959
2101
|
/* Edit History Methods */
|
|
1960
2102
|
/**
|
|
1961
2103
|
* Add a label to the history.
|
|
@@ -1963,19 +2105,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1963
2105
|
*/
|
|
1964
2106
|
static addStepHistory(step, choiseMade) {
|
|
1965
2107
|
let stepHistory = getStepSha1(step);
|
|
1966
|
-
let
|
|
1967
|
-
path: window.location.pathname,
|
|
1968
|
-
storage: GameStorageManager.export(),
|
|
1969
|
-
canvas: GameWindowManager.export(),
|
|
1970
|
-
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
1971
|
-
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
1972
|
-
};
|
|
2108
|
+
let currentStepData = _GameStepManager.currentStepData;
|
|
1973
2109
|
if (_GameStepManager.originalStepData) {
|
|
1974
|
-
if (_GameStepManager.originalStepData.openedLabels.length ===
|
|
2110
|
+
if (_GameStepManager.originalStepData.openedLabels.length === currentStepData.openedLabels.length) {
|
|
1975
2111
|
try {
|
|
1976
2112
|
let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
|
|
1977
|
-
let historyStepOpenedLabelsString = JSON.stringify(
|
|
1978
|
-
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path ===
|
|
2113
|
+
let historyStepOpenedLabelsString = JSON.stringify(currentStepData.openedLabels);
|
|
2114
|
+
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === currentStepData.path && _GameStepManager.originalStepData.labelIndex === currentStepData.labelIndex) {
|
|
1979
2115
|
return;
|
|
1980
2116
|
}
|
|
1981
2117
|
} catch (e) {
|
|
@@ -1983,7 +2119,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1983
2119
|
}
|
|
1984
2120
|
}
|
|
1985
2121
|
}
|
|
1986
|
-
let data = deepDiff.diff(_GameStepManager.originalStepData,
|
|
2122
|
+
let data = deepDiff.diff(_GameStepManager.originalStepData, currentStepData);
|
|
1987
2123
|
if (data) {
|
|
1988
2124
|
let dialoge = void 0;
|
|
1989
2125
|
let requiredChoices = void 0;
|
|
@@ -2002,7 +2138,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2002
2138
|
index: _GameStepManager.lastStepIndex,
|
|
2003
2139
|
choiceIndexMade: choiseMade
|
|
2004
2140
|
});
|
|
2005
|
-
_GameStepManager.originalStepData =
|
|
2141
|
+
_GameStepManager.originalStepData = currentStepData;
|
|
2006
2142
|
}
|
|
2007
2143
|
_GameStepManager.increaseLastStepIndex();
|
|
2008
2144
|
}
|
|
@@ -2093,6 +2229,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2093
2229
|
console.warn("[Pixi'VN] The player must make a choice");
|
|
2094
2230
|
return;
|
|
2095
2231
|
}
|
|
2232
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2233
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2234
|
+
}
|
|
2096
2235
|
_GameStepManager.increaseCurrentStepIndex();
|
|
2097
2236
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2098
2237
|
});
|
|
@@ -2117,6 +2256,10 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2117
2256
|
return;
|
|
2118
2257
|
}
|
|
2119
2258
|
if (currentLabel.steps.length > currentLabelStepIndex) {
|
|
2259
|
+
let onStepRun = currentLabel.onStepStart;
|
|
2260
|
+
if (onStepRun) {
|
|
2261
|
+
yield onStepRun(currentLabelStepIndex, currentLabel);
|
|
2262
|
+
}
|
|
2120
2263
|
let step = currentLabel.steps[currentLabelStepIndex];
|
|
2121
2264
|
let result = yield step(props);
|
|
2122
2265
|
_GameStepManager.addStepHistory(step, choiseMade);
|
|
@@ -2181,6 +2324,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2181
2324
|
if (!tempLabel) {
|
|
2182
2325
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2183
2326
|
}
|
|
2327
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2328
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2329
|
+
}
|
|
2184
2330
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2185
2331
|
} catch (e) {
|
|
2186
2332
|
console.error("[Pixi'VN] Error calling label", e);
|
|
@@ -2239,6 +2385,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2239
2385
|
if (!tempLabel) {
|
|
2240
2386
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2241
2387
|
}
|
|
2388
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2389
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2390
|
+
}
|
|
2242
2391
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2243
2392
|
} catch (e) {
|
|
2244
2393
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
@@ -2344,24 +2493,29 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2344
2493
|
* ```
|
|
2345
2494
|
*/
|
|
2346
2495
|
static goBack(navigate, steps = 1) {
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2496
|
+
return __async(this, null, function* () {
|
|
2497
|
+
if (steps <= 0) {
|
|
2498
|
+
console.warn("[Pixi'VN] Steps must be greater than 0");
|
|
2499
|
+
return;
|
|
2500
|
+
}
|
|
2501
|
+
if (_GameStepManager._stepsHistory.length <= 1) {
|
|
2502
|
+
console.warn("[Pixi'VN] No steps to go back");
|
|
2503
|
+
return;
|
|
2504
|
+
}
|
|
2505
|
+
let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
|
|
2506
|
+
if (restoredStep) {
|
|
2507
|
+
_GameStepManager._originalStepData = restoredStep;
|
|
2508
|
+
_GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
|
|
2509
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2510
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2511
|
+
}
|
|
2512
|
+
GameStorageManager.import(createExportableElement(restoredStep.storage));
|
|
2513
|
+
GameWindowManager.import(createExportableElement(restoredStep.canvas));
|
|
2514
|
+
navigate(restoredStep.path);
|
|
2515
|
+
} else {
|
|
2516
|
+
console.error("[Pixi'VN] Error going back");
|
|
2517
|
+
}
|
|
2518
|
+
});
|
|
2365
2519
|
}
|
|
2366
2520
|
static goBackInternal(steps, restoredStep) {
|
|
2367
2521
|
if (steps <= 0) {
|
|
@@ -2423,38 +2577,45 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2423
2577
|
* @param dataString The history in a JSON string.
|
|
2424
2578
|
*/
|
|
2425
2579
|
static importJson(dataString) {
|
|
2426
|
-
|
|
2580
|
+
return __async(this, null, function* () {
|
|
2581
|
+
yield _GameStepManager.import(JSON.parse(dataString));
|
|
2582
|
+
});
|
|
2427
2583
|
}
|
|
2428
2584
|
/**
|
|
2429
2585
|
* Import the history from an object.
|
|
2430
2586
|
* @param data The history in an object.
|
|
2431
2587
|
*/
|
|
2432
2588
|
static import(data) {
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2589
|
+
return __async(this, null, function* () {
|
|
2590
|
+
_GameStepManager.clear();
|
|
2591
|
+
try {
|
|
2592
|
+
if (data.hasOwnProperty("stepsHistory")) {
|
|
2593
|
+
_GameStepManager._stepsHistory = data["stepsHistory"];
|
|
2594
|
+
} else {
|
|
2595
|
+
console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
|
|
2596
|
+
}
|
|
2597
|
+
if (data.hasOwnProperty("openedLabels")) {
|
|
2598
|
+
_GameStepManager._openedLabels = data["openedLabels"];
|
|
2599
|
+
} else {
|
|
2600
|
+
console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
|
|
2601
|
+
}
|
|
2602
|
+
if (data.hasOwnProperty("lastStepIndex")) {
|
|
2603
|
+
_GameStepManager._lastStepIndex = data["lastStepIndex"];
|
|
2604
|
+
} else {
|
|
2605
|
+
console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
|
|
2606
|
+
}
|
|
2607
|
+
if (data.hasOwnProperty("originalStepData")) {
|
|
2608
|
+
_GameStepManager._originalStepData = data["originalStepData"];
|
|
2609
|
+
} else {
|
|
2610
|
+
console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
|
|
2611
|
+
}
|
|
2612
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2613
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2614
|
+
}
|
|
2615
|
+
} catch (e) {
|
|
2616
|
+
console.error("[Pixi'VN] Error importing data", e);
|
|
2454
2617
|
}
|
|
2455
|
-
}
|
|
2456
|
-
console.error("[Pixi'VN] Error importing data", e);
|
|
2457
|
-
}
|
|
2618
|
+
});
|
|
2458
2619
|
}
|
|
2459
2620
|
};
|
|
2460
2621
|
/**
|
|
@@ -2481,13 +2642,17 @@ function getSaveJson() {
|
|
|
2481
2642
|
return JSON.stringify(saveData);
|
|
2482
2643
|
}
|
|
2483
2644
|
function loadSaveData(data, navigate) {
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2645
|
+
return __async(this, null, function* () {
|
|
2646
|
+
yield GameStepManager.import(data.stepData);
|
|
2647
|
+
GameStorageManager.import(data.storageData);
|
|
2648
|
+
GameWindowManager.import(data.canvasData);
|
|
2649
|
+
navigate(data.path);
|
|
2650
|
+
});
|
|
2488
2651
|
}
|
|
2489
2652
|
function loadSaveJson(dataString, navigate) {
|
|
2490
|
-
|
|
2653
|
+
return __async(this, null, function* () {
|
|
2654
|
+
yield loadSaveData(jsonToSaveData(dataString), navigate);
|
|
2655
|
+
});
|
|
2491
2656
|
}
|
|
2492
2657
|
function jsonToSaveData(json) {
|
|
2493
2658
|
return JSON.parse(json);
|