@drincs/pixi-vn 0.5.0 → 0.5.2

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 (67) hide show
  1. package/dist/classes/CharacterBaseModel.js +6 -6
  2. package/dist/classes/CharacterBaseModel.js.map +1 -1
  3. package/dist/classes/CharacterBaseModel.mjs +6 -6
  4. package/dist/classes/CharacterBaseModel.mjs.map +1 -1
  5. package/dist/classes/ChoiceMenuOption.d.mts +17 -4
  6. package/dist/classes/ChoiceMenuOption.d.ts +17 -4
  7. package/dist/classes/ChoiceMenuOption.js +10 -1
  8. package/dist/classes/ChoiceMenuOption.js.map +1 -1
  9. package/dist/classes/ChoiceMenuOption.mjs +10 -1
  10. package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
  11. package/dist/classes/StoredClassModel.js.map +1 -1
  12. package/dist/classes/StoredClassModel.mjs.map +1 -1
  13. package/dist/classes/index.js +6 -6
  14. package/dist/classes/index.js.map +1 -1
  15. package/dist/classes/index.mjs +6 -6
  16. package/dist/classes/index.mjs.map +1 -1
  17. package/dist/classes/ticker/TickerFadeAlpha.js.map +1 -1
  18. package/dist/classes/ticker/TickerFadeAlpha.mjs.map +1 -1
  19. package/dist/classes/ticker/TickerMove.js.map +1 -1
  20. package/dist/classes/ticker/TickerMove.mjs.map +1 -1
  21. package/dist/classes/ticker/TickerRotate.js.map +1 -1
  22. package/dist/classes/ticker/TickerRotate.mjs.map +1 -1
  23. package/dist/classes/ticker/index.js.map +1 -1
  24. package/dist/classes/ticker/index.mjs.map +1 -1
  25. package/dist/constants.d.mts +1 -1
  26. package/dist/constants.d.ts +1 -1
  27. package/dist/constants.js +1 -1
  28. package/dist/constants.js.map +1 -1
  29. package/dist/constants.mjs +1 -1
  30. package/dist/constants.mjs.map +1 -1
  31. package/dist/functions/DialogueUtility.js +47 -17
  32. package/dist/functions/DialogueUtility.js.map +1 -1
  33. package/dist/functions/DialogueUtility.mjs +47 -17
  34. package/dist/functions/DialogueUtility.mjs.map +1 -1
  35. package/dist/functions/FlagsUtility.js.map +1 -1
  36. package/dist/functions/FlagsUtility.mjs.map +1 -1
  37. package/dist/functions/GameUtility.js.map +1 -1
  38. package/dist/functions/GameUtility.mjs.map +1 -1
  39. package/dist/functions/ImageUtility.js.map +1 -1
  40. package/dist/functions/ImageUtility.mjs.map +1 -1
  41. package/dist/functions/SavesUtility.js +25 -7
  42. package/dist/functions/SavesUtility.js.map +1 -1
  43. package/dist/functions/SavesUtility.mjs +25 -7
  44. package/dist/functions/SavesUtility.mjs.map +1 -1
  45. package/dist/functions/index.js +48 -18
  46. package/dist/functions/index.js.map +1 -1
  47. package/dist/functions/index.mjs +48 -18
  48. package/dist/functions/index.mjs.map +1 -1
  49. package/dist/index.js +60 -30
  50. package/dist/index.js.map +1 -1
  51. package/dist/index.mjs +60 -30
  52. package/dist/index.mjs.map +1 -1
  53. package/dist/interface/IDialogueHistory.d.mts +4 -4
  54. package/dist/interface/IDialogueHistory.d.ts +4 -4
  55. package/dist/interface/IHistoryStep.d.mts +2 -2
  56. package/dist/interface/IHistoryStep.d.ts +2 -2
  57. package/dist/managers/StepManager.d.mts +14 -0
  58. package/dist/managers/StepManager.d.ts +14 -0
  59. package/dist/managers/StepManager.js +18 -0
  60. package/dist/managers/StepManager.js.map +1 -1
  61. package/dist/managers/StepManager.mjs +18 -0
  62. package/dist/managers/StepManager.mjs.map +1 -1
  63. package/dist/managers/index.js +24 -6
  64. package/dist/managers/index.js.map +1 -1
  65. package/dist/managers/index.mjs +24 -6
  66. package/dist/managers/index.mjs.map +1 -1
  67. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -146,6 +146,21 @@ function getLabelInstanceByClassName(labelName) {
146
146
  }
147
147
  }
148
148
 
149
+ // src/types/CloseType.ts
150
+ var Close = "close";
151
+
152
+ // src/types/PauseType.ts
153
+ var PauseValueType = "pause";
154
+ function Pause(duration) {
155
+ return {
156
+ type: PauseValueType,
157
+ duration
158
+ };
159
+ }
160
+
161
+ // src/types/RepeatType.ts
162
+ var Repeat = "repeat";
163
+
149
164
  // src/classes/ChoiceMenuOption.ts
150
165
  var ChoiceMenuOption = class {
151
166
  /**
@@ -176,25 +191,18 @@ var ChoiceMenuOptionClose = class {
176
191
  * Label to be opened when the option is selected
177
192
  */
178
193
  this.label = new CloseLabel();
194
+ /**
195
+ * Type of the label to be opened
196
+ */
197
+ this.type = Close;
198
+ /**
199
+ * Properties to be passed to the label
200
+ */
201
+ this.props = {};
179
202
  this.text = text;
180
203
  }
181
204
  };
182
205
 
183
- // src/types/CloseType.ts
184
- var Close = "close";
185
-
186
- // src/types/PauseType.ts
187
- var PauseValueType = "pause";
188
- function Pause(duration) {
189
- return {
190
- type: PauseValueType,
191
- duration
192
- };
193
- }
194
-
195
- // src/types/RepeatType.ts
196
- var Repeat = "repeat";
197
-
198
206
  // src/functions/DialogueUtility.ts
199
207
  function setDialogue(props) {
200
208
  let text = "";
@@ -250,7 +258,9 @@ function getChoiceMenuOptions() {
250
258
  itemLabel.choiseIndex = index;
251
259
  options.push({
252
260
  text: option.text,
253
- label: itemLabel
261
+ label: itemLabel,
262
+ type: Close,
263
+ props: {}
254
264
  });
255
265
  return;
256
266
  }
@@ -275,28 +285,30 @@ function getDialogueHistory() {
275
285
  GameStepManager.stepsHistory.forEach((step) => {
276
286
  let dialoge = step.dialoge;
277
287
  let requiredChoices = step.choices;
278
- if (list.length > 0 && list[list.length - 1].choices && !list[list.length - 1].choiceMade && step.currentLabel) {
288
+ if (list.length > 0 && list[list.length - 1].choices && !list[list.length - 1].playerMadeChoice && step.currentLabel) {
279
289
  let oldChoices = list[list.length - 1].choices;
280
290
  if (oldChoices) {
281
- let choiceMade = void 0;
291
+ let choiceMade = false;
282
292
  if (step.choiceIndexMade !== void 0 && oldChoices.length > step.choiceIndexMade) {
283
- choiceMade = oldChoices[step.choiceIndexMade];
284
- } else {
285
- choiceMade = oldChoices.find((choice) => {
286
- if (choice.type === Close) {
287
- return false;
288
- }
289
- return choice.label === step.currentLabel;
290
- });
293
+ oldChoices[step.choiceIndexMade].isMadeChoice = true;
294
+ choiceMade = true;
291
295
  }
292
- list[list.length - 1].choiceMade = choiceMade;
296
+ list[list.length - 1].playerMadeChoice = choiceMade;
297
+ list[list.length - 1].choices = oldChoices;
293
298
  }
294
299
  }
295
300
  if (dialoge || requiredChoices) {
301
+ let choices = requiredChoices == null ? void 0 : requiredChoices.map((choice) => {
302
+ return {
303
+ text: choice.text,
304
+ type: choice.type,
305
+ isMadeChoice: false
306
+ };
307
+ });
296
308
  list.push({
297
309
  dialoge,
298
- choiceMade: void 0,
299
- choices: requiredChoices,
310
+ playerMadeChoice: false,
311
+ choices,
300
312
  stepIndex: step.index
301
313
  });
302
314
  }
@@ -1133,7 +1145,7 @@ function showWithDissolveTransition(tag, image, speed, priority) {
1133
1145
  }
1134
1146
 
1135
1147
  // src/constants.ts
1136
- var PIXIVN_VERSION = "0.5.0";
1148
+ var PIXIVN_VERSION = "0.5.2";
1137
1149
 
1138
1150
  // src/functions/SavesUtility.ts
1139
1151
  function getSaveData() {
@@ -2219,6 +2231,24 @@ var _GameStepManager = class _GameStepManager {
2219
2231
  return yield _GameStepManager.runCurrentStep(props);
2220
2232
  });
2221
2233
  }
2234
+ /**
2235
+ * When the player is in a choice menu, can use this function to exit to the choice menu.
2236
+ * @param props The props to pass to the step.
2237
+ * @returns StepLabelResultType or undefined.
2238
+ * @example
2239
+ * ```typescript
2240
+ * GameStepManager.exitToChoiceMenu(yourParams).then((result) => {
2241
+ * if (result) {
2242
+ * // your code
2243
+ * }
2244
+ * })
2245
+ * ```
2246
+ */
2247
+ static exitToChoiceMenu(props) {
2248
+ return __async(this, null, function* () {
2249
+ return _GameStepManager.runNextStep(props);
2250
+ });
2251
+ }
2222
2252
  /* After Update Methods */
2223
2253
  // /**
2224
2254
  // * After the update or code edit, some steps or labels may no longer match.