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