@drincs/pixi-vn 0.1.2 → 0.1.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/index.js ADDED
@@ -0,0 +1,2419 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __export = (target, all) => {
26
+ for (var name in all)
27
+ __defProp(target, name, { get: all[name], enumerable: true });
28
+ };
29
+ var __copyProps = (to, from, except, desc) => {
30
+ if (from && typeof from === "object" || typeof from === "function") {
31
+ for (let key of __getOwnPropNames(from))
32
+ if (!__hasOwnProp.call(to, key) && key !== except)
33
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
34
+ }
35
+ return to;
36
+ };
37
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
38
+ // If the importer is in node compatibility mode or this is not an ESM
39
+ // file that has been converted to a CommonJS file using a Babel-
40
+ // compatible transform (i.e. "__esModule" has not been set), then set
41
+ // "default" to the CommonJS "module.exports" for node compatibility.
42
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
43
+ mod
44
+ ));
45
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
46
+ var __decorateClass = (decorators, target, key, kind) => {
47
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
48
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
49
+ if (decorator = decorators[i])
50
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
51
+ if (kind && result)
52
+ __defProp(target, key, result);
53
+ return result;
54
+ };
55
+ var __async = (__this, __arguments, generator) => {
56
+ return new Promise((resolve, reject) => {
57
+ var fulfilled = (value) => {
58
+ try {
59
+ step(generator.next(value));
60
+ } catch (e) {
61
+ reject(e);
62
+ }
63
+ };
64
+ var rejected = (value) => {
65
+ try {
66
+ step(generator.throw(value));
67
+ } catch (e) {
68
+ reject(e);
69
+ }
70
+ };
71
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
72
+ step((generator = generator.apply(__this, __arguments)).next());
73
+ });
74
+ };
75
+
76
+ // src/index.ts
77
+ var src_exports = {};
78
+ __export(src_exports, {
79
+ CanvasBase: () => CanvasBase,
80
+ CanvasContainer: () => CanvasContainer,
81
+ CanvasEvent: () => CanvasEvent,
82
+ CanvasImage: () => CanvasImage,
83
+ CanvasSprite: () => CanvasSprite,
84
+ CanvasText: () => CanvasText,
85
+ CharacterModelBase: () => CharacterModelBase2,
86
+ ChoiceMenuOptionLabel: () => ChoiceMenuOptionLabel,
87
+ DialogueModelBase: () => DialogueModelBase,
88
+ GameStepManager: () => GameStepManager,
89
+ GameStorageManager: () => GameStorageManager,
90
+ GameWindowManager: () => GameWindowManager,
91
+ Label: () => Label,
92
+ LabelRunModeEnum: () => LabelRunModeEnum,
93
+ Pause: () => Pause,
94
+ PauseValueType: () => PauseValueType,
95
+ Repeat: () => Repeat,
96
+ StoredClassModel: () => StoredClassModel,
97
+ TickerBase: () => TickerBase,
98
+ TickerFadeAlpha: () => TickerFadeAlpha,
99
+ TickerRotate: () => TickerRotate,
100
+ addImage: () => addImage,
101
+ canvasElementDecorator: () => canvasElementDecorator,
102
+ clearAllGameDatas: () => clearAllGameDatas,
103
+ clearChoiceMenuOptions: () => clearChoiceMenuOptions,
104
+ clearDialogue: () => clearDialogue,
105
+ eventDecorator: () => eventDecorator,
106
+ getCharacterById: () => getCharacterById,
107
+ getChoiceMenuOptions: () => getChoiceMenuOptions,
108
+ getDialogue: () => getDialogue,
109
+ getDialogueHistory: () => getDialogueHistory,
110
+ getSaveData: () => getSaveData,
111
+ getSaveJson: () => getSaveJson,
112
+ getTexture: () => getTexture,
113
+ labelDecorator: () => labelDecorator,
114
+ loadSaveData: () => loadSaveData,
115
+ loadSaveJson: () => loadSaveJson,
116
+ removeCanvasElement: () => removeCanvasElement,
117
+ saveCharacter: () => saveCharacter,
118
+ setChoiceMenuOptions: () => setChoiceMenuOptions,
119
+ setDialogue: () => setDialogue,
120
+ showCanvasImages: () => showCanvasImages,
121
+ showImageWithDissolveTransition: () => showImageWithDissolveTransition,
122
+ tickerDecorator: () => tickerDecorator
123
+ });
124
+ module.exports = __toCommonJS(src_exports);
125
+
126
+ // src/classes/CanvasEvent.ts
127
+ var CanvasEvent = class {
128
+ fn(_event, _element) {
129
+ throw new Error("[Pixi'VN] The method CanvasEvent.fn() must be overridden");
130
+ }
131
+ };
132
+
133
+ // src/managers/StepManager.ts
134
+ var import_deep_diff = require("deep-diff");
135
+
136
+ // src/decorators/LabelDecorator.ts
137
+ var registeredLabels = {};
138
+ function labelDecorator(name) {
139
+ return function(target) {
140
+ if (!name) {
141
+ name = target.name;
142
+ }
143
+ if (registeredLabels[name]) {
144
+ console.warn(`[Pixi'VN] Label ${name} already exists, it will be overwritten`);
145
+ }
146
+ registeredLabels[name] = target;
147
+ };
148
+ }
149
+ function getLabelTypeByClassName(labelName) {
150
+ try {
151
+ let labelType = registeredLabels[labelName];
152
+ if (!labelType) {
153
+ console.error(`[Pixi'VN] Label ${labelName} not found`);
154
+ return;
155
+ }
156
+ new labelType();
157
+ return labelType;
158
+ } catch (e) {
159
+ console.error(`[Pixi'VN] Error while getting Label ${labelName}`, e);
160
+ return;
161
+ }
162
+ }
163
+ function getLabelInstanceByClassName(labelName) {
164
+ try {
165
+ let labelType = registeredLabels[labelName];
166
+ if (!labelType) {
167
+ console.error(`[Pixi'VN] Label ${labelName} not found`);
168
+ return;
169
+ }
170
+ let label = new labelType();
171
+ let step = label.steps;
172
+ if (step.length = 0) {
173
+ console.warn(`[Pixi'VN] Label ${labelName} has no steps`);
174
+ }
175
+ return label;
176
+ } catch (e) {
177
+ console.error(`[Pixi'VN] Error while getting Label ${labelName}`, e);
178
+ return;
179
+ }
180
+ }
181
+
182
+ // src/functions/DialogueUtility.ts
183
+ function setDialogue(props) {
184
+ let text = "";
185
+ let characterId = void 0;
186
+ if (typeof props === "string") {
187
+ text = props;
188
+ } else {
189
+ text = props.text;
190
+ if (props.character) {
191
+ if (typeof props.character === "string") {
192
+ characterId = props.character;
193
+ } else {
194
+ characterId = props.character.id;
195
+ }
196
+ }
197
+ }
198
+ let dialogue = new DialogueModelBase(text, characterId);
199
+ GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY, dialogue);
200
+ GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex);
201
+ }
202
+ function getDialogue() {
203
+ return GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY);
204
+ }
205
+ function clearDialogue() {
206
+ GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY, void 0);
207
+ }
208
+ function setChoiceMenuOptions(options) {
209
+ let value = options.map((option) => {
210
+ return __spreadProps(__spreadValues({}, option), {
211
+ label: option.label.name
212
+ });
213
+ });
214
+ GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY, value);
215
+ GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex);
216
+ }
217
+ function getChoiceMenuOptions() {
218
+ let d = GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY);
219
+ if (d) {
220
+ let options = [];
221
+ d.forEach((option) => {
222
+ let label = getLabelTypeByClassName(option.label);
223
+ if (label) {
224
+ options.push(__spreadProps(__spreadValues({}, option), {
225
+ label
226
+ }));
227
+ }
228
+ });
229
+ return options;
230
+ }
231
+ return void 0;
232
+ }
233
+ function clearChoiceMenuOptions() {
234
+ GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY, void 0);
235
+ }
236
+ function getDialogueHistory() {
237
+ let list = [];
238
+ GameStepManager.stepsHistory.forEach((step) => {
239
+ let dialoge = step.dialoge;
240
+ let requiredChoices = step.choices;
241
+ if (list.length > 0 && list[list.length - 1].choices && !list[list.length - 1].choiceMade && step.currentLabel) {
242
+ let oldChoices = list[list.length - 1].choices;
243
+ if (oldChoices) {
244
+ list[list.length - 1].choiceMade = oldChoices.find((choice) => choice.label === step.currentLabel);
245
+ }
246
+ }
247
+ if (dialoge || requiredChoices) {
248
+ list.push({
249
+ dialoge,
250
+ choiceMade: void 0,
251
+ choices: requiredChoices,
252
+ stepIndex: step.index
253
+ });
254
+ }
255
+ });
256
+ return list;
257
+ }
258
+
259
+ // src/functions/GameUtility.ts
260
+ function clearAllGameDatas() {
261
+ GameStorageManager.clear();
262
+ GameWindowManager.clear();
263
+ GameStepManager.clear();
264
+ }
265
+
266
+ // src/classes/canvas/CanvasBase.ts
267
+ var import_pixi = require("pixi.js");
268
+ var CanvasBase = class extends import_pixi.Container {
269
+ /**
270
+ * This method return the memory of the canvas element.
271
+ */
272
+ get memory() {
273
+ throw new Error("[Pixi'VN] The method CanvasBase.memory must be overridden");
274
+ }
275
+ /**
276
+ * This method set the memory of the canvas element.
277
+ */
278
+ set memory(_value) {
279
+ throw new Error("[Pixi'VN] The method CanvasBase.memory must be overridden");
280
+ }
281
+ };
282
+
283
+ // src/classes/canvas/CanvasContainer.ts
284
+ var import_pixi2 = require("pixi.js");
285
+
286
+ // src/decorators/CanvasElementDecorator.ts
287
+ var registeredCanvasElement = {};
288
+ function canvasElementDecorator(name) {
289
+ return function(target) {
290
+ if (!name) {
291
+ name = target.name;
292
+ }
293
+ if (registeredCanvasElement[name]) {
294
+ console.warn(`[Pixi'VN] CanvasElement ${name} already registered`);
295
+ }
296
+ registeredCanvasElement[name] = target;
297
+ };
298
+ }
299
+ function getCanvasElementInstanceByClassName(canvasName) {
300
+ try {
301
+ let eventType = registeredCanvasElement[canvasName];
302
+ if (!eventType) {
303
+ console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`);
304
+ return;
305
+ }
306
+ let canvasElement = new eventType();
307
+ return canvasElement;
308
+ } catch (e) {
309
+ console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e);
310
+ return;
311
+ }
312
+ }
313
+
314
+ // src/decorators/CharacterDecorator.ts
315
+ var registeredCharacters = {};
316
+ function saveCharacter(character) {
317
+ if (Array.isArray(character)) {
318
+ character.forEach((c) => saveCharacter(c));
319
+ return;
320
+ }
321
+ if (registeredCharacters[character.id]) {
322
+ console.warn(`[Pixi'VN] Character id ${character.id} already exists, it will be overwritten`);
323
+ }
324
+ registeredCharacters[character.id] = character;
325
+ }
326
+ function getCharacterById(id) {
327
+ try {
328
+ let character = registeredCharacters[id];
329
+ if (!character) {
330
+ console.error(`[Pixi'VN] Character ${id} not found`);
331
+ return;
332
+ }
333
+ return character;
334
+ } catch (e) {
335
+ console.error(`[Pixi'VN] Error while getting Character ${id}`, e);
336
+ return;
337
+ }
338
+ }
339
+
340
+ // src/decorators/EventDecorator.ts
341
+ var registeredEvents = {};
342
+ function eventDecorator(name) {
343
+ return function(target) {
344
+ if (!name) {
345
+ name = target.name;
346
+ }
347
+ if (registeredEvents[name]) {
348
+ console.warn(`[Pixi'VN] Event ${name} already exists, it will be overwritten`);
349
+ }
350
+ registeredEvents[name] = target;
351
+ };
352
+ }
353
+ function getEventTypeByClassName(eventName) {
354
+ try {
355
+ let eventType = registeredEvents[eventName];
356
+ if (!eventType) {
357
+ console.error(`[Pixi'VN] Event ${eventName} not found`);
358
+ return;
359
+ }
360
+ new eventType();
361
+ return eventType;
362
+ } catch (e) {
363
+ console.error(`[Pixi'VN] Error while getting Event ${eventName}`, e);
364
+ return;
365
+ }
366
+ }
367
+ function getEventInstanceByClassName(eventName) {
368
+ try {
369
+ let eventType = registeredEvents[eventName];
370
+ if (!eventType) {
371
+ console.error(`[Pixi'VN] Event ${eventName} not found`);
372
+ return;
373
+ }
374
+ let event = new eventType();
375
+ return event;
376
+ } catch (e) {
377
+ console.error(`[Pixi'VN] Error while getting Event ${eventName}`, e);
378
+ return;
379
+ }
380
+ }
381
+
382
+ // src/decorators/TickerDecorator.ts
383
+ var registeredTickers = {};
384
+ function tickerDecorator(name) {
385
+ return function(target) {
386
+ if (!name) {
387
+ name = target.name;
388
+ }
389
+ if (registeredTickers[name]) {
390
+ console.warn(`[Pixi'VN] Ticker ${name} already exists, it will be overwritten`);
391
+ }
392
+ registeredTickers[name] = target;
393
+ };
394
+ }
395
+ function geTickerInstanceByClassName(tickerName, args, duration, priority) {
396
+ try {
397
+ let ticker = registeredTickers[tickerName];
398
+ if (!ticker) {
399
+ console.error(`[Pixi'VN] Ticker ${tickerName} not found`);
400
+ return;
401
+ }
402
+ return new ticker(args, duration, priority);
403
+ } catch (e) {
404
+ console.error(`[Pixi'VN] Error while getting Ticker ${tickerName}`, e);
405
+ return;
406
+ }
407
+ }
408
+
409
+ // src/functions/CanvasUtility.ts
410
+ function getTextureMemory(texture) {
411
+ let sourceTexture = texture.source;
412
+ let textureMemory = {
413
+ image: sourceTexture.label
414
+ };
415
+ return textureMemory;
416
+ }
417
+ function exportCanvasElement(element) {
418
+ return element.memory;
419
+ }
420
+ function importCanvasElement(memory) {
421
+ let element = getCanvasElementInstanceByClassName(memory.className);
422
+ if (element) {
423
+ element.memory = memory;
424
+ } else {
425
+ throw new Error("[Pixi'VN] The element " + memory.className + "could not be created");
426
+ }
427
+ return element;
428
+ }
429
+
430
+ // src/classes/canvas/CanvasContainer.ts
431
+ var CanvasContainer = class extends import_pixi2.Container {
432
+ get memory() {
433
+ let memory = getMemoryContainer(this);
434
+ this.children.forEach((child) => {
435
+ memory.elements.push(exportCanvasElement(child));
436
+ });
437
+ return memory;
438
+ }
439
+ set memory(value) {
440
+ setMemoryContainer(this, value);
441
+ value.elements.forEach((child) => {
442
+ this.addChild(importCanvasElement(child));
443
+ });
444
+ }
445
+ };
446
+ CanvasContainer = __decorateClass([
447
+ canvasElementDecorator()
448
+ ], CanvasContainer);
449
+ function getMemoryContainer(element) {
450
+ return {
451
+ className: "CanvasContainer",
452
+ elements: [],
453
+ width: element.width,
454
+ height: element.height,
455
+ isRenderGroup: element.isRenderGroup,
456
+ blendMode: element.blendMode,
457
+ tint: element.tint,
458
+ alpha: element.alpha,
459
+ angle: element.angle,
460
+ renderable: element.renderable,
461
+ rotation: element.rotation,
462
+ scale: { x: element.scale.x, y: element.scale.y },
463
+ pivot: { x: element.pivot.x, y: element.pivot.y },
464
+ position: { x: element.position.x, y: element.position.y },
465
+ skew: { x: element.skew.x, y: element.skew.y },
466
+ visible: element.visible,
467
+ culled: element.culled,
468
+ x: element.x,
469
+ y: element.y,
470
+ boundsArea: element.boundsArea,
471
+ cursor: element.cursor,
472
+ eventMode: element.eventMode,
473
+ interactive: element.interactive,
474
+ interactiveChildren: element.interactiveChildren,
475
+ hitArea: element.hitArea
476
+ };
477
+ }
478
+ function setMemoryContainer(element, memory) {
479
+ memory.width && (element.width = memory.width);
480
+ memory.height && (element.height = memory.height);
481
+ memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
482
+ memory.blendMode && (element.blendMode = memory.blendMode);
483
+ memory.tint && (element.tint = memory.tint);
484
+ memory.alpha && (element.alpha = memory.alpha);
485
+ memory.angle && (element.angle = memory.angle);
486
+ memory.renderable && (element.renderable = memory.renderable);
487
+ memory.rotation && (element.rotation = memory.rotation);
488
+ if (memory.scale) {
489
+ if (typeof memory.scale === "number") {
490
+ element.scale.set(memory.scale, memory.scale);
491
+ } else {
492
+ element.scale.set(memory.scale.x, memory.scale.y);
493
+ }
494
+ }
495
+ if (memory.pivot) {
496
+ if (typeof memory.pivot === "number") {
497
+ element.pivot.set(memory.pivot, memory.pivot);
498
+ } else {
499
+ element.pivot.set(memory.pivot.x, memory.pivot.y);
500
+ }
501
+ }
502
+ memory.position && element.position.set(memory.position.x, memory.position.y);
503
+ memory.skew && element.skew.set(memory.skew.x, memory.skew.y);
504
+ memory.visible && (element.visible = memory.visible);
505
+ memory.culled && (element.culled = memory.culled);
506
+ memory.x && (element.x = memory.x);
507
+ memory.y && (element.y = memory.y);
508
+ memory.boundsArea && (element.boundsArea = memory.boundsArea);
509
+ memory.cursor && (element.cursor = memory.cursor);
510
+ memory.eventMode && (element.eventMode = memory.eventMode);
511
+ memory.interactive && (element.interactive = memory.interactive);
512
+ memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
513
+ memory.hitArea && (element.hitArea = memory.hitArea);
514
+ }
515
+
516
+ // src/classes/canvas/CanvasImage.ts
517
+ var import_pixi5 = require("pixi.js");
518
+
519
+ // src/functions/TextureUtility.ts
520
+ var import_pixi3 = require("pixi.js");
521
+ function getTexture(imageUrl) {
522
+ return __async(this, null, function* () {
523
+ if (import_pixi3.Assets.cache.has(imageUrl)) {
524
+ return import_pixi3.Assets.get(imageUrl);
525
+ }
526
+ return import_pixi3.Assets.load(imageUrl).then((texture) => {
527
+ if (!texture) {
528
+ console.error("[Pixi'VN] Texture not found", imageUrl);
529
+ return;
530
+ }
531
+ if (!(texture instanceof import_pixi3.Texture)) {
532
+ console.error("[Pixi'VN] File not is a image", imageUrl);
533
+ return;
534
+ }
535
+ return texture;
536
+ }).catch((e) => {
537
+ console.error("[Pixi'VN] Error loading image", e);
538
+ return;
539
+ });
540
+ });
541
+ }
542
+ function getTextStyle(style) {
543
+ let fill = style.fill;
544
+ if (fill instanceof Object) {
545
+ console.warn("[Pixi'VN] CanvasText.style.fill is a FillGradient or FillPattern, this is not supported yet.", fill);
546
+ fill = "#00FF00";
547
+ }
548
+ return {
549
+ align: style.align,
550
+ breakWords: style.breakWords,
551
+ dropShadow: style.dropShadow,
552
+ fill,
553
+ fontFamily: style.fontFamily,
554
+ fontSize: style.fontSize,
555
+ fontStyle: style.fontStyle,
556
+ fontVariant: style.fontVariant,
557
+ fontWeight: style.fontWeight,
558
+ leading: style.leading,
559
+ letterSpacing: style.letterSpacing,
560
+ lineHeight: style.lineHeight,
561
+ padding: style.padding,
562
+ stroke: style.stroke,
563
+ textBaseline: style.textBaseline,
564
+ trim: style.trim,
565
+ whiteSpace: style.whiteSpace,
566
+ wordWrap: style.wordWrap,
567
+ wordWrapWidth: style.wordWrapWidth
568
+ };
569
+ }
570
+
571
+ // src/classes/canvas/CanvasSprite.ts
572
+ var import_pixi4 = require("pixi.js");
573
+ var CanvasSprite = class extends import_pixi4.Sprite {
574
+ constructor() {
575
+ super(...arguments);
576
+ this._onEvents = {};
577
+ }
578
+ get memory() {
579
+ return getMemorySprite(this);
580
+ }
581
+ set memory(value) {
582
+ setMemorySprite(this, value);
583
+ }
584
+ get onEvents() {
585
+ return this._onEvents;
586
+ }
587
+ /**
588
+ * is same function as on(), but it keeps in memory the children.
589
+ * @param event The event type, e.g., 'click', 'mousedown', 'mouseup', 'pointerdown', etc.
590
+ * @param eventClass The class that extends CanvasEvent.
591
+ * @returns
592
+ * @example
593
+ * ```typescript
594
+ * \@eventDecorator()
595
+ * export class EventTest extends CanvasEvent<CanvasSprite> {
596
+ * override fn(event: CanvasEventNamesType, sprite: CanvasSprite): void {
597
+ * if (event === 'pointerdown') {
598
+ * sprite.scale.x *= 1.25;
599
+ * sprite.scale.y *= 1.25;
600
+ * }
601
+ * }
602
+ * }
603
+ * ```
604
+ *
605
+ * ```typescript
606
+ * let sprite = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
607
+ * await sprite.load()
608
+ *
609
+ * sprite.eventMode = 'static';
610
+ * sprite.cursor = 'pointer';
611
+ * sprite.onEvent('pointerdown', EventTest);
612
+ *
613
+ * GameWindowManager.addCanvasElement("bunny", sprite);
614
+ * ```
615
+ */
616
+ onEvent(event, eventClass) {
617
+ let className = eventClass.name;
618
+ let instance = getEventInstanceByClassName(className);
619
+ this._onEvents[event] = className;
620
+ if (instance) {
621
+ super.on(event, () => {
622
+ instance.fn(event, this);
623
+ });
624
+ }
625
+ return this;
626
+ }
627
+ /**
628
+ * on() does not keep in memory the event class, use onEvent() instead
629
+ * @deprecated
630
+ * @private
631
+ * @param event
632
+ * @param fn
633
+ * @param context
634
+ */
635
+ on(event, fn, context) {
636
+ return super.on(event, fn, context);
637
+ }
638
+ static from(source, skipCache) {
639
+ let sprite = import_pixi4.Sprite.from(source, skipCache);
640
+ let mySprite = new CanvasSprite();
641
+ mySprite.texture = sprite.texture;
642
+ return mySprite;
643
+ }
644
+ };
645
+ CanvasSprite = __decorateClass([
646
+ canvasElementDecorator()
647
+ ], CanvasSprite);
648
+ function getMemorySprite(element) {
649
+ let temp = getMemoryContainer(element);
650
+ return __spreadProps(__spreadValues({}, temp), {
651
+ className: "CanvasSprite",
652
+ textureImage: getTextureMemory(element.texture),
653
+ anchor: { x: element.anchor.x, y: element.anchor.y },
654
+ roundPixels: element.roundPixels,
655
+ onEvents: element.onEvents
656
+ });
657
+ }
658
+ function setMemorySprite(element, memory) {
659
+ setMemoryContainer(element, memory);
660
+ getTexture(memory.textureImage.image).then((texture) => {
661
+ if (texture) {
662
+ element.texture = texture;
663
+ }
664
+ });
665
+ if (memory.anchor) {
666
+ if (typeof memory.anchor === "number") {
667
+ element.anchor.set(memory.anchor, memory.anchor);
668
+ } else {
669
+ element.anchor.set(memory.anchor.x, memory.anchor.y);
670
+ }
671
+ }
672
+ memory.roundPixels && (element.roundPixels = memory.roundPixels);
673
+ for (let event in memory.onEvents) {
674
+ let className = memory.onEvents[event];
675
+ let instance = getEventTypeByClassName(className);
676
+ if (instance) {
677
+ element.onEvent(event, instance);
678
+ }
679
+ }
680
+ }
681
+
682
+ // src/classes/canvas/CanvasImage.ts
683
+ var CanvasImage = class extends CanvasSprite {
684
+ constructor() {
685
+ super(...arguments);
686
+ this.imageLink = "";
687
+ }
688
+ get memory() {
689
+ return __spreadProps(__spreadValues({}, getMemorySprite(this)), {
690
+ className: "CanvasImage",
691
+ textureImage: { image: this.imageLink }
692
+ });
693
+ }
694
+ set memory(memory) {
695
+ setMemorySprite(this, memory);
696
+ }
697
+ static from(source, skipCache) {
698
+ let sprite = import_pixi5.Sprite.from(source, skipCache);
699
+ let mySprite = new CanvasImage();
700
+ mySprite.texture = sprite.texture;
701
+ return mySprite;
702
+ }
703
+ /**
704
+ * Load the image in the canvas.
705
+ * @returns a promise that resolves when the image is loaded.
706
+ */
707
+ load() {
708
+ return __async(this, null, function* () {
709
+ return getTexture(this.imageLink).then((texture) => {
710
+ if (texture) {
711
+ this.texture = texture;
712
+ }
713
+ }).catch((e) => {
714
+ console.error("[Pixi'VN] Error into CanvasImage.load()", e);
715
+ });
716
+ });
717
+ }
718
+ };
719
+ CanvasImage = __decorateClass([
720
+ canvasElementDecorator()
721
+ ], CanvasImage);
722
+
723
+ // src/classes/canvas/CanvasText.ts
724
+ var import_pixi6 = require("pixi.js");
725
+ var CanvasText = class extends import_pixi6.Text {
726
+ constructor() {
727
+ super(...arguments);
728
+ this._onEvents = {};
729
+ }
730
+ get memory() {
731
+ return getMemoryText(this);
732
+ }
733
+ set memory(value) {
734
+ setMemoryText(this, value);
735
+ }
736
+ get onEvents() {
737
+ return this._onEvents;
738
+ }
739
+ /**
740
+ * is same function as on(), but it keeps in memory the children.
741
+ * @param event The event type, e.g., 'click', 'mousedown', 'mouseup', 'pointerdown', etc.
742
+ * @param eventClass The class that extends CanvasEvent.
743
+ * @returns
744
+ * @example
745
+ * ```typescript
746
+ * \@eventDecorator()
747
+ * export class EventTest extends CanvasEvent<CanvasText> {
748
+ * override fn(event: CanvasEventNamesType, text: CanvasText): void {
749
+ * if (event === 'pointerdown') {
750
+ * text.scale.x *= 1.25;
751
+ * text.scale.y *= 1.25;
752
+ * }
753
+ * }
754
+ * }
755
+ * ```
756
+ *
757
+ * ```typescript
758
+ * const text = new CanvasText();
759
+ * text.text = "Hello World"
760
+ *
761
+ * text.eventMode = 'static';
762
+ * text.cursor = 'pointer';
763
+ * text.onEvent('pointerdown', EventTest);
764
+ *
765
+ * GameWindowManager.addCanvasElement("text", text);
766
+ * ```
767
+ */
768
+ onEvent(event, eventClass) {
769
+ let className = eventClass.name;
770
+ let instance = getEventInstanceByClassName(className);
771
+ this._onEvents[event] = className;
772
+ if (instance) {
773
+ super.on(event, () => {
774
+ instance.fn(event, this);
775
+ });
776
+ }
777
+ return this;
778
+ }
779
+ /**
780
+ * on() does not keep in memory the event class, use onEvent() instead
781
+ * @deprecated
782
+ * @private
783
+ * @param event
784
+ * @param fn
785
+ * @param context
786
+ */
787
+ on(event, fn, context) {
788
+ return super.on(event, fn, context);
789
+ }
790
+ };
791
+ CanvasText = __decorateClass([
792
+ canvasElementDecorator()
793
+ ], CanvasText);
794
+ function getMemoryText(element) {
795
+ let temp = getMemoryContainer(element);
796
+ return __spreadProps(__spreadValues({}, temp), {
797
+ className: "CanvasText",
798
+ anchor: { x: element.anchor.x, y: element.anchor.y },
799
+ text: element.text,
800
+ resolution: element.resolution,
801
+ style: getTextStyle(element.style),
802
+ roundPixels: element.roundPixels,
803
+ onEvents: element.onEvents
804
+ });
805
+ }
806
+ function setMemoryText(element, memory) {
807
+ setMemoryContainer(element, memory);
808
+ if (memory.anchor) {
809
+ if (typeof memory.anchor === "number") {
810
+ element.anchor.set(memory.anchor, memory.anchor);
811
+ } else {
812
+ element.anchor.set(memory.anchor.x, memory.anchor.y);
813
+ }
814
+ }
815
+ memory.text && (element.text = memory.text);
816
+ memory.resolution && (element.resolution = memory.resolution);
817
+ memory.style && (element.style = memory.style);
818
+ memory.roundPixels && (element.roundPixels = memory.roundPixels);
819
+ for (let event in memory.onEvents) {
820
+ let className = memory.onEvents[event];
821
+ let instance = getEventTypeByClassName(className);
822
+ if (instance) {
823
+ element.onEvent(event, instance);
824
+ }
825
+ }
826
+ }
827
+
828
+ // src/classes/ticker/TickerBase.ts
829
+ var TickerBase = class {
830
+ constructor(args, duration, priority) {
831
+ this.args = args;
832
+ this.duration = duration;
833
+ this.priority = priority;
834
+ }
835
+ /**
836
+ * The method that will be called every frame.
837
+ * This method should be overridden and you can use GameWindowManager.addCanvasElement() to get the canvas element of the canvas, and edit them.
838
+ * @param t The ticker that is calling this method
839
+ * @param args The arguments that you passed when you added the ticker
840
+ * @param tags The tags of the canvas elements that are connected to this ticker
841
+ */
842
+ fn(_t, _args, _tags) {
843
+ throw new Error("[Pixi'VN] The method TickerBase.fn() must be overridden");
844
+ }
845
+ };
846
+
847
+ // src/classes/ticker/TickerFadeAlpha.ts
848
+ var import_pixi7 = require("pixi.js");
849
+ var TickerFadeAlpha = class extends TickerBase {
850
+ /**
851
+ * The method that will be called every frame to fade the alpha of the canvas element of the canvas.
852
+ * @param delta The delta time
853
+ * @param args The arguments that are passed to the ticker
854
+ * @param tags The tags of the canvas element that are connected to this ticker
855
+ */
856
+ fn(t, args, tags) {
857
+ let type = args.type === void 0 ? "hide" : args.type;
858
+ let speed = args.speed === void 0 ? 0.1 : args.speed;
859
+ let limit = args.limit === void 0 ? type === "hide" ? 0 : 1 : args.limit;
860
+ let removeElementAfter = args.tagToRemoveAfter || [];
861
+ if (typeof removeElementAfter === "string") {
862
+ removeElementAfter = [removeElementAfter];
863
+ }
864
+ if (type === "hide" && limit < 0) {
865
+ limit = 0;
866
+ }
867
+ if (type === "show" && limit > 1) {
868
+ limit = 1;
869
+ }
870
+ tags.filter((tag) => {
871
+ var _a;
872
+ let element = GameWindowManager.getCanvasElement(tag);
873
+ if (args.startOnlyIfHaveTexture) {
874
+ if (element && element instanceof import_pixi7.Sprite && ((_a = element.texture) == null ? void 0 : _a.label) == "EMPTY") {
875
+ return false;
876
+ }
877
+ }
878
+ return true;
879
+ }).forEach((tag) => {
880
+ let element = GameWindowManager.getCanvasElement(tag);
881
+ if (element && element instanceof import_pixi7.Container) {
882
+ if (type === "show" && element.alpha < limit) {
883
+ element.alpha += speed * t.deltaTime;
884
+ } else if (type === "hide" && element.alpha > limit) {
885
+ element.alpha -= speed * t.deltaTime;
886
+ } else {
887
+ element.alpha = limit;
888
+ GameWindowManager.removeAssociationBetweenTickerCanvasElement(tag, this);
889
+ GameWindowManager.removeCanvasElement(removeElementAfter);
890
+ }
891
+ }
892
+ });
893
+ }
894
+ };
895
+ TickerFadeAlpha = __decorateClass([
896
+ tickerDecorator()
897
+ ], TickerFadeAlpha);
898
+
899
+ // src/classes/ticker/TickerRotate.ts
900
+ var import_pixi8 = require("pixi.js");
901
+
902
+ // src/functions/TickerUtility.ts
903
+ function updateTickerProgression(args, propertyName, progression) {
904
+ if (args.hasOwnProperty(propertyName) && typeof args[propertyName] !== "number") {
905
+ return;
906
+ }
907
+ if (args[propertyName] !== void 0 && progression && args[propertyName] !== progression.limit) {
908
+ if (progression.type === "linear") {
909
+ args[propertyName] += progression.amt;
910
+ if (progression.limit !== void 0) {
911
+ if (args[propertyName] > progression.limit && progression.amt > 0) {
912
+ args[propertyName] = progression.limit;
913
+ } else if (args[propertyName] < progression.limit && progression.amt < 0) {
914
+ args[propertyName] = progression.limit;
915
+ }
916
+ }
917
+ } else if (progression.type === "exponential") {
918
+ args[propertyName] += args[propertyName] * progression.percentage;
919
+ if (progression.limit !== void 0) {
920
+ if (args[propertyName] > progression.limit && progression.percentage > 0) {
921
+ args[propertyName] = progression.limit;
922
+ } else if (args[propertyName] < progression.limit && progression.percentage < 0) {
923
+ args[propertyName] = progression.limit;
924
+ }
925
+ }
926
+ }
927
+ }
928
+ }
929
+
930
+ // src/classes/ticker/TickerRotate.ts
931
+ var TickerRotate = class extends TickerBase {
932
+ /**
933
+ * The method that will be called every frame to rotate the canvas element of the canvas.
934
+ * @param delta The delta time
935
+ * @param args The arguments that are passed to the ticker
936
+ * @param tags The tags of the canvas element that are connected to this ticker
937
+ */
938
+ fn(t, args, tags) {
939
+ let speed = args.speed === void 0 ? 0.1 : args.speed;
940
+ let clockwise = args.clockwise === void 0 ? true : args.clockwise;
941
+ tags.filter((tag) => {
942
+ var _a;
943
+ let element = GameWindowManager.getCanvasElement(tag);
944
+ if (args.startOnlyIfHaveTexture) {
945
+ if (element && element instanceof import_pixi8.Sprite && ((_a = element.texture) == null ? void 0 : _a.label) == "EMPTY") {
946
+ return false;
947
+ }
948
+ }
949
+ return true;
950
+ }).forEach((tag) => {
951
+ let element = GameWindowManager.getCanvasElement(tag);
952
+ if (element && element instanceof import_pixi8.Container) {
953
+ if (clockwise)
954
+ element.rotation += speed * t.deltaTime;
955
+ else
956
+ element.rotation -= speed * t.deltaTime;
957
+ }
958
+ });
959
+ if (args.speedProgression)
960
+ updateTickerProgression(args, "speed", args.speedProgression);
961
+ }
962
+ };
963
+ TickerRotate = __decorateClass([
964
+ tickerDecorator()
965
+ ], TickerRotate);
966
+
967
+ // src/functions/ImageUtility.ts
968
+ function addImage(tag, imageUrl) {
969
+ let image = new CanvasImage();
970
+ image.imageLink = imageUrl;
971
+ GameWindowManager.addCanvasElement(tag, image);
972
+ return image;
973
+ }
974
+ function showCanvasImages(canvasImages) {
975
+ return __async(this, null, function* () {
976
+ if (!Array.isArray(canvasImages)) {
977
+ return [canvasImages];
978
+ }
979
+ let promises = Array(canvasImages.length);
980
+ for (let i = 0; i < canvasImages.length; i++) {
981
+ promises[i] = getTexture(canvasImages[i].imageLink);
982
+ }
983
+ return Promise.all(promises).then((textures) => {
984
+ return textures.map((texture, index) => {
985
+ if (texture) {
986
+ canvasImages[index].texture = texture;
987
+ return canvasImages[index];
988
+ }
989
+ canvasImages[index].load();
990
+ return canvasImages[index];
991
+ });
992
+ });
993
+ });
994
+ }
995
+ function removeCanvasElement(tag) {
996
+ GameWindowManager.removeCanvasElement(tag);
997
+ }
998
+ function showImageWithDissolveTransition(tag, imageUrl, speed, priority) {
999
+ return __async(this, null, function* () {
1000
+ if (!GameWindowManager.getCanvasElement(tag)) {
1001
+ let image2 = addImage(tag, imageUrl);
1002
+ image2.alpha = 0;
1003
+ let effect2 = new TickerFadeAlpha({
1004
+ speed,
1005
+ type: "show",
1006
+ startOnlyIfHaveTexture: true
1007
+ }, 1e4, priority);
1008
+ GameWindowManager.addTicker(tag, effect2);
1009
+ return image2.load();
1010
+ }
1011
+ let specialTag = tag + "_temp_disolve";
1012
+ let effect = new TickerFadeAlpha({
1013
+ speed,
1014
+ type: "show",
1015
+ tagToRemoveAfter: specialTag,
1016
+ startOnlyIfHaveTexture: true
1017
+ }, 1e4, priority);
1018
+ GameWindowManager.editTagCanvasElement(tag, specialTag);
1019
+ let image = addImage(tag, imageUrl);
1020
+ image.alpha = 0;
1021
+ GameWindowManager.addTicker(tag, effect);
1022
+ return image.load();
1023
+ });
1024
+ }
1025
+
1026
+ // src/constants.ts
1027
+ var PIXIVM_VERSION = "0.1.4";
1028
+
1029
+ // src/functions/SavesUtility.ts
1030
+ function getSaveData() {
1031
+ return {
1032
+ version: PIXIVM_VERSION,
1033
+ stepData: GameStepManager.export(),
1034
+ storageData: GameStorageManager.export(),
1035
+ canvasData: GameWindowManager.export(),
1036
+ path: window.location.pathname
1037
+ };
1038
+ }
1039
+ function getSaveJson() {
1040
+ const saveData = getSaveData();
1041
+ return JSON.stringify(saveData);
1042
+ }
1043
+ function loadSaveData(data, navigate) {
1044
+ GameStepManager.import(data.stepData);
1045
+ GameStorageManager.import(data.storageData);
1046
+ GameWindowManager.import(data.canvasData);
1047
+ navigate(data.path);
1048
+ }
1049
+ function loadSaveJson(dataString, navigate) {
1050
+ loadSaveData(jsonToSaveData(dataString), navigate);
1051
+ }
1052
+ function jsonToSaveData(json) {
1053
+ return JSON.parse(json);
1054
+ }
1055
+
1056
+ // src/functions/ExportUtility.ts
1057
+ function createExportableElement(element) {
1058
+ try {
1059
+ let elementString = JSON.stringify(element);
1060
+ return JSON.parse(elementString);
1061
+ } catch (e) {
1062
+ console.error("[Pixi'VN] Error creating exportable element", e);
1063
+ throw new Error("[Pixi'VN] Error creating exportable element");
1064
+ }
1065
+ }
1066
+
1067
+ // src/functions/DiffUtility.ts
1068
+ function restoreDeepDiffChanges(data, differences) {
1069
+ let result = createExportableElement(data);
1070
+ differences.forEach((diff2) => {
1071
+ let dataToEdit = result;
1072
+ if (diff2.path && diff2.path.length > 0) {
1073
+ diff2.path.forEach((path, index) => {
1074
+ if (diff2.path && index === diff2.path.length - 1) {
1075
+ if (diff2.kind === "E" || diff2.kind === "D") {
1076
+ dataToEdit[path] = diff2.lhs;
1077
+ } else if (diff2.kind === "N") {
1078
+ if (Number.isInteger(path)) {
1079
+ if (Array.isArray(dataToEdit)) {
1080
+ dataToEdit.splice(path, 1);
1081
+ }
1082
+ } else if (typeof path === "string") {
1083
+ delete dataToEdit[path];
1084
+ }
1085
+ } else if (diff2.kind === "A") {
1086
+ let index2 = diff2.index;
1087
+ if (diff2.item.kind === "N") {
1088
+ dataToEdit[path].splice(index2, 1);
1089
+ } else if (diff2.item.kind === "E" || diff2.item.kind === "D") {
1090
+ dataToEdit[path][index2] = diff2.item.lhs;
1091
+ } else if (diff2.item.kind === "A") {
1092
+ console.warn("[Pixi'VN] Nested array found, skipping diff", diff2);
1093
+ } else {
1094
+ console.warn("[Pixi'VN] No array found, skipping diff", diff2);
1095
+ }
1096
+ }
1097
+ } else {
1098
+ dataToEdit = dataToEdit[path];
1099
+ }
1100
+ });
1101
+ } else {
1102
+ console.warn("[Pixi'VN] No path found, skipping diff", diff2);
1103
+ }
1104
+ });
1105
+ return result;
1106
+ }
1107
+
1108
+ // src/functions/StepLabelUtility.ts
1109
+ var import_sha1 = __toESM(require("crypto-js/sha1"));
1110
+ function getStepSha1(step) {
1111
+ let sha1String = (0, import_sha1.default)(step.toString().toLocaleLowerCase());
1112
+ return sha1String.toString();
1113
+ }
1114
+ function checkIfStepsIsEqual(step1, step2) {
1115
+ return step1 === step2;
1116
+ }
1117
+
1118
+ // src/managers/StorageManager.ts
1119
+ var _GameStorageManager = class _GameStorageManager {
1120
+ constructor() {
1121
+ }
1122
+ static get keysSystem() {
1123
+ return {
1124
+ CURRENT_DIALOGUE_MEMORY_KEY: "___current_dialogue_memory_key___",
1125
+ LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY: "___last_dialogue_added_in_step_memory_key___",
1126
+ CURRENT_MENU_OPTIONS_MEMORY_KEY: "___current_menu_options_memory_key___",
1127
+ LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY: "___last_menu_options_added_in_step_memory_key___",
1128
+ CHARACTER_PREKEY: "___character___"
1129
+ };
1130
+ }
1131
+ /**
1132
+ * Set a variable in the storage
1133
+ * @param key The key of the variable
1134
+ * @param value The value of the variable. If undefined, the variable will be removed
1135
+ * @returns
1136
+ */
1137
+ static setVariable(key, value) {
1138
+ key = key.toLowerCase();
1139
+ if (value === void 0) {
1140
+ if (_GameStorageManager.storage.hasOwnProperty(key)) {
1141
+ delete _GameStorageManager.storage[key];
1142
+ }
1143
+ return;
1144
+ }
1145
+ _GameStorageManager.storage[key] = value;
1146
+ }
1147
+ /**
1148
+ * Get a variable from the storage
1149
+ * @param key The key of the variable
1150
+ * @returns The value of the variable. If the variable does not exist, it will return undefined
1151
+ */
1152
+ static getVariable(key) {
1153
+ key = key.toLowerCase();
1154
+ if (_GameStorageManager.storage.hasOwnProperty(key)) {
1155
+ return _GameStorageManager.storage[key];
1156
+ }
1157
+ return void 0;
1158
+ }
1159
+ /**
1160
+ * Remove a variable from the storage
1161
+ * @param key The key of the variable
1162
+ * @returns
1163
+ */
1164
+ static removeVariable(key) {
1165
+ key = key.toLowerCase();
1166
+ if (_GameStorageManager.storage.hasOwnProperty(key)) {
1167
+ delete _GameStorageManager.storage[key];
1168
+ }
1169
+ }
1170
+ /**
1171
+ * Clear the storage and the oidsUsed
1172
+ * @returns
1173
+ */
1174
+ static clear() {
1175
+ _GameStorageManager.storage = {};
1176
+ }
1177
+ static exportJson() {
1178
+ return JSON.stringify(this.export());
1179
+ }
1180
+ static export() {
1181
+ return createExportableElement(_GameStorageManager.storage);
1182
+ }
1183
+ static importJson(dataString) {
1184
+ _GameStorageManager.import(JSON.parse(dataString));
1185
+ }
1186
+ static import(data) {
1187
+ _GameStorageManager.clear();
1188
+ try {
1189
+ if (data) {
1190
+ _GameStorageManager.storage = data;
1191
+ } else {
1192
+ console.warn("[Pixi'VN] No storage data found");
1193
+ }
1194
+ } catch (e) {
1195
+ console.error("[Pixi'VN] Error importing data", e);
1196
+ }
1197
+ }
1198
+ };
1199
+ _GameStorageManager.storage = {};
1200
+ var GameStorageManager = _GameStorageManager;
1201
+
1202
+ // src/managers/WindowManager.ts
1203
+ var import_pixi9 = require("pixi.js");
1204
+
1205
+ // src/types/PauseType.ts
1206
+ var PauseValueType = "Pause";
1207
+ function Pause(duration) {
1208
+ return {
1209
+ type: PauseValueType,
1210
+ duration
1211
+ };
1212
+ }
1213
+
1214
+ // src/types/RepeatType.ts
1215
+ var Repeat = "Repeat";
1216
+
1217
+ // src/managers/WindowManager.ts
1218
+ var _GameWindowManager = class _GameWindowManager {
1219
+ constructor() {
1220
+ }
1221
+ /**
1222
+ * The PIXI Application instance.
1223
+ * It not recommended to use this property directly.
1224
+ */
1225
+ static get app() {
1226
+ if (!_GameWindowManager._app) {
1227
+ throw new Error("[Pixi'VN] GameWindowManager.app is undefined");
1228
+ }
1229
+ return _GameWindowManager._app;
1230
+ }
1231
+ /**
1232
+ * If the manager is initialized.
1233
+ */
1234
+ static get isInitialized() {
1235
+ return _GameWindowManager._isInitialized;
1236
+ }
1237
+ static get screen() {
1238
+ return _GameWindowManager.app.screen;
1239
+ }
1240
+ /**
1241
+ * Initialize the PIXI Application and the interface div.
1242
+ * This method should be called before any other method.
1243
+ * @param element The html element where I will put the canvas. Example: document.body
1244
+ * @param width The width of the canvas
1245
+ * @param height The height of the canvas
1246
+ * @param options The options of PIXI Application
1247
+ * @example
1248
+ * ```typescript
1249
+ * const body = document.body
1250
+ * if (!body) {
1251
+ * throw new Error('body element not found')
1252
+ * }
1253
+ * await GameWindowManager.initialize(body, 1920, 1080, {
1254
+ * backgroundColor: "#303030"
1255
+ * })
1256
+ * ```
1257
+ */
1258
+ static initialize(element, width, height, options) {
1259
+ return __async(this, null, function* () {
1260
+ _GameWindowManager.canvasWidth = width;
1261
+ _GameWindowManager.canvasHeight = height;
1262
+ _GameWindowManager._app = new import_pixi9.Application();
1263
+ return _GameWindowManager.app.init(__spreadValues({
1264
+ resolution: window.devicePixelRatio || 1,
1265
+ autoDensity: true,
1266
+ width,
1267
+ height
1268
+ }, options)).then(() => {
1269
+ _GameWindowManager._isInitialized = true;
1270
+ this.addCanvasIntoElement(element);
1271
+ window.addEventListener("resize", _GameWindowManager.resize);
1272
+ _GameWindowManager.resize();
1273
+ });
1274
+ });
1275
+ }
1276
+ /**
1277
+ * Add the canvas into a html element.
1278
+ * @param element it is the html element where I will put the canvas. Example: document.body
1279
+ */
1280
+ static addCanvasIntoElement(element) {
1281
+ if (_GameWindowManager.isInitialized) {
1282
+ element.appendChild(_GameWindowManager.app.canvas);
1283
+ } else {
1284
+ console.error("[Pixi'VN] GameWindowManager is not initialized");
1285
+ }
1286
+ }
1287
+ /**
1288
+ * Initialize the interface div and add it into a html element.
1289
+ * @param element it is the html element where I will put the interface div. Example: document.getElementById('root')
1290
+ * @example
1291
+ * ```typescript
1292
+ * const root = document.getElementById('root')
1293
+ * if (!root) {
1294
+ * throw new Error('root element not found')
1295
+ * }
1296
+ * GameWindowManager.initializeHTMLLayout(root)
1297
+ * const reactRoot = createRoot(GameWindowManager.htmlLayout)
1298
+ * reactRoot.render(
1299
+ * <App />
1300
+ * )
1301
+ * ```
1302
+ */
1303
+ static initializeHTMLLayout(element) {
1304
+ let div = document.createElement("div");
1305
+ div.style.position = "absolute";
1306
+ div.style.pointerEvents = "none";
1307
+ element.appendChild(div);
1308
+ _GameWindowManager.htmlLayout = div;
1309
+ _GameWindowManager.resize();
1310
+ }
1311
+ /* Resize Metods */
1312
+ /**
1313
+ * This method returns the scale of the screen.
1314
+ */
1315
+ static get screenScale() {
1316
+ let screenWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
1317
+ let screenHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
1318
+ return Math.min(screenWidth / _GameWindowManager.canvasWidth, screenHeight / _GameWindowManager.canvasHeight);
1319
+ }
1320
+ /**
1321
+ * This method returns the width of the screen enlarged by the scale.
1322
+ */
1323
+ static get screenWidth() {
1324
+ return Math.floor(_GameWindowManager.screenScale * _GameWindowManager.canvasWidth);
1325
+ }
1326
+ /**
1327
+ * This method returns the height of the screen enlarged by the scale.
1328
+ */
1329
+ static get screenHeight() {
1330
+ return Math.floor(_GameWindowManager.screenScale * _GameWindowManager.canvasHeight);
1331
+ }
1332
+ /**
1333
+ * This method returns the horizontal margin of the screen.
1334
+ */
1335
+ static get horizontalMargin() {
1336
+ let screenWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
1337
+ return (screenWidth - _GameWindowManager.screenWidth) / 2;
1338
+ }
1339
+ /**
1340
+ * This method returns the vertical margin of the screen.
1341
+ */
1342
+ static get verticalMargin() {
1343
+ let screenHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
1344
+ return (screenHeight - _GameWindowManager.screenHeight) / 2;
1345
+ }
1346
+ /**
1347
+ * This method is called when the screen is resized.
1348
+ */
1349
+ static resize() {
1350
+ if (_GameWindowManager.isInitialized) {
1351
+ let style = _GameWindowManager.app.canvas.style;
1352
+ style.width = `${_GameWindowManager.screenWidth}px`;
1353
+ style.height = `${_GameWindowManager.screenHeight}px`;
1354
+ style.marginLeft = `${_GameWindowManager.horizontalMargin}px`;
1355
+ style.marginRight = `${_GameWindowManager.horizontalMargin}px`;
1356
+ style.marginTop = `${_GameWindowManager.verticalMargin}px`;
1357
+ style.marginBottom = `${_GameWindowManager.verticalMargin}px`;
1358
+ }
1359
+ if (_GameWindowManager.htmlLayout) {
1360
+ _GameWindowManager.htmlLayout.style.width = `${_GameWindowManager.screenWidth}px`;
1361
+ _GameWindowManager.htmlLayout.style.height = `${_GameWindowManager.screenHeight}px`;
1362
+ _GameWindowManager.htmlLayout.style.marginLeft = `${_GameWindowManager.horizontalMargin}px`;
1363
+ _GameWindowManager.htmlLayout.style.marginRight = `${_GameWindowManager.horizontalMargin}px`;
1364
+ _GameWindowManager.htmlLayout.style.marginTop = `${_GameWindowManager.verticalMargin}px`;
1365
+ _GameWindowManager.htmlLayout.style.marginBottom = `${_GameWindowManager.verticalMargin}px`;
1366
+ }
1367
+ }
1368
+ /* Edit Canvas Elements Methods */
1369
+ /**
1370
+ * This is a dictionary that contains all Canvas Elements of Canvas, currently.
1371
+ */
1372
+ static get currentCanvasElements() {
1373
+ return _GameWindowManager._children;
1374
+ }
1375
+ /**
1376
+ * Add a canvas element to the canvas.
1377
+ * If there is a canvas element with the same tag, it will be removed.
1378
+ * @param tag The tag of the canvas element.
1379
+ * @param canvasElement The canvas elements to be added.
1380
+ * @example
1381
+ * ```typescript
1382
+ * const texture = await Assets.load('https://pixijs.com/assets/bunny.png');
1383
+ * const sprite = CanvasSprite.from(texture);
1384
+ * GameWindowManager.addCanvasElement("bunny", sprite);
1385
+ * ```
1386
+ */
1387
+ static addCanvasElement(tag, canvasElement) {
1388
+ if (_GameWindowManager._children[tag]) {
1389
+ _GameWindowManager.removeCanvasElement(tag);
1390
+ }
1391
+ _GameWindowManager.app.stage.addChild(canvasElement);
1392
+ _GameWindowManager._children[tag] = canvasElement;
1393
+ _GameWindowManager.childrenTagsOrder.push(tag);
1394
+ }
1395
+ /**
1396
+ * Remove a canvas element from the canvas.
1397
+ * And remove all tickers that are not connected to any canvas element.
1398
+ * @param tag The tag of the canvas element to be removed.
1399
+ * @returns
1400
+ * @example
1401
+ * ```typescript
1402
+ * GameWindowManager.removeCanvasElement("bunny");
1403
+ * ```
1404
+ */
1405
+ static removeCanvasElement(tag) {
1406
+ if (typeof tag === "string") {
1407
+ tag = [tag];
1408
+ }
1409
+ tag.forEach((t) => {
1410
+ if (_GameWindowManager._children[t]) {
1411
+ _GameWindowManager.app.stage.removeChild(_GameWindowManager._children[t]);
1412
+ delete _GameWindowManager._children[t];
1413
+ }
1414
+ });
1415
+ _GameWindowManager.removeTickersWithoutAssociatedCanvasElement();
1416
+ _GameWindowManager.childrenTagsOrder = _GameWindowManager.childrenTagsOrder.filter((t) => !tag.includes(t));
1417
+ }
1418
+ /**
1419
+ * Get a canvas element by the tag.
1420
+ * @param tag The tag of the canvas element.
1421
+ * @returns The canvas element.
1422
+ * @example
1423
+ * ```typescript
1424
+ * const sprite = GameWindowManager.getCanvasElement<CanvasSprite>("bunny");
1425
+ * ```
1426
+ */
1427
+ static getCanvasElement(tag) {
1428
+ return _GameWindowManager._children[tag];
1429
+ }
1430
+ /**
1431
+ * Check if a DisplayObject is on the canvas.
1432
+ * @param pixiElement The DisplayObject to be checked.
1433
+ * @returns If the DisplayObject is on the canvas.
1434
+ */
1435
+ static canvasElementIsOnCanvas(pixiElement) {
1436
+ return _GameWindowManager.app.stage.children.includes(pixiElement);
1437
+ }
1438
+ /**
1439
+ * Remove all canvas elements from the canvas.
1440
+ * And remove all tickers that are not connected to any canvas element.
1441
+ */
1442
+ static removeCanvasElements() {
1443
+ _GameWindowManager.app.stage.removeChildren();
1444
+ _GameWindowManager._children = {};
1445
+ _GameWindowManager.childrenTagsOrder = [];
1446
+ _GameWindowManager.removeTickers();
1447
+ }
1448
+ /**
1449
+ * Edit the tag of a canvas element.
1450
+ * @param oldTag The old tag of the canvas element.
1451
+ * @param newTag The new tag of the canvas element.
1452
+ */
1453
+ static editTagCanvasElement(oldTag, newTag) {
1454
+ if (_GameWindowManager._children[oldTag]) {
1455
+ _GameWindowManager._children[newTag] = _GameWindowManager._children[oldTag];
1456
+ delete _GameWindowManager._children[oldTag];
1457
+ }
1458
+ }
1459
+ /** Edit Tickers Methods */
1460
+ /**
1461
+ * Currently tickers that are running.
1462
+ */
1463
+ static get currentTickers() {
1464
+ return _GameWindowManager._currentTickers;
1465
+ }
1466
+ /**
1467
+ * The steps of the tickers
1468
+ */
1469
+ static get currentTickersSteps() {
1470
+ return _GameWindowManager._currentTickersSteps;
1471
+ }
1472
+ /**
1473
+ * Run a ticker.
1474
+ * @param canvasEslementTag The tag of the canvas element that will use the ticker.
1475
+ * @param ticker The ticker class to be run.
1476
+ * @param args The arguments to be used in the ticker.
1477
+ * @param duration The time to be used in the ticker. This number is in milliseconds. If it is undefined, the ticker will run forever.
1478
+ * @param priority The priority to be used in the ticker.
1479
+ * @returns
1480
+ * @example
1481
+ * ```typescript
1482
+ * GameWindowManager.addTicker("alien", new TickerRotate({ speed: 0.2 }))
1483
+ * ```
1484
+ */
1485
+ static addTicker(canvasElementTag, ticker) {
1486
+ let tickerName = ticker.constructor.name;
1487
+ if (typeof canvasElementTag === "string") {
1488
+ canvasElementTag = [canvasElementTag];
1489
+ }
1490
+ let t = geTickerInstanceByClassName(tickerName, ticker.args, ticker.duration, ticker.priority);
1491
+ if (!t) {
1492
+ console.error(`[Pixi'VN] Ticker ${tickerName} not found`);
1493
+ return;
1494
+ }
1495
+ _GameWindowManager.removeAssociationBetweenTickerCanvasElement(canvasElementTag, ticker);
1496
+ let tickerHistory = {
1497
+ fn: () => {
1498
+ },
1499
+ className: tickerName,
1500
+ args: ticker.args,
1501
+ canvasElementTags: canvasElementTag,
1502
+ priority: ticker.priority,
1503
+ duration: ticker.duration
1504
+ };
1505
+ _GameWindowManager.pushTicker(tickerHistory, t);
1506
+ _GameWindowManager.removeTickersWithoutAssociatedCanvasElement();
1507
+ if (ticker.duration) {
1508
+ let timeout = setTimeout(() => {
1509
+ _GameWindowManager.removeTickerTimeoutInfo(timeout);
1510
+ _GameWindowManager.nextTickerStep(canvasElementTag);
1511
+ }, ticker.duration);
1512
+ _GameWindowManager.addTickerTimeoutInfo(canvasElementTag, tickerName, timeout.toString());
1513
+ }
1514
+ }
1515
+ static pushTicker(tickerData, ticker) {
1516
+ _GameWindowManager.removeAssociationBetweenTickerCanvasElement(tickerData.canvasElementTags, tickerData);
1517
+ _GameWindowManager._currentTickers.push(tickerData);
1518
+ tickerData.fn = (t) => {
1519
+ ticker == null ? void 0 : ticker.fn(t, tickerData.args, tickerData.canvasElementTags);
1520
+ };
1521
+ _GameWindowManager.app.ticker.add(tickerData.fn, void 0, tickerData.priority);
1522
+ }
1523
+ /**
1524
+ * Run a sequence of tickers.
1525
+ * @param tag The tag of canvas element that will use the tickers.
1526
+ * @param steps The steps of the tickers.
1527
+ * @returns
1528
+ * @example
1529
+ * ```typescript
1530
+ * GameWindowManager.addTickersSteps("alien", [
1531
+ * new TickerRotate({ speed: 0.1, clockwise: true }, 2000),
1532
+ * Pause(500),
1533
+ * new TickerRotate({ speed: 0.2, clockwise: false }, 2000),
1534
+ * Repeat,
1535
+ * ])
1536
+ * ```
1537
+ */
1538
+ static addTickersSteps(tag, steps) {
1539
+ if (steps.length == 0) {
1540
+ console.warn("[Pixi'VN] The steps of the tickers is empty");
1541
+ return;
1542
+ }
1543
+ let alredyExists = _GameWindowManager._currentTickersSteps[tag] !== void 0;
1544
+ _GameWindowManager._currentTickersSteps[tag] = {
1545
+ currentStepNumber: 0,
1546
+ steps: steps.map((s) => {
1547
+ if (s === Repeat) {
1548
+ return s;
1549
+ }
1550
+ if (!s.duration) {
1551
+ console.warn("[Pixi'VN] Duration is not defined, so it will be set to 1000");
1552
+ s.duration = 1e3;
1553
+ }
1554
+ if (s.hasOwnProperty("type") && s.type === PauseValueType) {
1555
+ return s;
1556
+ }
1557
+ let tickerName = s.constructor.name;
1558
+ return {
1559
+ ticker: tickerName,
1560
+ args: s.args,
1561
+ duration: s.duration
1562
+ };
1563
+ })
1564
+ };
1565
+ if (!alredyExists) {
1566
+ _GameWindowManager.runTickersSteps(tag);
1567
+ }
1568
+ }
1569
+ static runTickersSteps(tag) {
1570
+ let step = _GameWindowManager._currentTickersSteps[tag].steps[_GameWindowManager._currentTickersSteps[tag].currentStepNumber];
1571
+ if (step === Repeat) {
1572
+ step = _GameWindowManager._currentTickersSteps[tag].steps[0];
1573
+ _GameWindowManager._currentTickersSteps[tag].currentStepNumber = 0;
1574
+ if (step === Repeat) {
1575
+ console.error("[Pixi'VN] TikersSteps has a RepeatType in the first step");
1576
+ return;
1577
+ }
1578
+ }
1579
+ if (step.hasOwnProperty("type") && step.type === PauseValueType) {
1580
+ let timeout = setTimeout(() => {
1581
+ _GameWindowManager.removeTickerTimeoutInfo(timeout);
1582
+ _GameWindowManager.nextTickerStep(tag);
1583
+ }, step.duration);
1584
+ _GameWindowManager.addTickerTimeoutInfo(tag, "steps", timeout.toString());
1585
+ return;
1586
+ }
1587
+ let ticker = geTickerInstanceByClassName(step.ticker, step.args, step.duration, step.priority);
1588
+ if (!ticker) {
1589
+ console.error(`[Pixi'VN] Ticker ${step.ticker} not found`);
1590
+ return;
1591
+ }
1592
+ _GameWindowManager.addTicker(tag, ticker);
1593
+ }
1594
+ static nextTickerStep(tag) {
1595
+ if (typeof tag === "string") {
1596
+ tag = [tag];
1597
+ }
1598
+ tag.forEach((tag2) => {
1599
+ if (_GameWindowManager._currentTickersSteps[tag2]) {
1600
+ let steps = _GameWindowManager._currentTickersSteps[tag2];
1601
+ if (steps.currentStepNumber + 1 < steps.steps.length) {
1602
+ steps.currentStepNumber++;
1603
+ _GameWindowManager._currentTickersSteps[tag2] = steps;
1604
+ _GameWindowManager.runTickersSteps(tag2);
1605
+ } else {
1606
+ delete _GameWindowManager._currentTickersSteps[tag2];
1607
+ }
1608
+ }
1609
+ });
1610
+ }
1611
+ /**
1612
+ * Remove a connection between a canvas element and a ticker.
1613
+ * And remove the ticker if there is no canvas element connected to it.
1614
+ * @param tag The tag of the canvas element that will use the ticker.
1615
+ * @param ticker The ticker class to be removed.
1616
+ * @example
1617
+ * ```typescript
1618
+ * GameWindowManager.removeAssociationBetweenTickerCanvasElement("alien", TickerRotate)
1619
+ * ```
1620
+ */
1621
+ static removeAssociationBetweenTickerCanvasElement(tag, ticker) {
1622
+ let tickerName;
1623
+ if (ticker instanceof TickerBase) {
1624
+ tickerName = ticker.constructor.name;
1625
+ } else {
1626
+ tickerName = ticker.name;
1627
+ }
1628
+ if (typeof tag === "string") {
1629
+ tag = [tag];
1630
+ }
1631
+ _GameWindowManager._currentTickers = _GameWindowManager._currentTickers.map((t) => {
1632
+ if (t.className === tickerName) {
1633
+ t.canvasElementTags = t.canvasElementTags.filter((e) => !tag.includes(e));
1634
+ }
1635
+ return t;
1636
+ });
1637
+ for (let timeout in _GameWindowManager.currentTickersTimeouts) {
1638
+ let t = _GameWindowManager.currentTickersTimeouts[timeout].tags.filter((e) => !tag.includes(e));
1639
+ if (t.length == 0) {
1640
+ _GameWindowManager.removeTickerTimeoutInfo(timeout);
1641
+ } else {
1642
+ _GameWindowManager.currentTickersTimeouts[timeout].tags = t;
1643
+ }
1644
+ }
1645
+ _GameWindowManager.removeTickersWithoutAssociatedCanvasElement();
1646
+ }
1647
+ /**
1648
+ * Remove all tickers that are not connected to any existing canvas element.
1649
+ */
1650
+ static removeTickersWithoutAssociatedCanvasElement() {
1651
+ let currentTickers = _GameWindowManager._currentTickers.map((t) => {
1652
+ t.canvasElementTags = t.canvasElementTags.filter((e) => _GameWindowManager._children[e]);
1653
+ return t;
1654
+ });
1655
+ currentTickers.filter((t) => t.canvasElementTags.length === 0).forEach((t) => {
1656
+ _GameWindowManager.app.ticker.remove(t.fn);
1657
+ });
1658
+ currentTickers = currentTickers.filter((t) => t.canvasElementTags.length > 0);
1659
+ _GameWindowManager._currentTickers = currentTickers;
1660
+ for (let tag in _GameWindowManager._currentTickersSteps) {
1661
+ if (_GameWindowManager._children[tag] === void 0) {
1662
+ delete _GameWindowManager._currentTickersSteps[tag];
1663
+ }
1664
+ }
1665
+ }
1666
+ static addTickerTimeoutInfo(tags, ticker, timeout) {
1667
+ if (typeof tags === "string") {
1668
+ tags = [tags];
1669
+ }
1670
+ _GameWindowManager.currentTickersTimeouts[timeout] = {
1671
+ tags,
1672
+ ticker
1673
+ };
1674
+ }
1675
+ static removeTickerTimeoutInfo(timeout) {
1676
+ if (typeof timeout !== "string") {
1677
+ timeout = timeout.toString();
1678
+ }
1679
+ if (_GameWindowManager.currentTickersTimeouts[timeout]) {
1680
+ delete _GameWindowManager.currentTickersTimeouts[timeout];
1681
+ }
1682
+ }
1683
+ /**
1684
+ * Remove all tickers from the canvas.
1685
+ */
1686
+ static removeTickers() {
1687
+ _GameWindowManager._currentTickersSteps = {};
1688
+ _GameWindowManager._currentTickers.forEach((t) => {
1689
+ _GameWindowManager.app.ticker.remove(t.fn);
1690
+ });
1691
+ _GameWindowManager._currentTickers = [];
1692
+ for (let timeout in _GameWindowManager.currentTickersTimeouts) {
1693
+ _GameWindowManager.removeTickerTimeoutInfo(timeout);
1694
+ }
1695
+ }
1696
+ /**
1697
+ * Clear the canvas and the tickers.
1698
+ */
1699
+ static clear() {
1700
+ _GameWindowManager.removeCanvasElements();
1701
+ }
1702
+ /* Export and Import Methods */
1703
+ /**
1704
+ * Export the canvas and the tickers to a JSON string.
1705
+ * @returns The JSON string.
1706
+ */
1707
+ static exportJson() {
1708
+ return JSON.stringify(this.export());
1709
+ }
1710
+ /**
1711
+ * Export the canvas and the tickers to an object.
1712
+ * @returns The object.
1713
+ */
1714
+ static export() {
1715
+ let currentElements = {};
1716
+ for (let tag in _GameWindowManager._children) {
1717
+ currentElements[tag] = exportCanvasElement(_GameWindowManager._children[tag]);
1718
+ }
1719
+ return {
1720
+ currentTickers: createExportableElement(_GameWindowManager._currentTickers),
1721
+ currentElements: createExportableElement(currentElements),
1722
+ childrenTagsOrder: createExportableElement(_GameWindowManager.childrenTagsOrder)
1723
+ };
1724
+ }
1725
+ /**
1726
+ * Import the canvas and the tickers from a JSON string.
1727
+ * @param dataString The JSON string.
1728
+ */
1729
+ static importJson(dataString) {
1730
+ _GameWindowManager.import(JSON.parse(dataString));
1731
+ }
1732
+ /**
1733
+ * Import the canvas and the tickers from an object.
1734
+ * @param data The object.
1735
+ */
1736
+ static import(data) {
1737
+ _GameWindowManager.clear();
1738
+ try {
1739
+ if (data.hasOwnProperty("childrenTagsOrder") && data.hasOwnProperty("currentElements")) {
1740
+ let currentElements = data["currentElements"];
1741
+ let childrenTagsOrder = data["childrenTagsOrder"];
1742
+ childrenTagsOrder.forEach((tag) => {
1743
+ if (currentElements[tag]) {
1744
+ let element = importCanvasElement(currentElements[tag]);
1745
+ _GameWindowManager.addCanvasElement(tag, element);
1746
+ _GameWindowManager.childrenTagsOrder.push(tag);
1747
+ }
1748
+ });
1749
+ } else {
1750
+ console.error("[Pixi'VN] The data does not have the properties childrenTagsOrder and currentElements");
1751
+ return;
1752
+ }
1753
+ if (data.hasOwnProperty("currentTickers")) {
1754
+ let currentTickers = data["currentTickers"];
1755
+ currentTickers.forEach((t) => {
1756
+ let tags = t.canvasElementTags;
1757
+ let ticker = geTickerInstanceByClassName(t.className, t.args, t.duration, t.priority);
1758
+ if (ticker) {
1759
+ _GameWindowManager.addTicker(tags, ticker);
1760
+ } else {
1761
+ console.error(`[Pixi'VN] Ticker ${t.className} not found`);
1762
+ }
1763
+ });
1764
+ }
1765
+ } catch (e) {
1766
+ console.error("[Pixi'VN] Error importing data", e);
1767
+ }
1768
+ }
1769
+ };
1770
+ _GameWindowManager._app = void 0;
1771
+ _GameWindowManager._isInitialized = false;
1772
+ _GameWindowManager._children = {};
1773
+ /**
1774
+ * The order of the children tags.
1775
+ */
1776
+ _GameWindowManager.childrenTagsOrder = [];
1777
+ _GameWindowManager._currentTickers = [];
1778
+ _GameWindowManager._currentTickersSteps = {};
1779
+ _GameWindowManager.currentTickersTimeouts = {};
1780
+ var GameWindowManager = _GameWindowManager;
1781
+
1782
+ // src/managers/StepManager.ts
1783
+ var _GameStepManager = class _GameStepManager {
1784
+ constructor() {
1785
+ }
1786
+ static get stepsHistory() {
1787
+ return _GameStepManager._stepsHistory;
1788
+ }
1789
+ /**
1790
+ * lastStepIndex is the last step index that occurred during the progression of the steps. **Not is the length of the stepsHistory - 1.**
1791
+ */
1792
+ static get lastStepIndex() {
1793
+ return _GameStepManager._lastStepIndex;
1794
+ }
1795
+ /**
1796
+ * Increase the last step index that occurred during the progression of the steps.
1797
+ */
1798
+ static increaseLastStepIndex() {
1799
+ _GameStepManager._lastStepIndex++;
1800
+ }
1801
+ static get openedLabels() {
1802
+ return _GameStepManager._openedLabels;
1803
+ }
1804
+ /**
1805
+ * currentLabel is the current label that occurred during the progression of the steps.
1806
+ */
1807
+ static get currentLabel() {
1808
+ if (_GameStepManager._openedLabels.length > 0) {
1809
+ let item = _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1];
1810
+ return item.label;
1811
+ }
1812
+ return void 0;
1813
+ }
1814
+ /**
1815
+ * is the current step index of the current label that occurred during the progression of the steps.
1816
+ */
1817
+ static get currentLabelStepIndex() {
1818
+ if (_GameStepManager._openedLabels.length > 0) {
1819
+ let item = _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1];
1820
+ return item.currentStepIndex;
1821
+ }
1822
+ return null;
1823
+ }
1824
+ /**
1825
+ * lastHistoryStep is the last history step that occurred during the progression of the steps.
1826
+ */
1827
+ static get lastHistoryStep() {
1828
+ if (_GameStepManager._stepsHistory.length > 0) {
1829
+ return _GameStepManager._stepsHistory[_GameStepManager._stepsHistory.length - 1];
1830
+ }
1831
+ return null;
1832
+ }
1833
+ static get originalStepData() {
1834
+ if (!_GameStepManager._originalStepData) {
1835
+ return {
1836
+ path: "",
1837
+ storage: {},
1838
+ canvas: {
1839
+ childrenTagsOrder: [],
1840
+ currentElements: {},
1841
+ currentTickers: []
1842
+ },
1843
+ labelIndex: -1,
1844
+ openedLabels: []
1845
+ };
1846
+ }
1847
+ return createExportableElement(_GameStepManager._originalStepData);
1848
+ }
1849
+ static set originalStepData(value) {
1850
+ _GameStepManager._originalStepData = createExportableElement(value);
1851
+ }
1852
+ /* Edit History Methods */
1853
+ /**
1854
+ * Add a label to the history.
1855
+ * @param label The label to add to the history.
1856
+ */
1857
+ static addStepHistory(step) {
1858
+ let stepHistory = getStepSha1(step);
1859
+ let historyStep = {
1860
+ path: window.location.pathname,
1861
+ storage: GameStorageManager.export(),
1862
+ canvas: GameWindowManager.export(),
1863
+ labelIndex: _GameStepManager.currentLabelStepIndex || 0,
1864
+ openedLabels: createExportableElement(_GameStepManager._openedLabels)
1865
+ };
1866
+ if (_GameStepManager.originalStepData) {
1867
+ if (_GameStepManager.originalStepData.openedLabels.length === historyStep.openedLabels.length) {
1868
+ try {
1869
+ let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
1870
+ let historyStepOpenedLabelsString = JSON.stringify(historyStep.openedLabels);
1871
+ if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString) {
1872
+ return;
1873
+ }
1874
+ } catch (e) {
1875
+ console.error("[Pixi'VN] Error comparing openedLabels", e);
1876
+ }
1877
+ }
1878
+ }
1879
+ let data = (0, import_deep_diff.diff)(_GameStepManager.originalStepData, historyStep);
1880
+ if (data) {
1881
+ let dialoge = void 0;
1882
+ let requiredChoices = void 0;
1883
+ if (GameStorageManager.getVariable(GameStorageManager.keysSystem.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY) === _GameStepManager.lastStepIndex) {
1884
+ dialoge = getDialogue();
1885
+ }
1886
+ if (GameStorageManager.getVariable(GameStorageManager.keysSystem.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY) === _GameStepManager.lastStepIndex) {
1887
+ requiredChoices = GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY);
1888
+ }
1889
+ _GameStepManager._stepsHistory.push({
1890
+ diff: data,
1891
+ currentLabel: _GameStepManager.currentLabel,
1892
+ dialoge,
1893
+ choices: requiredChoices,
1894
+ stepSha1: stepHistory,
1895
+ index: _GameStepManager.lastStepIndex
1896
+ });
1897
+ _GameStepManager.originalStepData = historyStep;
1898
+ }
1899
+ _GameStepManager.increaseLastStepIndex();
1900
+ }
1901
+ /**
1902
+ * Add a label to the history.
1903
+ * @param label The label to add to the history.
1904
+ */
1905
+ static pushNewLabel(label) {
1906
+ let currentLabel = getLabelInstanceByClassName(label);
1907
+ if (!currentLabel) {
1908
+ throw new Error("[Pixi'VN] Label not found");
1909
+ }
1910
+ _GameStepManager._openedLabels.push({
1911
+ label,
1912
+ currentStepIndex: 0
1913
+ });
1914
+ }
1915
+ /**
1916
+ * Close the current label and add it to the history.
1917
+ * @returns
1918
+ */
1919
+ static closeCurrentLabel() {
1920
+ if (!_GameStepManager.currentLabel) {
1921
+ console.warn("[Pixi'VN] No label to close");
1922
+ return;
1923
+ }
1924
+ let currentLabel = getLabelInstanceByClassName(_GameStepManager.currentLabel);
1925
+ if (!currentLabel) {
1926
+ console.error("[Pixi'VN] Label not found");
1927
+ return;
1928
+ }
1929
+ _GameStepManager._openedLabels.pop();
1930
+ }
1931
+ /**
1932
+ * Close all labels and add them to the history.
1933
+ */
1934
+ static closeAllLabels() {
1935
+ while (_GameStepManager._openedLabels.length > 0) {
1936
+ _GameStepManager.closeCurrentLabel();
1937
+ }
1938
+ }
1939
+ /**
1940
+ * Increase the current step index of the current label.
1941
+ */
1942
+ static increaseCurrentStepIndex() {
1943
+ let item = _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1];
1944
+ _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1] = __spreadProps(__spreadValues({}, item), {
1945
+ currentStepIndex: item.currentStepIndex + 1
1946
+ });
1947
+ }
1948
+ /* Run Methods */
1949
+ /**
1950
+ * Execute the next step and add it to the history.
1951
+ * @returns
1952
+ * @example
1953
+ * ```typescript
1954
+ * function nextOnClick() {
1955
+ * setLoading(true)
1956
+ * GameStepManager.runNextStep()
1957
+ * .then(() => {
1958
+ * setUpdate((p) => p + 1)
1959
+ * setLoading(false)
1960
+ * })
1961
+ * .catch((e) => {
1962
+ * setLoading(false)
1963
+ * console.error(e)
1964
+ * })
1965
+ * }
1966
+ * ```
1967
+ */
1968
+ static runNextStep() {
1969
+ return __async(this, null, function* () {
1970
+ if (_GameStepManager._openedLabels.length === 0) {
1971
+ console.warn("[Pixi'VN] There are no labels to run");
1972
+ return;
1973
+ }
1974
+ _GameStepManager.increaseCurrentStepIndex();
1975
+ return yield _GameStepManager.runCurrentStep();
1976
+ });
1977
+ }
1978
+ /**
1979
+ * Execute the current step and add it to the history.
1980
+ * @returns
1981
+ */
1982
+ static runCurrentStep() {
1983
+ return __async(this, null, function* () {
1984
+ if (_GameStepManager.currentLabel) {
1985
+ let lasteStepsLength = _GameStepManager.currentLabelStepIndex;
1986
+ if (lasteStepsLength === null) {
1987
+ console.error("[Pixi'VN] currentLabelStepIndex is null");
1988
+ return;
1989
+ }
1990
+ let currentLabel = getLabelInstanceByClassName(_GameStepManager.currentLabel);
1991
+ if (!currentLabel) {
1992
+ console.error("[Pixi'VN] Label not found");
1993
+ return;
1994
+ }
1995
+ let n = currentLabel.steps.length;
1996
+ if (n > lasteStepsLength) {
1997
+ let nextStep = currentLabel.steps[lasteStepsLength];
1998
+ yield nextStep();
1999
+ _GameStepManager.addStepHistory(nextStep);
2000
+ } else if (n === lasteStepsLength) {
2001
+ _GameStepManager.closeCurrentLabel();
2002
+ yield _GameStepManager.runNextStep();
2003
+ } else {
2004
+ console.warn("[Pixi'VN] There are no steps to run");
2005
+ }
2006
+ }
2007
+ });
2008
+ }
2009
+ /**
2010
+ * Execute the label and add it to the history.
2011
+ * Is a call function in Ren'Py.
2012
+ * @param label The label to execute.
2013
+ * @returns
2014
+ * @example
2015
+ * ```typescript
2016
+ * GameStepManager.callLabel(StartLabel)
2017
+ * ```
2018
+ */
2019
+ static callLabel(label) {
2020
+ return __async(this, null, function* () {
2021
+ try {
2022
+ if (label instanceof Label) {
2023
+ label = label.constructor;
2024
+ }
2025
+ let labelName = label.name;
2026
+ _GameStepManager.pushNewLabel(labelName);
2027
+ } catch (e) {
2028
+ console.error("[Pixi'VN] Error calling label", e);
2029
+ return;
2030
+ }
2031
+ return yield _GameStepManager.runCurrentStep();
2032
+ });
2033
+ }
2034
+ /**
2035
+ * Execute the label, close all labels and add them to the history.
2036
+ * Is a jump function in Ren'Py.
2037
+ * @param label
2038
+ * @returns
2039
+ * @example
2040
+ * ```typescript
2041
+ * GameStepManager.jumpLabel(StartLabel)
2042
+ * ```
2043
+ */
2044
+ static jumpLabel(label) {
2045
+ return __async(this, null, function* () {
2046
+ _GameStepManager.closeAllLabels();
2047
+ try {
2048
+ if (label instanceof Label) {
2049
+ label = label.constructor;
2050
+ }
2051
+ let labelName = label.name;
2052
+ _GameStepManager.pushNewLabel(labelName);
2053
+ } catch (e) {
2054
+ console.error("[Pixi'VN] Error jumping label", e);
2055
+ return;
2056
+ }
2057
+ return yield _GameStepManager.runCurrentStep();
2058
+ });
2059
+ }
2060
+ /* After Update Methods */
2061
+ // /**
2062
+ // * After the update or code edit, some steps or labels may no longer match.
2063
+ // * - In case of step mismatch, the game will be updated to the last matching step.
2064
+ // * - In case of label mismatch, the game gives an error.
2065
+ // * @returns
2066
+ // */
2067
+ // private static afterUpdate() {
2068
+ // // TODO: implement
2069
+ // if (!GameStepManager.currentLabel) {
2070
+ // // TODO: implement
2071
+ // return
2072
+ // }
2073
+ // let currentLabel = getLabelInstanceByClassName(GameStepManager.currentLabel)
2074
+ // if (!currentLabel) {
2075
+ // console.error("Label not found")
2076
+ // return
2077
+ // }
2078
+ // let oldSteps = GameStepManager.stepsAfterLastHistoryLabel
2079
+ // let currentStepIndex = currentLabel.getCorrespondingStepsNumber(oldSteps)
2080
+ // let stepToRemove = oldSteps.length - currentStepIndex
2081
+ // GameStepManager.removeLastHistoryNodes(stepToRemove)
2082
+ // GameStepManager.loadLastStep()
2083
+ // }
2084
+ // private static loadLastStep() {
2085
+ // // TODO: implement
2086
+ // }
2087
+ // /**
2088
+ // * Remove a number of items from the last of the history.
2089
+ // * @param itemNumber The number of items to remove from the last of the history.
2090
+ // */
2091
+ // private static removeLastHistoryNodes(itemNumber: number) {
2092
+ // // TODO: implement
2093
+ // for (let i = 0; i < itemNumber; i++) {
2094
+ // GameStepManager._stepsHistory.pop()
2095
+ // }
2096
+ // }
2097
+ // /**
2098
+ // * stepsAfterLastHistoryLabel is a list of steps that occurred after the last history label.
2099
+ // */
2100
+ // private static get stepsAfterLastHistoryLabel(): StepHistoryDataType[] {
2101
+ // let length = GameStepManager._stepsHistory.length
2102
+ // let steps: StepHistoryDataType[] = []
2103
+ // for (let i = length - 1; i >= 0; i--) {
2104
+ // let element = GameStepManager._stepsHistory[i]
2105
+ // if (typeof element === "object" && "stepSha1" in element) {
2106
+ // steps.push(element.stepSha1)
2107
+ // }
2108
+ // else {
2109
+ // break
2110
+ // }
2111
+ // }
2112
+ // steps = steps.reverse()
2113
+ // return steps
2114
+ // }
2115
+ /* Go Back & Refresh Methods */
2116
+ /**
2117
+ * Go back to the last step and add it to the history.
2118
+ * @param navigate The navigate function.
2119
+ * @param steps The number of steps to go back.
2120
+ * @returns
2121
+ * @example
2122
+ * ```typescript
2123
+ * export function goBack(navigate: (path: string) => void, afterBack?: () => void) {
2124
+ * GameStepManager.goBack(navigate)
2125
+ * afterBack && afterBack()
2126
+ * }
2127
+ * ```
2128
+ */
2129
+ static goBack(navigate, steps = 1) {
2130
+ if (steps <= 0) {
2131
+ console.warn("[Pixi'VN] Steps must be greater than 0");
2132
+ return;
2133
+ }
2134
+ if (_GameStepManager._stepsHistory.length <= 1) {
2135
+ console.warn("[Pixi'VN] No steps to go back");
2136
+ return;
2137
+ }
2138
+ let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
2139
+ if (restoredStep) {
2140
+ _GameStepManager._originalStepData = restoredStep;
2141
+ _GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
2142
+ GameStorageManager.import(createExportableElement(restoredStep.storage));
2143
+ GameWindowManager.import(createExportableElement(restoredStep.canvas));
2144
+ navigate(restoredStep.path);
2145
+ } else {
2146
+ console.error("[Pixi'VN] Error going back");
2147
+ }
2148
+ }
2149
+ static goBackInternal(steps, restoredStep) {
2150
+ if (steps <= 0) {
2151
+ return restoredStep;
2152
+ }
2153
+ if (_GameStepManager._stepsHistory.length == 0) {
2154
+ return restoredStep;
2155
+ }
2156
+ let lastHistoryStep = _GameStepManager.lastHistoryStep;
2157
+ if (lastHistoryStep) {
2158
+ try {
2159
+ let result = restoreDeepDiffChanges(restoredStep, lastHistoryStep.diff);
2160
+ _GameStepManager._lastStepIndex = lastHistoryStep.index;
2161
+ _GameStepManager._stepsHistory.pop();
2162
+ return _GameStepManager.goBackInternal(steps - 1, result);
2163
+ } catch (e) {
2164
+ console.error("[Pixi'VN] Error applying diff", e);
2165
+ return restoredStep;
2166
+ }
2167
+ } else {
2168
+ return restoredStep;
2169
+ }
2170
+ }
2171
+ /**
2172
+ * Add a label to the history.
2173
+ */
2174
+ static clear() {
2175
+ _GameStepManager._stepsHistory = [];
2176
+ _GameStepManager._openedLabels = [];
2177
+ }
2178
+ /* Export and Import Methods */
2179
+ /**
2180
+ * Export the history to a JSON string.
2181
+ * @returns The history in a JSON string.
2182
+ */
2183
+ static exportJson() {
2184
+ return JSON.stringify(this.export());
2185
+ }
2186
+ /**
2187
+ * Export the history to an object.
2188
+ * @returns The history in an object.
2189
+ */
2190
+ static export() {
2191
+ return {
2192
+ stepsHistory: _GameStepManager._stepsHistory,
2193
+ openedLabels: _GameStepManager._openedLabels,
2194
+ lastStepIndex: _GameStepManager._lastStepIndex,
2195
+ originalStepData: _GameStepManager._originalStepData
2196
+ };
2197
+ }
2198
+ /**
2199
+ * Import the history from a JSON string.
2200
+ * @param dataString The history in a JSON string.
2201
+ */
2202
+ static importJson(dataString) {
2203
+ _GameStepManager.import(JSON.parse(dataString));
2204
+ }
2205
+ /**
2206
+ * Import the history from an object.
2207
+ * @param data The history in an object.
2208
+ */
2209
+ static import(data) {
2210
+ _GameStepManager.clear();
2211
+ try {
2212
+ if (data.hasOwnProperty("stepsHistory")) {
2213
+ _GameStepManager._stepsHistory = data["stepsHistory"];
2214
+ } else {
2215
+ console.warn("[Pixi'VN] No stepsHistory data found");
2216
+ }
2217
+ if (data.hasOwnProperty("openedLabels")) {
2218
+ _GameStepManager._openedLabels = data["openedLabels"];
2219
+ } else {
2220
+ console.warn("[Pixi'VN] No openedLabels data found");
2221
+ }
2222
+ if (data.hasOwnProperty("lastStepIndex")) {
2223
+ _GameStepManager._lastStepIndex = data["lastStepIndex"];
2224
+ } else {
2225
+ console.warn("[Pixi'VN] No lastStepIndex data found");
2226
+ }
2227
+ if (data.hasOwnProperty("originalStepData")) {
2228
+ _GameStepManager._originalStepData = data["originalStepData"];
2229
+ } else {
2230
+ console.warn("[Pixi'VN] No originalStepData data found");
2231
+ }
2232
+ } catch (e) {
2233
+ console.error("[Pixi'VN] Error importing data", e);
2234
+ }
2235
+ }
2236
+ };
2237
+ /**
2238
+ * stepHistory is a list of label events and steps that occurred during the progression of the steps.
2239
+ */
2240
+ _GameStepManager._stepsHistory = [];
2241
+ _GameStepManager._lastStepIndex = 0;
2242
+ _GameStepManager._openedLabels = [];
2243
+ _GameStepManager._originalStepData = void 0;
2244
+ var GameStepManager = _GameStepManager;
2245
+
2246
+ // src/classes/StoredClassModel.ts
2247
+ var StoredClassModel = class {
2248
+ constructor(id) {
2249
+ this.id = id;
2250
+ }
2251
+ get nameClass() {
2252
+ return this.constructor.name + "Storage";
2253
+ }
2254
+ updateStorageProperty(key, value) {
2255
+ let storage = GameStorageManager.getVariable(this.nameClass);
2256
+ if (!storage) {
2257
+ storage = {};
2258
+ }
2259
+ storage[this.id] = __spreadProps(__spreadValues({}, storage[this.id]), { [key]: value });
2260
+ GameStorageManager.setVariable(this.nameClass, storage);
2261
+ }
2262
+ getStorageProperty(key) {
2263
+ let storage = GameStorageManager.getVariable(this.nameClass);
2264
+ if (!storage) {
2265
+ return void 0;
2266
+ }
2267
+ if (storage[this.id].hasOwnProperty(key)) {
2268
+ return storage[this.id][key];
2269
+ }
2270
+ return void 0;
2271
+ }
2272
+ };
2273
+
2274
+ // src/classes/CharacterModelBase.ts
2275
+ var CharacterModelBase2 = class extends StoredClassModel {
2276
+ constructor(id, props) {
2277
+ super(GameStorageManager.keysSystem.CHARACTER_PREKEY + id);
2278
+ this.defaultName = "";
2279
+ this.defaultName = props.name;
2280
+ this.defaultSurname = props.surname;
2281
+ this.defaultAge = props.age;
2282
+ this._icon = props.icon;
2283
+ this._color = props.color;
2284
+ }
2285
+ get name() {
2286
+ return this.getStorageProperty("name") || this.defaultName;
2287
+ }
2288
+ set name(value) {
2289
+ this.updateStorageProperty("name", value);
2290
+ }
2291
+ get surname() {
2292
+ return this.getStorageProperty("surname") || this.defaultSurname;
2293
+ }
2294
+ set surname(value) {
2295
+ this.updateStorageProperty("surname", value);
2296
+ }
2297
+ get age() {
2298
+ return this.getStorageProperty("age") || this.defaultAge;
2299
+ }
2300
+ set age(value) {
2301
+ this.updateStorageProperty("age", value);
2302
+ }
2303
+ get icon() {
2304
+ return this._icon;
2305
+ }
2306
+ get color() {
2307
+ return this._color;
2308
+ }
2309
+ };
2310
+
2311
+ // src/enums/LabelRunModeEnum.ts
2312
+ var LabelRunModeEnum = /* @__PURE__ */ ((LabelRunModeEnum2) => {
2313
+ LabelRunModeEnum2["OpenByCall"] = "openbycall";
2314
+ LabelRunModeEnum2["OpenByJump"] = "openbyjump";
2315
+ return LabelRunModeEnum2;
2316
+ })(LabelRunModeEnum || {});
2317
+
2318
+ // src/classes/ChoiceMenuOptionLabel.ts
2319
+ var ChoiceMenuOptionLabel = class {
2320
+ /**
2321
+ * @param text Text to be displayed in the menu
2322
+ * @param label Label to be opened when the option is selected
2323
+ * @param type Type of the label to be opened
2324
+ */
2325
+ constructor(text, label, type = "openbycall" /* OpenByCall */) {
2326
+ this.text = text;
2327
+ this.label = label;
2328
+ this.type = type;
2329
+ }
2330
+ };
2331
+
2332
+ // src/classes/DialogueModelBase.ts
2333
+ var DialogueModelBase = class {
2334
+ constructor(text, characterId) {
2335
+ /**
2336
+ * The text of the dialogue.
2337
+ */
2338
+ this.text = "";
2339
+ this.text = text;
2340
+ this.characterId = characterId;
2341
+ }
2342
+ };
2343
+
2344
+ // src/classes/Label.ts
2345
+ var Label = class {
2346
+ /**
2347
+ * Get the steps of the label.
2348
+ * This class should be extended and the steps method should be overridden.
2349
+ * Every time you update this list will also be updated when the other game versions load.
2350
+ */
2351
+ get steps() {
2352
+ throw new Error("[Pixi'VN] The method Label.steps must be overridden");
2353
+ }
2354
+ /**
2355
+ * Get the corresponding steps number
2356
+ * @param externalSteps
2357
+ * @returns Numer of corresponding steps, for example, if externalSteps is [ABC, DEF, GHI] and the steps of the label is [ABC, GHT], the result will be 1
2358
+ */
2359
+ getCorrespondingStepsNumber(externalSteps) {
2360
+ if (externalSteps.length === 0) {
2361
+ return 0;
2362
+ }
2363
+ let res = 0;
2364
+ externalSteps.forEach((step, index) => {
2365
+ if (checkIfStepsIsEqual(step, this.steps[index])) {
2366
+ res = index;
2367
+ }
2368
+ });
2369
+ return res;
2370
+ }
2371
+ };
2372
+ // Annotate the CommonJS export names for ESM import in node:
2373
+ 0 && (module.exports = {
2374
+ CanvasBase,
2375
+ CanvasContainer,
2376
+ CanvasEvent,
2377
+ CanvasImage,
2378
+ CanvasSprite,
2379
+ CanvasText,
2380
+ CharacterModelBase,
2381
+ ChoiceMenuOptionLabel,
2382
+ DialogueModelBase,
2383
+ GameStepManager,
2384
+ GameStorageManager,
2385
+ GameWindowManager,
2386
+ Label,
2387
+ LabelRunModeEnum,
2388
+ Pause,
2389
+ PauseValueType,
2390
+ Repeat,
2391
+ StoredClassModel,
2392
+ TickerBase,
2393
+ TickerFadeAlpha,
2394
+ TickerRotate,
2395
+ addImage,
2396
+ canvasElementDecorator,
2397
+ clearAllGameDatas,
2398
+ clearChoiceMenuOptions,
2399
+ clearDialogue,
2400
+ eventDecorator,
2401
+ getCharacterById,
2402
+ getChoiceMenuOptions,
2403
+ getDialogue,
2404
+ getDialogueHistory,
2405
+ getSaveData,
2406
+ getSaveJson,
2407
+ getTexture,
2408
+ labelDecorator,
2409
+ loadSaveData,
2410
+ loadSaveJson,
2411
+ removeCanvasElement,
2412
+ saveCharacter,
2413
+ setChoiceMenuOptions,
2414
+ setDialogue,
2415
+ showCanvasImages,
2416
+ showImageWithDissolveTransition,
2417
+ tickerDecorator
2418
+ });
2419
+ //# sourceMappingURL=index.js.map