@drincs/pixi-vn 0.5.7 → 0.5.9

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 (61) hide show
  1. package/dist/classes/CharacterBaseModel.js.map +1 -1
  2. package/dist/classes/CharacterBaseModel.mjs.map +1 -1
  3. package/dist/classes/ChoiceMenuOption.js.map +1 -1
  4. package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
  5. package/dist/classes/StoredClassModel.js.map +1 -1
  6. package/dist/classes/StoredClassModel.mjs.map +1 -1
  7. package/dist/classes/index.js.map +1 -1
  8. package/dist/classes/index.mjs.map +1 -1
  9. package/dist/classes/ticker/TickerFadeAlpha.js.map +1 -1
  10. package/dist/classes/ticker/TickerFadeAlpha.mjs.map +1 -1
  11. package/dist/classes/ticker/TickerMove.js.map +1 -1
  12. package/dist/classes/ticker/TickerMove.mjs.map +1 -1
  13. package/dist/classes/ticker/TickerRotate.js.map +1 -1
  14. package/dist/classes/ticker/TickerRotate.mjs.map +1 -1
  15. package/dist/classes/ticker/index.js.map +1 -1
  16. package/dist/classes/ticker/index.mjs.map +1 -1
  17. package/dist/constants.d.mts +1 -1
  18. package/dist/constants.d.ts +1 -1
  19. package/dist/constants.js +1 -1
  20. package/dist/constants.js.map +1 -1
  21. package/dist/constants.mjs +1 -1
  22. package/dist/constants.mjs.map +1 -1
  23. package/dist/decorators/LabelDecorator.js.map +1 -1
  24. package/dist/decorators/LabelDecorator.mjs.map +1 -1
  25. package/dist/decorators/index.js.map +1 -1
  26. package/dist/decorators/index.mjs.map +1 -1
  27. package/dist/functions/DialogueUtility.d.mts +4 -2
  28. package/dist/functions/DialogueUtility.d.ts +4 -2
  29. package/dist/functions/DialogueUtility.js +21 -12
  30. package/dist/functions/DialogueUtility.js.map +1 -1
  31. package/dist/functions/DialogueUtility.mjs +21 -12
  32. package/dist/functions/DialogueUtility.mjs.map +1 -1
  33. package/dist/functions/FlagsUtility.js.map +1 -1
  34. package/dist/functions/FlagsUtility.mjs.map +1 -1
  35. package/dist/functions/GameUtility.js.map +1 -1
  36. package/dist/functions/GameUtility.mjs.map +1 -1
  37. package/dist/functions/ImageUtility.js.map +1 -1
  38. package/dist/functions/ImageUtility.mjs.map +1 -1
  39. package/dist/functions/SavesUtility.js +92 -13
  40. package/dist/functions/SavesUtility.js.map +1 -1
  41. package/dist/functions/SavesUtility.mjs +92 -13
  42. package/dist/functions/SavesUtility.mjs.map +1 -1
  43. package/dist/functions/index.js +22 -13
  44. package/dist/functions/index.js.map +1 -1
  45. package/dist/functions/index.mjs +22 -13
  46. package/dist/functions/index.mjs.map +1 -1
  47. package/dist/index.js +22 -13
  48. package/dist/index.js.map +1 -1
  49. package/dist/index.mjs +22 -13
  50. package/dist/index.mjs.map +1 -1
  51. package/dist/managers/StepManager.d.mts +1 -1
  52. package/dist/managers/StepManager.d.ts +1 -1
  53. package/dist/managers/StepManager.js +91 -12
  54. package/dist/managers/StepManager.js.map +1 -1
  55. package/dist/managers/StepManager.mjs +91 -12
  56. package/dist/managers/StepManager.mjs.map +1 -1
  57. package/dist/managers/index.js +91 -12
  58. package/dist/managers/index.js.map +1 -1
  59. package/dist/managers/index.mjs +91 -12
  60. package/dist/managers/index.mjs.map +1 -1
  61. package/package.json +2 -2
@@ -53,12 +53,14 @@ declare function clearDialogue(): void;
53
53
  * ])
54
54
  * ```
55
55
  */
56
- declare function setChoiceMenuOptions(options: ChoiceMenuOptionsType): void;
56
+ declare function setChoiceMenuOptions<T extends {} = {}>(options: ChoiceMenuOptionsType<T>): void;
57
57
  /**
58
58
  * Get the options to be shown in the game
59
59
  * @returns Options to be shown in the game
60
60
  */
61
- declare function getChoiceMenuOptions<TChoice extends ChoiceMenuOptionsType = ChoiceMenuOptionsType>(): TChoice | undefined;
61
+ declare function getChoiceMenuOptions<TChoice extends ChoiceMenuOptionsType = ChoiceMenuOptionsType<{
62
+ [key: string | number | symbol]: any;
63
+ }>>(): TChoice | undefined;
62
64
  /**
63
65
  * Clear the options to be shown in the game
64
66
  */
@@ -53,12 +53,14 @@ declare function clearDialogue(): void;
53
53
  * ])
54
54
  * ```
55
55
  */
56
- declare function setChoiceMenuOptions(options: ChoiceMenuOptionsType): void;
56
+ declare function setChoiceMenuOptions<T extends {} = {}>(options: ChoiceMenuOptionsType<T>): void;
57
57
  /**
58
58
  * Get the options to be shown in the game
59
59
  * @returns Options to be shown in the game
60
60
  */
61
- declare function getChoiceMenuOptions<TChoice extends ChoiceMenuOptionsType = ChoiceMenuOptionsType>(): TChoice | undefined;
61
+ declare function getChoiceMenuOptions<TChoice extends ChoiceMenuOptionsType = ChoiceMenuOptionsType<{
62
+ [key: string | number | symbol]: any;
63
+ }>>(): TChoice | undefined;
62
64
  /**
63
65
  * Clear the options to be shown in the game
64
66
  */
@@ -1778,8 +1778,8 @@ var _GameStepManager = class _GameStepManager {
1778
1778
  static runCurrentStep(props, choiseMade) {
1779
1779
  return __async(this, null, function* () {
1780
1780
  if (_GameStepManager.currentLabelId) {
1781
- let lasteStepsLength = _GameStepManager.currentLabelStepIndex;
1782
- if (lasteStepsLength === null) {
1781
+ let lastStepsLength = _GameStepManager.currentLabelStepIndex;
1782
+ if (lastStepsLength === null) {
1783
1783
  console.error("[Pixi'VN] currentLabelStepIndex is null");
1784
1784
  return;
1785
1785
  }
@@ -1789,12 +1789,12 @@ var _GameStepManager = class _GameStepManager {
1789
1789
  return;
1790
1790
  }
1791
1791
  let n = currentLabel.steps.length;
1792
- if (n > lasteStepsLength) {
1793
- let nextStep = currentLabel.steps[lasteStepsLength];
1794
- let result = yield nextStep(props);
1795
- _GameStepManager.addStepHistory(nextStep, choiseMade);
1792
+ if (n > lastStepsLength) {
1793
+ let step = currentLabel.steps[lastStepsLength];
1794
+ let result = yield step(props);
1795
+ _GameStepManager.addStepHistory(step, choiseMade);
1796
1796
  return result;
1797
- } else if (n === lasteStepsLength) {
1797
+ } else if (n === lastStepsLength) {
1798
1798
  _GameStepManager.closeCurrentLabel();
1799
1799
  return yield _GameStepManager.runNextStep(props);
1800
1800
  } else {
@@ -1839,7 +1839,8 @@ var _GameStepManager = class _GameStepManager {
1839
1839
  }
1840
1840
  try {
1841
1841
  if (labelId === CLOSE_LABEL_ID) {
1842
- return _GameStepManager.runNextStep(props);
1842
+ let closeLabel = newCloseLabel(choiseMade);
1843
+ return _GameStepManager.closeChoiceMenu(closeLabel, props);
1843
1844
  }
1844
1845
  let tempLabel = getLabelById(labelId);
1845
1846
  if (!tempLabel) {
@@ -1878,18 +1879,20 @@ var _GameStepManager = class _GameStepManager {
1878
1879
  static jumpLabel(label, props) {
1879
1880
  return __async(this, null, function* () {
1880
1881
  _GameStepManager.closeAllLabels();
1882
+ let choiseMade = void 0;
1881
1883
  let labelId;
1882
1884
  if (typeof label === "string") {
1883
1885
  labelId = label;
1884
1886
  } else {
1885
1887
  labelId = label.id;
1886
1888
  if (typeof label.choiseIndex === "number") {
1887
- label.choiseIndex;
1889
+ choiseMade = label.choiseIndex;
1888
1890
  }
1889
1891
  }
1890
1892
  try {
1891
1893
  if (labelId === CLOSE_LABEL_ID) {
1892
- return _GameStepManager.runNextStep(props);
1894
+ let closeLabel = newCloseLabel(choiseMade);
1895
+ return _GameStepManager.closeChoiceMenu(closeLabel, props);
1893
1896
  }
1894
1897
  let tempLabel = getLabelById(labelId);
1895
1898
  if (!tempLabel) {
@@ -1900,7 +1903,7 @@ var _GameStepManager = class _GameStepManager {
1900
1903
  console.error("[Pixi'VN] Error jumping label", e);
1901
1904
  return;
1902
1905
  }
1903
- return yield _GameStepManager.runCurrentStep(props);
1906
+ return yield _GameStepManager.runCurrentStep(props, choiseMade);
1904
1907
  });
1905
1908
  }
1906
1909
  /**
@@ -1916,8 +1919,14 @@ var _GameStepManager = class _GameStepManager {
1916
1919
  * })
1917
1920
  * ```
1918
1921
  */
1919
- static closeChoiceMenu(props) {
1922
+ static closeChoiceMenu(label, props) {
1920
1923
  return __async(this, null, function* () {
1924
+ let choiseMade = void 0;
1925
+ if (typeof label.choiseIndex === "number") {
1926
+ choiseMade = label.choiseIndex;
1927
+ }
1928
+ _GameStepManager.addStepHistory(() => {
1929
+ }, choiseMade);
1921
1930
  return _GameStepManager.runNextStep(props);
1922
1931
  });
1923
1932
  }