@drincs/pixi-vn 0.5.2 → 0.5.4
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 -7
- package/dist/classes/ChoiceMenuOption.js.map +1 -1
- package/dist/classes/ChoiceMenuOption.mjs +1386 -7
- package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
- package/dist/classes/CloseLabel.d.mts +8 -3
- package/dist/classes/CloseLabel.d.ts +8 -3
- package/dist/classes/CloseLabel.js +44 -2
- package/dist/classes/CloseLabel.js.map +1 -1
- package/dist/classes/CloseLabel.mjs +41 -2
- 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 +97 -67
- package/dist/functions/DialogueUtility.js.map +1 -1
- package/dist/functions/DialogueUtility.mjs +97 -67
- 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 +115 -143
- package/dist/functions/SavesUtility.js.map +1 -1
- package/dist/functions/SavesUtility.mjs +115 -143
- 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 +98 -68
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +98 -68
- 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 +361 -327
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +360 -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 +55 -81
- package/dist/managers/StepManager.js.map +1 -1
- package/dist/managers/StepManager.mjs +55 -81
- 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 +114 -142
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +114 -142
- 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,50 @@ var Label = class {
|
|
|
99
117
|
});
|
|
100
118
|
return res;
|
|
101
119
|
}
|
|
120
|
+
/**
|
|
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
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
get onStepRun() {
|
|
132
|
+
return this._onStepRun;
|
|
133
|
+
}
|
|
134
|
+
get choiseIndex() {
|
|
135
|
+
return this._choiseIndex;
|
|
136
|
+
}
|
|
102
137
|
};
|
|
103
138
|
|
|
104
139
|
// src/classes/CloseLabel.ts
|
|
140
|
+
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
105
141
|
var CloseLabel = class extends Label {
|
|
142
|
+
constructor(choiseIndex) {
|
|
143
|
+
super(CLOSE_LABEL_ID, [], void 0, choiseIndex);
|
|
144
|
+
}
|
|
106
145
|
};
|
|
107
146
|
|
|
108
147
|
// src/decorators/LabelDecorator.ts
|
|
109
148
|
var registeredLabels = {};
|
|
110
|
-
function
|
|
111
|
-
|
|
112
|
-
|
|
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;
|
|
149
|
+
function newLabel(id, steps, onStepRun) {
|
|
150
|
+
if (registeredLabels[id]) {
|
|
151
|
+
console.warn(`[Pixi'VN] Label ${id} already exists, it will be overwritten`);
|
|
133
152
|
}
|
|
153
|
+
let label = new Label(id, steps, onStepRun);
|
|
154
|
+
registeredLabels[id] = label;
|
|
155
|
+
return label;
|
|
134
156
|
}
|
|
135
|
-
function
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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);
|
|
157
|
+
function getLabelById(id) {
|
|
158
|
+
let label = registeredLabels[id];
|
|
159
|
+
if (!label) {
|
|
160
|
+
console.error(`[Pixi'VN] Label ${id} not found`);
|
|
150
161
|
return;
|
|
151
162
|
}
|
|
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
|
-
/**
|
|
172
|
-
* @param text Text to be displayed in the menu
|
|
173
|
-
* @param label Label to be opened when the option is selected
|
|
174
|
-
* @param type Type of the label to be opened
|
|
175
|
-
* @param props Properties to be passed to the label, when the label is called. it cannot contain functions or classes.
|
|
176
|
-
*/
|
|
177
|
-
constructor(text, label, type = "call", props) {
|
|
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
|
-
}
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
var ChoiceMenuOptionClose = class {
|
|
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;
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
// src/functions/DialogueUtility.ts
|
|
212
|
-
function setDialogue(props) {
|
|
213
|
-
let text = "";
|
|
214
|
-
let characterId = void 0;
|
|
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;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// src/functions/FlagsUtility.ts
|
|
325
|
-
function setFlag(name, value) {
|
|
326
|
-
let flags = GameStorageManager.getVariable(GameStorageManager.keysSystem.FLAGS_CATEGORY_KEY) || [];
|
|
327
|
-
if (value) {
|
|
328
|
-
if (!flags.includes(name)) {
|
|
329
|
-
flags.push(name);
|
|
330
|
-
}
|
|
331
|
-
} else {
|
|
332
|
-
let index = flags.indexOf(name);
|
|
333
|
-
if (index > -1) {
|
|
334
|
-
flags.splice(index, 1);
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
GameStorageManager.setVariable(GameStorageManager.keysSystem.FLAGS_CATEGORY_KEY, flags);
|
|
338
|
-
}
|
|
339
|
-
function getFlag(name) {
|
|
340
|
-
let flags = GameStorageManager.getVariable(GameStorageManager.keysSystem.FLAGS_CATEGORY_KEY) || [];
|
|
341
|
-
return flags.includes(name);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// src/functions/GameUtility.ts
|
|
345
|
-
function clearAllGameDatas() {
|
|
346
|
-
GameStorageManager.clear();
|
|
347
|
-
GameWindowManager.clear();
|
|
348
|
-
GameStepManager.clear();
|
|
163
|
+
return label;
|
|
349
164
|
}
|
|
350
165
|
var CanvasBase = class extends pixi_js.Container {
|
|
351
166
|
/**
|
|
@@ -362,45 +177,6 @@ var CanvasBase = class extends pixi_js.Container {
|
|
|
362
177
|
}
|
|
363
178
|
};
|
|
364
179
|
|
|
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
180
|
// src/functions/CanvasUtility.ts
|
|
405
181
|
function getTextureMemory(texture) {
|
|
406
182
|
let sourceTexture = texture.source;
|
|
@@ -847,30 +623,45 @@ function setMemoryText(element, memory) {
|
|
|
847
623
|
}
|
|
848
624
|
}
|
|
849
625
|
|
|
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
|
-
|
|
626
|
+
// src/decorators/CanvasElementDecorator.ts
|
|
627
|
+
var registeredCanvasElement = {};
|
|
628
|
+
function canvasElementDecorator(name) {
|
|
629
|
+
return function(target) {
|
|
630
|
+
if (!name) {
|
|
631
|
+
name = target.name;
|
|
632
|
+
}
|
|
633
|
+
if (registeredCanvasElement[name]) {
|
|
634
|
+
console.warn(`[Pixi'VN] CanvasElement ${name} already registered`);
|
|
635
|
+
}
|
|
636
|
+
registeredCanvasElement[name] = target;
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
function getCanvasElementInstanceByClassName(canvasName) {
|
|
640
|
+
try {
|
|
641
|
+
let eventType = registeredCanvasElement[canvasName];
|
|
642
|
+
if (!eventType) {
|
|
643
|
+
if (canvasName === "CanvasContainer") {
|
|
644
|
+
eventType = CanvasContainer;
|
|
645
|
+
} else if (canvasName === "CanvasImage") {
|
|
646
|
+
eventType = CanvasImage;
|
|
647
|
+
} else if (canvasName === "CanvasSprite") {
|
|
648
|
+
eventType = CanvasSprite;
|
|
649
|
+
} else if (canvasName === "CanvasText") {
|
|
650
|
+
eventType = CanvasText;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
if (!eventType) {
|
|
654
|
+
console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`);
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
let canvasElement = new eventType();
|
|
658
|
+
return canvasElement;
|
|
659
|
+
} catch (e) {
|
|
660
|
+
console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e);
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
874
665
|
// src/decorators/CharacterDecorator.ts
|
|
875
666
|
var registeredCharacters = {};
|
|
876
667
|
function saveCharacter(character) {
|
|
@@ -927,7 +718,232 @@ function geTickerInstanceByClassName(tickerName, args, duration, priority) {
|
|
|
927
718
|
}
|
|
928
719
|
}
|
|
929
720
|
|
|
930
|
-
// src/
|
|
721
|
+
// src/types/CloseType.ts
|
|
722
|
+
var Close = "close";
|
|
723
|
+
|
|
724
|
+
// src/types/PauseType.ts
|
|
725
|
+
var PauseValueType = "pause";
|
|
726
|
+
function Pause(duration) {
|
|
727
|
+
return {
|
|
728
|
+
type: PauseValueType,
|
|
729
|
+
duration
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
// src/types/RepeatType.ts
|
|
734
|
+
var Repeat = "repeat";
|
|
735
|
+
|
|
736
|
+
// src/classes/ChoiceMenuOption.ts
|
|
737
|
+
var ChoiceMenuOption = class {
|
|
738
|
+
/**
|
|
739
|
+
* @param text Text to be displayed in the menu
|
|
740
|
+
* @param label Label to be opened when the option is selected or the id of the label
|
|
741
|
+
* @param type Type of the label to be opened. @default "call"
|
|
742
|
+
* @param props Properties to be passed to the label, when the label is called. it cannot contain functions or classes. @default {}
|
|
743
|
+
*/
|
|
744
|
+
constructor(text, label, type = "call", props) {
|
|
745
|
+
/**
|
|
746
|
+
* Properties to be passed to the label
|
|
747
|
+
*/
|
|
748
|
+
this.props = {};
|
|
749
|
+
if (typeof label === "string") {
|
|
750
|
+
let tLabel = getLabelById(label);
|
|
751
|
+
if (!tLabel) {
|
|
752
|
+
throw new Error(`[Pixi'VN] Label ${label} not found`);
|
|
753
|
+
} else {
|
|
754
|
+
label = tLabel;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
this.text = text;
|
|
758
|
+
this.label = label;
|
|
759
|
+
this.type = type;
|
|
760
|
+
if (props) {
|
|
761
|
+
this.props = props;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
var ChoiceMenuOptionClose = class {
|
|
766
|
+
/**
|
|
767
|
+
* @param text Text to be displayed in the menu
|
|
768
|
+
*/
|
|
769
|
+
constructor(text) {
|
|
770
|
+
/**
|
|
771
|
+
* Label to be opened when the option is selected
|
|
772
|
+
*/
|
|
773
|
+
this.label = new CloseLabel();
|
|
774
|
+
/**
|
|
775
|
+
* Type of the label to be opened
|
|
776
|
+
*/
|
|
777
|
+
this.type = Close;
|
|
778
|
+
/**
|
|
779
|
+
* Properties to be passed to the label
|
|
780
|
+
*/
|
|
781
|
+
this.props = {};
|
|
782
|
+
this.text = text;
|
|
783
|
+
}
|
|
784
|
+
};
|
|
785
|
+
|
|
786
|
+
// src/functions/DialogueUtility.ts
|
|
787
|
+
function setDialogue(props) {
|
|
788
|
+
let text = "";
|
|
789
|
+
let characterId = void 0;
|
|
790
|
+
let dialogue;
|
|
791
|
+
if (typeof props === "string") {
|
|
792
|
+
text = props;
|
|
793
|
+
dialogue = new DialogueBaseModel(text, characterId);
|
|
794
|
+
} else if (!(props instanceof DialogueBaseModel)) {
|
|
795
|
+
text = props.text;
|
|
796
|
+
if (props.character) {
|
|
797
|
+
if (typeof props.character === "string") {
|
|
798
|
+
characterId = props.character;
|
|
799
|
+
} else {
|
|
800
|
+
characterId = props.character.id;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
dialogue = new DialogueBaseModel(text, characterId);
|
|
804
|
+
} else {
|
|
805
|
+
dialogue = props;
|
|
806
|
+
}
|
|
807
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY, dialogue);
|
|
808
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex);
|
|
809
|
+
}
|
|
810
|
+
function getDialogue() {
|
|
811
|
+
return GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY);
|
|
812
|
+
}
|
|
813
|
+
function clearDialogue() {
|
|
814
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY, void 0);
|
|
815
|
+
}
|
|
816
|
+
function setChoiceMenuOptions(options) {
|
|
817
|
+
let value = options.map((option) => {
|
|
818
|
+
if (option instanceof ChoiceMenuOptionClose) {
|
|
819
|
+
return {
|
|
820
|
+
text: option.text,
|
|
821
|
+
type: Close
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
return __spreadProps(__spreadValues({}, option), {
|
|
825
|
+
label: option.label.id
|
|
826
|
+
});
|
|
827
|
+
});
|
|
828
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY, value);
|
|
829
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex);
|
|
830
|
+
}
|
|
831
|
+
function getChoiceMenuOptions() {
|
|
832
|
+
let d = GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY);
|
|
833
|
+
if (d) {
|
|
834
|
+
let options = [];
|
|
835
|
+
d.forEach((option, index) => {
|
|
836
|
+
if (option.type === Close) {
|
|
837
|
+
let itemLabel = new CloseLabel(index);
|
|
838
|
+
options.push({
|
|
839
|
+
text: option.text,
|
|
840
|
+
label: itemLabel,
|
|
841
|
+
type: Close,
|
|
842
|
+
props: {}
|
|
843
|
+
});
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
let label = getLabelById(option.label);
|
|
847
|
+
if (label) {
|
|
848
|
+
let itemLabel = new Label(label.id, label.steps, label.onStepRun, index);
|
|
849
|
+
options.push(__spreadProps(__spreadValues({}, option), {
|
|
850
|
+
label: itemLabel
|
|
851
|
+
}));
|
|
852
|
+
}
|
|
853
|
+
});
|
|
854
|
+
return options;
|
|
855
|
+
}
|
|
856
|
+
return void 0;
|
|
857
|
+
}
|
|
858
|
+
function clearChoiceMenuOptions() {
|
|
859
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY, void 0);
|
|
860
|
+
}
|
|
861
|
+
function getDialogueHistory() {
|
|
862
|
+
let list = [];
|
|
863
|
+
GameStepManager.stepsHistory.forEach((step) => {
|
|
864
|
+
let dialoge = step.dialoge;
|
|
865
|
+
let requiredChoices = step.choices;
|
|
866
|
+
if (list.length > 0 && list[list.length - 1].choices && !list[list.length - 1].playerMadeChoice && step.currentLabel) {
|
|
867
|
+
let oldChoices = list[list.length - 1].choices;
|
|
868
|
+
if (oldChoices) {
|
|
869
|
+
let choiceMade = false;
|
|
870
|
+
if (step.choiceIndexMade !== void 0 && oldChoices.length > step.choiceIndexMade) {
|
|
871
|
+
oldChoices[step.choiceIndexMade].isResponse = true;
|
|
872
|
+
choiceMade = true;
|
|
873
|
+
}
|
|
874
|
+
list[list.length - 1].playerMadeChoice = choiceMade;
|
|
875
|
+
list[list.length - 1].choices = oldChoices;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
if (dialoge || requiredChoices) {
|
|
879
|
+
let choices = requiredChoices == null ? void 0 : requiredChoices.map((choice) => {
|
|
880
|
+
return {
|
|
881
|
+
text: choice.text,
|
|
882
|
+
type: choice.type,
|
|
883
|
+
isResponse: false
|
|
884
|
+
};
|
|
885
|
+
});
|
|
886
|
+
list.push({
|
|
887
|
+
dialoge,
|
|
888
|
+
playerMadeChoice: false,
|
|
889
|
+
choices,
|
|
890
|
+
stepIndex: step.index
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
});
|
|
894
|
+
return list;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
// src/functions/FlagsUtility.ts
|
|
898
|
+
function setFlag(name, value) {
|
|
899
|
+
let flags = GameStorageManager.getVariable(GameStorageManager.keysSystem.FLAGS_CATEGORY_KEY) || [];
|
|
900
|
+
if (value) {
|
|
901
|
+
if (!flags.includes(name)) {
|
|
902
|
+
flags.push(name);
|
|
903
|
+
}
|
|
904
|
+
} else {
|
|
905
|
+
let index = flags.indexOf(name);
|
|
906
|
+
if (index > -1) {
|
|
907
|
+
flags.splice(index, 1);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.FLAGS_CATEGORY_KEY, flags);
|
|
911
|
+
}
|
|
912
|
+
function getFlag(name) {
|
|
913
|
+
let flags = GameStorageManager.getVariable(GameStorageManager.keysSystem.FLAGS_CATEGORY_KEY) || [];
|
|
914
|
+
return flags.includes(name);
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
// src/functions/GameUtility.ts
|
|
918
|
+
function clearAllGameDatas() {
|
|
919
|
+
GameStorageManager.clear();
|
|
920
|
+
GameWindowManager.clear();
|
|
921
|
+
GameStepManager.clear();
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
// src/classes/ticker/TickerBase.ts
|
|
925
|
+
var TickerBase = class {
|
|
926
|
+
/**
|
|
927
|
+
* @param args The arguments that you want to pass to the ticker.
|
|
928
|
+
* @param duration The duration of the ticker. If is undefined, the ticker will be called every frame.
|
|
929
|
+
* @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL.
|
|
930
|
+
*/
|
|
931
|
+
constructor(args, duration, priority) {
|
|
932
|
+
this.args = args;
|
|
933
|
+
this.duration = duration;
|
|
934
|
+
this.priority = priority;
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* The method that will be called every frame.
|
|
938
|
+
* This method should be overridden and you can use GameWindowManager.addCanvasElement() to get the canvas element of the canvas, and edit them.
|
|
939
|
+
* @param t The ticker that is calling this method
|
|
940
|
+
* @param args The arguments that you passed when you added the ticker
|
|
941
|
+
* @param tags The tags of the canvas elements that are connected to this ticker
|
|
942
|
+
*/
|
|
943
|
+
fn(_t, _args, _tags) {
|
|
944
|
+
throw new Error("[Pixi'VN] The method TickerBase.fn() must be overridden");
|
|
945
|
+
}
|
|
946
|
+
};
|
|
931
947
|
exports.TickerFadeAlpha = class TickerFadeAlpha extends TickerBase {
|
|
932
948
|
/**
|
|
933
949
|
* The method that will be called every frame to fade the alpha of the canvas element of the canvas.
|
|
@@ -1150,7 +1166,7 @@ function showWithDissolveTransition(tag, image, speed, priority) {
|
|
|
1150
1166
|
}
|
|
1151
1167
|
|
|
1152
1168
|
// src/constants.ts
|
|
1153
|
-
var PIXIVN_VERSION = "0.5.
|
|
1169
|
+
var PIXIVN_VERSION = "0.5.4";
|
|
1154
1170
|
|
|
1155
1171
|
// src/functions/SavesUtility.ts
|
|
1156
1172
|
function getSaveData() {
|
|
@@ -1930,7 +1946,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1930
1946
|
*/
|
|
1931
1947
|
static get currentLabel() {
|
|
1932
1948
|
if (_GameStepManager.currentLabelId) {
|
|
1933
|
-
return
|
|
1949
|
+
return getLabelById(_GameStepManager.currentLabelId);
|
|
1934
1950
|
}
|
|
1935
1951
|
}
|
|
1936
1952
|
static get currentLabelStepIndex() {
|
|
@@ -1951,7 +1967,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1951
1967
|
return true;
|
|
1952
1968
|
} else {
|
|
1953
1969
|
this.openedLabels.forEach((item) => {
|
|
1954
|
-
let label =
|
|
1970
|
+
let label = getLabelById(item.label);
|
|
1955
1971
|
if (label && label.steps.length > item.currentStepIndex) {
|
|
1956
1972
|
return false;
|
|
1957
1973
|
}
|
|
@@ -2044,9 +2060,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2044
2060
|
* @param label The label to add to the history.
|
|
2045
2061
|
*/
|
|
2046
2062
|
static pushNewLabel(label) {
|
|
2047
|
-
let currentLabel =
|
|
2063
|
+
let currentLabel = getLabelById(label);
|
|
2048
2064
|
if (!currentLabel) {
|
|
2049
|
-
throw new Error(
|
|
2065
|
+
throw new Error(`[Pixi'VN] Label ${label} not found`);
|
|
2050
2066
|
}
|
|
2051
2067
|
_GameStepManager._openedLabels.push({
|
|
2052
2068
|
label,
|
|
@@ -2063,7 +2079,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2063
2079
|
return;
|
|
2064
2080
|
}
|
|
2065
2081
|
if (!_GameStepManager.currentLabel) {
|
|
2066
|
-
console.error("[Pixi'VN]
|
|
2082
|
+
console.error("[Pixi'VN] currentLabel not found");
|
|
2067
2083
|
return;
|
|
2068
2084
|
}
|
|
2069
2085
|
_GameStepManager._openedLabels.pop();
|
|
@@ -2135,7 +2151,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2135
2151
|
}
|
|
2136
2152
|
let currentLabel = _GameStepManager.currentLabel;
|
|
2137
2153
|
if (!currentLabel) {
|
|
2138
|
-
console.error("[Pixi'VN]
|
|
2154
|
+
console.error("[Pixi'VN] currentLabel not found");
|
|
2139
2155
|
return;
|
|
2140
2156
|
}
|
|
2141
2157
|
let n = currentLabel.steps.length;
|
|
@@ -2156,12 +2172,12 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2156
2172
|
/**
|
|
2157
2173
|
* Execute the label and add it to the history.
|
|
2158
2174
|
* Is a call function in Ren'Py.
|
|
2159
|
-
* @param label The label to execute
|
|
2175
|
+
* @param label The label to execute or the id of the label
|
|
2160
2176
|
* @param props The props to pass to the label.
|
|
2161
2177
|
* @returns StepLabelResultType or undefined.
|
|
2162
2178
|
* @example
|
|
2163
2179
|
* ```typescript
|
|
2164
|
-
* GameStepManager.callLabel(
|
|
2180
|
+
* GameStepManager.callLabel(startLabel, yourParams).then((result) => {
|
|
2165
2181
|
* if (result) {
|
|
2166
2182
|
* // your code
|
|
2167
2183
|
* }
|
|
@@ -2170,7 +2186,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2170
2186
|
* @example
|
|
2171
2187
|
* ```typescript
|
|
2172
2188
|
* // if you use it in a step label you should return the result.
|
|
2173
|
-
* return GameStepManager.callLabel(
|
|
2189
|
+
* return GameStepManager.callLabel(startLabel).then((result) => {
|
|
2174
2190
|
* return result
|
|
2175
2191
|
* })
|
|
2176
2192
|
* ```
|
|
@@ -2178,16 +2194,24 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2178
2194
|
static callLabel(label, props) {
|
|
2179
2195
|
return __async(this, null, function* () {
|
|
2180
2196
|
let choiseMade = void 0;
|
|
2197
|
+
let labelId;
|
|
2198
|
+
if (typeof label === "string") {
|
|
2199
|
+
labelId = label;
|
|
2200
|
+
} else {
|
|
2201
|
+
labelId = label.id;
|
|
2202
|
+
if (typeof label.choiseIndex === "number") {
|
|
2203
|
+
choiseMade = label.choiseIndex;
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2181
2206
|
try {
|
|
2182
|
-
if (
|
|
2207
|
+
if (labelId === CLOSE_LABEL_ID) {
|
|
2183
2208
|
return _GameStepManager.runNextStep(props);
|
|
2184
2209
|
}
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2210
|
+
let tempLabel = getLabelById(labelId);
|
|
2211
|
+
if (!tempLabel) {
|
|
2212
|
+
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2188
2213
|
}
|
|
2189
|
-
|
|
2190
|
-
_GameStepManager.pushNewLabel(labelName);
|
|
2214
|
+
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2191
2215
|
} catch (e) {
|
|
2192
2216
|
console.error("[Pixi'VN] Error calling label", e);
|
|
2193
2217
|
return;
|
|
@@ -2199,11 +2223,11 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2199
2223
|
* Execute the label, close all labels and add them to the history.
|
|
2200
2224
|
* Is a jump function in Ren'Py.
|
|
2201
2225
|
* @param label The label to execute.
|
|
2202
|
-
* @param props The props to pass to the label
|
|
2226
|
+
* @param props The props to pass to the label or the id of the label
|
|
2203
2227
|
* @returns StepLabelResultType or undefined.
|
|
2204
2228
|
* @example
|
|
2205
2229
|
* ```typescript
|
|
2206
|
-
* GameStepManager.jumpLabel(
|
|
2230
|
+
* GameStepManager.jumpLabel(startLabel, yourParams).then((result) => {
|
|
2207
2231
|
* if (result) {
|
|
2208
2232
|
* // your code
|
|
2209
2233
|
* }
|
|
@@ -2212,7 +2236,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2212
2236
|
* @example
|
|
2213
2237
|
* ```typescript
|
|
2214
2238
|
* // if you use it in a step label you should return the result.
|
|
2215
|
-
* return GameStepManager.jumpLabel(
|
|
2239
|
+
* return GameStepManager.jumpLabel(startLabel).then((result) => {
|
|
2216
2240
|
* return result
|
|
2217
2241
|
* })
|
|
2218
2242
|
* ```
|
|
@@ -2220,15 +2244,24 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2220
2244
|
static jumpLabel(label, props) {
|
|
2221
2245
|
return __async(this, null, function* () {
|
|
2222
2246
|
_GameStepManager.closeAllLabels();
|
|
2247
|
+
let labelId;
|
|
2248
|
+
if (typeof label === "string") {
|
|
2249
|
+
labelId = label;
|
|
2250
|
+
} else {
|
|
2251
|
+
labelId = label.id;
|
|
2252
|
+
if (typeof label.choiseIndex === "number") {
|
|
2253
|
+
label.choiseIndex;
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2223
2256
|
try {
|
|
2224
|
-
if (
|
|
2257
|
+
if (labelId === CLOSE_LABEL_ID) {
|
|
2225
2258
|
return _GameStepManager.runNextStep(props);
|
|
2226
2259
|
}
|
|
2227
|
-
|
|
2228
|
-
|
|
2260
|
+
let tempLabel = getLabelById(labelId);
|
|
2261
|
+
if (!tempLabel) {
|
|
2262
|
+
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2229
2263
|
}
|
|
2230
|
-
|
|
2231
|
-
_GameStepManager.pushNewLabel(labelName);
|
|
2264
|
+
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2232
2265
|
} catch (e) {
|
|
2233
2266
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
2234
2267
|
return;
|
|
@@ -2242,14 +2275,14 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2242
2275
|
* @returns StepLabelResultType or undefined.
|
|
2243
2276
|
* @example
|
|
2244
2277
|
* ```typescript
|
|
2245
|
-
* GameStepManager.
|
|
2278
|
+
* GameStepManager.closeChoiceMenu(yourParams).then((result) => {
|
|
2246
2279
|
* if (result) {
|
|
2247
2280
|
* // your code
|
|
2248
2281
|
* }
|
|
2249
2282
|
* })
|
|
2250
2283
|
* ```
|
|
2251
2284
|
*/
|
|
2252
|
-
static
|
|
2285
|
+
static closeChoiceMenu(props) {
|
|
2253
2286
|
return __async(this, null, function* () {
|
|
2254
2287
|
return _GameStepManager.runNextStep(props);
|
|
2255
2288
|
});
|
|
@@ -2641,13 +2674,14 @@ exports.getChoiceMenuOptions = getChoiceMenuOptions;
|
|
|
2641
2674
|
exports.getDialogue = getDialogue;
|
|
2642
2675
|
exports.getDialogueHistory = getDialogueHistory;
|
|
2643
2676
|
exports.getFlag = getFlag;
|
|
2677
|
+
exports.getLabelById = getLabelById;
|
|
2644
2678
|
exports.getSaveData = getSaveData;
|
|
2645
2679
|
exports.getSaveJson = getSaveJson;
|
|
2646
2680
|
exports.getTexture = getTexture;
|
|
2647
|
-
exports.labelDecorator = labelDecorator;
|
|
2648
2681
|
exports.loadImages = loadImages;
|
|
2649
2682
|
exports.loadSaveData = loadSaveData;
|
|
2650
2683
|
exports.loadSaveJson = loadSaveJson;
|
|
2684
|
+
exports.newLabel = newLabel;
|
|
2651
2685
|
exports.removeCanvasElement = removeCanvasElement;
|
|
2652
2686
|
exports.saveCharacter = saveCharacter;
|
|
2653
2687
|
exports.setChoiceMenuOptions = setChoiceMenuOptions;
|