@drincs/pixi-vn 0.5.3 → 0.5.5
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/dist/classes/CharacterBaseModel.js +110 -112
- package/dist/classes/CharacterBaseModel.js.map +1 -1
- package/dist/classes/CharacterBaseModel.mjs +110 -112
- package/dist/classes/CharacterBaseModel.mjs.map +1 -1
- package/dist/classes/ChoiceMenuOption.d.mts +19 -7
- package/dist/classes/ChoiceMenuOption.d.ts +19 -7
- package/dist/classes/ChoiceMenuOption.js +1386 -9
- package/dist/classes/ChoiceMenuOption.js.map +1 -1
- package/dist/classes/ChoiceMenuOption.mjs +1386 -9
- package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
- package/dist/classes/CloseLabel.d.mts +8 -5
- package/dist/classes/CloseLabel.d.ts +8 -5
- package/dist/classes/CloseLabel.js +44 -4
- package/dist/classes/CloseLabel.js.map +1 -1
- package/dist/classes/CloseLabel.mjs +41 -4
- package/dist/classes/CloseLabel.mjs.map +1 -1
- package/dist/classes/Label.d.mts +47 -21
- package/dist/classes/Label.d.ts +47 -21
- package/dist/classes/Label.js +36 -1
- package/dist/classes/Label.js.map +1 -1
- package/dist/classes/Label.mjs +36 -1
- package/dist/classes/Label.mjs.map +1 -1
- package/dist/classes/StoredClassModel.js +55 -57
- package/dist/classes/StoredClassModel.js.map +1 -1
- package/dist/classes/StoredClassModel.mjs +55 -57
- package/dist/classes/StoredClassModel.mjs.map +1 -1
- package/dist/classes/index.d.mts +2 -2
- package/dist/classes/index.d.ts +2 -2
- package/dist/classes/index.js +125 -73
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +125 -73
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/ticker/TickerFadeAlpha.js +27 -27
- package/dist/classes/ticker/TickerFadeAlpha.js.map +1 -1
- package/dist/classes/ticker/TickerFadeAlpha.mjs +27 -27
- package/dist/classes/ticker/TickerFadeAlpha.mjs.map +1 -1
- package/dist/classes/ticker/TickerMove.js +57 -55
- package/dist/classes/ticker/TickerMove.js.map +1 -1
- package/dist/classes/ticker/TickerMove.mjs +57 -55
- package/dist/classes/ticker/TickerMove.mjs.map +1 -1
- package/dist/classes/ticker/TickerRotate.js +57 -55
- package/dist/classes/ticker/TickerRotate.js.map +1 -1
- package/dist/classes/ticker/TickerRotate.mjs +57 -55
- package/dist/classes/ticker/TickerRotate.mjs.map +1 -1
- package/dist/classes/ticker/index.js +17 -17
- package/dist/classes/ticker/index.js.map +1 -1
- package/dist/classes/ticker/index.mjs +17 -17
- 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/LabelDecorator.d.mts +13 -20
- package/dist/decorators/LabelDecorator.d.ts +13 -20
- package/dist/decorators/LabelDecorator.js +1388 -28
- package/dist/decorators/LabelDecorator.js.map +1 -1
- package/dist/decorators/LabelDecorator.mjs +1388 -25
- package/dist/decorators/LabelDecorator.mjs.map +1 -1
- package/dist/decorators/index.d.mts +4 -4
- package/dist/decorators/index.d.ts +4 -4
- package/dist/decorators/index.js +1385 -13
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +1384 -13
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/DialogueUtility.d.mts +7 -7
- package/dist/functions/DialogueUtility.d.ts +7 -7
- package/dist/functions/DialogueUtility.js +96 -68
- package/dist/functions/DialogueUtility.js.map +1 -1
- package/dist/functions/DialogueUtility.mjs +96 -68
- package/dist/functions/DialogueUtility.mjs.map +1 -1
- package/dist/functions/FlagsUtility.js +55 -57
- package/dist/functions/FlagsUtility.js.map +1 -1
- package/dist/functions/FlagsUtility.mjs +55 -57
- package/dist/functions/FlagsUtility.mjs.map +1 -1
- package/dist/functions/GameUtility.js +55 -57
- package/dist/functions/GameUtility.js.map +1 -1
- package/dist/functions/GameUtility.mjs +55 -57
- package/dist/functions/GameUtility.mjs.map +1 -1
- package/dist/functions/ImageUtility.js +17 -17
- package/dist/functions/ImageUtility.js.map +1 -1
- package/dist/functions/ImageUtility.mjs +17 -17
- package/dist/functions/ImageUtility.mjs.map +1 -1
- package/dist/functions/SavesUtility.d.mts +2 -2
- package/dist/functions/SavesUtility.d.ts +2 -2
- package/dist/functions/SavesUtility.js +113 -141
- package/dist/functions/SavesUtility.js.map +1 -1
- package/dist/functions/SavesUtility.mjs +113 -141
- package/dist/functions/SavesUtility.mjs.map +1 -1
- package/dist/functions/StepLabelUtility.d.mts +0 -1
- package/dist/functions/StepLabelUtility.d.ts +0 -1
- package/dist/functions/index.d.mts +4 -4
- package/dist/functions/index.d.ts +4 -4
- package/dist/functions/index.js +97 -69
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +97 -69
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +359 -327
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +358 -327
- package/dist/index.mjs.map +1 -1
- package/dist/interface/{IDialogueHistory.d.mts → DialogueHistory.d.mts} +5 -5
- package/dist/interface/{IDialogueHistory.d.ts → DialogueHistory.d.ts} +5 -5
- package/dist/interface/{IDialogueHistory.js → DialogueHistory.js} +1 -1
- package/dist/interface/DialogueHistory.mjs +3 -0
- package/dist/interface/IHistoryStep.d.mts +2 -2
- package/dist/interface/IHistoryStep.d.ts +2 -2
- package/dist/interface/ISaveData.d.mts +2 -2
- package/dist/interface/ISaveData.d.ts +2 -2
- package/dist/interface/export/ExportedStep.d.mts +2 -2
- package/dist/interface/export/ExportedStep.d.ts +2 -2
- package/dist/interface/export/index.d.mts +2 -2
- package/dist/interface/export/index.d.ts +2 -2
- package/dist/interface/index.d.mts +6 -6
- package/dist/interface/index.d.ts +6 -6
- package/dist/managers/StepManager.d.mts +12 -12
- package/dist/managers/StepManager.d.ts +12 -12
- package/dist/managers/StepManager.js +53 -79
- package/dist/managers/StepManager.js.map +1 -1
- package/dist/managers/StepManager.mjs +53 -79
- package/dist/managers/StepManager.mjs.map +1 -1
- package/dist/managers/WindowManager.d.mts +1 -1
- package/dist/managers/WindowManager.d.ts +1 -1
- package/dist/managers/index.d.mts +2 -2
- package/dist/managers/index.d.ts +2 -2
- package/dist/managers/index.js +112 -140
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +112 -140
- package/dist/managers/index.mjs.map +1 -1
- package/dist/types/ChoiceMenuOptionsType.d.mts +3 -3
- package/dist/types/ChoiceMenuOptionsType.d.ts +3 -3
- package/dist/types/StepLabelType.d.mts +2 -3
- package/dist/types/StepLabelType.d.ts +2 -3
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/interface/IDialogueHistory.mjs +0 -3
- /package/dist/interface/{IDialogueHistory.js.map → DialogueHistory.js.map} +0 -0
- /package/dist/interface/{IDialogueHistory.mjs.map → DialogueHistory.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -74,13 +74,31 @@ function checkIfStepsIsEqual(step1, step2) {
|
|
|
74
74
|
|
|
75
75
|
// src/classes/Label.ts
|
|
76
76
|
var Label = class {
|
|
77
|
+
/**
|
|
78
|
+
* @param id is the id of the label
|
|
79
|
+
* @param steps is the list of steps that the label will perform
|
|
80
|
+
* @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
|
|
81
|
+
* @param choiseIndex is the index of the choice that the label will perform
|
|
82
|
+
*/
|
|
83
|
+
constructor(id, steps, onStepRun, choiseIndex) {
|
|
84
|
+
this._id = id;
|
|
85
|
+
this._steps = steps;
|
|
86
|
+
this._onStepRun = onStepRun;
|
|
87
|
+
this._choiseIndex = choiseIndex;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get the id of the label
|
|
91
|
+
*/
|
|
92
|
+
get id() {
|
|
93
|
+
return this._id;
|
|
94
|
+
}
|
|
77
95
|
/**
|
|
78
96
|
* Get the steps of the label.
|
|
79
97
|
* This class should be extended and the steps method should be overridden.
|
|
80
98
|
* Every time you update this list will also be updated when the other game versions load.
|
|
81
99
|
*/
|
|
82
100
|
get steps() {
|
|
83
|
-
|
|
101
|
+
return this._steps;
|
|
84
102
|
}
|
|
85
103
|
/**
|
|
86
104
|
* Get the corresponding steps number
|
|
@@ -99,253 +117,48 @@ var Label = class {
|
|
|
99
117
|
});
|
|
100
118
|
return res;
|
|
101
119
|
}
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
// src/classes/CloseLabel.ts
|
|
105
|
-
var CloseLabel = class extends Label {
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// src/decorators/LabelDecorator.ts
|
|
109
|
-
var registeredLabels = {};
|
|
110
|
-
function labelDecorator(name) {
|
|
111
|
-
return function(target) {
|
|
112
|
-
if (!name) {
|
|
113
|
-
name = target.name;
|
|
114
|
-
}
|
|
115
|
-
if (registeredLabels[name]) {
|
|
116
|
-
console.warn(`[Pixi'VN] Label ${name} already exists, it will be overwritten`);
|
|
117
|
-
}
|
|
118
|
-
registeredLabels[name] = target;
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
function getLabelTypeByClassName(labelName) {
|
|
122
|
-
try {
|
|
123
|
-
let labelType = registeredLabels[labelName];
|
|
124
|
-
if (!labelType) {
|
|
125
|
-
console.error(`[Pixi'VN] Label ${labelName} not found`);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
new labelType();
|
|
129
|
-
return labelType;
|
|
130
|
-
} catch (e) {
|
|
131
|
-
console.error(`[Pixi'VN] Error while getting Label ${labelName}`, e);
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
function getLabelInstanceByClassName(labelName) {
|
|
136
|
-
try {
|
|
137
|
-
let labelType = registeredLabels[labelName];
|
|
138
|
-
if (!labelType) {
|
|
139
|
-
console.error(`[Pixi'VN] Label ${labelName} not found`);
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
let label = new labelType();
|
|
143
|
-
let step = label.steps;
|
|
144
|
-
if (step.length = 0) {
|
|
145
|
-
console.warn(`[Pixi'VN] Label ${labelName} has no steps`);
|
|
146
|
-
}
|
|
147
|
-
return label;
|
|
148
|
-
} catch (e) {
|
|
149
|
-
console.error(`[Pixi'VN] Error while getting Label ${labelName}`, e);
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// src/types/CloseType.ts
|
|
155
|
-
var Close = "close";
|
|
156
|
-
|
|
157
|
-
// src/types/PauseType.ts
|
|
158
|
-
var PauseValueType = "pause";
|
|
159
|
-
function Pause(duration) {
|
|
160
|
-
return {
|
|
161
|
-
type: PauseValueType,
|
|
162
|
-
duration
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// src/types/RepeatType.ts
|
|
167
|
-
var Repeat = "repeat";
|
|
168
|
-
|
|
169
|
-
// src/classes/ChoiceMenuOption.ts
|
|
170
|
-
var ChoiceMenuOption = class {
|
|
171
120
|
/**
|
|
172
|
-
*
|
|
173
|
-
* @
|
|
174
|
-
* @
|
|
175
|
-
*
|
|
121
|
+
* Get the function that will be executed before any step is executed, is useful for example to make sure all images used have been cached
|
|
122
|
+
* @returns Promise<void> or void
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* newLabel("id", [], () => {
|
|
126
|
+
* Assets.load('path/to/image1.png')
|
|
127
|
+
* Assets.load('path/to/image2.png')
|
|
128
|
+
* })
|
|
129
|
+
* ```
|
|
176
130
|
*/
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
* Properties to be passed to the label
|
|
180
|
-
*/
|
|
181
|
-
this.props = {};
|
|
182
|
-
this.text = text;
|
|
183
|
-
this.label = new label();
|
|
184
|
-
this.type = type;
|
|
185
|
-
if (props) {
|
|
186
|
-
this.props = props;
|
|
187
|
-
}
|
|
131
|
+
get onStepRun() {
|
|
132
|
+
return this._onStepRun;
|
|
188
133
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* @param text Text to be displayed in the menu
|
|
193
|
-
*/
|
|
194
|
-
constructor(text) {
|
|
195
|
-
/**
|
|
196
|
-
* Label to be opened when the option is selected
|
|
197
|
-
*/
|
|
198
|
-
this.label = new CloseLabel();
|
|
199
|
-
/**
|
|
200
|
-
* Type of the label to be opened
|
|
201
|
-
*/
|
|
202
|
-
this.type = Close;
|
|
203
|
-
/**
|
|
204
|
-
* Properties to be passed to the label
|
|
205
|
-
*/
|
|
206
|
-
this.props = {};
|
|
207
|
-
this.text = text;
|
|
134
|
+
get choiseIndex() {
|
|
135
|
+
return this._choiseIndex;
|
|
208
136
|
}
|
|
209
137
|
};
|
|
210
138
|
|
|
211
|
-
// src/
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
let dialogue;
|
|
216
|
-
if (typeof props === "string") {
|
|
217
|
-
text = props;
|
|
218
|
-
dialogue = new DialogueBaseModel(text, characterId);
|
|
219
|
-
} else if (!(props instanceof DialogueBaseModel)) {
|
|
220
|
-
text = props.text;
|
|
221
|
-
if (props.character) {
|
|
222
|
-
if (typeof props.character === "string") {
|
|
223
|
-
characterId = props.character;
|
|
224
|
-
} else {
|
|
225
|
-
characterId = props.character.id;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
dialogue = new DialogueBaseModel(text, characterId);
|
|
229
|
-
} else {
|
|
230
|
-
dialogue = props;
|
|
231
|
-
}
|
|
232
|
-
GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY, dialogue);
|
|
233
|
-
GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex);
|
|
234
|
-
}
|
|
235
|
-
function getDialogue() {
|
|
236
|
-
return GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY);
|
|
237
|
-
}
|
|
238
|
-
function clearDialogue() {
|
|
239
|
-
GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY, void 0);
|
|
240
|
-
}
|
|
241
|
-
function setChoiceMenuOptions(options) {
|
|
242
|
-
let value = options.map((option) => {
|
|
243
|
-
if (option instanceof ChoiceMenuOptionClose) {
|
|
244
|
-
return {
|
|
245
|
-
text: option.text,
|
|
246
|
-
type: Close
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
return __spreadProps(__spreadValues({}, option), {
|
|
250
|
-
label: option.label.constructor.name
|
|
251
|
-
});
|
|
252
|
-
});
|
|
253
|
-
GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY, value);
|
|
254
|
-
GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex);
|
|
255
|
-
}
|
|
256
|
-
function getChoiceMenuOptions() {
|
|
257
|
-
let d = GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY);
|
|
258
|
-
if (d) {
|
|
259
|
-
let options = [];
|
|
260
|
-
d.forEach((option, index) => {
|
|
261
|
-
if (option.type === Close) {
|
|
262
|
-
let itemLabel = new CloseLabel();
|
|
263
|
-
itemLabel.choiseIndex = index;
|
|
264
|
-
options.push({
|
|
265
|
-
text: option.text,
|
|
266
|
-
label: itemLabel,
|
|
267
|
-
type: Close,
|
|
268
|
-
props: {}
|
|
269
|
-
});
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
let label = getLabelTypeByClassName(option.label);
|
|
273
|
-
if (label) {
|
|
274
|
-
let itemLabel = new label();
|
|
275
|
-
itemLabel.choiseIndex = index;
|
|
276
|
-
options.push(__spreadProps(__spreadValues({}, option), {
|
|
277
|
-
label: itemLabel
|
|
278
|
-
}));
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
return options;
|
|
282
|
-
}
|
|
283
|
-
return void 0;
|
|
284
|
-
}
|
|
285
|
-
function clearChoiceMenuOptions() {
|
|
286
|
-
GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY, void 0);
|
|
287
|
-
}
|
|
288
|
-
function getDialogueHistory() {
|
|
289
|
-
let list = [];
|
|
290
|
-
GameStepManager.stepsHistory.forEach((step) => {
|
|
291
|
-
let dialoge = step.dialoge;
|
|
292
|
-
let requiredChoices = step.choices;
|
|
293
|
-
if (list.length > 0 && list[list.length - 1].choices && !list[list.length - 1].playerMadeChoice && step.currentLabel) {
|
|
294
|
-
let oldChoices = list[list.length - 1].choices;
|
|
295
|
-
if (oldChoices) {
|
|
296
|
-
let choiceMade = false;
|
|
297
|
-
if (step.choiceIndexMade !== void 0 && oldChoices.length > step.choiceIndexMade) {
|
|
298
|
-
oldChoices[step.choiceIndexMade].isMadeChoice = true;
|
|
299
|
-
choiceMade = true;
|
|
300
|
-
}
|
|
301
|
-
list[list.length - 1].playerMadeChoice = choiceMade;
|
|
302
|
-
list[list.length - 1].choices = oldChoices;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
if (dialoge || requiredChoices) {
|
|
306
|
-
let choices = requiredChoices == null ? void 0 : requiredChoices.map((choice) => {
|
|
307
|
-
return {
|
|
308
|
-
text: choice.text,
|
|
309
|
-
type: choice.type,
|
|
310
|
-
isMadeChoice: false
|
|
311
|
-
};
|
|
312
|
-
});
|
|
313
|
-
list.push({
|
|
314
|
-
dialoge,
|
|
315
|
-
playerMadeChoice: false,
|
|
316
|
-
choices,
|
|
317
|
-
stepIndex: step.index
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
return list;
|
|
139
|
+
// src/classes/CloseLabel.ts
|
|
140
|
+
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
141
|
+
function newCloseLabel(choiseIndex) {
|
|
142
|
+
return new Label(CLOSE_LABEL_ID, [], void 0, choiseIndex);
|
|
322
143
|
}
|
|
323
144
|
|
|
324
|
-
// src/
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
if (
|
|
328
|
-
|
|
329
|
-
flags.push(name);
|
|
330
|
-
}
|
|
331
|
-
} else {
|
|
332
|
-
let index = flags.indexOf(name);
|
|
333
|
-
if (index > -1) {
|
|
334
|
-
flags.splice(index, 1);
|
|
335
|
-
}
|
|
145
|
+
// src/decorators/LabelDecorator.ts
|
|
146
|
+
var registeredLabels = {};
|
|
147
|
+
function newLabel(id, steps, onStepRun) {
|
|
148
|
+
if (registeredLabels[id]) {
|
|
149
|
+
console.warn(`[Pixi'VN] Label ${id} already exists, it will be overwritten`);
|
|
336
150
|
}
|
|
337
|
-
|
|
151
|
+
let label = new Label(id, steps, onStepRun);
|
|
152
|
+
registeredLabels[id] = label;
|
|
153
|
+
return label;
|
|
338
154
|
}
|
|
339
|
-
function
|
|
340
|
-
let
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
GameStorageManager.clear();
|
|
347
|
-
GameWindowManager.clear();
|
|
348
|
-
GameStepManager.clear();
|
|
155
|
+
function getLabelById(id) {
|
|
156
|
+
let label = registeredLabels[id];
|
|
157
|
+
if (!label) {
|
|
158
|
+
console.error(`[Pixi'VN] Label ${id} not found`);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
return label;
|
|
349
162
|
}
|
|
350
163
|
var CanvasBase = class extends pixi_js.Container {
|
|
351
164
|
/**
|
|
@@ -362,45 +175,6 @@ var CanvasBase = class extends pixi_js.Container {
|
|
|
362
175
|
}
|
|
363
176
|
};
|
|
364
177
|
|
|
365
|
-
// src/decorators/CanvasElementDecorator.ts
|
|
366
|
-
var registeredCanvasElement = {};
|
|
367
|
-
function canvasElementDecorator(name) {
|
|
368
|
-
return function(target) {
|
|
369
|
-
if (!name) {
|
|
370
|
-
name = target.name;
|
|
371
|
-
}
|
|
372
|
-
if (registeredCanvasElement[name]) {
|
|
373
|
-
console.warn(`[Pixi'VN] CanvasElement ${name} already registered`);
|
|
374
|
-
}
|
|
375
|
-
registeredCanvasElement[name] = target;
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
function getCanvasElementInstanceByClassName(canvasName) {
|
|
379
|
-
try {
|
|
380
|
-
let eventType = registeredCanvasElement[canvasName];
|
|
381
|
-
if (!eventType) {
|
|
382
|
-
if (canvasName === "CanvasContainer") {
|
|
383
|
-
eventType = CanvasContainer;
|
|
384
|
-
} else if (canvasName === "CanvasImage") {
|
|
385
|
-
eventType = CanvasImage;
|
|
386
|
-
} else if (canvasName === "CanvasSprite") {
|
|
387
|
-
eventType = CanvasSprite;
|
|
388
|
-
} else if (canvasName === "CanvasText") {
|
|
389
|
-
eventType = CanvasText;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
if (!eventType) {
|
|
393
|
-
console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`);
|
|
394
|
-
return;
|
|
395
|
-
}
|
|
396
|
-
let canvasElement = new eventType();
|
|
397
|
-
return canvasElement;
|
|
398
|
-
} catch (e) {
|
|
399
|
-
console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e);
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
178
|
// src/functions/CanvasUtility.ts
|
|
405
179
|
function getTextureMemory(texture) {
|
|
406
180
|
let sourceTexture = texture.source;
|
|
@@ -847,30 +621,45 @@ function setMemoryText(element, memory) {
|
|
|
847
621
|
}
|
|
848
622
|
}
|
|
849
623
|
|
|
850
|
-
// src/
|
|
851
|
-
var
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
624
|
+
// src/decorators/CanvasElementDecorator.ts
|
|
625
|
+
var registeredCanvasElement = {};
|
|
626
|
+
function canvasElementDecorator(name) {
|
|
627
|
+
return function(target) {
|
|
628
|
+
if (!name) {
|
|
629
|
+
name = target.name;
|
|
630
|
+
}
|
|
631
|
+
if (registeredCanvasElement[name]) {
|
|
632
|
+
console.warn(`[Pixi'VN] CanvasElement ${name} already registered`);
|
|
633
|
+
}
|
|
634
|
+
registeredCanvasElement[name] = target;
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
function getCanvasElementInstanceByClassName(canvasName) {
|
|
638
|
+
try {
|
|
639
|
+
let eventType = registeredCanvasElement[canvasName];
|
|
640
|
+
if (!eventType) {
|
|
641
|
+
if (canvasName === "CanvasContainer") {
|
|
642
|
+
eventType = CanvasContainer;
|
|
643
|
+
} else if (canvasName === "CanvasImage") {
|
|
644
|
+
eventType = CanvasImage;
|
|
645
|
+
} else if (canvasName === "CanvasSprite") {
|
|
646
|
+
eventType = CanvasSprite;
|
|
647
|
+
} else if (canvasName === "CanvasText") {
|
|
648
|
+
eventType = CanvasText;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
if (!eventType) {
|
|
652
|
+
console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`);
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
let canvasElement = new eventType();
|
|
656
|
+
return canvasElement;
|
|
657
|
+
} catch (e) {
|
|
658
|
+
console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e);
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
|
|
874
663
|
// src/decorators/CharacterDecorator.ts
|
|
875
664
|
var registeredCharacters = {};
|
|
876
665
|
function saveCharacter(character) {
|
|
@@ -927,7 +716,232 @@ function geTickerInstanceByClassName(tickerName, args, duration, priority) {
|
|
|
927
716
|
}
|
|
928
717
|
}
|
|
929
718
|
|
|
930
|
-
// src/
|
|
719
|
+
// src/types/CloseType.ts
|
|
720
|
+
var Close = "close";
|
|
721
|
+
|
|
722
|
+
// src/types/PauseType.ts
|
|
723
|
+
var PauseValueType = "pause";
|
|
724
|
+
function Pause(duration) {
|
|
725
|
+
return {
|
|
726
|
+
type: PauseValueType,
|
|
727
|
+
duration
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// src/types/RepeatType.ts
|
|
732
|
+
var Repeat = "repeat";
|
|
733
|
+
|
|
734
|
+
// src/classes/ChoiceMenuOption.ts
|
|
735
|
+
var ChoiceMenuOption = class {
|
|
736
|
+
/**
|
|
737
|
+
* @param text Text to be displayed in the menu
|
|
738
|
+
* @param label Label to be opened when the option is selected or the id of the label
|
|
739
|
+
* @param type Type of the label to be opened. @default "call"
|
|
740
|
+
* @param props Properties to be passed to the label, when the label is called. it cannot contain functions or classes. @default {}
|
|
741
|
+
*/
|
|
742
|
+
constructor(text, label, type = "call", props) {
|
|
743
|
+
/**
|
|
744
|
+
* Properties to be passed to the label
|
|
745
|
+
*/
|
|
746
|
+
this.props = {};
|
|
747
|
+
if (typeof label === "string") {
|
|
748
|
+
let tLabel = getLabelById(label);
|
|
749
|
+
if (!tLabel) {
|
|
750
|
+
throw new Error(`[Pixi'VN] Label ${label} not found`);
|
|
751
|
+
} else {
|
|
752
|
+
label = tLabel;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
this.text = text;
|
|
756
|
+
this.label = label;
|
|
757
|
+
this.type = type;
|
|
758
|
+
if (props) {
|
|
759
|
+
this.props = props;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
var ChoiceMenuOptionClose = class {
|
|
764
|
+
/**
|
|
765
|
+
* @param text Text to be displayed in the menu
|
|
766
|
+
*/
|
|
767
|
+
constructor(text) {
|
|
768
|
+
/**
|
|
769
|
+
* Label to be opened when the option is selected
|
|
770
|
+
*/
|
|
771
|
+
this.label = newCloseLabel();
|
|
772
|
+
/**
|
|
773
|
+
* Type of the label to be opened
|
|
774
|
+
*/
|
|
775
|
+
this.type = Close;
|
|
776
|
+
/**
|
|
777
|
+
* Properties to be passed to the label
|
|
778
|
+
*/
|
|
779
|
+
this.props = {};
|
|
780
|
+
this.text = text;
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
|
|
784
|
+
// src/functions/DialogueUtility.ts
|
|
785
|
+
function setDialogue(props) {
|
|
786
|
+
let text = "";
|
|
787
|
+
let characterId = void 0;
|
|
788
|
+
let dialogue;
|
|
789
|
+
if (typeof props === "string") {
|
|
790
|
+
text = props;
|
|
791
|
+
dialogue = new DialogueBaseModel(text, characterId);
|
|
792
|
+
} else if (!(props instanceof DialogueBaseModel)) {
|
|
793
|
+
text = props.text;
|
|
794
|
+
if (props.character) {
|
|
795
|
+
if (typeof props.character === "string") {
|
|
796
|
+
characterId = props.character;
|
|
797
|
+
} else {
|
|
798
|
+
characterId = props.character.id;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
dialogue = new DialogueBaseModel(text, characterId);
|
|
802
|
+
} else {
|
|
803
|
+
dialogue = props;
|
|
804
|
+
}
|
|
805
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY, dialogue);
|
|
806
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex);
|
|
807
|
+
}
|
|
808
|
+
function getDialogue() {
|
|
809
|
+
return GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY);
|
|
810
|
+
}
|
|
811
|
+
function clearDialogue() {
|
|
812
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY, void 0);
|
|
813
|
+
}
|
|
814
|
+
function setChoiceMenuOptions(options) {
|
|
815
|
+
let value = options.map((option) => {
|
|
816
|
+
if (option instanceof ChoiceMenuOptionClose) {
|
|
817
|
+
return {
|
|
818
|
+
text: option.text,
|
|
819
|
+
type: Close
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
return __spreadProps(__spreadValues({}, option), {
|
|
823
|
+
label: option.label.id
|
|
824
|
+
});
|
|
825
|
+
});
|
|
826
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY, value);
|
|
827
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex);
|
|
828
|
+
}
|
|
829
|
+
function getChoiceMenuOptions() {
|
|
830
|
+
let d = GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY);
|
|
831
|
+
if (d) {
|
|
832
|
+
let options = [];
|
|
833
|
+
d.forEach((option, index) => {
|
|
834
|
+
if (option.type === Close) {
|
|
835
|
+
let itemLabel = newCloseLabel(index);
|
|
836
|
+
options.push({
|
|
837
|
+
text: option.text,
|
|
838
|
+
label: itemLabel,
|
|
839
|
+
type: Close,
|
|
840
|
+
props: {}
|
|
841
|
+
});
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
let label = getLabelById(option.label);
|
|
845
|
+
if (label) {
|
|
846
|
+
let itemLabel = new Label(label.id, label.steps, label.onStepRun, index);
|
|
847
|
+
options.push(__spreadProps(__spreadValues({}, option), {
|
|
848
|
+
label: itemLabel
|
|
849
|
+
}));
|
|
850
|
+
}
|
|
851
|
+
});
|
|
852
|
+
return options;
|
|
853
|
+
}
|
|
854
|
+
return void 0;
|
|
855
|
+
}
|
|
856
|
+
function clearChoiceMenuOptions() {
|
|
857
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY, void 0);
|
|
858
|
+
}
|
|
859
|
+
function getDialogueHistory() {
|
|
860
|
+
let list = [];
|
|
861
|
+
GameStepManager.stepsHistory.forEach((step) => {
|
|
862
|
+
let dialoge = step.dialoge;
|
|
863
|
+
let requiredChoices = step.choices;
|
|
864
|
+
if (list.length > 0 && list[list.length - 1].choices && !list[list.length - 1].playerMadeChoice && step.currentLabel) {
|
|
865
|
+
let oldChoices = list[list.length - 1].choices;
|
|
866
|
+
if (oldChoices) {
|
|
867
|
+
let choiceMade = false;
|
|
868
|
+
if (step.choiceIndexMade !== void 0 && oldChoices.length > step.choiceIndexMade) {
|
|
869
|
+
oldChoices[step.choiceIndexMade].isResponse = true;
|
|
870
|
+
choiceMade = true;
|
|
871
|
+
}
|
|
872
|
+
list[list.length - 1].playerMadeChoice = choiceMade;
|
|
873
|
+
list[list.length - 1].choices = oldChoices;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
if (dialoge || requiredChoices) {
|
|
877
|
+
let choices = requiredChoices == null ? void 0 : requiredChoices.map((choice) => {
|
|
878
|
+
return {
|
|
879
|
+
text: choice.text,
|
|
880
|
+
type: choice.type,
|
|
881
|
+
isResponse: false
|
|
882
|
+
};
|
|
883
|
+
});
|
|
884
|
+
list.push({
|
|
885
|
+
dialoge,
|
|
886
|
+
playerMadeChoice: false,
|
|
887
|
+
choices,
|
|
888
|
+
stepIndex: step.index
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
});
|
|
892
|
+
return list;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
// src/functions/FlagsUtility.ts
|
|
896
|
+
function setFlag(name, value) {
|
|
897
|
+
let flags = GameStorageManager.getVariable(GameStorageManager.keysSystem.FLAGS_CATEGORY_KEY) || [];
|
|
898
|
+
if (value) {
|
|
899
|
+
if (!flags.includes(name)) {
|
|
900
|
+
flags.push(name);
|
|
901
|
+
}
|
|
902
|
+
} else {
|
|
903
|
+
let index = flags.indexOf(name);
|
|
904
|
+
if (index > -1) {
|
|
905
|
+
flags.splice(index, 1);
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.FLAGS_CATEGORY_KEY, flags);
|
|
909
|
+
}
|
|
910
|
+
function getFlag(name) {
|
|
911
|
+
let flags = GameStorageManager.getVariable(GameStorageManager.keysSystem.FLAGS_CATEGORY_KEY) || [];
|
|
912
|
+
return flags.includes(name);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
// src/functions/GameUtility.ts
|
|
916
|
+
function clearAllGameDatas() {
|
|
917
|
+
GameStorageManager.clear();
|
|
918
|
+
GameWindowManager.clear();
|
|
919
|
+
GameStepManager.clear();
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
// src/classes/ticker/TickerBase.ts
|
|
923
|
+
var TickerBase = class {
|
|
924
|
+
/**
|
|
925
|
+
* @param args The arguments that you want to pass to the ticker.
|
|
926
|
+
* @param duration The duration of the ticker. If is undefined, the ticker will be called every frame.
|
|
927
|
+
* @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL.
|
|
928
|
+
*/
|
|
929
|
+
constructor(args, duration, priority) {
|
|
930
|
+
this.args = args;
|
|
931
|
+
this.duration = duration;
|
|
932
|
+
this.priority = priority;
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* The method that will be called every frame.
|
|
936
|
+
* This method should be overridden and you can use GameWindowManager.addCanvasElement() to get the canvas element of the canvas, and edit them.
|
|
937
|
+
* @param t The ticker that is calling this method
|
|
938
|
+
* @param args The arguments that you passed when you added the ticker
|
|
939
|
+
* @param tags The tags of the canvas elements that are connected to this ticker
|
|
940
|
+
*/
|
|
941
|
+
fn(_t, _args, _tags) {
|
|
942
|
+
throw new Error("[Pixi'VN] The method TickerBase.fn() must be overridden");
|
|
943
|
+
}
|
|
944
|
+
};
|
|
931
945
|
exports.TickerFadeAlpha = class TickerFadeAlpha extends TickerBase {
|
|
932
946
|
/**
|
|
933
947
|
* The method that will be called every frame to fade the alpha of the canvas element of the canvas.
|
|
@@ -1150,7 +1164,7 @@ function showWithDissolveTransition(tag, image, speed, priority) {
|
|
|
1150
1164
|
}
|
|
1151
1165
|
|
|
1152
1166
|
// src/constants.ts
|
|
1153
|
-
var PIXIVN_VERSION = "0.5.
|
|
1167
|
+
var PIXIVN_VERSION = "0.5.5";
|
|
1154
1168
|
|
|
1155
1169
|
// src/functions/SavesUtility.ts
|
|
1156
1170
|
function getSaveData() {
|
|
@@ -1930,7 +1944,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1930
1944
|
*/
|
|
1931
1945
|
static get currentLabel() {
|
|
1932
1946
|
if (_GameStepManager.currentLabelId) {
|
|
1933
|
-
return
|
|
1947
|
+
return getLabelById(_GameStepManager.currentLabelId);
|
|
1934
1948
|
}
|
|
1935
1949
|
}
|
|
1936
1950
|
static get currentLabelStepIndex() {
|
|
@@ -1951,7 +1965,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1951
1965
|
return true;
|
|
1952
1966
|
} else {
|
|
1953
1967
|
this.openedLabels.forEach((item) => {
|
|
1954
|
-
let label =
|
|
1968
|
+
let label = getLabelById(item.label);
|
|
1955
1969
|
if (label && label.steps.length > item.currentStepIndex) {
|
|
1956
1970
|
return false;
|
|
1957
1971
|
}
|
|
@@ -2044,9 +2058,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2044
2058
|
* @param label The label to add to the history.
|
|
2045
2059
|
*/
|
|
2046
2060
|
static pushNewLabel(label) {
|
|
2047
|
-
let currentLabel =
|
|
2061
|
+
let currentLabel = getLabelById(label);
|
|
2048
2062
|
if (!currentLabel) {
|
|
2049
|
-
throw new Error(
|
|
2063
|
+
throw new Error(`[Pixi'VN] Label ${label} not found`);
|
|
2050
2064
|
}
|
|
2051
2065
|
_GameStepManager._openedLabels.push({
|
|
2052
2066
|
label,
|
|
@@ -2063,7 +2077,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2063
2077
|
return;
|
|
2064
2078
|
}
|
|
2065
2079
|
if (!_GameStepManager.currentLabel) {
|
|
2066
|
-
console.error("[Pixi'VN]
|
|
2080
|
+
console.error("[Pixi'VN] currentLabel not found");
|
|
2067
2081
|
return;
|
|
2068
2082
|
}
|
|
2069
2083
|
_GameStepManager._openedLabels.pop();
|
|
@@ -2135,7 +2149,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2135
2149
|
}
|
|
2136
2150
|
let currentLabel = _GameStepManager.currentLabel;
|
|
2137
2151
|
if (!currentLabel) {
|
|
2138
|
-
console.error("[Pixi'VN]
|
|
2152
|
+
console.error("[Pixi'VN] currentLabel not found");
|
|
2139
2153
|
return;
|
|
2140
2154
|
}
|
|
2141
2155
|
let n = currentLabel.steps.length;
|
|
@@ -2156,12 +2170,12 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2156
2170
|
/**
|
|
2157
2171
|
* Execute the label and add it to the history.
|
|
2158
2172
|
* Is a call function in Ren'Py.
|
|
2159
|
-
* @param label The label to execute
|
|
2173
|
+
* @param label The label to execute or the id of the label
|
|
2160
2174
|
* @param props The props to pass to the label.
|
|
2161
2175
|
* @returns StepLabelResultType or undefined.
|
|
2162
2176
|
* @example
|
|
2163
2177
|
* ```typescript
|
|
2164
|
-
* GameStepManager.callLabel(
|
|
2178
|
+
* GameStepManager.callLabel(startLabel, yourParams).then((result) => {
|
|
2165
2179
|
* if (result) {
|
|
2166
2180
|
* // your code
|
|
2167
2181
|
* }
|
|
@@ -2170,7 +2184,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2170
2184
|
* @example
|
|
2171
2185
|
* ```typescript
|
|
2172
2186
|
* // if you use it in a step label you should return the result.
|
|
2173
|
-
* return GameStepManager.callLabel(
|
|
2187
|
+
* return GameStepManager.callLabel(startLabel).then((result) => {
|
|
2174
2188
|
* return result
|
|
2175
2189
|
* })
|
|
2176
2190
|
* ```
|
|
@@ -2178,16 +2192,24 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2178
2192
|
static callLabel(label, props) {
|
|
2179
2193
|
return __async(this, null, function* () {
|
|
2180
2194
|
let choiseMade = void 0;
|
|
2195
|
+
let labelId;
|
|
2196
|
+
if (typeof label === "string") {
|
|
2197
|
+
labelId = label;
|
|
2198
|
+
} else {
|
|
2199
|
+
labelId = label.id;
|
|
2200
|
+
if (typeof label.choiseIndex === "number") {
|
|
2201
|
+
choiseMade = label.choiseIndex;
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2181
2204
|
try {
|
|
2182
|
-
if (
|
|
2205
|
+
if (labelId === CLOSE_LABEL_ID) {
|
|
2183
2206
|
return _GameStepManager.runNextStep(props);
|
|
2184
2207
|
}
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2208
|
+
let tempLabel = getLabelById(labelId);
|
|
2209
|
+
if (!tempLabel) {
|
|
2210
|
+
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2188
2211
|
}
|
|
2189
|
-
|
|
2190
|
-
_GameStepManager.pushNewLabel(labelName);
|
|
2212
|
+
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2191
2213
|
} catch (e) {
|
|
2192
2214
|
console.error("[Pixi'VN] Error calling label", e);
|
|
2193
2215
|
return;
|
|
@@ -2199,11 +2221,11 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2199
2221
|
* Execute the label, close all labels and add them to the history.
|
|
2200
2222
|
* Is a jump function in Ren'Py.
|
|
2201
2223
|
* @param label The label to execute.
|
|
2202
|
-
* @param props The props to pass to the label
|
|
2224
|
+
* @param props The props to pass to the label or the id of the label
|
|
2203
2225
|
* @returns StepLabelResultType or undefined.
|
|
2204
2226
|
* @example
|
|
2205
2227
|
* ```typescript
|
|
2206
|
-
* GameStepManager.jumpLabel(
|
|
2228
|
+
* GameStepManager.jumpLabel(startLabel, yourParams).then((result) => {
|
|
2207
2229
|
* if (result) {
|
|
2208
2230
|
* // your code
|
|
2209
2231
|
* }
|
|
@@ -2212,7 +2234,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2212
2234
|
* @example
|
|
2213
2235
|
* ```typescript
|
|
2214
2236
|
* // if you use it in a step label you should return the result.
|
|
2215
|
-
* return GameStepManager.jumpLabel(
|
|
2237
|
+
* return GameStepManager.jumpLabel(startLabel).then((result) => {
|
|
2216
2238
|
* return result
|
|
2217
2239
|
* })
|
|
2218
2240
|
* ```
|
|
@@ -2220,15 +2242,24 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2220
2242
|
static jumpLabel(label, props) {
|
|
2221
2243
|
return __async(this, null, function* () {
|
|
2222
2244
|
_GameStepManager.closeAllLabels();
|
|
2245
|
+
let labelId;
|
|
2246
|
+
if (typeof label === "string") {
|
|
2247
|
+
labelId = label;
|
|
2248
|
+
} else {
|
|
2249
|
+
labelId = label.id;
|
|
2250
|
+
if (typeof label.choiseIndex === "number") {
|
|
2251
|
+
label.choiseIndex;
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2223
2254
|
try {
|
|
2224
|
-
if (
|
|
2255
|
+
if (labelId === CLOSE_LABEL_ID) {
|
|
2225
2256
|
return _GameStepManager.runNextStep(props);
|
|
2226
2257
|
}
|
|
2227
|
-
|
|
2228
|
-
|
|
2258
|
+
let tempLabel = getLabelById(labelId);
|
|
2259
|
+
if (!tempLabel) {
|
|
2260
|
+
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2229
2261
|
}
|
|
2230
|
-
|
|
2231
|
-
_GameStepManager.pushNewLabel(labelName);
|
|
2262
|
+
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2232
2263
|
} catch (e) {
|
|
2233
2264
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
2234
2265
|
return;
|
|
@@ -2641,13 +2672,14 @@ exports.getChoiceMenuOptions = getChoiceMenuOptions;
|
|
|
2641
2672
|
exports.getDialogue = getDialogue;
|
|
2642
2673
|
exports.getDialogueHistory = getDialogueHistory;
|
|
2643
2674
|
exports.getFlag = getFlag;
|
|
2675
|
+
exports.getLabelById = getLabelById;
|
|
2644
2676
|
exports.getSaveData = getSaveData;
|
|
2645
2677
|
exports.getSaveJson = getSaveJson;
|
|
2646
2678
|
exports.getTexture = getTexture;
|
|
2647
|
-
exports.labelDecorator = labelDecorator;
|
|
2648
2679
|
exports.loadImages = loadImages;
|
|
2649
2680
|
exports.loadSaveData = loadSaveData;
|
|
2650
2681
|
exports.loadSaveJson = loadSaveJson;
|
|
2682
|
+
exports.newLabel = newLabel;
|
|
2651
2683
|
exports.removeCanvasElement = removeCanvasElement;
|
|
2652
2684
|
exports.saveCharacter = saveCharacter;
|
|
2653
2685
|
exports.setChoiceMenuOptions = setChoiceMenuOptions;
|