@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.mjs
CHANGED
|
@@ -58,19 +58,18 @@ function checkIfStepsIsEqual(step1, step2) {
|
|
|
58
58
|
return step1 === step2;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
// src/classes/
|
|
62
|
-
var
|
|
61
|
+
// src/classes/LabelAbstract.ts
|
|
62
|
+
var LabelAbstract = class {
|
|
63
63
|
/**
|
|
64
64
|
* @param id is the id of the label
|
|
65
|
-
* @param
|
|
66
|
-
* @param onStepRun is a function that will be executed before any step is executed, is useful for example to make sure all images used have been cached
|
|
67
|
-
* @param choiseIndex is the index of the choice that the label will perform
|
|
65
|
+
* @param props is the properties of the label
|
|
68
66
|
*/
|
|
69
|
-
constructor(id,
|
|
67
|
+
constructor(id, props) {
|
|
70
68
|
this._id = id;
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
73
|
-
this.
|
|
69
|
+
this._onStepStart = props == null ? void 0 : props.onStepStart;
|
|
70
|
+
this._onLoadStep = props == null ? void 0 : props.onLoadStep;
|
|
71
|
+
this._onStepEnd = props == null ? void 0 : props.onStepEnd;
|
|
72
|
+
this._choiseIndex = props == null ? void 0 : props.choiseIndex;
|
|
74
73
|
}
|
|
75
74
|
/**
|
|
76
75
|
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
@@ -78,17 +77,6 @@ var Label = class {
|
|
|
78
77
|
get id() {
|
|
79
78
|
return this._id;
|
|
80
79
|
}
|
|
81
|
-
/**
|
|
82
|
-
* Get the steps of the label.
|
|
83
|
-
* This class should be extended and the steps method should be overridden.
|
|
84
|
-
* Every time you update this list will also be updated when the other game versions load.
|
|
85
|
-
*/
|
|
86
|
-
get steps() {
|
|
87
|
-
if (typeof this._steps === "function") {
|
|
88
|
-
return this._steps();
|
|
89
|
-
}
|
|
90
|
-
return this._steps;
|
|
91
|
-
}
|
|
92
80
|
/**
|
|
93
81
|
* Get the corresponding steps number
|
|
94
82
|
* @param externalSteps
|
|
@@ -107,28 +95,66 @@ var Label = class {
|
|
|
107
95
|
return res;
|
|
108
96
|
}
|
|
109
97
|
/**
|
|
110
|
-
*
|
|
98
|
+
* Is a function that will be executed in {@link Label#onStepStart} and when the user goes back to it or when the user laods a save file.
|
|
99
|
+
* @returns Promise<void> or void
|
|
100
|
+
*/
|
|
101
|
+
get onStepStart() {
|
|
102
|
+
return (stepIndex, label) => __async(this, null, function* () {
|
|
103
|
+
if (this._onLoadStep) {
|
|
104
|
+
yield this._onLoadStep(stepIndex, label);
|
|
105
|
+
}
|
|
106
|
+
if (this._onStepStart) {
|
|
107
|
+
return yield this._onStepStart(stepIndex, label);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Get the function that will be executed a old step is reloaded. A step is reloaded when the user goes back to it or when the user laods a save file.
|
|
111
113
|
* @returns Promise<void> or void
|
|
112
|
-
* @example
|
|
113
|
-
* ```typescript
|
|
114
|
-
* newLabel("id", [], () => {
|
|
115
|
-
* Assets.load('path/to/image1.png')
|
|
116
|
-
* Assets.load('path/to/image2.png')
|
|
117
|
-
* })
|
|
118
|
-
* ```
|
|
119
114
|
*/
|
|
120
|
-
get
|
|
121
|
-
return this.
|
|
115
|
+
get onLoadStep() {
|
|
116
|
+
return this._onLoadStep;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Is a function that will be executed when the step ends.
|
|
120
|
+
* @returns Promise<void> or void
|
|
121
|
+
*/
|
|
122
|
+
get onStepEnd() {
|
|
123
|
+
return this._onStepEnd;
|
|
122
124
|
}
|
|
123
125
|
get choiseIndex() {
|
|
124
126
|
return this._choiseIndex;
|
|
125
127
|
}
|
|
126
128
|
};
|
|
127
129
|
|
|
130
|
+
// src/classes/Label.ts
|
|
131
|
+
var Label = class extends LabelAbstract {
|
|
132
|
+
/**
|
|
133
|
+
* @param id is the id of the label
|
|
134
|
+
* @param steps is the list of steps that the label will perform
|
|
135
|
+
* @param props is the properties of the label
|
|
136
|
+
*/
|
|
137
|
+
constructor(id, steps, props) {
|
|
138
|
+
super(id, props);
|
|
139
|
+
this._steps = steps;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Get the steps of the label.
|
|
143
|
+
*/
|
|
144
|
+
get steps() {
|
|
145
|
+
if (typeof this._steps === "function") {
|
|
146
|
+
return this._steps();
|
|
147
|
+
}
|
|
148
|
+
return this._steps;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
128
152
|
// src/classes/CloseLabel.ts
|
|
129
153
|
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
130
154
|
function newCloseLabel(choiseIndex) {
|
|
131
|
-
return new Label(CLOSE_LABEL_ID, [],
|
|
155
|
+
return new Label(CLOSE_LABEL_ID, [], {
|
|
156
|
+
choiseIndex
|
|
157
|
+
});
|
|
132
158
|
}
|
|
133
159
|
|
|
134
160
|
// src/decorators/LabelDecorator.ts
|
|
@@ -141,6 +167,9 @@ function getLabelById(id) {
|
|
|
141
167
|
}
|
|
142
168
|
return label;
|
|
143
169
|
}
|
|
170
|
+
function saveLabel(label) {
|
|
171
|
+
registeredLabels[label.id] = label;
|
|
172
|
+
}
|
|
144
173
|
|
|
145
174
|
// src/functions/ExportUtility.ts
|
|
146
175
|
function createExportableElement(element) {
|
|
@@ -310,7 +339,7 @@ var TickerBase = class {
|
|
|
310
339
|
};
|
|
311
340
|
|
|
312
341
|
// src/constants.ts
|
|
313
|
-
var PIXIVN_VERSION = "0.6.
|
|
342
|
+
var PIXIVN_VERSION = "0.6.6";
|
|
314
343
|
var Repeat = "repeat";
|
|
315
344
|
function Pause(duration) {
|
|
316
345
|
return {
|
|
@@ -400,8 +429,6 @@ function getMemoryContainer(element) {
|
|
|
400
429
|
};
|
|
401
430
|
}
|
|
402
431
|
function setMemoryContainer(element, memory) {
|
|
403
|
-
memory.width && (element.width = memory.width);
|
|
404
|
-
memory.height && (element.height = memory.height);
|
|
405
432
|
memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
|
|
406
433
|
memory.blendMode && (element.blendMode = memory.blendMode);
|
|
407
434
|
memory.tint && (element.tint = memory.tint);
|
|
@@ -434,6 +461,8 @@ function setMemoryContainer(element, memory) {
|
|
|
434
461
|
memory.interactive && (element.interactive = memory.interactive);
|
|
435
462
|
memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
|
|
436
463
|
memory.hitArea && (element.hitArea = memory.hitArea);
|
|
464
|
+
memory.width && (element.width = memory.width);
|
|
465
|
+
memory.height && (element.height = memory.height);
|
|
437
466
|
}
|
|
438
467
|
function getTexture(imageUrl) {
|
|
439
468
|
return __async(this, null, function* () {
|
|
@@ -1639,6 +1668,16 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1639
1668
|
static set originalStepData(value) {
|
|
1640
1669
|
_GameStepManager._originalStepData = createExportableElement(value);
|
|
1641
1670
|
}
|
|
1671
|
+
static get currentStepData() {
|
|
1672
|
+
let currentStepData = {
|
|
1673
|
+
path: window.location.pathname,
|
|
1674
|
+
storage: GameStorageManager.export(),
|
|
1675
|
+
canvas: GameWindowManager.export(),
|
|
1676
|
+
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
1677
|
+
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
1678
|
+
};
|
|
1679
|
+
return currentStepData;
|
|
1680
|
+
}
|
|
1642
1681
|
/* Edit History Methods */
|
|
1643
1682
|
/**
|
|
1644
1683
|
* Add a label to the history.
|
|
@@ -1646,19 +1685,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1646
1685
|
*/
|
|
1647
1686
|
static addStepHistory(step, choiseMade) {
|
|
1648
1687
|
let stepHistory = getStepSha1(step);
|
|
1649
|
-
let
|
|
1650
|
-
path: window.location.pathname,
|
|
1651
|
-
storage: GameStorageManager.export(),
|
|
1652
|
-
canvas: GameWindowManager.export(),
|
|
1653
|
-
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
1654
|
-
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
1655
|
-
};
|
|
1688
|
+
let currentStepData = _GameStepManager.currentStepData;
|
|
1656
1689
|
if (_GameStepManager.originalStepData) {
|
|
1657
|
-
if (_GameStepManager.originalStepData.openedLabels.length ===
|
|
1690
|
+
if (_GameStepManager.originalStepData.openedLabels.length === currentStepData.openedLabels.length) {
|
|
1658
1691
|
try {
|
|
1659
1692
|
let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
|
|
1660
|
-
let historyStepOpenedLabelsString = JSON.stringify(
|
|
1661
|
-
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path ===
|
|
1693
|
+
let historyStepOpenedLabelsString = JSON.stringify(currentStepData.openedLabels);
|
|
1694
|
+
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === currentStepData.path && _GameStepManager.originalStepData.labelIndex === currentStepData.labelIndex) {
|
|
1662
1695
|
return;
|
|
1663
1696
|
}
|
|
1664
1697
|
} catch (e) {
|
|
@@ -1666,7 +1699,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1666
1699
|
}
|
|
1667
1700
|
}
|
|
1668
1701
|
}
|
|
1669
|
-
let data = diff(_GameStepManager.originalStepData,
|
|
1702
|
+
let data = diff(_GameStepManager.originalStepData, currentStepData);
|
|
1670
1703
|
if (data) {
|
|
1671
1704
|
let dialoge = void 0;
|
|
1672
1705
|
let requiredChoices = void 0;
|
|
@@ -1685,7 +1718,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1685
1718
|
index: _GameStepManager.lastStepIndex,
|
|
1686
1719
|
choiceIndexMade: choiseMade
|
|
1687
1720
|
});
|
|
1688
|
-
_GameStepManager.originalStepData =
|
|
1721
|
+
_GameStepManager.originalStepData = currentStepData;
|
|
1689
1722
|
}
|
|
1690
1723
|
_GameStepManager.increaseLastStepIndex();
|
|
1691
1724
|
}
|
|
@@ -1776,6 +1809,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1776
1809
|
console.warn("[Pixi'VN] The player must make a choice");
|
|
1777
1810
|
return;
|
|
1778
1811
|
}
|
|
1812
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
1813
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
1814
|
+
}
|
|
1779
1815
|
_GameStepManager.increaseCurrentStepIndex();
|
|
1780
1816
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
1781
1817
|
});
|
|
@@ -1800,6 +1836,10 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1800
1836
|
return;
|
|
1801
1837
|
}
|
|
1802
1838
|
if (currentLabel.steps.length > currentLabelStepIndex) {
|
|
1839
|
+
let onStepRun = currentLabel.onStepStart;
|
|
1840
|
+
if (onStepRun) {
|
|
1841
|
+
yield onStepRun(currentLabelStepIndex, currentLabel);
|
|
1842
|
+
}
|
|
1803
1843
|
let step = currentLabel.steps[currentLabelStepIndex];
|
|
1804
1844
|
let result = yield step(props);
|
|
1805
1845
|
_GameStepManager.addStepHistory(step, choiseMade);
|
|
@@ -1864,6 +1904,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1864
1904
|
if (!tempLabel) {
|
|
1865
1905
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
1866
1906
|
}
|
|
1907
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
1908
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
1909
|
+
}
|
|
1867
1910
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
1868
1911
|
} catch (e) {
|
|
1869
1912
|
console.error("[Pixi'VN] Error calling label", e);
|
|
@@ -1922,6 +1965,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1922
1965
|
if (!tempLabel) {
|
|
1923
1966
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
1924
1967
|
}
|
|
1968
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
1969
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
1970
|
+
}
|
|
1925
1971
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
1926
1972
|
} catch (e) {
|
|
1927
1973
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
@@ -2027,24 +2073,29 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2027
2073
|
* ```
|
|
2028
2074
|
*/
|
|
2029
2075
|
static goBack(navigate, steps = 1) {
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2076
|
+
return __async(this, null, function* () {
|
|
2077
|
+
if (steps <= 0) {
|
|
2078
|
+
console.warn("[Pixi'VN] Steps must be greater than 0");
|
|
2079
|
+
return;
|
|
2080
|
+
}
|
|
2081
|
+
if (_GameStepManager._stepsHistory.length <= 1) {
|
|
2082
|
+
console.warn("[Pixi'VN] No steps to go back");
|
|
2083
|
+
return;
|
|
2084
|
+
}
|
|
2085
|
+
let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
|
|
2086
|
+
if (restoredStep) {
|
|
2087
|
+
_GameStepManager._originalStepData = restoredStep;
|
|
2088
|
+
_GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
|
|
2089
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2090
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2091
|
+
}
|
|
2092
|
+
GameStorageManager.import(createExportableElement(restoredStep.storage));
|
|
2093
|
+
GameWindowManager.import(createExportableElement(restoredStep.canvas));
|
|
2094
|
+
navigate(restoredStep.path);
|
|
2095
|
+
} else {
|
|
2096
|
+
console.error("[Pixi'VN] Error going back");
|
|
2097
|
+
}
|
|
2098
|
+
});
|
|
2048
2099
|
}
|
|
2049
2100
|
static goBackInternal(steps, restoredStep) {
|
|
2050
2101
|
if (steps <= 0) {
|
|
@@ -2106,38 +2157,45 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2106
2157
|
* @param dataString The history in a JSON string.
|
|
2107
2158
|
*/
|
|
2108
2159
|
static importJson(dataString) {
|
|
2109
|
-
|
|
2160
|
+
return __async(this, null, function* () {
|
|
2161
|
+
yield _GameStepManager.import(JSON.parse(dataString));
|
|
2162
|
+
});
|
|
2110
2163
|
}
|
|
2111
2164
|
/**
|
|
2112
2165
|
* Import the history from an object.
|
|
2113
2166
|
* @param data The history in an object.
|
|
2114
2167
|
*/
|
|
2115
2168
|
static import(data) {
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2169
|
+
return __async(this, null, function* () {
|
|
2170
|
+
_GameStepManager.clear();
|
|
2171
|
+
try {
|
|
2172
|
+
if (data.hasOwnProperty("stepsHistory")) {
|
|
2173
|
+
_GameStepManager._stepsHistory = data["stepsHistory"];
|
|
2174
|
+
} else {
|
|
2175
|
+
console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
|
|
2176
|
+
}
|
|
2177
|
+
if (data.hasOwnProperty("openedLabels")) {
|
|
2178
|
+
_GameStepManager._openedLabels = data["openedLabels"];
|
|
2179
|
+
} else {
|
|
2180
|
+
console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
|
|
2181
|
+
}
|
|
2182
|
+
if (data.hasOwnProperty("lastStepIndex")) {
|
|
2183
|
+
_GameStepManager._lastStepIndex = data["lastStepIndex"];
|
|
2184
|
+
} else {
|
|
2185
|
+
console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
|
|
2186
|
+
}
|
|
2187
|
+
if (data.hasOwnProperty("originalStepData")) {
|
|
2188
|
+
_GameStepManager._originalStepData = data["originalStepData"];
|
|
2189
|
+
} else {
|
|
2190
|
+
console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
|
|
2191
|
+
}
|
|
2192
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2193
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2194
|
+
}
|
|
2195
|
+
} catch (e) {
|
|
2196
|
+
console.error("[Pixi'VN] Error importing data", e);
|
|
2137
2197
|
}
|
|
2138
|
-
}
|
|
2139
|
-
console.error("[Pixi'VN] Error importing data", e);
|
|
2140
|
-
}
|
|
2198
|
+
});
|
|
2141
2199
|
}
|
|
2142
2200
|
};
|
|
2143
2201
|
/**
|
|
@@ -2153,6 +2211,62 @@ var GameStepManager = _GameStepManager;
|
|
|
2153
2211
|
var Close = "close";
|
|
2154
2212
|
|
|
2155
2213
|
// src/classes/ChoiceMenuOption.ts
|
|
2214
|
+
var ChoiceMenuOption = class {
|
|
2215
|
+
/**
|
|
2216
|
+
* @param text Text to be displayed in the menu
|
|
2217
|
+
* @param label Label to be opened when the option is selected or the id of the label
|
|
2218
|
+
* @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.
|
|
2219
|
+
* @param type Type of the label to be opened. @default "call"
|
|
2220
|
+
*/
|
|
2221
|
+
constructor(text, label, props, type = "call") {
|
|
2222
|
+
/**
|
|
2223
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
2224
|
+
* @example
|
|
2225
|
+
* ```tsx
|
|
2226
|
+
* setChoiceMenuOptions([
|
|
2227
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
2228
|
+
* ])
|
|
2229
|
+
* return <List>
|
|
2230
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
2231
|
+
* return (
|
|
2232
|
+
* <ChoiceButton
|
|
2233
|
+
* disabled={item.props.disabled}
|
|
2234
|
+
* onClick={() => {
|
|
2235
|
+
* afterSelectChoice(item)
|
|
2236
|
+
* }}
|
|
2237
|
+
* >
|
|
2238
|
+
* {item.text}
|
|
2239
|
+
* </ChoiceButton>
|
|
2240
|
+
* )
|
|
2241
|
+
* })}
|
|
2242
|
+
* </List>
|
|
2243
|
+
* ```
|
|
2244
|
+
*/
|
|
2245
|
+
this.props = {};
|
|
2246
|
+
this.text = text;
|
|
2247
|
+
this._label = label;
|
|
2248
|
+
this.type = type;
|
|
2249
|
+
if (props) {
|
|
2250
|
+
this.props = props;
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
/**
|
|
2254
|
+
* Label to be opened when the option is selected
|
|
2255
|
+
*/
|
|
2256
|
+
get label() {
|
|
2257
|
+
let label = this._label;
|
|
2258
|
+
if (typeof label === "string") {
|
|
2259
|
+
let res = getLabelById(label);
|
|
2260
|
+
if (res) {
|
|
2261
|
+
label = res;
|
|
2262
|
+
} else {
|
|
2263
|
+
console.error(`Label ${label} not found, so it will be closed`);
|
|
2264
|
+
label = newCloseLabel();
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
return label;
|
|
2268
|
+
}
|
|
2269
|
+
};
|
|
2156
2270
|
var ChoiceMenuOptionClose = class {
|
|
2157
2271
|
/**
|
|
2158
2272
|
* @param text Text to be displayed in the menu
|
|
@@ -2168,7 +2282,27 @@ var ChoiceMenuOptionClose = class {
|
|
|
2168
2282
|
*/
|
|
2169
2283
|
this.type = Close;
|
|
2170
2284
|
/**
|
|
2171
|
-
* Properties to be passed to the label
|
|
2285
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
2286
|
+
* @example
|
|
2287
|
+
* ```tsx
|
|
2288
|
+
* setChoiceMenuOptions([
|
|
2289
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
2290
|
+
* ])
|
|
2291
|
+
* return <List>
|
|
2292
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
2293
|
+
* return (
|
|
2294
|
+
* <ChoiceButton
|
|
2295
|
+
* disabled={item.props.disabled}
|
|
2296
|
+
* onClick={() => {
|
|
2297
|
+
* afterSelectChoice(item)
|
|
2298
|
+
* }}
|
|
2299
|
+
* >
|
|
2300
|
+
* {item.text}
|
|
2301
|
+
* </ChoiceButton>
|
|
2302
|
+
* )
|
|
2303
|
+
* })}
|
|
2304
|
+
* </List>
|
|
2305
|
+
* ```
|
|
2172
2306
|
*/
|
|
2173
2307
|
this.props = {};
|
|
2174
2308
|
this.text = text;
|
|
@@ -2222,6 +2356,54 @@ var DialogueBaseModel = class {
|
|
|
2222
2356
|
}
|
|
2223
2357
|
};
|
|
2224
2358
|
|
|
2359
|
+
// src/classes/LabelJson.ts
|
|
2360
|
+
var LabelJson2 = class extends LabelAbstract {
|
|
2361
|
+
/**
|
|
2362
|
+
* @param id is the id of the label
|
|
2363
|
+
* @param steps is the list of steps that the label will perform
|
|
2364
|
+
* @param props is the properties of the label
|
|
2365
|
+
*/
|
|
2366
|
+
constructor(id, steps, props) {
|
|
2367
|
+
super(id, props);
|
|
2368
|
+
this._steps = steps;
|
|
2369
|
+
}
|
|
2370
|
+
/**
|
|
2371
|
+
* Get the steps of the label.
|
|
2372
|
+
*/
|
|
2373
|
+
get steps() {
|
|
2374
|
+
if (typeof this._steps === "function") {
|
|
2375
|
+
return this._steps().map(this.stepConverter);
|
|
2376
|
+
}
|
|
2377
|
+
return this._steps.map(this.stepConverter);
|
|
2378
|
+
}
|
|
2379
|
+
stepConverter(step) {
|
|
2380
|
+
return (props) => {
|
|
2381
|
+
if (step.currentChoiceMenuOptions) {
|
|
2382
|
+
setChoiceMenuOptions(step.currentChoiceMenuOptions);
|
|
2383
|
+
} else {
|
|
2384
|
+
clearChoiceMenuOptions();
|
|
2385
|
+
}
|
|
2386
|
+
if (step.dialog) {
|
|
2387
|
+
setDialogue(step.dialog);
|
|
2388
|
+
} else {
|
|
2389
|
+
clearDialogue();
|
|
2390
|
+
}
|
|
2391
|
+
if (step.labelToOpen) {
|
|
2392
|
+
if (step.labelToOpen.type === "jump") {
|
|
2393
|
+
GameStepManager.jumpLabel(step.labelToOpen.labelId, props);
|
|
2394
|
+
} else {
|
|
2395
|
+
GameStepManager.callLabel(step.labelToOpen.labelId, props);
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
if (step.end === "game_end") {
|
|
2399
|
+
console.warn("[Pixi'VN] Game end not implemented");
|
|
2400
|
+
} else if (step.end === "label_end") {
|
|
2401
|
+
GameStepManager.closeCurrentLabel();
|
|
2402
|
+
}
|
|
2403
|
+
};
|
|
2404
|
+
}
|
|
2405
|
+
};
|
|
2406
|
+
|
|
2225
2407
|
// src/functions/DialogueUtility.ts
|
|
2226
2408
|
function setDialogue(props) {
|
|
2227
2409
|
let text = "";
|
|
@@ -2275,21 +2457,18 @@ function getChoiceMenuOptions() {
|
|
|
2275
2457
|
d.forEach((option, index) => {
|
|
2276
2458
|
if (option.type === Close) {
|
|
2277
2459
|
let itemLabel = newCloseLabel(index);
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
type: Close,
|
|
2282
|
-
closeCurrentLabel: option.closeCurrentLabel,
|
|
2283
|
-
props: {}
|
|
2284
|
-
});
|
|
2460
|
+
let choice = new ChoiceMenuOptionClose(option.text, option.closeCurrentLabel);
|
|
2461
|
+
choice.label = itemLabel;
|
|
2462
|
+
options.push(choice);
|
|
2285
2463
|
return;
|
|
2286
2464
|
}
|
|
2287
2465
|
let label = getLabelById(option.label);
|
|
2288
2466
|
if (label) {
|
|
2289
|
-
let itemLabel = new Label(label.id, label.steps,
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
})
|
|
2467
|
+
let itemLabel = new Label(label.id, label.steps, {
|
|
2468
|
+
onStepStart: label.onStepStart,
|
|
2469
|
+
choiseIndex: index
|
|
2470
|
+
});
|
|
2471
|
+
options.push(new ChoiceMenuOption(option.text, itemLabel, option.props, option.type));
|
|
2293
2472
|
}
|
|
2294
2473
|
});
|
|
2295
2474
|
return options;
|
|
@@ -2410,8 +2589,9 @@ FadeAlphaTicker = __decorateClass([
|
|
|
2410
2589
|
], FadeAlphaTicker);
|
|
2411
2590
|
|
|
2412
2591
|
// src/functions/TickerUtility.ts
|
|
2413
|
-
function updateTickerProgression(args, propertyName, progression) {
|
|
2414
|
-
|
|
2592
|
+
function updateTickerProgression(args, propertyName, progression, valueConvert) {
|
|
2593
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
2594
|
+
if (args[propertyName] === void 0 || !progression || args[propertyName] === limit) {
|
|
2415
2595
|
return;
|
|
2416
2596
|
}
|
|
2417
2597
|
if (typeof args[propertyName] === "number") {
|
|
@@ -2430,22 +2610,25 @@ function updateTickerProgression(args, propertyName, progression) {
|
|
|
2430
2610
|
}
|
|
2431
2611
|
}
|
|
2432
2612
|
}
|
|
2433
|
-
function getLinearProgression(number, progression) {
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
return
|
|
2613
|
+
function getLinearProgression(number, progression, valueConvert) {
|
|
2614
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
2615
|
+
let amt = valueConvert ? valueConvert(progression.amt) : progression.amt;
|
|
2616
|
+
if (limit !== void 0) {
|
|
2617
|
+
if (number > limit && amt > 0) {
|
|
2618
|
+
return limit;
|
|
2619
|
+
} else if (number < limit && amt < 0) {
|
|
2620
|
+
return limit;
|
|
2439
2621
|
}
|
|
2440
2622
|
}
|
|
2441
|
-
return number +
|
|
2623
|
+
return number + amt;
|
|
2442
2624
|
}
|
|
2443
|
-
function getExponentialProgression(number, progression) {
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2625
|
+
function getExponentialProgression(number, progression, valueConvert) {
|
|
2626
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
2627
|
+
if (limit !== void 0) {
|
|
2628
|
+
if (number > limit && progression.percentage > 0) {
|
|
2629
|
+
return limit;
|
|
2630
|
+
} else if (number < limit && progression.percentage < 0) {
|
|
2631
|
+
return limit;
|
|
2449
2632
|
}
|
|
2450
2633
|
}
|
|
2451
2634
|
return number + number * progression.percentage;
|
|
@@ -2458,15 +2641,13 @@ var MoveTicker = class extends TickerBase {
|
|
|
2458
2641
|
let ySpeed = 1;
|
|
2459
2642
|
if (args.speed) {
|
|
2460
2643
|
if (typeof args.speed === "number") {
|
|
2461
|
-
xSpeed = args.speed;
|
|
2462
|
-
ySpeed = args.speed;
|
|
2644
|
+
xSpeed = this.speedConvert(args.speed);
|
|
2645
|
+
ySpeed = this.speedConvert(args.speed);
|
|
2463
2646
|
} else {
|
|
2464
|
-
xSpeed = args.speed.x;
|
|
2465
|
-
ySpeed = args.speed.y;
|
|
2647
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
2648
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
2466
2649
|
}
|
|
2467
2650
|
}
|
|
2468
|
-
xSpeed /= 60;
|
|
2469
|
-
ySpeed /= 60;
|
|
2470
2651
|
let destination = args.destination;
|
|
2471
2652
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
2472
2653
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -2506,7 +2687,10 @@ var MoveTicker = class extends TickerBase {
|
|
|
2506
2687
|
}
|
|
2507
2688
|
});
|
|
2508
2689
|
if (args.speedProgression)
|
|
2509
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
2690
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
2691
|
+
}
|
|
2692
|
+
speedConvert(speed) {
|
|
2693
|
+
return speed / 6;
|
|
2510
2694
|
}
|
|
2511
2695
|
};
|
|
2512
2696
|
MoveTicker = __decorateClass([
|
|
@@ -2514,7 +2698,7 @@ MoveTicker = __decorateClass([
|
|
|
2514
2698
|
], MoveTicker);
|
|
2515
2699
|
var RotateTicker = class extends TickerBase {
|
|
2516
2700
|
fn(ticker, args, tags, tickerId) {
|
|
2517
|
-
let speed = (args.speed === void 0 ? 1 : args.speed)
|
|
2701
|
+
let speed = this.speedConvert(args.speed === void 0 ? 1 : args.speed);
|
|
2518
2702
|
let clockwise = args.clockwise === void 0 ? true : args.clockwise;
|
|
2519
2703
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
2520
2704
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -2542,7 +2726,10 @@ var RotateTicker = class extends TickerBase {
|
|
|
2542
2726
|
}
|
|
2543
2727
|
});
|
|
2544
2728
|
if (args.speedProgression)
|
|
2545
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
2729
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
2730
|
+
}
|
|
2731
|
+
speedConvert(speed) {
|
|
2732
|
+
return speed / 60;
|
|
2546
2733
|
}
|
|
2547
2734
|
};
|
|
2548
2735
|
RotateTicker = __decorateClass([
|
|
@@ -2554,15 +2741,13 @@ var ZoomTicker = class extends TickerBase {
|
|
|
2554
2741
|
let ySpeed = 0.1;
|
|
2555
2742
|
if (args.speed) {
|
|
2556
2743
|
if (typeof args.speed === "number") {
|
|
2557
|
-
xSpeed = args.speed;
|
|
2558
|
-
ySpeed = args.speed;
|
|
2744
|
+
xSpeed = this.speedConvert(args.speed);
|
|
2745
|
+
ySpeed = this.speedConvert(args.speed);
|
|
2559
2746
|
} else {
|
|
2560
|
-
xSpeed = args.speed.x;
|
|
2561
|
-
ySpeed = args.speed.y;
|
|
2747
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
2748
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
2562
2749
|
}
|
|
2563
2750
|
}
|
|
2564
|
-
xSpeed /= 60;
|
|
2565
|
-
ySpeed /= 60;
|
|
2566
2751
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
2567
2752
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
2568
2753
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
@@ -2629,7 +2814,10 @@ var ZoomTicker = class extends TickerBase {
|
|
|
2629
2814
|
}
|
|
2630
2815
|
});
|
|
2631
2816
|
if (args.speedProgression)
|
|
2632
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
2817
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
2818
|
+
}
|
|
2819
|
+
speedConvert(speed) {
|
|
2820
|
+
return speed / 60;
|
|
2633
2821
|
}
|
|
2634
2822
|
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
2635
2823
|
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
@@ -2827,14 +3015,14 @@ function zoomIn(_0, _1) {
|
|
|
2827
3015
|
} else {
|
|
2828
3016
|
canvasElement = image;
|
|
2829
3017
|
}
|
|
2830
|
-
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
2831
|
-
yield canvasElement.load();
|
|
2832
|
-
}
|
|
2833
3018
|
let container = new CanvasContainer();
|
|
2834
3019
|
container.addChild(canvasElement);
|
|
2835
3020
|
container.height = GameWindowManager.canvasHeight;
|
|
2836
3021
|
container.width = GameWindowManager.canvasWidth;
|
|
2837
3022
|
GameWindowManager.addCanvasElement(tag, container);
|
|
3023
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
3024
|
+
yield canvasElement.load();
|
|
3025
|
+
}
|
|
2838
3026
|
if (props.direction == "up") {
|
|
2839
3027
|
container.pivot.y = GameWindowManager.canvasHeight;
|
|
2840
3028
|
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
@@ -2907,6 +3095,37 @@ function zoomOut(tag, props = { direction: "right" }, priority) {
|
|
|
2907
3095
|
GameWindowManager.addTicker(tag, effect);
|
|
2908
3096
|
}
|
|
2909
3097
|
|
|
3098
|
+
// src/functions/Importer.ts
|
|
3099
|
+
function importPixiVNJson(data) {
|
|
3100
|
+
if (Array.isArray(data)) {
|
|
3101
|
+
data.forEach((label) => {
|
|
3102
|
+
importPixiVNJson(label);
|
|
3103
|
+
});
|
|
3104
|
+
return;
|
|
3105
|
+
}
|
|
3106
|
+
try {
|
|
3107
|
+
if (typeof data === "string") {
|
|
3108
|
+
data = JSON.parse(data);
|
|
3109
|
+
}
|
|
3110
|
+
} catch (e) {
|
|
3111
|
+
console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON", e);
|
|
3112
|
+
return;
|
|
3113
|
+
}
|
|
3114
|
+
if (typeof data !== "object") {
|
|
3115
|
+
console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON: data is not an object");
|
|
3116
|
+
return;
|
|
3117
|
+
}
|
|
3118
|
+
for (const labelId in data) {
|
|
3119
|
+
try {
|
|
3120
|
+
const steps = data[labelId];
|
|
3121
|
+
let label = new LabelJson2(labelId, steps);
|
|
3122
|
+
saveLabel(label);
|
|
3123
|
+
} catch (e) {
|
|
3124
|
+
console.error(`[Pixi'VN] Error creating JSON label ${labelId}`, e);
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
}
|
|
3128
|
+
|
|
2910
3129
|
// src/functions/SavesUtility.ts
|
|
2911
3130
|
function getSaveData() {
|
|
2912
3131
|
return {
|
|
@@ -2922,18 +3141,22 @@ function getSaveJson() {
|
|
|
2922
3141
|
return JSON.stringify(saveData);
|
|
2923
3142
|
}
|
|
2924
3143
|
function loadSaveData(data, navigate) {
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
3144
|
+
return __async(this, null, function* () {
|
|
3145
|
+
yield GameStepManager.import(data.stepData);
|
|
3146
|
+
GameStorageManager.import(data.storageData);
|
|
3147
|
+
GameWindowManager.import(data.canvasData);
|
|
3148
|
+
navigate(data.path);
|
|
3149
|
+
});
|
|
2929
3150
|
}
|
|
2930
3151
|
function loadSaveJson(dataString, navigate) {
|
|
2931
|
-
|
|
3152
|
+
return __async(this, null, function* () {
|
|
3153
|
+
yield loadSaveData(jsonToSaveData(dataString), navigate);
|
|
3154
|
+
});
|
|
2932
3155
|
}
|
|
2933
3156
|
function jsonToSaveData(json) {
|
|
2934
3157
|
return JSON.parse(json);
|
|
2935
3158
|
}
|
|
2936
3159
|
|
|
2937
|
-
export { addImage, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, loadImage, loadSaveData, loadSaveJson, moveIn, moveOut, removeCanvasElement, removeWithDissolveTransition, removeWithFadeTransition, setChoiceMenuOptions, setDialogue, setFlag, showImage, showWithDissolveTransition, showWithFadeTransition, zoomIn, zoomOut };
|
|
3160
|
+
export { addImage, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, importPixiVNJson, loadImage, loadSaveData, loadSaveJson, moveIn, moveOut, removeCanvasElement, removeWithDissolveTransition, removeWithFadeTransition, setChoiceMenuOptions, setDialogue, setFlag, showImage, showWithDissolveTransition, showWithFadeTransition, zoomIn, zoomOut };
|
|
2938
3161
|
//# sourceMappingURL=index.mjs.map
|
|
2939
3162
|
//# sourceMappingURL=index.mjs.map
|