@drincs/pixi-vn 0.5.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/classes/CharacterBaseModel.js +110 -112
  2. package/dist/classes/CharacterBaseModel.js.map +1 -1
  3. package/dist/classes/CharacterBaseModel.mjs +110 -112
  4. package/dist/classes/CharacterBaseModel.mjs.map +1 -1
  5. package/dist/classes/ChoiceMenuOption.d.mts +19 -7
  6. package/dist/classes/ChoiceMenuOption.d.ts +19 -7
  7. package/dist/classes/ChoiceMenuOption.js +1386 -7
  8. package/dist/classes/ChoiceMenuOption.js.map +1 -1
  9. package/dist/classes/ChoiceMenuOption.mjs +1386 -7
  10. package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
  11. package/dist/classes/CloseLabel.d.mts +8 -3
  12. package/dist/classes/CloseLabel.d.ts +8 -3
  13. package/dist/classes/CloseLabel.js +44 -2
  14. package/dist/classes/CloseLabel.js.map +1 -1
  15. package/dist/classes/CloseLabel.mjs +41 -2
  16. package/dist/classes/CloseLabel.mjs.map +1 -1
  17. package/dist/classes/Label.d.mts +47 -21
  18. package/dist/classes/Label.d.ts +47 -21
  19. package/dist/classes/Label.js +36 -1
  20. package/dist/classes/Label.js.map +1 -1
  21. package/dist/classes/Label.mjs +36 -1
  22. package/dist/classes/Label.mjs.map +1 -1
  23. package/dist/classes/StoredClassModel.js +55 -57
  24. package/dist/classes/StoredClassModel.js.map +1 -1
  25. package/dist/classes/StoredClassModel.mjs +55 -57
  26. package/dist/classes/StoredClassModel.mjs.map +1 -1
  27. package/dist/classes/index.d.mts +2 -2
  28. package/dist/classes/index.d.ts +2 -2
  29. package/dist/classes/index.js +125 -73
  30. package/dist/classes/index.js.map +1 -1
  31. package/dist/classes/index.mjs +125 -73
  32. package/dist/classes/index.mjs.map +1 -1
  33. package/dist/classes/ticker/TickerFadeAlpha.js +27 -27
  34. package/dist/classes/ticker/TickerFadeAlpha.js.map +1 -1
  35. package/dist/classes/ticker/TickerFadeAlpha.mjs +27 -27
  36. package/dist/classes/ticker/TickerFadeAlpha.mjs.map +1 -1
  37. package/dist/classes/ticker/TickerMove.js +57 -55
  38. package/dist/classes/ticker/TickerMove.js.map +1 -1
  39. package/dist/classes/ticker/TickerMove.mjs +57 -55
  40. package/dist/classes/ticker/TickerMove.mjs.map +1 -1
  41. package/dist/classes/ticker/TickerRotate.js +57 -55
  42. package/dist/classes/ticker/TickerRotate.js.map +1 -1
  43. package/dist/classes/ticker/TickerRotate.mjs +57 -55
  44. package/dist/classes/ticker/TickerRotate.mjs.map +1 -1
  45. package/dist/classes/ticker/index.js +17 -17
  46. package/dist/classes/ticker/index.js.map +1 -1
  47. package/dist/classes/ticker/index.mjs +17 -17
  48. package/dist/classes/ticker/index.mjs.map +1 -1
  49. package/dist/constants.d.mts +1 -1
  50. package/dist/constants.d.ts +1 -1
  51. package/dist/constants.js +1 -1
  52. package/dist/constants.js.map +1 -1
  53. package/dist/constants.mjs +1 -1
  54. package/dist/constants.mjs.map +1 -1
  55. package/dist/decorators/LabelDecorator.d.mts +13 -20
  56. package/dist/decorators/LabelDecorator.d.ts +13 -20
  57. package/dist/decorators/LabelDecorator.js +1388 -28
  58. package/dist/decorators/LabelDecorator.js.map +1 -1
  59. package/dist/decorators/LabelDecorator.mjs +1388 -25
  60. package/dist/decorators/LabelDecorator.mjs.map +1 -1
  61. package/dist/decorators/index.d.mts +4 -4
  62. package/dist/decorators/index.d.ts +4 -4
  63. package/dist/decorators/index.js +1385 -13
  64. package/dist/decorators/index.js.map +1 -1
  65. package/dist/decorators/index.mjs +1384 -13
  66. package/dist/decorators/index.mjs.map +1 -1
  67. package/dist/functions/DialogueUtility.d.mts +7 -7
  68. package/dist/functions/DialogueUtility.d.ts +7 -7
  69. package/dist/functions/DialogueUtility.js +97 -67
  70. package/dist/functions/DialogueUtility.js.map +1 -1
  71. package/dist/functions/DialogueUtility.mjs +97 -67
  72. package/dist/functions/DialogueUtility.mjs.map +1 -1
  73. package/dist/functions/FlagsUtility.js +55 -57
  74. package/dist/functions/FlagsUtility.js.map +1 -1
  75. package/dist/functions/FlagsUtility.mjs +55 -57
  76. package/dist/functions/FlagsUtility.mjs.map +1 -1
  77. package/dist/functions/GameUtility.js +55 -57
  78. package/dist/functions/GameUtility.js.map +1 -1
  79. package/dist/functions/GameUtility.mjs +55 -57
  80. package/dist/functions/GameUtility.mjs.map +1 -1
  81. package/dist/functions/ImageUtility.js +17 -17
  82. package/dist/functions/ImageUtility.js.map +1 -1
  83. package/dist/functions/ImageUtility.mjs +17 -17
  84. package/dist/functions/ImageUtility.mjs.map +1 -1
  85. package/dist/functions/SavesUtility.d.mts +2 -2
  86. package/dist/functions/SavesUtility.d.ts +2 -2
  87. package/dist/functions/SavesUtility.js +115 -143
  88. package/dist/functions/SavesUtility.js.map +1 -1
  89. package/dist/functions/SavesUtility.mjs +115 -143
  90. package/dist/functions/SavesUtility.mjs.map +1 -1
  91. package/dist/functions/StepLabelUtility.d.mts +0 -1
  92. package/dist/functions/StepLabelUtility.d.ts +0 -1
  93. package/dist/functions/index.d.mts +4 -4
  94. package/dist/functions/index.d.ts +4 -4
  95. package/dist/functions/index.js +98 -68
  96. package/dist/functions/index.js.map +1 -1
  97. package/dist/functions/index.mjs +98 -68
  98. package/dist/functions/index.mjs.map +1 -1
  99. package/dist/index.d.mts +3 -3
  100. package/dist/index.d.ts +3 -3
  101. package/dist/index.js +361 -327
  102. package/dist/index.js.map +1 -1
  103. package/dist/index.mjs +360 -327
  104. package/dist/index.mjs.map +1 -1
  105. package/dist/interface/{IDialogueHistory.d.mts → DialogueHistory.d.mts} +5 -5
  106. package/dist/interface/{IDialogueHistory.d.ts → DialogueHistory.d.ts} +5 -5
  107. package/dist/interface/{IDialogueHistory.js → DialogueHistory.js} +1 -1
  108. package/dist/interface/DialogueHistory.mjs +3 -0
  109. package/dist/interface/IHistoryStep.d.mts +2 -2
  110. package/dist/interface/IHistoryStep.d.ts +2 -2
  111. package/dist/interface/ISaveData.d.mts +2 -2
  112. package/dist/interface/ISaveData.d.ts +2 -2
  113. package/dist/interface/export/ExportedStep.d.mts +2 -2
  114. package/dist/interface/export/ExportedStep.d.ts +2 -2
  115. package/dist/interface/export/index.d.mts +2 -2
  116. package/dist/interface/export/index.d.ts +2 -2
  117. package/dist/interface/index.d.mts +6 -6
  118. package/dist/interface/index.d.ts +6 -6
  119. package/dist/managers/StepManager.d.mts +12 -12
  120. package/dist/managers/StepManager.d.ts +12 -12
  121. package/dist/managers/StepManager.js +55 -81
  122. package/dist/managers/StepManager.js.map +1 -1
  123. package/dist/managers/StepManager.mjs +55 -81
  124. package/dist/managers/StepManager.mjs.map +1 -1
  125. package/dist/managers/WindowManager.d.mts +1 -1
  126. package/dist/managers/WindowManager.d.ts +1 -1
  127. package/dist/managers/index.d.mts +2 -2
  128. package/dist/managers/index.d.ts +2 -2
  129. package/dist/managers/index.js +114 -142
  130. package/dist/managers/index.js.map +1 -1
  131. package/dist/managers/index.mjs +114 -142
  132. package/dist/managers/index.mjs.map +1 -1
  133. package/dist/types/ChoiceMenuOptionsType.d.mts +3 -3
  134. package/dist/types/ChoiceMenuOptionsType.d.ts +3 -3
  135. package/dist/types/StepLabelType.d.mts +2 -3
  136. package/dist/types/StepLabelType.d.ts +2 -3
  137. package/dist/types/index.d.mts +1 -1
  138. package/dist/types/index.d.ts +1 -1
  139. package/package.json +2 -2
  140. package/dist/interface/IDialogueHistory.mjs +0 -3
  141. /package/dist/interface/{IDialogueHistory.js.map → DialogueHistory.js.map} +0 -0
  142. /package/dist/interface/{IDialogueHistory.mjs.map → DialogueHistory.mjs.map} +0 -0
@@ -2,9 +2,9 @@ import * as pixi_js from 'pixi.js';
2
2
  import { Application, ApplicationOptions, Container } from 'pixi.js';
3
3
  import CanvasBase from '../classes/canvas/CanvasBase.mjs';
4
4
  import { a as TickerArgsType, T as TickerBase, I as ITicker } from '../TickerBase-CFEJHstJ.mjs';
5
- import { IClassWithArgsHistory } from '../interface/IClassWithArgsHistory.mjs';
6
5
  import { PauseType } from '../types/PauseType.mjs';
7
6
  import { RepeatType } from '../types/RepeatType.mjs';
7
+ import { IClassWithArgsHistory } from '../interface/IClassWithArgsHistory.mjs';
8
8
  import ExportedCanvas from '../interface/export/ExportedCanvas.mjs';
9
9
  import ITickersSteps from '../interface/ITickersSteps.mjs';
10
10
  import '../interface/canvas/ICanvasBaseMemory.mjs';
@@ -2,9 +2,9 @@ import * as pixi_js from 'pixi.js';
2
2
  import { Application, ApplicationOptions, Container } from 'pixi.js';
3
3
  import CanvasBase from '../classes/canvas/CanvasBase.js';
4
4
  import { a as TickerArgsType, T as TickerBase, I as ITicker } from '../TickerBase-CjfyD6j5.js';
5
- import { IClassWithArgsHistory } from '../interface/IClassWithArgsHistory.js';
6
5
  import { PauseType } from '../types/PauseType.js';
7
6
  import { RepeatType } from '../types/RepeatType.js';
7
+ import { IClassWithArgsHistory } from '../interface/IClassWithArgsHistory.js';
8
8
  import ExportedCanvas from '../interface/export/ExportedCanvas.js';
9
9
  import ITickersSteps from '../interface/ITickersSteps.js';
10
10
  import '../interface/canvas/ICanvasBaseMemory.js';
@@ -5,10 +5,11 @@ import '../classes/CharacterBaseModel.mjs';
5
5
  import '../classes/StoredClassModel.mjs';
6
6
  import '../types/StepLabelType.mjs';
7
7
  import '@drincs/pixi-vn/dist/override';
8
- import '../types/StorageElementType.mjs';
8
+ import '../types/LabelIdType.mjs';
9
9
  import '../classes/Label.mjs';
10
10
  import '../types/StepHistoryDataType.mjs';
11
11
  import '../classes/DialogueBaseModel.mjs';
12
+ import '../types/StorageElementType.mjs';
12
13
  import '../interface/export/ExportedStep.mjs';
13
14
  import '../interface/export/ExportedCanvas.mjs';
14
15
  import '../interface/canvas/ICanvasBaseMemory.mjs';
@@ -21,7 +22,6 @@ import 'deep-diff';
21
22
  import '../classes/ChoiceMenuOption.mjs';
22
23
  import '../types/CloseType.mjs';
23
24
  import '../types/LabelRunModeType.mjs';
24
- import '../types/LabelIdType.mjs';
25
25
  import '../interface/export/ExportedStorage.mjs';
26
26
  import '../interface/IOpenedLabel.mjs';
27
27
  import '../classes/canvas/CanvasBase.mjs';
@@ -5,10 +5,11 @@ import '../classes/CharacterBaseModel.js';
5
5
  import '../classes/StoredClassModel.js';
6
6
  import '../types/StepLabelType.js';
7
7
  import '@drincs/pixi-vn/dist/override';
8
- import '../types/StorageElementType.js';
8
+ import '../types/LabelIdType.js';
9
9
  import '../classes/Label.js';
10
10
  import '../types/StepHistoryDataType.js';
11
11
  import '../classes/DialogueBaseModel.js';
12
+ import '../types/StorageElementType.js';
12
13
  import '../interface/export/ExportedStep.js';
13
14
  import '../interface/export/ExportedCanvas.js';
14
15
  import '../interface/canvas/ICanvasBaseMemory.js';
@@ -21,7 +22,6 @@ import 'deep-diff';
21
22
  import '../classes/ChoiceMenuOption.js';
22
23
  import '../types/CloseType.js';
23
24
  import '../types/LabelRunModeType.js';
24
- import '../types/LabelIdType.js';
25
25
  import '../interface/export/ExportedStorage.js';
26
26
  import '../interface/IOpenedLabel.js';
27
27
  import '../classes/canvas/CanvasBase.js';
@@ -57,106 +57,13 @@ var __async = (__this, __arguments, generator) => {
57
57
  step((generator = generator.apply(__this, __arguments)).next());
58
58
  });
59
59
  };
60
-
61
- // src/types/PauseType.ts
62
- var PauseValueType = "pause";
63
-
64
- // src/types/RepeatType.ts
65
- var Repeat = "repeat";
66
60
  function getStepSha1(step) {
67
61
  let sha1String = sha1__default.default(step.toString().toLocaleLowerCase());
68
62
  return sha1String.toString();
69
63
  }
70
- function checkIfStepsIsEqual(step1, step2) {
71
- return step1 === step2;
72
- }
73
-
74
- // src/classes/Label.ts
75
- var Label = class {
76
- /**
77
- * Get the steps of the label.
78
- * This class should be extended and the steps method should be overridden.
79
- * Every time you update this list will also be updated when the other game versions load.
80
- */
81
- get steps() {
82
- throw new Error("[Pixi'VN] The method Label.steps must be overridden");
83
- }
84
- /**
85
- * Get the corresponding steps number
86
- * @param externalSteps
87
- * @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
88
- */
89
- getCorrespondingStepsNumber(externalSteps) {
90
- if (externalSteps.length === 0) {
91
- return 0;
92
- }
93
- let res = 0;
94
- externalSteps.forEach((step, index) => {
95
- if (checkIfStepsIsEqual(step, this.steps[index])) {
96
- res = index;
97
- }
98
- });
99
- return res;
100
- }
101
- };
102
64
 
103
65
  // src/classes/CloseLabel.ts
104
- var CloseLabel = class extends Label {
105
- };
106
-
107
- // src/decorators/LabelDecorator.ts
108
- var registeredLabels = {};
109
- function getLabelInstanceByClassName(labelName) {
110
- try {
111
- let labelType = registeredLabels[labelName];
112
- if (!labelType) {
113
- console.error(`[Pixi'VN] Label ${labelName} not found`);
114
- return;
115
- }
116
- let label = new labelType();
117
- let step = label.steps;
118
- if (step.length = 0) {
119
- console.warn(`[Pixi'VN] Label ${labelName} has no steps`);
120
- }
121
- return label;
122
- } catch (e) {
123
- console.error(`[Pixi'VN] Error while getting Label ${labelName}`, e);
124
- return;
125
- }
126
- }
127
-
128
- // src/functions/DialogueUtility.ts
129
- function getDialogue() {
130
- return GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY);
131
- }
132
-
133
- // src/decorators/CanvasElementDecorator.ts
134
- var registeredCanvasElement = {};
135
- function getCanvasElementInstanceByClassName(canvasName) {
136
- try {
137
- let eventType = registeredCanvasElement[canvasName];
138
- if (!eventType) {
139
- if (canvasName === "CanvasContainer") {
140
- eventType = CanvasContainer;
141
- } else if (canvasName === "CanvasImage") {
142
- eventType = CanvasImage;
143
- } else if (canvasName === "CanvasSprite") {
144
- eventType = CanvasSprite;
145
- } else if (canvasName === "CanvasText") {
146
- eventType = CanvasText;
147
- }
148
- }
149
- if (!eventType) {
150
- console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`);
151
- return;
152
- }
153
- let canvasElement = new eventType();
154
- return canvasElement;
155
- } catch (e) {
156
- console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e);
157
- return;
158
- }
159
- }
66
+ var CLOSE_LABEL_ID = "__close-label-id__";
160
67
 
161
68
  // src/functions/CanvasUtility.ts
162
69
  function getTextureMemory(texture) {
@@ -593,29 +500,33 @@ function setMemoryText(element, memory) {
593
500
  }
594
501
  }
595
502
 
596
- // src/classes/ticker/TickerBase.ts
597
- var TickerBase = class {
598
- /**
599
- * @param args The arguments that you want to pass to the ticker.
600
- * @param duration The duration of the ticker. If is undefined, the ticker will be called every frame.
601
- * @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL.
602
- */
603
- constructor(args, duration, priority) {
604
- this.args = args;
605
- this.duration = duration;
606
- this.priority = priority;
607
- }
608
- /**
609
- * The method that will be called every frame.
610
- * This method should be overridden and you can use GameWindowManager.addCanvasElement() to get the canvas element of the canvas, and edit them.
611
- * @param t The ticker that is calling this method
612
- * @param args The arguments that you passed when you added the ticker
613
- * @param tags The tags of the canvas elements that are connected to this ticker
614
- */
615
- fn(_t, _args, _tags) {
616
- throw new Error("[Pixi'VN] The method TickerBase.fn() must be overridden");
503
+ // src/decorators/CanvasElementDecorator.ts
504
+ var registeredCanvasElement = {};
505
+ function getCanvasElementInstanceByClassName(canvasName) {
506
+ try {
507
+ let eventType = registeredCanvasElement[canvasName];
508
+ if (!eventType) {
509
+ if (canvasName === "CanvasContainer") {
510
+ eventType = CanvasContainer;
511
+ } else if (canvasName === "CanvasImage") {
512
+ eventType = CanvasImage;
513
+ } else if (canvasName === "CanvasSprite") {
514
+ eventType = CanvasSprite;
515
+ } else if (canvasName === "CanvasText") {
516
+ eventType = CanvasText;
517
+ }
518
+ }
519
+ if (!eventType) {
520
+ console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`);
521
+ return;
522
+ }
523
+ let canvasElement = new eventType();
524
+ return canvasElement;
525
+ } catch (e) {
526
+ console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e);
527
+ return;
617
528
  }
618
- };
529
+ }
619
530
 
620
531
  // src/decorators/TickerDecorator.ts
621
532
  var registeredTickers = {};
@@ -644,7 +555,51 @@ function geTickerInstanceByClassName(tickerName, args, duration, priority) {
644
555
  }
645
556
  }
646
557
 
647
- // src/classes/ticker/TickerFadeAlpha.ts
558
+ // src/types/PauseType.ts
559
+ var PauseValueType = "pause";
560
+
561
+ // src/types/RepeatType.ts
562
+ var Repeat = "repeat";
563
+
564
+ // src/decorators/LabelDecorator.ts
565
+ var registeredLabels = {};
566
+ function getLabelById(id) {
567
+ let label = registeredLabels[id];
568
+ if (!label) {
569
+ console.error(`[Pixi'VN] Label ${id} not found`);
570
+ return;
571
+ }
572
+ return label;
573
+ }
574
+
575
+ // src/functions/DialogueUtility.ts
576
+ function getDialogue() {
577
+ return GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY);
578
+ }
579
+
580
+ // src/classes/ticker/TickerBase.ts
581
+ var TickerBase = class {
582
+ /**
583
+ * @param args The arguments that you want to pass to the ticker.
584
+ * @param duration The duration of the ticker. If is undefined, the ticker will be called every frame.
585
+ * @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL.
586
+ */
587
+ constructor(args, duration, priority) {
588
+ this.args = args;
589
+ this.duration = duration;
590
+ this.priority = priority;
591
+ }
592
+ /**
593
+ * The method that will be called every frame.
594
+ * This method should be overridden and you can use GameWindowManager.addCanvasElement() to get the canvas element of the canvas, and edit them.
595
+ * @param t The ticker that is calling this method
596
+ * @param args The arguments that you passed when you added the ticker
597
+ * @param tags The tags of the canvas elements that are connected to this ticker
598
+ */
599
+ fn(_t, _args, _tags) {
600
+ throw new Error("[Pixi'VN] The method TickerBase.fn() must be overridden");
601
+ }
602
+ };
648
603
  var TickerFadeAlpha = class extends TickerBase {
649
604
  /**
650
605
  * The method that will be called every frame to fade the alpha of the canvas element of the canvas.
@@ -1558,7 +1513,7 @@ var _GameStepManager = class _GameStepManager {
1558
1513
  */
1559
1514
  static get currentLabel() {
1560
1515
  if (_GameStepManager.currentLabelId) {
1561
- return getLabelInstanceByClassName(_GameStepManager.currentLabelId);
1516
+ return getLabelById(_GameStepManager.currentLabelId);
1562
1517
  }
1563
1518
  }
1564
1519
  static get currentLabelStepIndex() {
@@ -1579,7 +1534,7 @@ var _GameStepManager = class _GameStepManager {
1579
1534
  return true;
1580
1535
  } else {
1581
1536
  this.openedLabels.forEach((item) => {
1582
- let label = getLabelInstanceByClassName(item.label);
1537
+ let label = getLabelById(item.label);
1583
1538
  if (label && label.steps.length > item.currentStepIndex) {
1584
1539
  return false;
1585
1540
  }
@@ -1672,9 +1627,9 @@ var _GameStepManager = class _GameStepManager {
1672
1627
  * @param label The label to add to the history.
1673
1628
  */
1674
1629
  static pushNewLabel(label) {
1675
- let currentLabel = getLabelInstanceByClassName(label);
1630
+ let currentLabel = getLabelById(label);
1676
1631
  if (!currentLabel) {
1677
- throw new Error("[Pixi'VN] Label not found");
1632
+ throw new Error(`[Pixi'VN] Label ${label} not found`);
1678
1633
  }
1679
1634
  _GameStepManager._openedLabels.push({
1680
1635
  label,
@@ -1691,7 +1646,7 @@ var _GameStepManager = class _GameStepManager {
1691
1646
  return;
1692
1647
  }
1693
1648
  if (!_GameStepManager.currentLabel) {
1694
- console.error("[Pixi'VN] Label not found");
1649
+ console.error("[Pixi'VN] currentLabel not found");
1695
1650
  return;
1696
1651
  }
1697
1652
  _GameStepManager._openedLabels.pop();
@@ -1763,7 +1718,7 @@ var _GameStepManager = class _GameStepManager {
1763
1718
  }
1764
1719
  let currentLabel = _GameStepManager.currentLabel;
1765
1720
  if (!currentLabel) {
1766
- console.error("[Pixi'VN] Label not found");
1721
+ console.error("[Pixi'VN] currentLabel not found");
1767
1722
  return;
1768
1723
  }
1769
1724
  let n = currentLabel.steps.length;
@@ -1784,12 +1739,12 @@ var _GameStepManager = class _GameStepManager {
1784
1739
  /**
1785
1740
  * Execute the label and add it to the history.
1786
1741
  * Is a call function in Ren'Py.
1787
- * @param label The label to execute.
1742
+ * @param label The label to execute or the id of the label
1788
1743
  * @param props The props to pass to the label.
1789
1744
  * @returns StepLabelResultType or undefined.
1790
1745
  * @example
1791
1746
  * ```typescript
1792
- * GameStepManager.callLabel(StartLabel, yourParams).then((result) => {
1747
+ * GameStepManager.callLabel(startLabel, yourParams).then((result) => {
1793
1748
  * if (result) {
1794
1749
  * // your code
1795
1750
  * }
@@ -1798,7 +1753,7 @@ var _GameStepManager = class _GameStepManager {
1798
1753
  * @example
1799
1754
  * ```typescript
1800
1755
  * // if you use it in a step label you should return the result.
1801
- * return GameStepManager.callLabel(StartLabel).then((result) => {
1756
+ * return GameStepManager.callLabel(startLabel).then((result) => {
1802
1757
  * return result
1803
1758
  * })
1804
1759
  * ```
@@ -1806,16 +1761,24 @@ var _GameStepManager = class _GameStepManager {
1806
1761
  static callLabel(label, props) {
1807
1762
  return __async(this, null, function* () {
1808
1763
  let choiseMade = void 0;
1764
+ let labelId;
1765
+ if (typeof label === "string") {
1766
+ labelId = label;
1767
+ } else {
1768
+ labelId = label.id;
1769
+ if (typeof label.choiseIndex === "number") {
1770
+ choiseMade = label.choiseIndex;
1771
+ }
1772
+ }
1809
1773
  try {
1810
- if (label instanceof CloseLabel) {
1774
+ if (labelId === CLOSE_LABEL_ID) {
1811
1775
  return _GameStepManager.runNextStep(props);
1812
1776
  }
1813
- if (label instanceof Label) {
1814
- choiseMade = label.choiseIndex;
1815
- label = label.constructor;
1777
+ let tempLabel = getLabelById(labelId);
1778
+ if (!tempLabel) {
1779
+ throw new Error(`[Pixi'VN] Label ${labelId} not found`);
1816
1780
  }
1817
- let labelName = label.name;
1818
- _GameStepManager.pushNewLabel(labelName);
1781
+ _GameStepManager.pushNewLabel(tempLabel.id);
1819
1782
  } catch (e) {
1820
1783
  console.error("[Pixi'VN] Error calling label", e);
1821
1784
  return;
@@ -1827,11 +1790,11 @@ var _GameStepManager = class _GameStepManager {
1827
1790
  * Execute the label, close all labels and add them to the history.
1828
1791
  * Is a jump function in Ren'Py.
1829
1792
  * @param label The label to execute.
1830
- * @param props The props to pass to the label.
1793
+ * @param props The props to pass to the label or the id of the label
1831
1794
  * @returns StepLabelResultType or undefined.
1832
1795
  * @example
1833
1796
  * ```typescript
1834
- * GameStepManager.jumpLabel(StartLabel, yourParams).then((result) => {
1797
+ * GameStepManager.jumpLabel(startLabel, yourParams).then((result) => {
1835
1798
  * if (result) {
1836
1799
  * // your code
1837
1800
  * }
@@ -1840,7 +1803,7 @@ var _GameStepManager = class _GameStepManager {
1840
1803
  * @example
1841
1804
  * ```typescript
1842
1805
  * // if you use it in a step label you should return the result.
1843
- * return GameStepManager.jumpLabel(StartLabel).then((result) => {
1806
+ * return GameStepManager.jumpLabel(startLabel).then((result) => {
1844
1807
  * return result
1845
1808
  * })
1846
1809
  * ```
@@ -1848,15 +1811,24 @@ var _GameStepManager = class _GameStepManager {
1848
1811
  static jumpLabel(label, props) {
1849
1812
  return __async(this, null, function* () {
1850
1813
  _GameStepManager.closeAllLabels();
1814
+ let labelId;
1815
+ if (typeof label === "string") {
1816
+ labelId = label;
1817
+ } else {
1818
+ labelId = label.id;
1819
+ if (typeof label.choiseIndex === "number") {
1820
+ label.choiseIndex;
1821
+ }
1822
+ }
1851
1823
  try {
1852
- if (label instanceof CloseLabel) {
1824
+ if (labelId === CLOSE_LABEL_ID) {
1853
1825
  return _GameStepManager.runNextStep(props);
1854
1826
  }
1855
- if (label instanceof Label) {
1856
- label = label.constructor;
1827
+ let tempLabel = getLabelById(labelId);
1828
+ if (!tempLabel) {
1829
+ throw new Error(`[Pixi'VN] Label ${labelId} not found`);
1857
1830
  }
1858
- let labelName = label.name;
1859
- _GameStepManager.pushNewLabel(labelName);
1831
+ _GameStepManager.pushNewLabel(tempLabel.id);
1860
1832
  } catch (e) {
1861
1833
  console.error("[Pixi'VN] Error jumping label", e);
1862
1834
  return;
@@ -1870,14 +1842,14 @@ var _GameStepManager = class _GameStepManager {
1870
1842
  * @returns StepLabelResultType or undefined.
1871
1843
  * @example
1872
1844
  * ```typescript
1873
- * GameStepManager.exitToChoiceMenu(yourParams).then((result) => {
1845
+ * GameStepManager.closeChoiceMenu(yourParams).then((result) => {
1874
1846
  * if (result) {
1875
1847
  * // your code
1876
1848
  * }
1877
1849
  * })
1878
1850
  * ```
1879
1851
  */
1880
- static exitToChoiceMenu(props) {
1852
+ static closeChoiceMenu(props) {
1881
1853
  return __async(this, null, function* () {
1882
1854
  return _GameStepManager.runNextStep(props);
1883
1855
  });