@drincs/pixi-vn 0.3.3 → 0.3.5

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 CHANGED
@@ -802,6 +802,11 @@ function setMemoryText(element, memory) {
802
802
 
803
803
  // src/classes/ticker/TickerBase.ts
804
804
  var TickerBase = class {
805
+ /**
806
+ * @param args The arguments that you want to pass to the ticker.
807
+ * @param duration The duration of the ticker. If is undefined, the ticker will be called every frame.
808
+ * @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL.
809
+ */
805
810
  constructor(args, duration, priority) {
806
811
  this.args = args;
807
812
  this.duration = duration;
@@ -2019,15 +2024,18 @@ var _GameStepManager = class _GameStepManager {
2019
2024
  /* Run Methods */
2020
2025
  /**
2021
2026
  * Execute the next step and add it to the history.
2022
- * @returns
2027
+ * @returns StepLabelResultType or undefined.
2023
2028
  * @example
2024
2029
  * ```typescript
2025
2030
  * function nextOnClick() {
2026
2031
  * setLoading(true)
2027
2032
  * GameStepManager.runNextStep()
2028
- * .then(() => {
2033
+ * .then((result) => {
2029
2034
  * setUpdate((p) => p + 1)
2030
2035
  * setLoading(false)
2036
+ * if (result) {
2037
+ * // your code
2038
+ * }
2031
2039
  * })
2032
2040
  * .catch((e) => {
2033
2041
  * setLoading(false)
@@ -2048,7 +2056,7 @@ var _GameStepManager = class _GameStepManager {
2048
2056
  }
2049
2057
  /**
2050
2058
  * Execute the current step and add it to the history.
2051
- * @returns
2059
+ * @returns StepLabelResultType or undefined.
2052
2060
  */
2053
2061
  static runCurrentStep() {
2054
2062
  return __async(this, null, function* () {
@@ -2066,11 +2074,12 @@ var _GameStepManager = class _GameStepManager {
2066
2074
  let n = currentLabel.steps.length;
2067
2075
  if (n > lasteStepsLength) {
2068
2076
  let nextStep = currentLabel.steps[lasteStepsLength];
2069
- yield nextStep();
2077
+ let result = yield nextStep();
2070
2078
  _GameStepManager.addStepHistory(nextStep);
2079
+ return result;
2071
2080
  } else if (n === lasteStepsLength) {
2072
2081
  _GameStepManager.closeCurrentLabel();
2073
- yield _GameStepManager.runNextStep();
2082
+ return yield _GameStepManager.runNextStep();
2074
2083
  } else {
2075
2084
  console.warn("[Pixi'VN] There are no steps to run");
2076
2085
  }
@@ -2081,10 +2090,21 @@ var _GameStepManager = class _GameStepManager {
2081
2090
  * Execute the label and add it to the history.
2082
2091
  * Is a call function in Ren'Py.
2083
2092
  * @param label The label to execute.
2084
- * @returns
2093
+ * @returns StepLabelResultType or undefined.
2085
2094
  * @example
2086
2095
  * ```typescript
2087
- * GameStepManager.callLabel(StartLabel)
2096
+ * GameStepManager.callLabel(StartLabel).then((result) => {
2097
+ * if (result) {
2098
+ * // your code
2099
+ * }
2100
+ * })
2101
+ * ```
2102
+ * @example
2103
+ * ```typescript
2104
+ * // if you use it in a step label you should return the result.
2105
+ * return GameStepManager.callLabel(StartLabel).then((result) => {
2106
+ * return result
2107
+ * })
2088
2108
  * ```
2089
2109
  */
2090
2110
  static callLabel(label) {
@@ -2105,11 +2125,22 @@ var _GameStepManager = class _GameStepManager {
2105
2125
  /**
2106
2126
  * Execute the label, close all labels and add them to the history.
2107
2127
  * Is a jump function in Ren'Py.
2108
- * @param label
2109
- * @returns
2128
+ * @param label The label to execute.
2129
+ * @returns StepLabelResultType or undefined.
2130
+ * @example
2131
+ * ```typescript
2132
+ * GameStepManager.jumpLabel(StartLabel).then((result) => {
2133
+ * if (result) {
2134
+ * // your code
2135
+ * }
2136
+ * })
2137
+ * ```
2110
2138
  * @example
2111
2139
  * ```typescript
2112
- * GameStepManager.jumpLabel(StartLabel)
2140
+ * // if you use it in a step label you should return the result.
2141
+ * return GameStepManager.jumpLabel(StartLabel).then((result) => {
2142
+ * return result
2143
+ * })
2113
2144
  * ```
2114
2145
  */
2115
2146
  static jumpLabel(label) {
@@ -2377,6 +2408,10 @@ var StoredClassModel = class {
2377
2408
 
2378
2409
  // src/classes/CharacterBaseModel.ts
2379
2410
  var CharacterBaseModel2 = class extends StoredClassModel {
2411
+ /**
2412
+ * @param id The id of the character.
2413
+ * @param props The properties of the character.
2414
+ */
2380
2415
  constructor(id, props) {
2381
2416
  super(GameStorageManager.keysSystem.CHARACTER_CATEGORY_KEY, id);
2382
2417
  this.defaultName = "";
@@ -2386,27 +2421,45 @@ var CharacterBaseModel2 = class extends StoredClassModel {
2386
2421
  this._icon = props.icon;
2387
2422
  this._color = props.color;
2388
2423
  }
2424
+ /***
2425
+ * The name of the character.
2426
+ * If you set undefined, it will return the default name.
2427
+ */
2389
2428
  get name() {
2390
2429
  return this.getStorageProperty("name") || this.defaultName;
2391
2430
  }
2392
2431
  set name(value) {
2393
2432
  this.setStorageProperty("name", value);
2394
2433
  }
2434
+ /**
2435
+ * The surname of the character.
2436
+ * If you set undefined, it will return the default surname.
2437
+ */
2395
2438
  get surname() {
2396
2439
  return this.getStorageProperty("surname") || this.defaultSurname;
2397
2440
  }
2398
2441
  set surname(value) {
2399
2442
  this.setStorageProperty("surname", value);
2400
2443
  }
2444
+ /**
2445
+ * The age of the character.
2446
+ * If you set undefined, it will return the default age.
2447
+ */
2401
2448
  get age() {
2402
2449
  return this.getStorageProperty("age") || this.defaultAge;
2403
2450
  }
2404
2451
  set age(value) {
2405
2452
  this.setStorageProperty("age", value);
2406
2453
  }
2454
+ /**
2455
+ * The icon of the character.
2456
+ */
2407
2457
  get icon() {
2408
2458
  return this._icon;
2409
2459
  }
2460
+ /**
2461
+ * The color of the character.
2462
+ */
2410
2463
  get color() {
2411
2464
  return this._color;
2412
2465
  }
@@ -2435,17 +2488,27 @@ var ChoiceMenuOptionLabel = class {
2435
2488
 
2436
2489
  // src/classes/DialogueBaseModel.ts
2437
2490
  var DialogueBaseModel = class {
2438
- constructor(text, character) {
2491
+ /**
2492
+ * @param text The text of the dialogue.
2493
+ * @param character The id of the character that is speaking.
2494
+ * @param oltherParams Other parameters that can be stored in the dialogue.
2495
+ */
2496
+ constructor(text, character, oltherParams = {}) {
2439
2497
  /**
2440
2498
  * The text of the dialogue.
2441
2499
  */
2442
2500
  this.text = "";
2501
+ /**
2502
+ * Other parameters that can be stored in the dialogue.
2503
+ */
2504
+ this.oltherParams = {};
2443
2505
  this.text = text;
2444
2506
  if (typeof character === "string") {
2445
2507
  this.characterId = character;
2446
2508
  } else {
2447
2509
  this.characterId = character == null ? void 0 : character.id;
2448
2510
  }
2511
+ this.oltherParams = oltherParams;
2449
2512
  }
2450
2513
  };
2451
2514