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