@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
|
@@ -78,19 +78,18 @@ function checkIfStepsIsEqual(step1, step2) {
|
|
|
78
78
|
return step1 === step2;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
// src/classes/
|
|
82
|
-
var
|
|
81
|
+
// src/classes/LabelAbstract.ts
|
|
82
|
+
var LabelAbstract = class {
|
|
83
83
|
/**
|
|
84
84
|
* @param id is the id of the label
|
|
85
|
-
* @param
|
|
86
|
-
* @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
|
|
87
|
-
* @param choiseIndex is the index of the choice that the label will perform
|
|
85
|
+
* @param props is the properties of the label
|
|
88
86
|
*/
|
|
89
|
-
constructor(id,
|
|
87
|
+
constructor(id, props) {
|
|
90
88
|
this._id = id;
|
|
91
|
-
this.
|
|
92
|
-
this.
|
|
93
|
-
this.
|
|
89
|
+
this._onStepStart = props == null ? void 0 : props.onStepStart;
|
|
90
|
+
this._onLoadStep = props == null ? void 0 : props.onLoadStep;
|
|
91
|
+
this._onStepEnd = props == null ? void 0 : props.onStepEnd;
|
|
92
|
+
this._choiseIndex = props == null ? void 0 : props.choiseIndex;
|
|
94
93
|
}
|
|
95
94
|
/**
|
|
96
95
|
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
@@ -98,17 +97,6 @@ var Label = class {
|
|
|
98
97
|
get id() {
|
|
99
98
|
return this._id;
|
|
100
99
|
}
|
|
101
|
-
/**
|
|
102
|
-
* Get the steps of the label.
|
|
103
|
-
* This class should be extended and the steps method should be overridden.
|
|
104
|
-
* Every time you update this list will also be updated when the other game versions load.
|
|
105
|
-
*/
|
|
106
|
-
get steps() {
|
|
107
|
-
if (typeof this._steps === "function") {
|
|
108
|
-
return this._steps();
|
|
109
|
-
}
|
|
110
|
-
return this._steps;
|
|
111
|
-
}
|
|
112
100
|
/**
|
|
113
101
|
* Get the corresponding steps number
|
|
114
102
|
* @param externalSteps
|
|
@@ -127,37 +115,75 @@ var Label = class {
|
|
|
127
115
|
return res;
|
|
128
116
|
}
|
|
129
117
|
/**
|
|
130
|
-
*
|
|
118
|
+
* 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.
|
|
119
|
+
* @returns Promise<void> or void
|
|
120
|
+
*/
|
|
121
|
+
get onStepStart() {
|
|
122
|
+
return (stepIndex, label) => __async(this, null, function* () {
|
|
123
|
+
if (this._onLoadStep) {
|
|
124
|
+
yield this._onLoadStep(stepIndex, label);
|
|
125
|
+
}
|
|
126
|
+
if (this._onStepStart) {
|
|
127
|
+
return yield this._onStepStart(stepIndex, label);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* 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.
|
|
133
|
+
* @returns Promise<void> or void
|
|
134
|
+
*/
|
|
135
|
+
get onLoadStep() {
|
|
136
|
+
return this._onLoadStep;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Is a function that will be executed when the step ends.
|
|
131
140
|
* @returns Promise<void> or void
|
|
132
|
-
* @example
|
|
133
|
-
* ```typescript
|
|
134
|
-
* newLabel("id", [], () => {
|
|
135
|
-
* Assets.load('path/to/image1.png')
|
|
136
|
-
* Assets.load('path/to/image2.png')
|
|
137
|
-
* })
|
|
138
|
-
* ```
|
|
139
141
|
*/
|
|
140
|
-
get
|
|
141
|
-
return this.
|
|
142
|
+
get onStepEnd() {
|
|
143
|
+
return this._onStepEnd;
|
|
142
144
|
}
|
|
143
145
|
get choiseIndex() {
|
|
144
146
|
return this._choiseIndex;
|
|
145
147
|
}
|
|
146
148
|
};
|
|
147
149
|
|
|
150
|
+
// src/classes/Label.ts
|
|
151
|
+
var Label = class extends LabelAbstract {
|
|
152
|
+
/**
|
|
153
|
+
* @param id is the id of the label
|
|
154
|
+
* @param steps is the list of steps that the label will perform
|
|
155
|
+
* @param props is the properties of the label
|
|
156
|
+
*/
|
|
157
|
+
constructor(id, steps, props) {
|
|
158
|
+
super(id, props);
|
|
159
|
+
this._steps = steps;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Get the steps of the label.
|
|
163
|
+
*/
|
|
164
|
+
get steps() {
|
|
165
|
+
if (typeof this._steps === "function") {
|
|
166
|
+
return this._steps();
|
|
167
|
+
}
|
|
168
|
+
return this._steps;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
148
172
|
// src/classes/CloseLabel.ts
|
|
149
173
|
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
150
174
|
function newCloseLabel(choiseIndex) {
|
|
151
|
-
return new Label(CLOSE_LABEL_ID, [],
|
|
175
|
+
return new Label(CLOSE_LABEL_ID, [], {
|
|
176
|
+
choiseIndex
|
|
177
|
+
});
|
|
152
178
|
}
|
|
153
179
|
|
|
154
180
|
// src/decorators/LabelDecorator.ts
|
|
155
181
|
var registeredLabels = {};
|
|
156
|
-
function newLabel(id, steps,
|
|
182
|
+
function newLabel(id, steps, props) {
|
|
157
183
|
if (registeredLabels[id]) {
|
|
158
184
|
console.info(`[Pixi'VN] Label ${id} already exists, it will be overwritten`);
|
|
159
185
|
}
|
|
160
|
-
let label = new Label(id, steps,
|
|
186
|
+
let label = new Label(id, steps, props);
|
|
161
187
|
registeredLabels[id] = label;
|
|
162
188
|
return label;
|
|
163
189
|
}
|
|
@@ -246,8 +272,6 @@ function getMemoryContainer(element) {
|
|
|
246
272
|
};
|
|
247
273
|
}
|
|
248
274
|
function setMemoryContainer(element, memory) {
|
|
249
|
-
memory.width && (element.width = memory.width);
|
|
250
|
-
memory.height && (element.height = memory.height);
|
|
251
275
|
memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
|
|
252
276
|
memory.blendMode && (element.blendMode = memory.blendMode);
|
|
253
277
|
memory.tint && (element.tint = memory.tint);
|
|
@@ -280,6 +304,8 @@ function setMemoryContainer(element, memory) {
|
|
|
280
304
|
memory.interactive && (element.interactive = memory.interactive);
|
|
281
305
|
memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
|
|
282
306
|
memory.hitArea && (element.hitArea = memory.hitArea);
|
|
307
|
+
memory.width && (element.width = memory.width);
|
|
308
|
+
memory.height && (element.height = memory.height);
|
|
283
309
|
}
|
|
284
310
|
function getTexture(imageUrl) {
|
|
285
311
|
return __async(this, null, function* () {
|
|
@@ -708,6 +734,106 @@ function geTickerInstanceById(tickerId, args, duration, priority) {
|
|
|
708
734
|
// src/types/CloseType.ts
|
|
709
735
|
var Close = "close";
|
|
710
736
|
|
|
737
|
+
// src/classes/ChoiceMenuOption.ts
|
|
738
|
+
var ChoiceMenuOption = class {
|
|
739
|
+
/**
|
|
740
|
+
* @param text Text to be displayed in the menu
|
|
741
|
+
* @param label Label to be opened when the option is selected or the id of the label
|
|
742
|
+
* @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.
|
|
743
|
+
* @param type Type of the label to be opened. @default "call"
|
|
744
|
+
*/
|
|
745
|
+
constructor(text, label, props, type = "call") {
|
|
746
|
+
/**
|
|
747
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
748
|
+
* @example
|
|
749
|
+
* ```tsx
|
|
750
|
+
* setChoiceMenuOptions([
|
|
751
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
752
|
+
* ])
|
|
753
|
+
* return <List>
|
|
754
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
755
|
+
* return (
|
|
756
|
+
* <ChoiceButton
|
|
757
|
+
* disabled={item.props.disabled}
|
|
758
|
+
* onClick={() => {
|
|
759
|
+
* afterSelectChoice(item)
|
|
760
|
+
* }}
|
|
761
|
+
* >
|
|
762
|
+
* {item.text}
|
|
763
|
+
* </ChoiceButton>
|
|
764
|
+
* )
|
|
765
|
+
* })}
|
|
766
|
+
* </List>
|
|
767
|
+
* ```
|
|
768
|
+
*/
|
|
769
|
+
this.props = {};
|
|
770
|
+
this.text = text;
|
|
771
|
+
this._label = label;
|
|
772
|
+
this.type = type;
|
|
773
|
+
if (props) {
|
|
774
|
+
this.props = props;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* Label to be opened when the option is selected
|
|
779
|
+
*/
|
|
780
|
+
get label() {
|
|
781
|
+
let label = this._label;
|
|
782
|
+
if (typeof label === "string") {
|
|
783
|
+
let res = getLabelById(label);
|
|
784
|
+
if (res) {
|
|
785
|
+
label = res;
|
|
786
|
+
} else {
|
|
787
|
+
console.error(`Label ${label} not found, so it will be closed`);
|
|
788
|
+
label = newCloseLabel();
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
return label;
|
|
792
|
+
}
|
|
793
|
+
};
|
|
794
|
+
var ChoiceMenuOptionClose = class {
|
|
795
|
+
/**
|
|
796
|
+
* @param text Text to be displayed in the menu
|
|
797
|
+
* @param closeCurrentLabel If true, the current label will be closed. @default false
|
|
798
|
+
*/
|
|
799
|
+
constructor(text, closeCurrentLabel = false) {
|
|
800
|
+
/**
|
|
801
|
+
* Label to be opened when the option is selected
|
|
802
|
+
*/
|
|
803
|
+
this.label = newCloseLabel();
|
|
804
|
+
/**
|
|
805
|
+
* Type of the label to be opened
|
|
806
|
+
*/
|
|
807
|
+
this.type = Close;
|
|
808
|
+
/**
|
|
809
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
810
|
+
* @example
|
|
811
|
+
* ```tsx
|
|
812
|
+
* setChoiceMenuOptions([
|
|
813
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
814
|
+
* ])
|
|
815
|
+
* return <List>
|
|
816
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
817
|
+
* return (
|
|
818
|
+
* <ChoiceButton
|
|
819
|
+
* disabled={item.props.disabled}
|
|
820
|
+
* onClick={() => {
|
|
821
|
+
* afterSelectChoice(item)
|
|
822
|
+
* }}
|
|
823
|
+
* >
|
|
824
|
+
* {item.text}
|
|
825
|
+
* </ChoiceButton>
|
|
826
|
+
* )
|
|
827
|
+
* })}
|
|
828
|
+
* </List>
|
|
829
|
+
* ```
|
|
830
|
+
*/
|
|
831
|
+
this.props = {};
|
|
832
|
+
this.text = text;
|
|
833
|
+
this.closeCurrentLabel = closeCurrentLabel;
|
|
834
|
+
}
|
|
835
|
+
};
|
|
836
|
+
|
|
711
837
|
// src/functions/DialogueUtility.ts
|
|
712
838
|
function setDialogue(props) {
|
|
713
839
|
let text = "";
|
|
@@ -742,21 +868,18 @@ function getChoiceMenuOptions() {
|
|
|
742
868
|
d.forEach((option, index) => {
|
|
743
869
|
if (option.type === Close) {
|
|
744
870
|
let itemLabel = newCloseLabel(index);
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
type: Close,
|
|
749
|
-
closeCurrentLabel: option.closeCurrentLabel,
|
|
750
|
-
props: {}
|
|
751
|
-
});
|
|
871
|
+
let choice = new ChoiceMenuOptionClose(option.text, option.closeCurrentLabel);
|
|
872
|
+
choice.label = itemLabel;
|
|
873
|
+
options.push(choice);
|
|
752
874
|
return;
|
|
753
875
|
}
|
|
754
876
|
let label = getLabelById(option.label);
|
|
755
877
|
if (label) {
|
|
756
|
-
let itemLabel = new Label(label.id, label.steps,
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
})
|
|
878
|
+
let itemLabel = new Label(label.id, label.steps, {
|
|
879
|
+
onStepStart: label.onStepStart,
|
|
880
|
+
choiseIndex: index
|
|
881
|
+
});
|
|
882
|
+
options.push(new ChoiceMenuOption(option.text, itemLabel, option.props, option.type));
|
|
760
883
|
}
|
|
761
884
|
});
|
|
762
885
|
return options;
|
|
@@ -844,8 +967,9 @@ FadeAlphaTicker = __decorateClass([
|
|
|
844
967
|
], FadeAlphaTicker);
|
|
845
968
|
|
|
846
969
|
// src/functions/TickerUtility.ts
|
|
847
|
-
function updateTickerProgression(args, propertyName, progression) {
|
|
848
|
-
|
|
970
|
+
function updateTickerProgression(args, propertyName, progression, valueConvert) {
|
|
971
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
972
|
+
if (args[propertyName] === void 0 || !progression || args[propertyName] === limit) {
|
|
849
973
|
return;
|
|
850
974
|
}
|
|
851
975
|
if (typeof args[propertyName] === "number") {
|
|
@@ -864,22 +988,25 @@ function updateTickerProgression(args, propertyName, progression) {
|
|
|
864
988
|
}
|
|
865
989
|
}
|
|
866
990
|
}
|
|
867
|
-
function getLinearProgression(number, progression) {
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
return
|
|
991
|
+
function getLinearProgression(number, progression, valueConvert) {
|
|
992
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
993
|
+
let amt = valueConvert ? valueConvert(progression.amt) : progression.amt;
|
|
994
|
+
if (limit !== void 0) {
|
|
995
|
+
if (number > limit && amt > 0) {
|
|
996
|
+
return limit;
|
|
997
|
+
} else if (number < limit && amt < 0) {
|
|
998
|
+
return limit;
|
|
873
999
|
}
|
|
874
1000
|
}
|
|
875
|
-
return number +
|
|
1001
|
+
return number + amt;
|
|
876
1002
|
}
|
|
877
|
-
function getExponentialProgression(number, progression) {
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
1003
|
+
function getExponentialProgression(number, progression, valueConvert) {
|
|
1004
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
1005
|
+
if (limit !== void 0) {
|
|
1006
|
+
if (number > limit && progression.percentage > 0) {
|
|
1007
|
+
return limit;
|
|
1008
|
+
} else if (number < limit && progression.percentage < 0) {
|
|
1009
|
+
return limit;
|
|
883
1010
|
}
|
|
884
1011
|
}
|
|
885
1012
|
return number + number * progression.percentage;
|
|
@@ -892,15 +1019,13 @@ var MoveTicker = class extends TickerBase {
|
|
|
892
1019
|
let ySpeed = 1;
|
|
893
1020
|
if (args.speed) {
|
|
894
1021
|
if (typeof args.speed === "number") {
|
|
895
|
-
xSpeed = args.speed;
|
|
896
|
-
ySpeed = args.speed;
|
|
1022
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1023
|
+
ySpeed = this.speedConvert(args.speed);
|
|
897
1024
|
} else {
|
|
898
|
-
xSpeed = args.speed.x;
|
|
899
|
-
ySpeed = args.speed.y;
|
|
1025
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1026
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
900
1027
|
}
|
|
901
1028
|
}
|
|
902
|
-
xSpeed /= 60;
|
|
903
|
-
ySpeed /= 60;
|
|
904
1029
|
let destination = args.destination;
|
|
905
1030
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
906
1031
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -940,7 +1065,10 @@ var MoveTicker = class extends TickerBase {
|
|
|
940
1065
|
}
|
|
941
1066
|
});
|
|
942
1067
|
if (args.speedProgression)
|
|
943
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1068
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1069
|
+
}
|
|
1070
|
+
speedConvert(speed) {
|
|
1071
|
+
return speed / 6;
|
|
944
1072
|
}
|
|
945
1073
|
};
|
|
946
1074
|
MoveTicker = __decorateClass([
|
|
@@ -948,7 +1076,7 @@ MoveTicker = __decorateClass([
|
|
|
948
1076
|
], MoveTicker);
|
|
949
1077
|
var RotateTicker = class extends TickerBase {
|
|
950
1078
|
fn(ticker, args, tags, tickerId) {
|
|
951
|
-
let speed = (args.speed === void 0 ? 1 : args.speed)
|
|
1079
|
+
let speed = this.speedConvert(args.speed === void 0 ? 1 : args.speed);
|
|
952
1080
|
let clockwise = args.clockwise === void 0 ? true : args.clockwise;
|
|
953
1081
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
954
1082
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -976,7 +1104,10 @@ var RotateTicker = class extends TickerBase {
|
|
|
976
1104
|
}
|
|
977
1105
|
});
|
|
978
1106
|
if (args.speedProgression)
|
|
979
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1107
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1108
|
+
}
|
|
1109
|
+
speedConvert(speed) {
|
|
1110
|
+
return speed / 60;
|
|
980
1111
|
}
|
|
981
1112
|
};
|
|
982
1113
|
RotateTicker = __decorateClass([
|
|
@@ -988,15 +1119,13 @@ var ZoomTicker = class extends TickerBase {
|
|
|
988
1119
|
let ySpeed = 0.1;
|
|
989
1120
|
if (args.speed) {
|
|
990
1121
|
if (typeof args.speed === "number") {
|
|
991
|
-
xSpeed = args.speed;
|
|
992
|
-
ySpeed = args.speed;
|
|
1122
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1123
|
+
ySpeed = this.speedConvert(args.speed);
|
|
993
1124
|
} else {
|
|
994
|
-
xSpeed = args.speed.x;
|
|
995
|
-
ySpeed = args.speed.y;
|
|
1125
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1126
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
996
1127
|
}
|
|
997
1128
|
}
|
|
998
|
-
xSpeed /= 60;
|
|
999
|
-
ySpeed /= 60;
|
|
1000
1129
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
1001
1130
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
1002
1131
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
@@ -1063,7 +1192,10 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1063
1192
|
}
|
|
1064
1193
|
});
|
|
1065
1194
|
if (args.speedProgression)
|
|
1066
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1195
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1196
|
+
}
|
|
1197
|
+
speedConvert(speed) {
|
|
1198
|
+
return speed / 60;
|
|
1067
1199
|
}
|
|
1068
1200
|
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
1069
1201
|
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
@@ -2025,6 +2157,16 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2025
2157
|
static set originalStepData(value) {
|
|
2026
2158
|
_GameStepManager._originalStepData = createExportableElement(value);
|
|
2027
2159
|
}
|
|
2160
|
+
static get currentStepData() {
|
|
2161
|
+
let currentStepData = {
|
|
2162
|
+
path: window.location.pathname,
|
|
2163
|
+
storage: GameStorageManager.export(),
|
|
2164
|
+
canvas: GameWindowManager.export(),
|
|
2165
|
+
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2166
|
+
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2167
|
+
};
|
|
2168
|
+
return currentStepData;
|
|
2169
|
+
}
|
|
2028
2170
|
/* Edit History Methods */
|
|
2029
2171
|
/**
|
|
2030
2172
|
* Add a label to the history.
|
|
@@ -2032,19 +2174,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2032
2174
|
*/
|
|
2033
2175
|
static addStepHistory(step, choiseMade) {
|
|
2034
2176
|
let stepHistory = getStepSha1(step);
|
|
2035
|
-
let
|
|
2036
|
-
path: window.location.pathname,
|
|
2037
|
-
storage: GameStorageManager.export(),
|
|
2038
|
-
canvas: GameWindowManager.export(),
|
|
2039
|
-
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2040
|
-
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2041
|
-
};
|
|
2177
|
+
let currentStepData = _GameStepManager.currentStepData;
|
|
2042
2178
|
if (_GameStepManager.originalStepData) {
|
|
2043
|
-
if (_GameStepManager.originalStepData.openedLabels.length ===
|
|
2179
|
+
if (_GameStepManager.originalStepData.openedLabels.length === currentStepData.openedLabels.length) {
|
|
2044
2180
|
try {
|
|
2045
2181
|
let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
|
|
2046
|
-
let historyStepOpenedLabelsString = JSON.stringify(
|
|
2047
|
-
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path ===
|
|
2182
|
+
let historyStepOpenedLabelsString = JSON.stringify(currentStepData.openedLabels);
|
|
2183
|
+
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === currentStepData.path && _GameStepManager.originalStepData.labelIndex === currentStepData.labelIndex) {
|
|
2048
2184
|
return;
|
|
2049
2185
|
}
|
|
2050
2186
|
} catch (e) {
|
|
@@ -2052,7 +2188,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2052
2188
|
}
|
|
2053
2189
|
}
|
|
2054
2190
|
}
|
|
2055
|
-
let data = deepDiff.diff(_GameStepManager.originalStepData,
|
|
2191
|
+
let data = deepDiff.diff(_GameStepManager.originalStepData, currentStepData);
|
|
2056
2192
|
if (data) {
|
|
2057
2193
|
let dialoge = void 0;
|
|
2058
2194
|
let requiredChoices = void 0;
|
|
@@ -2071,7 +2207,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2071
2207
|
index: _GameStepManager.lastStepIndex,
|
|
2072
2208
|
choiceIndexMade: choiseMade
|
|
2073
2209
|
});
|
|
2074
|
-
_GameStepManager.originalStepData =
|
|
2210
|
+
_GameStepManager.originalStepData = currentStepData;
|
|
2075
2211
|
}
|
|
2076
2212
|
_GameStepManager.increaseLastStepIndex();
|
|
2077
2213
|
}
|
|
@@ -2162,6 +2298,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2162
2298
|
console.warn("[Pixi'VN] The player must make a choice");
|
|
2163
2299
|
return;
|
|
2164
2300
|
}
|
|
2301
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2302
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2303
|
+
}
|
|
2165
2304
|
_GameStepManager.increaseCurrentStepIndex();
|
|
2166
2305
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2167
2306
|
});
|
|
@@ -2186,6 +2325,10 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2186
2325
|
return;
|
|
2187
2326
|
}
|
|
2188
2327
|
if (currentLabel.steps.length > currentLabelStepIndex) {
|
|
2328
|
+
let onStepRun = currentLabel.onStepStart;
|
|
2329
|
+
if (onStepRun) {
|
|
2330
|
+
yield onStepRun(currentLabelStepIndex, currentLabel);
|
|
2331
|
+
}
|
|
2189
2332
|
let step = currentLabel.steps[currentLabelStepIndex];
|
|
2190
2333
|
let result = yield step(props);
|
|
2191
2334
|
_GameStepManager.addStepHistory(step, choiseMade);
|
|
@@ -2250,6 +2393,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2250
2393
|
if (!tempLabel) {
|
|
2251
2394
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2252
2395
|
}
|
|
2396
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2397
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2398
|
+
}
|
|
2253
2399
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2254
2400
|
} catch (e) {
|
|
2255
2401
|
console.error("[Pixi'VN] Error calling label", e);
|
|
@@ -2308,6 +2454,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2308
2454
|
if (!tempLabel) {
|
|
2309
2455
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2310
2456
|
}
|
|
2457
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2458
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2459
|
+
}
|
|
2311
2460
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2312
2461
|
} catch (e) {
|
|
2313
2462
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
@@ -2413,24 +2562,29 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2413
2562
|
* ```
|
|
2414
2563
|
*/
|
|
2415
2564
|
static goBack(navigate, steps = 1) {
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2565
|
+
return __async(this, null, function* () {
|
|
2566
|
+
if (steps <= 0) {
|
|
2567
|
+
console.warn("[Pixi'VN] Steps must be greater than 0");
|
|
2568
|
+
return;
|
|
2569
|
+
}
|
|
2570
|
+
if (_GameStepManager._stepsHistory.length <= 1) {
|
|
2571
|
+
console.warn("[Pixi'VN] No steps to go back");
|
|
2572
|
+
return;
|
|
2573
|
+
}
|
|
2574
|
+
let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
|
|
2575
|
+
if (restoredStep) {
|
|
2576
|
+
_GameStepManager._originalStepData = restoredStep;
|
|
2577
|
+
_GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
|
|
2578
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2579
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2580
|
+
}
|
|
2581
|
+
GameStorageManager.import(createExportableElement(restoredStep.storage));
|
|
2582
|
+
GameWindowManager.import(createExportableElement(restoredStep.canvas));
|
|
2583
|
+
navigate(restoredStep.path);
|
|
2584
|
+
} else {
|
|
2585
|
+
console.error("[Pixi'VN] Error going back");
|
|
2586
|
+
}
|
|
2587
|
+
});
|
|
2434
2588
|
}
|
|
2435
2589
|
static goBackInternal(steps, restoredStep) {
|
|
2436
2590
|
if (steps <= 0) {
|
|
@@ -2492,38 +2646,45 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2492
2646
|
* @param dataString The history in a JSON string.
|
|
2493
2647
|
*/
|
|
2494
2648
|
static importJson(dataString) {
|
|
2495
|
-
|
|
2649
|
+
return __async(this, null, function* () {
|
|
2650
|
+
yield _GameStepManager.import(JSON.parse(dataString));
|
|
2651
|
+
});
|
|
2496
2652
|
}
|
|
2497
2653
|
/**
|
|
2498
2654
|
* Import the history from an object.
|
|
2499
2655
|
* @param data The history in an object.
|
|
2500
2656
|
*/
|
|
2501
2657
|
static import(data) {
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2658
|
+
return __async(this, null, function* () {
|
|
2659
|
+
_GameStepManager.clear();
|
|
2660
|
+
try {
|
|
2661
|
+
if (data.hasOwnProperty("stepsHistory")) {
|
|
2662
|
+
_GameStepManager._stepsHistory = data["stepsHistory"];
|
|
2663
|
+
} else {
|
|
2664
|
+
console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
|
|
2665
|
+
}
|
|
2666
|
+
if (data.hasOwnProperty("openedLabels")) {
|
|
2667
|
+
_GameStepManager._openedLabels = data["openedLabels"];
|
|
2668
|
+
} else {
|
|
2669
|
+
console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
|
|
2670
|
+
}
|
|
2671
|
+
if (data.hasOwnProperty("lastStepIndex")) {
|
|
2672
|
+
_GameStepManager._lastStepIndex = data["lastStepIndex"];
|
|
2673
|
+
} else {
|
|
2674
|
+
console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
|
|
2675
|
+
}
|
|
2676
|
+
if (data.hasOwnProperty("originalStepData")) {
|
|
2677
|
+
_GameStepManager._originalStepData = data["originalStepData"];
|
|
2678
|
+
} else {
|
|
2679
|
+
console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
|
|
2680
|
+
}
|
|
2681
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2682
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2683
|
+
}
|
|
2684
|
+
} catch (e) {
|
|
2685
|
+
console.error("[Pixi'VN] Error importing data", e);
|
|
2523
2686
|
}
|
|
2524
|
-
}
|
|
2525
|
-
console.error("[Pixi'VN] Error importing data", e);
|
|
2526
|
-
}
|
|
2687
|
+
});
|
|
2527
2688
|
}
|
|
2528
2689
|
};
|
|
2529
2690
|
/**
|
|
@@ -2699,7 +2860,7 @@ var DialogueBaseModel = class {
|
|
|
2699
2860
|
var juliette = new CharacterBaseModel2("___pixivn_juliette___", {
|
|
2700
2861
|
name: "Juliette",
|
|
2701
2862
|
age: 25,
|
|
2702
|
-
icon: "https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-square.webp?alt=media
|
|
2863
|
+
icon: "https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-square.webp?alt=media",
|
|
2703
2864
|
color: "#ac0086"
|
|
2704
2865
|
});
|
|
2705
2866
|
saveCharacter(juliette);
|
|
@@ -2719,36 +2880,30 @@ exports.EventTest1 = __decorateClass([
|
|
|
2719
2880
|
eventDecorator("___pixi_vn_canvas_events_test_event1___")
|
|
2720
2881
|
], exports.EventTest1);
|
|
2721
2882
|
exports.EventTest2 = class EventTest2 extends CanvasEvent {
|
|
2722
|
-
constructor() {
|
|
2723
|
-
super(...arguments);
|
|
2724
|
-
this.textureButtonDown = pixi_js.Texture.from("https://pixijs.com/assets/button_down.png");
|
|
2725
|
-
this.textureButtonOver = pixi_js.Texture.from("https://pixijs.com/assets/button_over.png");
|
|
2726
|
-
this.textureButton = pixi_js.Texture.from("https://pixijs.com/assets/button.png");
|
|
2727
|
-
}
|
|
2728
2883
|
fn(event, sprite) {
|
|
2729
2884
|
if (event === "pointerdown") {
|
|
2730
2885
|
sprite.isdown = true;
|
|
2731
|
-
sprite.texture =
|
|
2886
|
+
sprite.texture = pixi_js.Texture.from("https://pixijs.com/assets/button_down.png");
|
|
2732
2887
|
sprite.alpha = 1;
|
|
2733
2888
|
} else if (event === "pointerup" || event === "pointerupoutside") {
|
|
2734
2889
|
sprite.isdown = false;
|
|
2735
2890
|
if (sprite.isOver) {
|
|
2736
|
-
sprite.texture =
|
|
2891
|
+
sprite.texture = pixi_js.Texture.from("https://pixijs.com/assets/button_over.png");
|
|
2737
2892
|
} else {
|
|
2738
|
-
sprite.texture =
|
|
2893
|
+
sprite.texture = pixi_js.Texture.from("https://pixijs.com/assets/button.png");
|
|
2739
2894
|
}
|
|
2740
2895
|
} else if (event === "pointerover") {
|
|
2741
2896
|
sprite.isOver = true;
|
|
2742
2897
|
if (sprite.isdown) {
|
|
2743
2898
|
return;
|
|
2744
2899
|
}
|
|
2745
|
-
sprite.texture =
|
|
2900
|
+
sprite.texture = pixi_js.Texture.from("https://pixijs.com/assets/button_over.png");
|
|
2746
2901
|
} else if (event === "pointerout") {
|
|
2747
2902
|
sprite.isOver = false;
|
|
2748
2903
|
if (sprite.isdown) {
|
|
2749
2904
|
return;
|
|
2750
2905
|
}
|
|
2751
|
-
sprite.texture =
|
|
2906
|
+
sprite.texture = pixi_js.Texture.from("https://pixijs.com/assets/button.png");
|
|
2752
2907
|
}
|
|
2753
2908
|
}
|
|
2754
2909
|
};
|
|
@@ -2770,6 +2925,7 @@ var canvasEventsTestLabel = newLabel(
|
|
|
2770
2925
|
});
|
|
2771
2926
|
const texture = yield pixi_js.Assets.load(bunnyImage);
|
|
2772
2927
|
const sprite = CanvasSprite.from(texture);
|
|
2928
|
+
sprite.scale.set(3);
|
|
2773
2929
|
sprite.anchor.set(0.5);
|
|
2774
2930
|
sprite.x = GameWindowManager.screen.width / 2;
|
|
2775
2931
|
sprite.y = GameWindowManager.screen.height / 2;
|
|
@@ -2785,12 +2941,11 @@ var canvasEventsTestLabel = newLabel(
|
|
|
2785
2941
|
text: `This is the test of buttons in a canvas. (This example is from the official [PixiJS website](https://pixijs.com/8.x/examples/events/interactivity).)`
|
|
2786
2942
|
});
|
|
2787
2943
|
const backgroundT = yield pixi_js.Assets.load("https://pixijs.com/assets/bg_button.jpg");
|
|
2788
|
-
const background = CanvasSprite
|
|
2944
|
+
const background = new CanvasSprite(backgroundT);
|
|
2789
2945
|
background.width = GameWindowManager.screen.width;
|
|
2790
2946
|
background.height = GameWindowManager.screen.height;
|
|
2791
2947
|
GameWindowManager.addCanvasElement("bg", background);
|
|
2792
|
-
const
|
|
2793
|
-
const textureButton = CanvasSprite.from(textureButtonT);
|
|
2948
|
+
const textureButton = yield pixi_js.Assets.load("https://pixijs.com/assets/button.png");
|
|
2794
2949
|
const buttons = [];
|
|
2795
2950
|
const buttonPositions = [175, 75, 655, 75, 410, 325, 150, 465, 685, 445];
|
|
2796
2951
|
for (let i = 0; i < 5; i++) {
|
|
@@ -2810,7 +2965,17 @@ var canvasEventsTestLabel = newLabel(
|
|
|
2810
2965
|
buttons[4].scale.set(0.8, 1.2);
|
|
2811
2966
|
buttons[4].rotation = Math.PI;
|
|
2812
2967
|
})
|
|
2813
|
-
]
|
|
2968
|
+
],
|
|
2969
|
+
{
|
|
2970
|
+
onLoadStep: () => __async(void 0, null, function* () {
|
|
2971
|
+
yield pixi_js.Assets.load([
|
|
2972
|
+
"https://pixijs.com/assets/bg_button.jpg",
|
|
2973
|
+
"https://pixijs.com/assets/button.png",
|
|
2974
|
+
"https://pixijs.com/assets/button_down.png",
|
|
2975
|
+
"https://pixijs.com/assets/button_over.png"
|
|
2976
|
+
]);
|
|
2977
|
+
})
|
|
2978
|
+
}
|
|
2814
2979
|
);
|
|
2815
2980
|
|
|
2816
2981
|
exports.canvasEventsTestLabel = canvasEventsTestLabel;
|