@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.mjs CHANGED
@@ -724,6 +724,11 @@ function setMemoryText(element, memory) {
724
724
 
725
725
  // src/classes/ticker/TickerBase.ts
726
726
  var TickerBase = class {
727
+ /**
728
+ * @param args The arguments that you want to pass to the ticker.
729
+ * @param duration The duration of the ticker. If is undefined, the ticker will be called every frame.
730
+ * @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL.
731
+ */
727
732
  constructor(args, duration, priority) {
728
733
  this.args = args;
729
734
  this.duration = duration;
@@ -1941,15 +1946,18 @@ var _GameStepManager = class _GameStepManager {
1941
1946
  /* Run Methods */
1942
1947
  /**
1943
1948
  * Execute the next step and add it to the history.
1944
- * @returns
1949
+ * @returns StepLabelResultType or undefined.
1945
1950
  * @example
1946
1951
  * ```typescript
1947
1952
  * function nextOnClick() {
1948
1953
  * setLoading(true)
1949
1954
  * GameStepManager.runNextStep()
1950
- * .then(() => {
1955
+ * .then((result) => {
1951
1956
  * setUpdate((p) => p + 1)
1952
1957
  * setLoading(false)
1958
+ * if (result) {
1959
+ * // your code
1960
+ * }
1953
1961
  * })
1954
1962
  * .catch((e) => {
1955
1963
  * setLoading(false)
@@ -1970,7 +1978,7 @@ var _GameStepManager = class _GameStepManager {
1970
1978
  }
1971
1979
  /**
1972
1980
  * Execute the current step and add it to the history.
1973
- * @returns
1981
+ * @returns StepLabelResultType or undefined.
1974
1982
  */
1975
1983
  static runCurrentStep() {
1976
1984
  return __async(this, null, function* () {
@@ -1988,11 +1996,12 @@ var _GameStepManager = class _GameStepManager {
1988
1996
  let n = currentLabel.steps.length;
1989
1997
  if (n > lasteStepsLength) {
1990
1998
  let nextStep = currentLabel.steps[lasteStepsLength];
1991
- yield nextStep();
1999
+ let result = yield nextStep();
1992
2000
  _GameStepManager.addStepHistory(nextStep);
2001
+ return result;
1993
2002
  } else if (n === lasteStepsLength) {
1994
2003
  _GameStepManager.closeCurrentLabel();
1995
- yield _GameStepManager.runNextStep();
2004
+ return yield _GameStepManager.runNextStep();
1996
2005
  } else {
1997
2006
  console.warn("[Pixi'VN] There are no steps to run");
1998
2007
  }
@@ -2003,10 +2012,21 @@ var _GameStepManager = class _GameStepManager {
2003
2012
  * Execute the label and add it to the history.
2004
2013
  * Is a call function in Ren'Py.
2005
2014
  * @param label The label to execute.
2006
- * @returns
2015
+ * @returns StepLabelResultType or undefined.
2007
2016
  * @example
2008
2017
  * ```typescript
2009
- * GameStepManager.callLabel(StartLabel)
2018
+ * GameStepManager.callLabel(StartLabel).then((result) => {
2019
+ * if (result) {
2020
+ * // your code
2021
+ * }
2022
+ * })
2023
+ * ```
2024
+ * @example
2025
+ * ```typescript
2026
+ * // if you use it in a step label you should return the result.
2027
+ * return GameStepManager.callLabel(StartLabel).then((result) => {
2028
+ * return result
2029
+ * })
2010
2030
  * ```
2011
2031
  */
2012
2032
  static callLabel(label) {
@@ -2027,11 +2047,22 @@ var _GameStepManager = class _GameStepManager {
2027
2047
  /**
2028
2048
  * Execute the label, close all labels and add them to the history.
2029
2049
  * Is a jump function in Ren'Py.
2030
- * @param label
2031
- * @returns
2050
+ * @param label The label to execute.
2051
+ * @returns StepLabelResultType or undefined.
2052
+ * @example
2053
+ * ```typescript
2054
+ * GameStepManager.jumpLabel(StartLabel).then((result) => {
2055
+ * if (result) {
2056
+ * // your code
2057
+ * }
2058
+ * })
2059
+ * ```
2032
2060
  * @example
2033
2061
  * ```typescript
2034
- * GameStepManager.jumpLabel(StartLabel)
2062
+ * // if you use it in a step label you should return the result.
2063
+ * return GameStepManager.jumpLabel(StartLabel).then((result) => {
2064
+ * return result
2065
+ * })
2035
2066
  * ```
2036
2067
  */
2037
2068
  static jumpLabel(label) {
@@ -2299,6 +2330,10 @@ var StoredClassModel = class {
2299
2330
 
2300
2331
  // src/classes/CharacterBaseModel.ts
2301
2332
  var CharacterBaseModel2 = class extends StoredClassModel {
2333
+ /**
2334
+ * @param id The id of the character.
2335
+ * @param props The properties of the character.
2336
+ */
2302
2337
  constructor(id, props) {
2303
2338
  super(GameStorageManager.keysSystem.CHARACTER_CATEGORY_KEY, id);
2304
2339
  this.defaultName = "";
@@ -2308,27 +2343,45 @@ var CharacterBaseModel2 = class extends StoredClassModel {
2308
2343
  this._icon = props.icon;
2309
2344
  this._color = props.color;
2310
2345
  }
2346
+ /***
2347
+ * The name of the character.
2348
+ * If you set undefined, it will return the default name.
2349
+ */
2311
2350
  get name() {
2312
2351
  return this.getStorageProperty("name") || this.defaultName;
2313
2352
  }
2314
2353
  set name(value) {
2315
2354
  this.setStorageProperty("name", value);
2316
2355
  }
2356
+ /**
2357
+ * The surname of the character.
2358
+ * If you set undefined, it will return the default surname.
2359
+ */
2317
2360
  get surname() {
2318
2361
  return this.getStorageProperty("surname") || this.defaultSurname;
2319
2362
  }
2320
2363
  set surname(value) {
2321
2364
  this.setStorageProperty("surname", value);
2322
2365
  }
2366
+ /**
2367
+ * The age of the character.
2368
+ * If you set undefined, it will return the default age.
2369
+ */
2323
2370
  get age() {
2324
2371
  return this.getStorageProperty("age") || this.defaultAge;
2325
2372
  }
2326
2373
  set age(value) {
2327
2374
  this.setStorageProperty("age", value);
2328
2375
  }
2376
+ /**
2377
+ * The icon of the character.
2378
+ */
2329
2379
  get icon() {
2330
2380
  return this._icon;
2331
2381
  }
2382
+ /**
2383
+ * The color of the character.
2384
+ */
2332
2385
  get color() {
2333
2386
  return this._color;
2334
2387
  }
@@ -2357,17 +2410,27 @@ var ChoiceMenuOptionLabel = class {
2357
2410
 
2358
2411
  // src/classes/DialogueBaseModel.ts
2359
2412
  var DialogueBaseModel = class {
2360
- constructor(text, character) {
2413
+ /**
2414
+ * @param text The text of the dialogue.
2415
+ * @param character The id of the character that is speaking.
2416
+ * @param oltherParams Other parameters that can be stored in the dialogue.
2417
+ */
2418
+ constructor(text, character, oltherParams = {}) {
2361
2419
  /**
2362
2420
  * The text of the dialogue.
2363
2421
  */
2364
2422
  this.text = "";
2423
+ /**
2424
+ * Other parameters that can be stored in the dialogue.
2425
+ */
2426
+ this.oltherParams = {};
2365
2427
  this.text = text;
2366
2428
  if (typeof character === "string") {
2367
2429
  this.characterId = character;
2368
2430
  } else {
2369
2431
  this.characterId = character == null ? void 0 : character.id;
2370
2432
  }
2433
+ this.oltherParams = oltherParams;
2371
2434
  }
2372
2435
  };
2373
2436