@drincs/pixi-vn 0.1.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.mts +55 -14
- package/dist/index.d.ts +55 -14
- package/dist/index.js +232 -144
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +230 -144
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -181,6 +181,26 @@ function getDialogueHistory() {
|
|
|
181
181
|
return list;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
// src/functions/FlagsUtility.ts
|
|
185
|
+
function setFlag(name, value) {
|
|
186
|
+
let flags = GameStorageManager.getVariable(GameStorageManager.keysSystem.FLAGS_CATEGORY_KEY) || [];
|
|
187
|
+
if (value) {
|
|
188
|
+
if (!flags.includes(name)) {
|
|
189
|
+
flags.push(name);
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
let index = flags.indexOf(name);
|
|
193
|
+
if (index > -1) {
|
|
194
|
+
flags.splice(index, 1);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.FLAGS_CATEGORY_KEY, flags);
|
|
198
|
+
}
|
|
199
|
+
function getFlag(name) {
|
|
200
|
+
let flags = GameStorageManager.getVariable(GameStorageManager.keysSystem.FLAGS_CATEGORY_KEY) || [];
|
|
201
|
+
return flags.includes(name);
|
|
202
|
+
}
|
|
203
|
+
|
|
184
204
|
// src/functions/GameUtility.ts
|
|
185
205
|
function clearAllGameDatas() {
|
|
186
206
|
GameStorageManager.clear();
|
|
@@ -224,6 +244,17 @@ function canvasElementDecorator(name) {
|
|
|
224
244
|
function getCanvasElementInstanceByClassName(canvasName) {
|
|
225
245
|
try {
|
|
226
246
|
let eventType = registeredCanvasElement[canvasName];
|
|
247
|
+
if (!eventType) {
|
|
248
|
+
if (canvasName === "CanvasContainer") {
|
|
249
|
+
eventType = CanvasContainer;
|
|
250
|
+
} else if (canvasName === "CanvasImage") {
|
|
251
|
+
eventType = CanvasImage;
|
|
252
|
+
} else if (canvasName === "CanvasSprite") {
|
|
253
|
+
eventType = CanvasSprite;
|
|
254
|
+
} else if (canvasName === "CanvasText") {
|
|
255
|
+
eventType = CanvasText;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
227
258
|
if (!eventType) {
|
|
228
259
|
console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`);
|
|
229
260
|
return;
|
|
@@ -236,101 +267,6 @@ function getCanvasElementInstanceByClassName(canvasName) {
|
|
|
236
267
|
}
|
|
237
268
|
}
|
|
238
269
|
|
|
239
|
-
// src/decorators/CharacterDecorator.ts
|
|
240
|
-
var registeredCharacters = {};
|
|
241
|
-
function saveCharacter(character) {
|
|
242
|
-
if (Array.isArray(character)) {
|
|
243
|
-
character.forEach((c) => saveCharacter(c));
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
if (registeredCharacters[character.id]) {
|
|
247
|
-
console.warn(`[Pixi'VN] Character id ${character.id} already exists, it will be overwritten`);
|
|
248
|
-
}
|
|
249
|
-
registeredCharacters[character.id] = character;
|
|
250
|
-
}
|
|
251
|
-
function getCharacterById(id) {
|
|
252
|
-
try {
|
|
253
|
-
let character = registeredCharacters[id];
|
|
254
|
-
if (!character) {
|
|
255
|
-
console.error(`[Pixi'VN] Character ${id} not found`);
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
return character;
|
|
259
|
-
} catch (e) {
|
|
260
|
-
console.error(`[Pixi'VN] Error while getting Character ${id}`, e);
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// src/decorators/EventDecorator.ts
|
|
266
|
-
var registeredEvents = {};
|
|
267
|
-
function eventDecorator(name) {
|
|
268
|
-
return function(target) {
|
|
269
|
-
if (!name) {
|
|
270
|
-
name = target.name;
|
|
271
|
-
}
|
|
272
|
-
if (registeredEvents[name]) {
|
|
273
|
-
console.warn(`[Pixi'VN] Event ${name} already exists, it will be overwritten`);
|
|
274
|
-
}
|
|
275
|
-
registeredEvents[name] = target;
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
function getEventTypeByClassName(eventName) {
|
|
279
|
-
try {
|
|
280
|
-
let eventType = registeredEvents[eventName];
|
|
281
|
-
if (!eventType) {
|
|
282
|
-
console.error(`[Pixi'VN] Event ${eventName} not found`);
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
new eventType();
|
|
286
|
-
return eventType;
|
|
287
|
-
} catch (e) {
|
|
288
|
-
console.error(`[Pixi'VN] Error while getting Event ${eventName}`, e);
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
function getEventInstanceByClassName(eventName) {
|
|
293
|
-
try {
|
|
294
|
-
let eventType = registeredEvents[eventName];
|
|
295
|
-
if (!eventType) {
|
|
296
|
-
console.error(`[Pixi'VN] Event ${eventName} not found`);
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
let event = new eventType();
|
|
300
|
-
return event;
|
|
301
|
-
} catch (e) {
|
|
302
|
-
console.error(`[Pixi'VN] Error while getting Event ${eventName}`, e);
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
// src/decorators/TickerDecorator.ts
|
|
308
|
-
var registeredTickers = {};
|
|
309
|
-
function tickerDecorator(name) {
|
|
310
|
-
return function(target) {
|
|
311
|
-
if (!name) {
|
|
312
|
-
name = target.name;
|
|
313
|
-
}
|
|
314
|
-
if (registeredTickers[name]) {
|
|
315
|
-
console.warn(`[Pixi'VN] Ticker ${name} already exists, it will be overwritten`);
|
|
316
|
-
}
|
|
317
|
-
registeredTickers[name] = target;
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
function geTickerInstanceByClassName(tickerName, args, duration, priority) {
|
|
321
|
-
try {
|
|
322
|
-
let ticker = registeredTickers[tickerName];
|
|
323
|
-
if (!ticker) {
|
|
324
|
-
console.error(`[Pixi'VN] Ticker ${tickerName} not found`);
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
return new ticker(args, duration, priority);
|
|
328
|
-
} catch (e) {
|
|
329
|
-
console.error(`[Pixi'VN] Error while getting Ticker ${tickerName}`, e);
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
270
|
// src/functions/CanvasUtility.ts
|
|
335
271
|
function getTextureMemory(texture) {
|
|
336
272
|
let sourceTexture = texture.source;
|
|
@@ -347,7 +283,7 @@ function importCanvasElement(memory) {
|
|
|
347
283
|
if (element) {
|
|
348
284
|
element.memory = memory;
|
|
349
285
|
} else {
|
|
350
|
-
throw new Error("[Pixi'VN] The element " + memory.className + "could not be created");
|
|
286
|
+
throw new Error("[Pixi'VN] The element " + memory.className + " could not be created");
|
|
351
287
|
}
|
|
352
288
|
return element;
|
|
353
289
|
}
|
|
@@ -368,9 +304,6 @@ var CanvasContainer = class extends Container2 {
|
|
|
368
304
|
});
|
|
369
305
|
}
|
|
370
306
|
};
|
|
371
|
-
CanvasContainer = __decorateClass([
|
|
372
|
-
canvasElementDecorator()
|
|
373
|
-
], CanvasContainer);
|
|
374
307
|
function getMemoryContainer(element) {
|
|
375
308
|
return {
|
|
376
309
|
className: "CanvasContainer",
|
|
@@ -495,7 +428,51 @@ function getTextStyle(style) {
|
|
|
495
428
|
|
|
496
429
|
// src/classes/canvas/CanvasSprite.ts
|
|
497
430
|
import { Sprite } from "pixi.js";
|
|
498
|
-
|
|
431
|
+
|
|
432
|
+
// src/decorators/EventDecorator.ts
|
|
433
|
+
var registeredEvents = {};
|
|
434
|
+
function eventDecorator(name) {
|
|
435
|
+
return function(target) {
|
|
436
|
+
if (!name) {
|
|
437
|
+
name = target.name;
|
|
438
|
+
}
|
|
439
|
+
if (registeredEvents[name]) {
|
|
440
|
+
console.warn(`[Pixi'VN] Event ${name} already exists, it will be overwritten`);
|
|
441
|
+
}
|
|
442
|
+
registeredEvents[name] = target;
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
function getEventTypeByClassName(eventName) {
|
|
446
|
+
try {
|
|
447
|
+
let eventType = registeredEvents[eventName];
|
|
448
|
+
if (!eventType) {
|
|
449
|
+
console.error(`[Pixi'VN] Event ${eventName} not found`);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
new eventType();
|
|
453
|
+
return eventType;
|
|
454
|
+
} catch (e) {
|
|
455
|
+
console.error(`[Pixi'VN] Error while getting Event ${eventName}`, e);
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
function getEventInstanceByClassName(eventName) {
|
|
460
|
+
try {
|
|
461
|
+
let eventType = registeredEvents[eventName];
|
|
462
|
+
if (!eventType) {
|
|
463
|
+
console.error(`[Pixi'VN] Event ${eventName} not found`);
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
let event = new eventType();
|
|
467
|
+
return event;
|
|
468
|
+
} catch (e) {
|
|
469
|
+
console.error(`[Pixi'VN] Error while getting Event ${eventName}`, e);
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// src/classes/canvas/CanvasSprite.ts
|
|
475
|
+
var CanvasSprite = class _CanvasSprite extends Sprite {
|
|
499
476
|
constructor() {
|
|
500
477
|
super(...arguments);
|
|
501
478
|
this._onEvents = {};
|
|
@@ -562,14 +539,11 @@ var CanvasSprite = class extends Sprite {
|
|
|
562
539
|
}
|
|
563
540
|
static from(source, skipCache) {
|
|
564
541
|
let sprite = Sprite.from(source, skipCache);
|
|
565
|
-
let mySprite = new
|
|
542
|
+
let mySprite = new _CanvasSprite();
|
|
566
543
|
mySprite.texture = sprite.texture;
|
|
567
544
|
return mySprite;
|
|
568
545
|
}
|
|
569
546
|
};
|
|
570
|
-
CanvasSprite = __decorateClass([
|
|
571
|
-
canvasElementDecorator()
|
|
572
|
-
], CanvasSprite);
|
|
573
547
|
function getMemorySprite(element) {
|
|
574
548
|
let temp = getMemoryContainer(element);
|
|
575
549
|
return __spreadProps(__spreadValues({}, temp), {
|
|
@@ -605,7 +579,7 @@ function setMemorySprite(element, memory) {
|
|
|
605
579
|
}
|
|
606
580
|
|
|
607
581
|
// src/classes/canvas/CanvasImage.ts
|
|
608
|
-
var CanvasImage = class extends CanvasSprite {
|
|
582
|
+
var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
609
583
|
constructor() {
|
|
610
584
|
super(...arguments);
|
|
611
585
|
this.imageLink = "";
|
|
@@ -621,7 +595,7 @@ var CanvasImage = class extends CanvasSprite {
|
|
|
621
595
|
}
|
|
622
596
|
static from(source, skipCache) {
|
|
623
597
|
let sprite = Sprite2.from(source, skipCache);
|
|
624
|
-
let mySprite = new
|
|
598
|
+
let mySprite = new _CanvasImage();
|
|
625
599
|
mySprite.texture = sprite.texture;
|
|
626
600
|
return mySprite;
|
|
627
601
|
}
|
|
@@ -641,9 +615,6 @@ var CanvasImage = class extends CanvasSprite {
|
|
|
641
615
|
});
|
|
642
616
|
}
|
|
643
617
|
};
|
|
644
|
-
CanvasImage = __decorateClass([
|
|
645
|
-
canvasElementDecorator()
|
|
646
|
-
], CanvasImage);
|
|
647
618
|
|
|
648
619
|
// src/classes/canvas/CanvasText.ts
|
|
649
620
|
import { Text } from "pixi.js";
|
|
@@ -713,9 +684,6 @@ var CanvasText = class extends Text {
|
|
|
713
684
|
return super.on(event, fn, context);
|
|
714
685
|
}
|
|
715
686
|
};
|
|
716
|
-
CanvasText = __decorateClass([
|
|
717
|
-
canvasElementDecorator()
|
|
718
|
-
], CanvasText);
|
|
719
687
|
function getMemoryText(element) {
|
|
720
688
|
let temp = getMemoryContainer(element);
|
|
721
689
|
return __spreadProps(__spreadValues({}, temp), {
|
|
@@ -771,6 +739,61 @@ var TickerBase = class {
|
|
|
771
739
|
|
|
772
740
|
// src/classes/ticker/TickerFadeAlpha.ts
|
|
773
741
|
import { Container as Container3, Sprite as Sprite3 } from "pixi.js";
|
|
742
|
+
|
|
743
|
+
// src/decorators/CharacterDecorator.ts
|
|
744
|
+
var registeredCharacters = {};
|
|
745
|
+
function saveCharacter(character) {
|
|
746
|
+
if (Array.isArray(character)) {
|
|
747
|
+
character.forEach((c) => saveCharacter(c));
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
if (registeredCharacters[character.id]) {
|
|
751
|
+
console.warn(`[Pixi'VN] Character id ${character.id} already exists, it will be overwritten`);
|
|
752
|
+
}
|
|
753
|
+
registeredCharacters[character.id] = character;
|
|
754
|
+
}
|
|
755
|
+
function getCharacterById(id) {
|
|
756
|
+
try {
|
|
757
|
+
let character = registeredCharacters[id];
|
|
758
|
+
if (!character) {
|
|
759
|
+
console.error(`[Pixi'VN] Character ${id} not found`);
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
return character;
|
|
763
|
+
} catch (e) {
|
|
764
|
+
console.error(`[Pixi'VN] Error while getting Character ${id}`, e);
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
// src/decorators/TickerDecorator.ts
|
|
770
|
+
var registeredTickers = {};
|
|
771
|
+
function tickerDecorator(name) {
|
|
772
|
+
return function(target) {
|
|
773
|
+
if (!name) {
|
|
774
|
+
name = target.name;
|
|
775
|
+
}
|
|
776
|
+
if (registeredTickers[name]) {
|
|
777
|
+
console.warn(`[Pixi'VN] Ticker ${name} already exists, it will be overwritten`);
|
|
778
|
+
}
|
|
779
|
+
registeredTickers[name] = target;
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
function geTickerInstanceByClassName(tickerName, args, duration, priority) {
|
|
783
|
+
try {
|
|
784
|
+
let ticker = registeredTickers[tickerName];
|
|
785
|
+
if (!ticker) {
|
|
786
|
+
console.error(`[Pixi'VN] Ticker ${tickerName} not found`);
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
return new ticker(args, duration, priority);
|
|
790
|
+
} catch (e) {
|
|
791
|
+
console.error(`[Pixi'VN] Error while getting Ticker ${tickerName}`, e);
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
// src/classes/ticker/TickerFadeAlpha.ts
|
|
774
797
|
var TickerFadeAlpha = class extends TickerBase {
|
|
775
798
|
/**
|
|
776
799
|
* The method that will be called every frame to fade the alpha of the canvas element of the canvas.
|
|
@@ -949,12 +972,12 @@ function showImageWithDissolveTransition(tag, imageUrl, speed, priority) {
|
|
|
949
972
|
}
|
|
950
973
|
|
|
951
974
|
// src/constants.ts
|
|
952
|
-
var
|
|
975
|
+
var PIXIVN_VERSION = "0.1.5";
|
|
953
976
|
|
|
954
977
|
// src/functions/SavesUtility.ts
|
|
955
978
|
function getSaveData() {
|
|
956
979
|
return {
|
|
957
|
-
|
|
980
|
+
pixivn_version: PIXIVN_VERSION,
|
|
958
981
|
stepData: GameStepManager.export(),
|
|
959
982
|
storageData: GameStorageManager.export(),
|
|
960
983
|
canvasData: GameWindowManager.export(),
|
|
@@ -1050,7 +1073,8 @@ var _GameStorageManager = class _GameStorageManager {
|
|
|
1050
1073
|
LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY: "___last_dialogue_added_in_step_memory_key___",
|
|
1051
1074
|
CURRENT_MENU_OPTIONS_MEMORY_KEY: "___current_menu_options_memory_key___",
|
|
1052
1075
|
LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY: "___last_menu_options_added_in_step_memory_key___",
|
|
1053
|
-
|
|
1076
|
+
CHARACTER_CATEGORY_KEY: "___character___",
|
|
1077
|
+
FLAGS_CATEGORY_KEY: "___flags___"
|
|
1054
1078
|
};
|
|
1055
1079
|
}
|
|
1056
1080
|
/**
|
|
@@ -1061,7 +1085,7 @@ var _GameStorageManager = class _GameStorageManager {
|
|
|
1061
1085
|
*/
|
|
1062
1086
|
static setVariable(key, value) {
|
|
1063
1087
|
key = key.toLowerCase();
|
|
1064
|
-
if (value === void 0) {
|
|
1088
|
+
if (value === void 0 || value === null) {
|
|
1065
1089
|
if (_GameStorageManager.storage.hasOwnProperty(key)) {
|
|
1066
1090
|
delete _GameStorageManager.storage[key];
|
|
1067
1091
|
}
|
|
@@ -1127,6 +1151,17 @@ var GameStorageManager = _GameStorageManager;
|
|
|
1127
1151
|
// src/managers/WindowManager.ts
|
|
1128
1152
|
import { Application } from "pixi.js";
|
|
1129
1153
|
|
|
1154
|
+
// src/functions/EasterEgg.ts
|
|
1155
|
+
function asciiArtLog() {
|
|
1156
|
+
console.log(`
|
|
1157
|
+
____ _ _ ___ ___ _
|
|
1158
|
+
| _ (_)_ _(_| ) / / | |
|
|
1159
|
+
| |_) | / / |/ / /| | |
|
|
1160
|
+
| __/| |> <| | V / | | |
|
|
1161
|
+
|_| |_/_/__| _/ |_| _|
|
|
1162
|
+
`);
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1130
1165
|
// src/types/PauseType.ts
|
|
1131
1166
|
var PauseValueType = "Pause";
|
|
1132
1167
|
function Pause(duration) {
|
|
@@ -1195,6 +1230,7 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1195
1230
|
this.addCanvasIntoElement(element);
|
|
1196
1231
|
window.addEventListener("resize", _GameWindowManager.resize);
|
|
1197
1232
|
_GameWindowManager.resize();
|
|
1233
|
+
asciiArtLog();
|
|
1198
1234
|
});
|
|
1199
1235
|
});
|
|
1200
1236
|
}
|
|
@@ -1727,9 +1763,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1727
1763
|
return _GameStepManager._openedLabels;
|
|
1728
1764
|
}
|
|
1729
1765
|
/**
|
|
1730
|
-
*
|
|
1766
|
+
* currentLabelId is the current label id that occurred during the progression of the steps.
|
|
1731
1767
|
*/
|
|
1732
|
-
static get
|
|
1768
|
+
static get currentLabelId() {
|
|
1733
1769
|
if (_GameStepManager._openedLabels.length > 0) {
|
|
1734
1770
|
let item = _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1];
|
|
1735
1771
|
return item.label;
|
|
@@ -1737,8 +1773,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1737
1773
|
return void 0;
|
|
1738
1774
|
}
|
|
1739
1775
|
/**
|
|
1740
|
-
* is the current
|
|
1776
|
+
* currentLabel is the current label that occurred during the progression of the steps.
|
|
1741
1777
|
*/
|
|
1778
|
+
static get currentLabel() {
|
|
1779
|
+
if (_GameStepManager.currentLabelId) {
|
|
1780
|
+
return getLabelInstanceByClassName(_GameStepManager.currentLabelId);
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1742
1783
|
static get currentLabelStepIndex() {
|
|
1743
1784
|
if (_GameStepManager._openedLabels.length > 0) {
|
|
1744
1785
|
let item = _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1];
|
|
@@ -1746,6 +1787,17 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1746
1787
|
}
|
|
1747
1788
|
return null;
|
|
1748
1789
|
}
|
|
1790
|
+
/**
|
|
1791
|
+
* currentLabelStep is the current step that occurred during the progression of the steps. It can used to determine the game end.
|
|
1792
|
+
*/
|
|
1793
|
+
static get isLastGameStep() {
|
|
1794
|
+
var _a;
|
|
1795
|
+
let stepLabel = (_a = _GameStepManager.currentLabel) == null ? void 0 : _a.steps;
|
|
1796
|
+
if (stepLabel) {
|
|
1797
|
+
return _GameStepManager.currentLabelStepIndex === stepLabel.length;
|
|
1798
|
+
}
|
|
1799
|
+
return false;
|
|
1800
|
+
}
|
|
1749
1801
|
/**
|
|
1750
1802
|
* lastHistoryStep is the last history step that occurred during the progression of the steps.
|
|
1751
1803
|
*/
|
|
@@ -1813,7 +1865,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1813
1865
|
}
|
|
1814
1866
|
_GameStepManager._stepsHistory.push({
|
|
1815
1867
|
diff: data,
|
|
1816
|
-
currentLabel: _GameStepManager.
|
|
1868
|
+
currentLabel: _GameStepManager.currentLabelId,
|
|
1817
1869
|
dialoge,
|
|
1818
1870
|
choices: requiredChoices,
|
|
1819
1871
|
stepSha1: stepHistory,
|
|
@@ -1842,12 +1894,11 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1842
1894
|
* @returns
|
|
1843
1895
|
*/
|
|
1844
1896
|
static closeCurrentLabel() {
|
|
1845
|
-
if (!_GameStepManager.
|
|
1897
|
+
if (!_GameStepManager.currentLabelId) {
|
|
1846
1898
|
console.warn("[Pixi'VN] No label to close");
|
|
1847
1899
|
return;
|
|
1848
1900
|
}
|
|
1849
|
-
|
|
1850
|
-
if (!currentLabel) {
|
|
1901
|
+
if (!_GameStepManager.currentLabel) {
|
|
1851
1902
|
console.error("[Pixi'VN] Label not found");
|
|
1852
1903
|
return;
|
|
1853
1904
|
}
|
|
@@ -1906,13 +1957,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1906
1957
|
*/
|
|
1907
1958
|
static runCurrentStep() {
|
|
1908
1959
|
return __async(this, null, function* () {
|
|
1909
|
-
if (_GameStepManager.
|
|
1960
|
+
if (_GameStepManager.currentLabelId) {
|
|
1910
1961
|
let lasteStepsLength = _GameStepManager.currentLabelStepIndex;
|
|
1911
1962
|
if (lasteStepsLength === null) {
|
|
1912
1963
|
console.error("[Pixi'VN] currentLabelStepIndex is null");
|
|
1913
1964
|
return;
|
|
1914
1965
|
}
|
|
1915
|
-
let currentLabel =
|
|
1966
|
+
let currentLabel = _GameStepManager.currentLabel;
|
|
1916
1967
|
if (!currentLabel) {
|
|
1917
1968
|
console.error("[Pixi'VN] Label not found");
|
|
1918
1969
|
return;
|
|
@@ -2093,6 +2144,12 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2093
2144
|
return restoredStep;
|
|
2094
2145
|
}
|
|
2095
2146
|
}
|
|
2147
|
+
/**
|
|
2148
|
+
* Return true if it is possible to go back.
|
|
2149
|
+
*/
|
|
2150
|
+
static get canGoBack() {
|
|
2151
|
+
return _GameStepManager._stepsHistory.length > 1;
|
|
2152
|
+
}
|
|
2096
2153
|
/**
|
|
2097
2154
|
* Add a label to the history.
|
|
2098
2155
|
*/
|
|
@@ -2170,27 +2227,54 @@ var GameStepManager = _GameStepManager;
|
|
|
2170
2227
|
|
|
2171
2228
|
// src/classes/StoredClassModel.ts
|
|
2172
2229
|
var StoredClassModel = class {
|
|
2173
|
-
|
|
2174
|
-
|
|
2230
|
+
/**
|
|
2231
|
+
* @param categoryId The id of the category. For example if you are storing a character class, you can use "characters" as categoryId. so all instances of the character class will be stored in the "characters" category.
|
|
2232
|
+
* @param id The id of instance of the class. This id must be unique for the category.
|
|
2233
|
+
*/
|
|
2234
|
+
constructor(categoryId, id) {
|
|
2235
|
+
this.categoryId = categoryId;
|
|
2236
|
+
this._id = id;
|
|
2175
2237
|
}
|
|
2176
|
-
|
|
2177
|
-
|
|
2238
|
+
/**
|
|
2239
|
+
* Is id of the stored class. is unique for this class.
|
|
2240
|
+
*/
|
|
2241
|
+
get id() {
|
|
2242
|
+
return this._id;
|
|
2178
2243
|
}
|
|
2179
|
-
|
|
2180
|
-
|
|
2244
|
+
/**
|
|
2245
|
+
* Update a property in the storage.
|
|
2246
|
+
* @param propertyName The name of the property to set.
|
|
2247
|
+
* @param value The value to set. If is undefined, the property will be removed from the storage.
|
|
2248
|
+
*/
|
|
2249
|
+
setStorageProperty(propertyName, value) {
|
|
2250
|
+
let storage = GameStorageManager.getVariable(this.categoryId);
|
|
2181
2251
|
if (!storage) {
|
|
2182
2252
|
storage = {};
|
|
2183
2253
|
}
|
|
2184
|
-
storage
|
|
2185
|
-
|
|
2186
|
-
}
|
|
2187
|
-
getStorageProperty(key) {
|
|
2188
|
-
let storage = GameStorageManager.getVariable(this.nameClass);
|
|
2189
|
-
if (!storage) {
|
|
2190
|
-
return void 0;
|
|
2254
|
+
if (!storage.hasOwnProperty(this.id)) {
|
|
2255
|
+
storage[this.id] = {};
|
|
2191
2256
|
}
|
|
2192
|
-
if (
|
|
2193
|
-
|
|
2257
|
+
if (value === void 0 || value === null) {
|
|
2258
|
+
if (storage[this.id].hasOwnProperty(propertyName)) {
|
|
2259
|
+
delete storage[this.id][propertyName];
|
|
2260
|
+
}
|
|
2261
|
+
} else {
|
|
2262
|
+
storage[this.id] = __spreadProps(__spreadValues({}, storage[this.id]), { [propertyName]: value });
|
|
2263
|
+
}
|
|
2264
|
+
if (Object.keys(storage[this.id]).length === 0) {
|
|
2265
|
+
delete storage[this.id];
|
|
2266
|
+
}
|
|
2267
|
+
GameStorageManager.setVariable(this.categoryId, storage);
|
|
2268
|
+
}
|
|
2269
|
+
/**
|
|
2270
|
+
* Get a property from the storage.
|
|
2271
|
+
* @param propertyName The name of the property to get.
|
|
2272
|
+
* @returns The value of the property. If the property is not found, returns undefined.
|
|
2273
|
+
*/
|
|
2274
|
+
getStorageProperty(propertyName) {
|
|
2275
|
+
let storage = GameStorageManager.getVariable(this.categoryId);
|
|
2276
|
+
if (storage && storage.hasOwnProperty(this.id) && storage[this.id].hasOwnProperty(propertyName)) {
|
|
2277
|
+
return storage[this.id][propertyName];
|
|
2194
2278
|
}
|
|
2195
2279
|
return void 0;
|
|
2196
2280
|
}
|
|
@@ -2199,7 +2283,7 @@ var StoredClassModel = class {
|
|
|
2199
2283
|
// src/classes/CharacterModelBase.ts
|
|
2200
2284
|
var CharacterModelBase2 = class extends StoredClassModel {
|
|
2201
2285
|
constructor(id, props) {
|
|
2202
|
-
super(GameStorageManager.keysSystem.
|
|
2286
|
+
super(GameStorageManager.keysSystem.CHARACTER_CATEGORY_KEY, id);
|
|
2203
2287
|
this.defaultName = "";
|
|
2204
2288
|
this.defaultName = props.name;
|
|
2205
2289
|
this.defaultSurname = props.surname;
|
|
@@ -2211,19 +2295,19 @@ var CharacterModelBase2 = class extends StoredClassModel {
|
|
|
2211
2295
|
return this.getStorageProperty("name") || this.defaultName;
|
|
2212
2296
|
}
|
|
2213
2297
|
set name(value) {
|
|
2214
|
-
this.
|
|
2298
|
+
this.setStorageProperty("name", value);
|
|
2215
2299
|
}
|
|
2216
2300
|
get surname() {
|
|
2217
2301
|
return this.getStorageProperty("surname") || this.defaultSurname;
|
|
2218
2302
|
}
|
|
2219
2303
|
set surname(value) {
|
|
2220
|
-
this.
|
|
2304
|
+
this.setStorageProperty("surname", value);
|
|
2221
2305
|
}
|
|
2222
2306
|
get age() {
|
|
2223
2307
|
return this.getStorageProperty("age") || this.defaultAge;
|
|
2224
2308
|
}
|
|
2225
2309
|
set age(value) {
|
|
2226
|
-
this.
|
|
2310
|
+
this.setStorageProperty("age", value);
|
|
2227
2311
|
}
|
|
2228
2312
|
get icon() {
|
|
2229
2313
|
return this._icon;
|
|
@@ -2326,6 +2410,7 @@ export {
|
|
|
2326
2410
|
getChoiceMenuOptions,
|
|
2327
2411
|
getDialogue,
|
|
2328
2412
|
getDialogueHistory,
|
|
2413
|
+
getFlag,
|
|
2329
2414
|
getSaveData,
|
|
2330
2415
|
getSaveJson,
|
|
2331
2416
|
getTexture,
|
|
@@ -2336,6 +2421,7 @@ export {
|
|
|
2336
2421
|
saveCharacter,
|
|
2337
2422
|
setChoiceMenuOptions,
|
|
2338
2423
|
setDialogue,
|
|
2424
|
+
setFlag,
|
|
2339
2425
|
showCanvasImages,
|
|
2340
2426
|
showImageWithDissolveTransition,
|
|
2341
2427
|
tickerDecorator
|