@drincs/pixi-vn 0.6.4 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -7
- package/dist/classes/CharacterBaseModel.js +99 -90
- package/dist/classes/CharacterBaseModel.js.map +1 -1
- package/dist/classes/CharacterBaseModel.mjs +99 -90
- package/dist/classes/CharacterBaseModel.mjs.map +1 -1
- package/dist/classes/ChoiceMenuOption.d.mts +71 -8
- package/dist/classes/ChoiceMenuOption.d.ts +71 -8
- package/dist/classes/ChoiceMenuOption.js +160 -77
- package/dist/classes/ChoiceMenuOption.js.map +1 -1
- package/dist/classes/ChoiceMenuOption.mjs +160 -77
- package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
- package/dist/classes/CloseLabel.d.mts +3 -1
- package/dist/classes/CloseLabel.d.ts +3 -1
- package/dist/classes/CloseLabel.js +77 -32
- package/dist/classes/CloseLabel.js.map +1 -1
- package/dist/classes/CloseLabel.mjs +77 -32
- package/dist/classes/CloseLabel.mjs.map +1 -1
- package/dist/classes/Label.d.mts +6 -33
- package/dist/classes/Label.d.ts +6 -33
- package/dist/classes/Label.js +74 -31
- package/dist/classes/Label.js.map +1 -1
- package/dist/classes/Label.mjs +74 -31
- package/dist/classes/Label.mjs.map +1 -1
- package/dist/classes/LabelAbstract.d.mts +50 -0
- package/dist/classes/LabelAbstract.d.ts +50 -0
- package/dist/classes/LabelAbstract.js +100 -0
- package/dist/classes/LabelAbstract.js.map +1 -0
- package/dist/classes/LabelAbstract.mjs +98 -0
- package/dist/classes/LabelAbstract.mjs.map +1 -0
- package/dist/classes/LabelJson.d.mts +30 -0
- package/dist/classes/LabelJson.d.ts +30 -0
- package/dist/classes/LabelJson.js +2766 -0
- package/dist/classes/LabelJson.js.map +1 -0
- package/dist/classes/LabelJson.mjs +2760 -0
- package/dist/classes/LabelJson.mjs.map +1 -0
- package/dist/classes/StoredClassModel.js +42 -33
- package/dist/classes/StoredClassModel.js.map +1 -1
- package/dist/classes/StoredClassModel.mjs +42 -33
- package/dist/classes/StoredClassModel.mjs.map +1 -1
- package/dist/classes/canvas/CanvasContainer.js +2 -2
- package/dist/classes/canvas/CanvasContainer.js.map +1 -1
- package/dist/classes/canvas/CanvasContainer.mjs +2 -2
- package/dist/classes/canvas/CanvasContainer.mjs.map +1 -1
- package/dist/classes/canvas/CanvasImage.js +2 -2
- package/dist/classes/canvas/CanvasImage.js.map +1 -1
- package/dist/classes/canvas/CanvasImage.mjs +2 -2
- package/dist/classes/canvas/CanvasImage.mjs.map +1 -1
- package/dist/classes/canvas/CanvasSprite.js +2 -2
- package/dist/classes/canvas/CanvasSprite.js.map +1 -1
- package/dist/classes/canvas/CanvasSprite.mjs +2 -2
- package/dist/classes/canvas/CanvasSprite.mjs.map +1 -1
- package/dist/classes/canvas/CanvasText.js +2 -2
- package/dist/classes/canvas/CanvasText.js.map +1 -1
- package/dist/classes/canvas/CanvasText.mjs +2 -2
- package/dist/classes/canvas/CanvasText.mjs.map +1 -1
- package/dist/classes/canvas/index.js +2 -2
- package/dist/classes/canvas/index.js.map +1 -1
- package/dist/classes/canvas/index.mjs +2 -2
- package/dist/classes/canvas/index.mjs.map +1 -1
- package/dist/classes/index.d.mts +6 -1
- package/dist/classes/index.d.ts +6 -1
- package/dist/classes/index.js +945 -78
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +945 -79
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/ticker/FadeAlphaTicker.js +42 -33
- package/dist/classes/ticker/FadeAlphaTicker.js.map +1 -1
- package/dist/classes/ticker/FadeAlphaTicker.mjs +42 -33
- package/dist/classes/ticker/FadeAlphaTicker.mjs.map +1 -1
- package/dist/classes/ticker/MoveTicker.d.mts +1 -0
- package/dist/classes/ticker/MoveTicker.d.ts +1 -0
- package/dist/classes/ticker/MoveTicker.js +42 -33
- package/dist/classes/ticker/MoveTicker.js.map +1 -1
- package/dist/classes/ticker/MoveTicker.mjs +42 -33
- package/dist/classes/ticker/MoveTicker.mjs.map +1 -1
- package/dist/classes/ticker/RotateTicker.d.mts +1 -0
- package/dist/classes/ticker/RotateTicker.d.ts +1 -0
- package/dist/classes/ticker/RotateTicker.js +42 -33
- package/dist/classes/ticker/RotateTicker.js.map +1 -1
- package/dist/classes/ticker/RotateTicker.mjs +42 -33
- package/dist/classes/ticker/RotateTicker.mjs.map +1 -1
- package/dist/classes/ticker/ZoomTicker.d.mts +1 -0
- package/dist/classes/ticker/ZoomTicker.d.ts +1 -0
- package/dist/classes/ticker/ZoomTicker.js +42 -33
- package/dist/classes/ticker/ZoomTicker.js.map +1 -1
- package/dist/classes/ticker/ZoomTicker.mjs +42 -33
- package/dist/classes/ticker/ZoomTicker.mjs.map +1 -1
- package/dist/classes/ticker/index.js +42 -33
- package/dist/classes/ticker/index.js.map +1 -1
- package/dist/classes/ticker/index.mjs +42 -33
- package/dist/classes/ticker/index.mjs.map +1 -1
- package/dist/constants.d.mts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/constants.mjs.map +1 -1
- package/dist/decorators/CanvasElementDecorator.js +2 -2
- package/dist/decorators/CanvasElementDecorator.js.map +1 -1
- package/dist/decorators/CanvasElementDecorator.mjs +2 -2
- package/dist/decorators/CanvasElementDecorator.mjs.map +1 -1
- package/dist/decorators/LabelDecorator.d.mts +19 -5
- package/dist/decorators/LabelDecorator.d.ts +19 -5
- package/dist/decorators/LabelDecorator.js +102 -65
- package/dist/decorators/LabelDecorator.js.map +1 -1
- package/dist/decorators/LabelDecorator.mjs +102 -66
- package/dist/decorators/LabelDecorator.mjs.map +1 -1
- package/dist/decorators/index.d.mts +10 -2
- package/dist/decorators/index.d.ts +10 -2
- package/dist/decorators/index.js +98 -65
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +98 -65
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/CanvasUtility.js +2 -2
- package/dist/functions/CanvasUtility.js.map +1 -1
- package/dist/functions/CanvasUtility.mjs +2 -2
- package/dist/functions/CanvasUtility.mjs.map +1 -1
- package/dist/functions/DialogueUtility.d.mts +10 -8
- package/dist/functions/DialogueUtility.d.ts +10 -8
- package/dist/functions/DialogueUtility.js +268 -131
- package/dist/functions/DialogueUtility.js.map +1 -1
- package/dist/functions/DialogueUtility.mjs +268 -131
- package/dist/functions/DialogueUtility.mjs.map +1 -1
- package/dist/functions/FlagsUtility.js +42 -33
- package/dist/functions/FlagsUtility.js.map +1 -1
- package/dist/functions/FlagsUtility.mjs +42 -33
- package/dist/functions/FlagsUtility.mjs.map +1 -1
- package/dist/functions/GameUtility.js +42 -33
- package/dist/functions/GameUtility.js.map +1 -1
- package/dist/functions/GameUtility.mjs +42 -33
- package/dist/functions/GameUtility.mjs.map +1 -1
- package/dist/functions/ImageUtility.js +45 -36
- package/dist/functions/ImageUtility.js.map +1 -1
- package/dist/functions/ImageUtility.mjs +45 -36
- package/dist/functions/ImageUtility.mjs.map +1 -1
- package/dist/functions/Importer.d.mts +24 -0
- package/dist/functions/Importer.d.ts +24 -0
- package/dist/functions/Importer.js +2804 -0
- package/dist/functions/Importer.js.map +1 -0
- package/dist/functions/Importer.mjs +2798 -0
- package/dist/functions/Importer.mjs.map +1 -0
- package/dist/functions/SavesUtility.d.mts +5 -3
- package/dist/functions/SavesUtility.d.ts +5 -3
- package/dist/functions/SavesUtility.js +310 -145
- package/dist/functions/SavesUtility.js.map +1 -1
- package/dist/functions/SavesUtility.mjs +310 -145
- package/dist/functions/SavesUtility.mjs.map +1 -1
- package/dist/functions/TickerUtility.d.mts +2 -1
- package/dist/functions/TickerUtility.d.ts +2 -1
- package/dist/functions/TickerUtility.js +19 -15
- package/dist/functions/TickerUtility.js.map +1 -1
- package/dist/functions/TickerUtility.mjs +19 -15
- package/dist/functions/TickerUtility.mjs.map +1 -1
- package/dist/functions/index.d.mts +7 -2
- package/dist/functions/index.d.ts +7 -2
- package/dist/functions/index.js +364 -140
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +364 -141
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +453 -219
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +453 -221
- package/dist/index.mjs.map +1 -1
- package/dist/interface/IHistoryStep.d.mts +3 -1
- package/dist/interface/IHistoryStep.d.ts +3 -1
- package/dist/interface/ISaveData.d.mts +3 -1
- package/dist/interface/ISaveData.d.ts +3 -1
- package/dist/interface/LabelProps.d.mts +38 -0
- package/dist/interface/LabelProps.d.ts +38 -0
- package/dist/interface/LabelProps.js +4 -0
- package/dist/interface/LabelProps.js.map +1 -0
- package/dist/interface/LabelProps.mjs +3 -0
- package/dist/interface/LabelProps.mjs.map +1 -0
- package/dist/interface/export/ExportedStep.d.mts +3 -1
- package/dist/interface/export/ExportedStep.d.ts +3 -1
- package/dist/interface/export/index.d.mts +3 -1
- package/dist/interface/export/index.d.ts +3 -1
- package/dist/interface/index.d.mts +3 -1
- package/dist/interface/index.d.ts +3 -1
- package/dist/labels/BaseCanvasElementTestLabel.d.mts +3 -1
- package/dist/labels/BaseCanvasElementTestLabel.d.ts +3 -1
- package/dist/labels/BaseCanvasElementTestLabel.js +303 -136
- package/dist/labels/BaseCanvasElementTestLabel.js.map +1 -1
- package/dist/labels/BaseCanvasElementTestLabel.mjs +304 -137
- package/dist/labels/BaseCanvasElementTestLabel.mjs.map +1 -1
- package/dist/labels/CanvasEventsTestLabel.d.mts +4 -5
- package/dist/labels/CanvasEventsTestLabel.d.ts +4 -5
- package/dist/labels/CanvasEventsTestLabel.js +313 -148
- package/dist/labels/CanvasEventsTestLabel.js.map +1 -1
- package/dist/labels/CanvasEventsTestLabel.mjs +314 -149
- package/dist/labels/CanvasEventsTestLabel.mjs.map +1 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.d.mts +3 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.d.ts +3 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.js +294 -133
- package/dist/labels/CustomTickerCanvasElementTestLabel.js.map +1 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs +295 -134
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs.map +1 -1
- package/dist/labels/ImagesAnimationsTestLabel.d.mts +3 -1
- package/dist/labels/ImagesAnimationsTestLabel.d.ts +3 -1
- package/dist/labels/ImagesAnimationsTestLabel.js +298 -181
- package/dist/labels/ImagesAnimationsTestLabel.js.map +1 -1
- package/dist/labels/ImagesAnimationsTestLabel.mjs +299 -182
- package/dist/labels/ImagesAnimationsTestLabel.mjs.map +1 -1
- package/dist/labels/MarkdownTest.d.mts +3 -1
- package/dist/labels/MarkdownTest.d.ts +3 -1
- package/dist/labels/MarkdownTest.js +294 -133
- package/dist/labels/MarkdownTest.js.map +1 -1
- package/dist/labels/MarkdownTest.mjs +294 -133
- package/dist/labels/MarkdownTest.mjs.map +1 -1
- package/dist/labels/StartLabel.d.mts +3 -1
- package/dist/labels/StartLabel.d.ts +3 -1
- package/dist/labels/StartLabel.js +360 -213
- package/dist/labels/StartLabel.js.map +1 -1
- package/dist/labels/StartLabel.mjs +361 -214
- package/dist/labels/StartLabel.mjs.map +1 -1
- package/dist/labels/StepLabelTest.d.mts +11 -0
- package/dist/labels/StepLabelTest.d.ts +11 -0
- package/dist/labels/StepLabelTest.js +2861 -0
- package/dist/labels/StepLabelTest.js.map +1 -0
- package/dist/labels/StepLabelTest.mjs +2855 -0
- package/dist/labels/StepLabelTest.mjs.map +1 -0
- package/dist/labels/TestConstant.js +43 -34
- package/dist/labels/TestConstant.js.map +1 -1
- package/dist/labels/TestConstant.mjs +43 -34
- package/dist/labels/TestConstant.mjs.map +1 -1
- package/dist/labels/index.d.mts +3 -1
- package/dist/labels/index.d.ts +3 -1
- package/dist/labels/index.js +360 -213
- package/dist/labels/index.js.map +1 -1
- package/dist/labels/index.mjs +361 -214
- package/dist/labels/index.mjs.map +1 -1
- package/dist/managers/StepManager.d.mts +10 -7
- package/dist/managers/StepManager.d.ts +10 -7
- package/dist/managers/StepManager.js +300 -139
- package/dist/managers/StepManager.js.map +1 -1
- package/dist/managers/StepManager.mjs +300 -139
- package/dist/managers/StepManager.mjs.map +1 -1
- package/dist/managers/WindowManager.js +2 -2
- package/dist/managers/WindowManager.js.map +1 -1
- package/dist/managers/WindowManager.mjs +2 -2
- package/dist/managers/WindowManager.mjs.map +1 -1
- package/dist/managers/index.d.mts +7 -5
- package/dist/managers/index.d.ts +7 -5
- package/dist/managers/index.js +300 -139
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +300 -139
- package/dist/managers/index.mjs.map +1 -1
- package/dist/types/ChoiceMenuOptionsType.d.mts +3 -1
- package/dist/types/ChoiceMenuOptionsType.d.ts +3 -1
- package/dist/types/LabelJsonType.d.mts +22 -0
- package/dist/types/LabelJsonType.d.ts +22 -0
- package/dist/types/LabelJsonType.js +4 -0
- package/dist/types/LabelJsonType.js.map +1 -0
- package/dist/types/LabelJsonType.mjs +3 -0
- package/dist/types/LabelJsonType.mjs.map +1 -0
- package/dist/types/StepLabelJsonType.d.mts +30 -0
- package/dist/types/StepLabelJsonType.d.ts +30 -0
- package/dist/types/StepLabelJsonType.js +4 -0
- package/dist/types/StepLabelJsonType.js.map +1 -0
- package/dist/types/StepLabelJsonType.mjs +3 -0
- package/dist/types/StepLabelJsonType.mjs.map +1 -0
- package/dist/types/index.d.mts +4 -0
- package/dist/types/index.d.ts +4 -0
- package/package.json +7 -6
package/dist/functions/index.js
CHANGED
|
@@ -64,19 +64,18 @@ function checkIfStepsIsEqual(step1, step2) {
|
|
|
64
64
|
return step1 === step2;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
// src/classes/
|
|
68
|
-
var
|
|
67
|
+
// src/classes/LabelAbstract.ts
|
|
68
|
+
var LabelAbstract = class {
|
|
69
69
|
/**
|
|
70
70
|
* @param id is the id of the label
|
|
71
|
-
* @param
|
|
72
|
-
* @param onStepRun is a function that will be executed before any step is executed, is useful for example to make sure all images used have been cached
|
|
73
|
-
* @param choiseIndex is the index of the choice that the label will perform
|
|
71
|
+
* @param props is the properties of the label
|
|
74
72
|
*/
|
|
75
|
-
constructor(id,
|
|
73
|
+
constructor(id, props) {
|
|
76
74
|
this._id = id;
|
|
77
|
-
this.
|
|
78
|
-
this.
|
|
79
|
-
this.
|
|
75
|
+
this._onStepStart = props == null ? void 0 : props.onStepStart;
|
|
76
|
+
this._onLoadStep = props == null ? void 0 : props.onLoadStep;
|
|
77
|
+
this._onStepEnd = props == null ? void 0 : props.onStepEnd;
|
|
78
|
+
this._choiseIndex = props == null ? void 0 : props.choiseIndex;
|
|
80
79
|
}
|
|
81
80
|
/**
|
|
82
81
|
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
@@ -84,17 +83,6 @@ var Label = class {
|
|
|
84
83
|
get id() {
|
|
85
84
|
return this._id;
|
|
86
85
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Get the steps of the label.
|
|
89
|
-
* This class should be extended and the steps method should be overridden.
|
|
90
|
-
* Every time you update this list will also be updated when the other game versions load.
|
|
91
|
-
*/
|
|
92
|
-
get steps() {
|
|
93
|
-
if (typeof this._steps === "function") {
|
|
94
|
-
return this._steps();
|
|
95
|
-
}
|
|
96
|
-
return this._steps;
|
|
97
|
-
}
|
|
98
86
|
/**
|
|
99
87
|
* Get the corresponding steps number
|
|
100
88
|
* @param externalSteps
|
|
@@ -113,28 +101,66 @@ var Label = class {
|
|
|
113
101
|
return res;
|
|
114
102
|
}
|
|
115
103
|
/**
|
|
116
|
-
*
|
|
104
|
+
* Is a function that will be executed in {@link Label#onStepStart} and when the user goes back to it or when the user laods a save file.
|
|
105
|
+
* @returns Promise<void> or void
|
|
106
|
+
*/
|
|
107
|
+
get onStepStart() {
|
|
108
|
+
return (stepIndex, label) => __async(this, null, function* () {
|
|
109
|
+
if (this._onLoadStep) {
|
|
110
|
+
yield this._onLoadStep(stepIndex, label);
|
|
111
|
+
}
|
|
112
|
+
if (this._onStepStart) {
|
|
113
|
+
return yield this._onStepStart(stepIndex, label);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Get the function that will be executed a old step is reloaded. A step is reloaded when the user goes back to it or when the user laods a save file.
|
|
117
119
|
* @returns Promise<void> or void
|
|
118
|
-
* @example
|
|
119
|
-
* ```typescript
|
|
120
|
-
* newLabel("id", [], () => {
|
|
121
|
-
* Assets.load('path/to/image1.png')
|
|
122
|
-
* Assets.load('path/to/image2.png')
|
|
123
|
-
* })
|
|
124
|
-
* ```
|
|
125
120
|
*/
|
|
126
|
-
get
|
|
127
|
-
return this.
|
|
121
|
+
get onLoadStep() {
|
|
122
|
+
return this._onLoadStep;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Is a function that will be executed when the step ends.
|
|
126
|
+
* @returns Promise<void> or void
|
|
127
|
+
*/
|
|
128
|
+
get onStepEnd() {
|
|
129
|
+
return this._onStepEnd;
|
|
128
130
|
}
|
|
129
131
|
get choiseIndex() {
|
|
130
132
|
return this._choiseIndex;
|
|
131
133
|
}
|
|
132
134
|
};
|
|
133
135
|
|
|
136
|
+
// src/classes/Label.ts
|
|
137
|
+
var Label = class extends LabelAbstract {
|
|
138
|
+
/**
|
|
139
|
+
* @param id is the id of the label
|
|
140
|
+
* @param steps is the list of steps that the label will perform
|
|
141
|
+
* @param props is the properties of the label
|
|
142
|
+
*/
|
|
143
|
+
constructor(id, steps, props) {
|
|
144
|
+
super(id, props);
|
|
145
|
+
this._steps = steps;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Get the steps of the label.
|
|
149
|
+
*/
|
|
150
|
+
get steps() {
|
|
151
|
+
if (typeof this._steps === "function") {
|
|
152
|
+
return this._steps();
|
|
153
|
+
}
|
|
154
|
+
return this._steps;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
134
158
|
// src/classes/CloseLabel.ts
|
|
135
159
|
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
136
160
|
function newCloseLabel(choiseIndex) {
|
|
137
|
-
return new Label(CLOSE_LABEL_ID, [],
|
|
161
|
+
return new Label(CLOSE_LABEL_ID, [], {
|
|
162
|
+
choiseIndex
|
|
163
|
+
});
|
|
138
164
|
}
|
|
139
165
|
|
|
140
166
|
// src/decorators/LabelDecorator.ts
|
|
@@ -147,6 +173,9 @@ function getLabelById(id) {
|
|
|
147
173
|
}
|
|
148
174
|
return label;
|
|
149
175
|
}
|
|
176
|
+
function saveLabel(label) {
|
|
177
|
+
registeredLabels[label.id] = label;
|
|
178
|
+
}
|
|
150
179
|
|
|
151
180
|
// src/functions/ExportUtility.ts
|
|
152
181
|
function createExportableElement(element) {
|
|
@@ -316,7 +345,7 @@ var TickerBase = class {
|
|
|
316
345
|
};
|
|
317
346
|
|
|
318
347
|
// src/constants.ts
|
|
319
|
-
var PIXIVN_VERSION = "0.6.
|
|
348
|
+
var PIXIVN_VERSION = "0.6.6";
|
|
320
349
|
var Repeat = "repeat";
|
|
321
350
|
function Pause(duration) {
|
|
322
351
|
return {
|
|
@@ -406,8 +435,6 @@ function getMemoryContainer(element) {
|
|
|
406
435
|
};
|
|
407
436
|
}
|
|
408
437
|
function setMemoryContainer(element, memory) {
|
|
409
|
-
memory.width && (element.width = memory.width);
|
|
410
|
-
memory.height && (element.height = memory.height);
|
|
411
438
|
memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
|
|
412
439
|
memory.blendMode && (element.blendMode = memory.blendMode);
|
|
413
440
|
memory.tint && (element.tint = memory.tint);
|
|
@@ -440,6 +467,8 @@ function setMemoryContainer(element, memory) {
|
|
|
440
467
|
memory.interactive && (element.interactive = memory.interactive);
|
|
441
468
|
memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
|
|
442
469
|
memory.hitArea && (element.hitArea = memory.hitArea);
|
|
470
|
+
memory.width && (element.width = memory.width);
|
|
471
|
+
memory.height && (element.height = memory.height);
|
|
443
472
|
}
|
|
444
473
|
function getTexture(imageUrl) {
|
|
445
474
|
return __async(this, null, function* () {
|
|
@@ -1645,6 +1674,16 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1645
1674
|
static set originalStepData(value) {
|
|
1646
1675
|
_GameStepManager._originalStepData = createExportableElement(value);
|
|
1647
1676
|
}
|
|
1677
|
+
static get currentStepData() {
|
|
1678
|
+
let currentStepData = {
|
|
1679
|
+
path: window.location.pathname,
|
|
1680
|
+
storage: GameStorageManager.export(),
|
|
1681
|
+
canvas: GameWindowManager.export(),
|
|
1682
|
+
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
1683
|
+
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
1684
|
+
};
|
|
1685
|
+
return currentStepData;
|
|
1686
|
+
}
|
|
1648
1687
|
/* Edit History Methods */
|
|
1649
1688
|
/**
|
|
1650
1689
|
* Add a label to the history.
|
|
@@ -1652,19 +1691,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1652
1691
|
*/
|
|
1653
1692
|
static addStepHistory(step, choiseMade) {
|
|
1654
1693
|
let stepHistory = getStepSha1(step);
|
|
1655
|
-
let
|
|
1656
|
-
path: window.location.pathname,
|
|
1657
|
-
storage: GameStorageManager.export(),
|
|
1658
|
-
canvas: GameWindowManager.export(),
|
|
1659
|
-
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
1660
|
-
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
1661
|
-
};
|
|
1694
|
+
let currentStepData = _GameStepManager.currentStepData;
|
|
1662
1695
|
if (_GameStepManager.originalStepData) {
|
|
1663
|
-
if (_GameStepManager.originalStepData.openedLabels.length ===
|
|
1696
|
+
if (_GameStepManager.originalStepData.openedLabels.length === currentStepData.openedLabels.length) {
|
|
1664
1697
|
try {
|
|
1665
1698
|
let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
|
|
1666
|
-
let historyStepOpenedLabelsString = JSON.stringify(
|
|
1667
|
-
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path ===
|
|
1699
|
+
let historyStepOpenedLabelsString = JSON.stringify(currentStepData.openedLabels);
|
|
1700
|
+
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === currentStepData.path && _GameStepManager.originalStepData.labelIndex === currentStepData.labelIndex) {
|
|
1668
1701
|
return;
|
|
1669
1702
|
}
|
|
1670
1703
|
} catch (e) {
|
|
@@ -1672,7 +1705,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1672
1705
|
}
|
|
1673
1706
|
}
|
|
1674
1707
|
}
|
|
1675
|
-
let data = deepDiff.diff(_GameStepManager.originalStepData,
|
|
1708
|
+
let data = deepDiff.diff(_GameStepManager.originalStepData, currentStepData);
|
|
1676
1709
|
if (data) {
|
|
1677
1710
|
let dialoge = void 0;
|
|
1678
1711
|
let requiredChoices = void 0;
|
|
@@ -1691,7 +1724,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1691
1724
|
index: _GameStepManager.lastStepIndex,
|
|
1692
1725
|
choiceIndexMade: choiseMade
|
|
1693
1726
|
});
|
|
1694
|
-
_GameStepManager.originalStepData =
|
|
1727
|
+
_GameStepManager.originalStepData = currentStepData;
|
|
1695
1728
|
}
|
|
1696
1729
|
_GameStepManager.increaseLastStepIndex();
|
|
1697
1730
|
}
|
|
@@ -1782,6 +1815,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1782
1815
|
console.warn("[Pixi'VN] The player must make a choice");
|
|
1783
1816
|
return;
|
|
1784
1817
|
}
|
|
1818
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
1819
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
1820
|
+
}
|
|
1785
1821
|
_GameStepManager.increaseCurrentStepIndex();
|
|
1786
1822
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
1787
1823
|
});
|
|
@@ -1806,6 +1842,10 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1806
1842
|
return;
|
|
1807
1843
|
}
|
|
1808
1844
|
if (currentLabel.steps.length > currentLabelStepIndex) {
|
|
1845
|
+
let onStepRun = currentLabel.onStepStart;
|
|
1846
|
+
if (onStepRun) {
|
|
1847
|
+
yield onStepRun(currentLabelStepIndex, currentLabel);
|
|
1848
|
+
}
|
|
1809
1849
|
let step = currentLabel.steps[currentLabelStepIndex];
|
|
1810
1850
|
let result = yield step(props);
|
|
1811
1851
|
_GameStepManager.addStepHistory(step, choiseMade);
|
|
@@ -1870,6 +1910,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1870
1910
|
if (!tempLabel) {
|
|
1871
1911
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
1872
1912
|
}
|
|
1913
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
1914
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
1915
|
+
}
|
|
1873
1916
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
1874
1917
|
} catch (e) {
|
|
1875
1918
|
console.error("[Pixi'VN] Error calling label", e);
|
|
@@ -1928,6 +1971,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1928
1971
|
if (!tempLabel) {
|
|
1929
1972
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
1930
1973
|
}
|
|
1974
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
1975
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
1976
|
+
}
|
|
1931
1977
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
1932
1978
|
} catch (e) {
|
|
1933
1979
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
@@ -2033,24 +2079,29 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2033
2079
|
* ```
|
|
2034
2080
|
*/
|
|
2035
2081
|
static goBack(navigate, steps = 1) {
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2082
|
+
return __async(this, null, function* () {
|
|
2083
|
+
if (steps <= 0) {
|
|
2084
|
+
console.warn("[Pixi'VN] Steps must be greater than 0");
|
|
2085
|
+
return;
|
|
2086
|
+
}
|
|
2087
|
+
if (_GameStepManager._stepsHistory.length <= 1) {
|
|
2088
|
+
console.warn("[Pixi'VN] No steps to go back");
|
|
2089
|
+
return;
|
|
2090
|
+
}
|
|
2091
|
+
let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
|
|
2092
|
+
if (restoredStep) {
|
|
2093
|
+
_GameStepManager._originalStepData = restoredStep;
|
|
2094
|
+
_GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
|
|
2095
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2096
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2097
|
+
}
|
|
2098
|
+
GameStorageManager.import(createExportableElement(restoredStep.storage));
|
|
2099
|
+
GameWindowManager.import(createExportableElement(restoredStep.canvas));
|
|
2100
|
+
navigate(restoredStep.path);
|
|
2101
|
+
} else {
|
|
2102
|
+
console.error("[Pixi'VN] Error going back");
|
|
2103
|
+
}
|
|
2104
|
+
});
|
|
2054
2105
|
}
|
|
2055
2106
|
static goBackInternal(steps, restoredStep) {
|
|
2056
2107
|
if (steps <= 0) {
|
|
@@ -2112,38 +2163,45 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2112
2163
|
* @param dataString The history in a JSON string.
|
|
2113
2164
|
*/
|
|
2114
2165
|
static importJson(dataString) {
|
|
2115
|
-
|
|
2166
|
+
return __async(this, null, function* () {
|
|
2167
|
+
yield _GameStepManager.import(JSON.parse(dataString));
|
|
2168
|
+
});
|
|
2116
2169
|
}
|
|
2117
2170
|
/**
|
|
2118
2171
|
* Import the history from an object.
|
|
2119
2172
|
* @param data The history in an object.
|
|
2120
2173
|
*/
|
|
2121
2174
|
static import(data) {
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2175
|
+
return __async(this, null, function* () {
|
|
2176
|
+
_GameStepManager.clear();
|
|
2177
|
+
try {
|
|
2178
|
+
if (data.hasOwnProperty("stepsHistory")) {
|
|
2179
|
+
_GameStepManager._stepsHistory = data["stepsHistory"];
|
|
2180
|
+
} else {
|
|
2181
|
+
console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
|
|
2182
|
+
}
|
|
2183
|
+
if (data.hasOwnProperty("openedLabels")) {
|
|
2184
|
+
_GameStepManager._openedLabels = data["openedLabels"];
|
|
2185
|
+
} else {
|
|
2186
|
+
console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
|
|
2187
|
+
}
|
|
2188
|
+
if (data.hasOwnProperty("lastStepIndex")) {
|
|
2189
|
+
_GameStepManager._lastStepIndex = data["lastStepIndex"];
|
|
2190
|
+
} else {
|
|
2191
|
+
console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
|
|
2192
|
+
}
|
|
2193
|
+
if (data.hasOwnProperty("originalStepData")) {
|
|
2194
|
+
_GameStepManager._originalStepData = data["originalStepData"];
|
|
2195
|
+
} else {
|
|
2196
|
+
console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
|
|
2197
|
+
}
|
|
2198
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2199
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2200
|
+
}
|
|
2201
|
+
} catch (e) {
|
|
2202
|
+
console.error("[Pixi'VN] Error importing data", e);
|
|
2143
2203
|
}
|
|
2144
|
-
}
|
|
2145
|
-
console.error("[Pixi'VN] Error importing data", e);
|
|
2146
|
-
}
|
|
2204
|
+
});
|
|
2147
2205
|
}
|
|
2148
2206
|
};
|
|
2149
2207
|
/**
|
|
@@ -2159,6 +2217,62 @@ var GameStepManager = _GameStepManager;
|
|
|
2159
2217
|
var Close = "close";
|
|
2160
2218
|
|
|
2161
2219
|
// src/classes/ChoiceMenuOption.ts
|
|
2220
|
+
var ChoiceMenuOption = class {
|
|
2221
|
+
/**
|
|
2222
|
+
* @param text Text to be displayed in the menu
|
|
2223
|
+
* @param label Label to be opened when the option is selected or the id of the label
|
|
2224
|
+
* @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.
|
|
2225
|
+
* @param type Type of the label to be opened. @default "call"
|
|
2226
|
+
*/
|
|
2227
|
+
constructor(text, label, props, type = "call") {
|
|
2228
|
+
/**
|
|
2229
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
2230
|
+
* @example
|
|
2231
|
+
* ```tsx
|
|
2232
|
+
* setChoiceMenuOptions([
|
|
2233
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
2234
|
+
* ])
|
|
2235
|
+
* return <List>
|
|
2236
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
2237
|
+
* return (
|
|
2238
|
+
* <ChoiceButton
|
|
2239
|
+
* disabled={item.props.disabled}
|
|
2240
|
+
* onClick={() => {
|
|
2241
|
+
* afterSelectChoice(item)
|
|
2242
|
+
* }}
|
|
2243
|
+
* >
|
|
2244
|
+
* {item.text}
|
|
2245
|
+
* </ChoiceButton>
|
|
2246
|
+
* )
|
|
2247
|
+
* })}
|
|
2248
|
+
* </List>
|
|
2249
|
+
* ```
|
|
2250
|
+
*/
|
|
2251
|
+
this.props = {};
|
|
2252
|
+
this.text = text;
|
|
2253
|
+
this._label = label;
|
|
2254
|
+
this.type = type;
|
|
2255
|
+
if (props) {
|
|
2256
|
+
this.props = props;
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
/**
|
|
2260
|
+
* Label to be opened when the option is selected
|
|
2261
|
+
*/
|
|
2262
|
+
get label() {
|
|
2263
|
+
let label = this._label;
|
|
2264
|
+
if (typeof label === "string") {
|
|
2265
|
+
let res = getLabelById(label);
|
|
2266
|
+
if (res) {
|
|
2267
|
+
label = res;
|
|
2268
|
+
} else {
|
|
2269
|
+
console.error(`Label ${label} not found, so it will be closed`);
|
|
2270
|
+
label = newCloseLabel();
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
return label;
|
|
2274
|
+
}
|
|
2275
|
+
};
|
|
2162
2276
|
var ChoiceMenuOptionClose = class {
|
|
2163
2277
|
/**
|
|
2164
2278
|
* @param text Text to be displayed in the menu
|
|
@@ -2174,7 +2288,27 @@ var ChoiceMenuOptionClose = class {
|
|
|
2174
2288
|
*/
|
|
2175
2289
|
this.type = Close;
|
|
2176
2290
|
/**
|
|
2177
|
-
* Properties to be passed to the label
|
|
2291
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
2292
|
+
* @example
|
|
2293
|
+
* ```tsx
|
|
2294
|
+
* setChoiceMenuOptions([
|
|
2295
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
2296
|
+
* ])
|
|
2297
|
+
* return <List>
|
|
2298
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
2299
|
+
* return (
|
|
2300
|
+
* <ChoiceButton
|
|
2301
|
+
* disabled={item.props.disabled}
|
|
2302
|
+
* onClick={() => {
|
|
2303
|
+
* afterSelectChoice(item)
|
|
2304
|
+
* }}
|
|
2305
|
+
* >
|
|
2306
|
+
* {item.text}
|
|
2307
|
+
* </ChoiceButton>
|
|
2308
|
+
* )
|
|
2309
|
+
* })}
|
|
2310
|
+
* </List>
|
|
2311
|
+
* ```
|
|
2178
2312
|
*/
|
|
2179
2313
|
this.props = {};
|
|
2180
2314
|
this.text = text;
|
|
@@ -2228,6 +2362,54 @@ var DialogueBaseModel = class {
|
|
|
2228
2362
|
}
|
|
2229
2363
|
};
|
|
2230
2364
|
|
|
2365
|
+
// src/classes/LabelJson.ts
|
|
2366
|
+
var LabelJson2 = class extends LabelAbstract {
|
|
2367
|
+
/**
|
|
2368
|
+
* @param id is the id of the label
|
|
2369
|
+
* @param steps is the list of steps that the label will perform
|
|
2370
|
+
* @param props is the properties of the label
|
|
2371
|
+
*/
|
|
2372
|
+
constructor(id, steps, props) {
|
|
2373
|
+
super(id, props);
|
|
2374
|
+
this._steps = steps;
|
|
2375
|
+
}
|
|
2376
|
+
/**
|
|
2377
|
+
* Get the steps of the label.
|
|
2378
|
+
*/
|
|
2379
|
+
get steps() {
|
|
2380
|
+
if (typeof this._steps === "function") {
|
|
2381
|
+
return this._steps().map(this.stepConverter);
|
|
2382
|
+
}
|
|
2383
|
+
return this._steps.map(this.stepConverter);
|
|
2384
|
+
}
|
|
2385
|
+
stepConverter(step) {
|
|
2386
|
+
return (props) => {
|
|
2387
|
+
if (step.currentChoiceMenuOptions) {
|
|
2388
|
+
setChoiceMenuOptions(step.currentChoiceMenuOptions);
|
|
2389
|
+
} else {
|
|
2390
|
+
clearChoiceMenuOptions();
|
|
2391
|
+
}
|
|
2392
|
+
if (step.dialog) {
|
|
2393
|
+
setDialogue(step.dialog);
|
|
2394
|
+
} else {
|
|
2395
|
+
clearDialogue();
|
|
2396
|
+
}
|
|
2397
|
+
if (step.labelToOpen) {
|
|
2398
|
+
if (step.labelToOpen.type === "jump") {
|
|
2399
|
+
GameStepManager.jumpLabel(step.labelToOpen.labelId, props);
|
|
2400
|
+
} else {
|
|
2401
|
+
GameStepManager.callLabel(step.labelToOpen.labelId, props);
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
if (step.end === "game_end") {
|
|
2405
|
+
console.warn("[Pixi'VN] Game end not implemented");
|
|
2406
|
+
} else if (step.end === "label_end") {
|
|
2407
|
+
GameStepManager.closeCurrentLabel();
|
|
2408
|
+
}
|
|
2409
|
+
};
|
|
2410
|
+
}
|
|
2411
|
+
};
|
|
2412
|
+
|
|
2231
2413
|
// src/functions/DialogueUtility.ts
|
|
2232
2414
|
function setDialogue(props) {
|
|
2233
2415
|
let text = "";
|
|
@@ -2281,21 +2463,18 @@ function getChoiceMenuOptions() {
|
|
|
2281
2463
|
d.forEach((option, index) => {
|
|
2282
2464
|
if (option.type === Close) {
|
|
2283
2465
|
let itemLabel = newCloseLabel(index);
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
type: Close,
|
|
2288
|
-
closeCurrentLabel: option.closeCurrentLabel,
|
|
2289
|
-
props: {}
|
|
2290
|
-
});
|
|
2466
|
+
let choice = new ChoiceMenuOptionClose(option.text, option.closeCurrentLabel);
|
|
2467
|
+
choice.label = itemLabel;
|
|
2468
|
+
options.push(choice);
|
|
2291
2469
|
return;
|
|
2292
2470
|
}
|
|
2293
2471
|
let label = getLabelById(option.label);
|
|
2294
2472
|
if (label) {
|
|
2295
|
-
let itemLabel = new Label(label.id, label.steps,
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
})
|
|
2473
|
+
let itemLabel = new Label(label.id, label.steps, {
|
|
2474
|
+
onStepStart: label.onStepStart,
|
|
2475
|
+
choiseIndex: index
|
|
2476
|
+
});
|
|
2477
|
+
options.push(new ChoiceMenuOption(option.text, itemLabel, option.props, option.type));
|
|
2299
2478
|
}
|
|
2300
2479
|
});
|
|
2301
2480
|
return options;
|
|
@@ -2416,8 +2595,9 @@ FadeAlphaTicker = __decorateClass([
|
|
|
2416
2595
|
], FadeAlphaTicker);
|
|
2417
2596
|
|
|
2418
2597
|
// src/functions/TickerUtility.ts
|
|
2419
|
-
function updateTickerProgression(args, propertyName, progression) {
|
|
2420
|
-
|
|
2598
|
+
function updateTickerProgression(args, propertyName, progression, valueConvert) {
|
|
2599
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
2600
|
+
if (args[propertyName] === void 0 || !progression || args[propertyName] === limit) {
|
|
2421
2601
|
return;
|
|
2422
2602
|
}
|
|
2423
2603
|
if (typeof args[propertyName] === "number") {
|
|
@@ -2436,22 +2616,25 @@ function updateTickerProgression(args, propertyName, progression) {
|
|
|
2436
2616
|
}
|
|
2437
2617
|
}
|
|
2438
2618
|
}
|
|
2439
|
-
function getLinearProgression(number, progression) {
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
return
|
|
2619
|
+
function getLinearProgression(number, progression, valueConvert) {
|
|
2620
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
2621
|
+
let amt = valueConvert ? valueConvert(progression.amt) : progression.amt;
|
|
2622
|
+
if (limit !== void 0) {
|
|
2623
|
+
if (number > limit && amt > 0) {
|
|
2624
|
+
return limit;
|
|
2625
|
+
} else if (number < limit && amt < 0) {
|
|
2626
|
+
return limit;
|
|
2445
2627
|
}
|
|
2446
2628
|
}
|
|
2447
|
-
return number +
|
|
2629
|
+
return number + amt;
|
|
2448
2630
|
}
|
|
2449
|
-
function getExponentialProgression(number, progression) {
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2631
|
+
function getExponentialProgression(number, progression, valueConvert) {
|
|
2632
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
2633
|
+
if (limit !== void 0) {
|
|
2634
|
+
if (number > limit && progression.percentage > 0) {
|
|
2635
|
+
return limit;
|
|
2636
|
+
} else if (number < limit && progression.percentage < 0) {
|
|
2637
|
+
return limit;
|
|
2455
2638
|
}
|
|
2456
2639
|
}
|
|
2457
2640
|
return number + number * progression.percentage;
|
|
@@ -2464,15 +2647,13 @@ var MoveTicker = class extends TickerBase {
|
|
|
2464
2647
|
let ySpeed = 1;
|
|
2465
2648
|
if (args.speed) {
|
|
2466
2649
|
if (typeof args.speed === "number") {
|
|
2467
|
-
xSpeed = args.speed;
|
|
2468
|
-
ySpeed = args.speed;
|
|
2650
|
+
xSpeed = this.speedConvert(args.speed);
|
|
2651
|
+
ySpeed = this.speedConvert(args.speed);
|
|
2469
2652
|
} else {
|
|
2470
|
-
xSpeed = args.speed.x;
|
|
2471
|
-
ySpeed = args.speed.y;
|
|
2653
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
2654
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
2472
2655
|
}
|
|
2473
2656
|
}
|
|
2474
|
-
xSpeed /= 60;
|
|
2475
|
-
ySpeed /= 60;
|
|
2476
2657
|
let destination = args.destination;
|
|
2477
2658
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
2478
2659
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -2512,7 +2693,10 @@ var MoveTicker = class extends TickerBase {
|
|
|
2512
2693
|
}
|
|
2513
2694
|
});
|
|
2514
2695
|
if (args.speedProgression)
|
|
2515
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
2696
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
2697
|
+
}
|
|
2698
|
+
speedConvert(speed) {
|
|
2699
|
+
return speed / 6;
|
|
2516
2700
|
}
|
|
2517
2701
|
};
|
|
2518
2702
|
MoveTicker = __decorateClass([
|
|
@@ -2520,7 +2704,7 @@ MoveTicker = __decorateClass([
|
|
|
2520
2704
|
], MoveTicker);
|
|
2521
2705
|
var RotateTicker = class extends TickerBase {
|
|
2522
2706
|
fn(ticker, args, tags, tickerId) {
|
|
2523
|
-
let speed = (args.speed === void 0 ? 1 : args.speed)
|
|
2707
|
+
let speed = this.speedConvert(args.speed === void 0 ? 1 : args.speed);
|
|
2524
2708
|
let clockwise = args.clockwise === void 0 ? true : args.clockwise;
|
|
2525
2709
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
2526
2710
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -2548,7 +2732,10 @@ var RotateTicker = class extends TickerBase {
|
|
|
2548
2732
|
}
|
|
2549
2733
|
});
|
|
2550
2734
|
if (args.speedProgression)
|
|
2551
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
2735
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
2736
|
+
}
|
|
2737
|
+
speedConvert(speed) {
|
|
2738
|
+
return speed / 60;
|
|
2552
2739
|
}
|
|
2553
2740
|
};
|
|
2554
2741
|
RotateTicker = __decorateClass([
|
|
@@ -2560,15 +2747,13 @@ var ZoomTicker = class extends TickerBase {
|
|
|
2560
2747
|
let ySpeed = 0.1;
|
|
2561
2748
|
if (args.speed) {
|
|
2562
2749
|
if (typeof args.speed === "number") {
|
|
2563
|
-
xSpeed = args.speed;
|
|
2564
|
-
ySpeed = args.speed;
|
|
2750
|
+
xSpeed = this.speedConvert(args.speed);
|
|
2751
|
+
ySpeed = this.speedConvert(args.speed);
|
|
2565
2752
|
} else {
|
|
2566
|
-
xSpeed = args.speed.x;
|
|
2567
|
-
ySpeed = args.speed.y;
|
|
2753
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
2754
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
2568
2755
|
}
|
|
2569
2756
|
}
|
|
2570
|
-
xSpeed /= 60;
|
|
2571
|
-
ySpeed /= 60;
|
|
2572
2757
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
2573
2758
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
2574
2759
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
@@ -2635,7 +2820,10 @@ var ZoomTicker = class extends TickerBase {
|
|
|
2635
2820
|
}
|
|
2636
2821
|
});
|
|
2637
2822
|
if (args.speedProgression)
|
|
2638
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
2823
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
2824
|
+
}
|
|
2825
|
+
speedConvert(speed) {
|
|
2826
|
+
return speed / 60;
|
|
2639
2827
|
}
|
|
2640
2828
|
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
2641
2829
|
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
@@ -2833,14 +3021,14 @@ function zoomIn(_0, _1) {
|
|
|
2833
3021
|
} else {
|
|
2834
3022
|
canvasElement = image;
|
|
2835
3023
|
}
|
|
2836
|
-
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
2837
|
-
yield canvasElement.load();
|
|
2838
|
-
}
|
|
2839
3024
|
let container = new CanvasContainer();
|
|
2840
3025
|
container.addChild(canvasElement);
|
|
2841
3026
|
container.height = GameWindowManager.canvasHeight;
|
|
2842
3027
|
container.width = GameWindowManager.canvasWidth;
|
|
2843
3028
|
GameWindowManager.addCanvasElement(tag, container);
|
|
3029
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
3030
|
+
yield canvasElement.load();
|
|
3031
|
+
}
|
|
2844
3032
|
if (props.direction == "up") {
|
|
2845
3033
|
container.pivot.y = GameWindowManager.canvasHeight;
|
|
2846
3034
|
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
@@ -2913,6 +3101,37 @@ function zoomOut(tag, props = { direction: "right" }, priority) {
|
|
|
2913
3101
|
GameWindowManager.addTicker(tag, effect);
|
|
2914
3102
|
}
|
|
2915
3103
|
|
|
3104
|
+
// src/functions/Importer.ts
|
|
3105
|
+
function importPixiVNJson(data) {
|
|
3106
|
+
if (Array.isArray(data)) {
|
|
3107
|
+
data.forEach((label) => {
|
|
3108
|
+
importPixiVNJson(label);
|
|
3109
|
+
});
|
|
3110
|
+
return;
|
|
3111
|
+
}
|
|
3112
|
+
try {
|
|
3113
|
+
if (typeof data === "string") {
|
|
3114
|
+
data = JSON.parse(data);
|
|
3115
|
+
}
|
|
3116
|
+
} catch (e) {
|
|
3117
|
+
console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON", e);
|
|
3118
|
+
return;
|
|
3119
|
+
}
|
|
3120
|
+
if (typeof data !== "object") {
|
|
3121
|
+
console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON: data is not an object");
|
|
3122
|
+
return;
|
|
3123
|
+
}
|
|
3124
|
+
for (const labelId in data) {
|
|
3125
|
+
try {
|
|
3126
|
+
const steps = data[labelId];
|
|
3127
|
+
let label = new LabelJson2(labelId, steps);
|
|
3128
|
+
saveLabel(label);
|
|
3129
|
+
} catch (e) {
|
|
3130
|
+
console.error(`[Pixi'VN] Error creating JSON label ${labelId}`, e);
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
|
|
2916
3135
|
// src/functions/SavesUtility.ts
|
|
2917
3136
|
function getSaveData() {
|
|
2918
3137
|
return {
|
|
@@ -2928,13 +3147,17 @@ function getSaveJson() {
|
|
|
2928
3147
|
return JSON.stringify(saveData);
|
|
2929
3148
|
}
|
|
2930
3149
|
function loadSaveData(data, navigate) {
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
3150
|
+
return __async(this, null, function* () {
|
|
3151
|
+
yield GameStepManager.import(data.stepData);
|
|
3152
|
+
GameStorageManager.import(data.storageData);
|
|
3153
|
+
GameWindowManager.import(data.canvasData);
|
|
3154
|
+
navigate(data.path);
|
|
3155
|
+
});
|
|
2935
3156
|
}
|
|
2936
3157
|
function loadSaveJson(dataString, navigate) {
|
|
2937
|
-
|
|
3158
|
+
return __async(this, null, function* () {
|
|
3159
|
+
yield loadSaveData(jsonToSaveData(dataString), navigate);
|
|
3160
|
+
});
|
|
2938
3161
|
}
|
|
2939
3162
|
function jsonToSaveData(json) {
|
|
2940
3163
|
return JSON.parse(json);
|
|
@@ -2951,6 +3174,7 @@ exports.getFlag = getFlag;
|
|
|
2951
3174
|
exports.getSaveData = getSaveData;
|
|
2952
3175
|
exports.getSaveJson = getSaveJson;
|
|
2953
3176
|
exports.getTexture = getTexture;
|
|
3177
|
+
exports.importPixiVNJson = importPixiVNJson;
|
|
2954
3178
|
exports.loadImage = loadImage;
|
|
2955
3179
|
exports.loadSaveData = loadSaveData;
|
|
2956
3180
|
exports.loadSaveJson = loadSaveJson;
|