@drincs/pixi-vn 0.4.5 → 0.4.7

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.d.mts CHANGED
@@ -192,20 +192,38 @@ type LabelIdType = string;
192
192
  type StepHistoryDataType = string;
193
193
 
194
194
  /**
195
- * StepLabel is a function that will be executed as the game continues.
195
+ * StepLabelPropsType is the type of the props that will be passed to the StepLabel.
196
+ * You can override this interface to add your own props.
197
+ * @example
198
+ * ```typescript
199
+ * declare module '@drincs/pixi-vn/dist' {
200
+ * navigate: (route: string) => void
201
+ * }
202
+ * ```
196
203
  */
197
- type StepLabelType = (() => StepLabelResultType | Promise<StepLabelResultType>);
204
+ interface StepLabelProps {
205
+ [key: string]: any;
206
+ }
198
207
  /**
199
208
  * StepLabelResultType is the return type of the StepLabel function.
200
209
  * It can be useful for returning to the information calling function to perform other operations that cannot be performed within the StepLabel.
210
+ * You can override this interface to add your own return types.
211
+ * @example
212
+ * ```typescript
213
+ * declare module '@drincs/pixi-vn/dist' {
214
+ * newRoute: string
215
+ * }
216
+ * ```
201
217
  */
202
- type StepLabelResultType = {
203
- /**
204
- * The new route to navigate to.
205
- */
206
- newRoute?: string;
218
+ interface StepLabelResult {
207
219
  [key: string]: any;
208
- } | void;
220
+ }
221
+ type StepLabelResultType = StepLabelResult | void;
222
+ type StepLabelPropsType = StepLabelProps;
223
+ /**
224
+ * StepLabel is a function that will be executed as the game continues.
225
+ */
226
+ type StepLabelType = ((props: StepLabelPropsType) => StepLabelResultType | Promise<StepLabelResultType>);
209
227
 
210
228
  /**
211
229
  * Label is a class that contains a list of steps, which will be performed as the game continues.
@@ -548,14 +566,15 @@ declare class CanvasSprite<Memory extends SpriteOptions & ICanvasBaseMemory = IC
548
566
  * This class is a extension of the CanvasSprite class, it has the same properties and methods,
549
567
  * but it has some features that make texture management easier.
550
568
  * You need to use CanvasImage.load() to show the image in the canvas.
551
- * This class is used for functions like addImage, loadImages and showImageWithDissolveTransition.
569
+ * This class is used for functions like addImage, loadImages and showWithDissolveTransition.
552
570
  * @example
553
571
  * ```typescript
554
- * let alien = new CanvasImage()
555
- * alien.anchor.set(0.5);
556
- * alien.x = 100
557
- * alien.y = 100
558
- * await alien.load('https://pixijs.com/assets/eggHead.png')
572
+ * let alien = new CanvasImage({
573
+ * anchor: { x: 0.5, y: 0.5 },
574
+ * x: 100,
575
+ * y: 100,
576
+ * }, 'https://pixijs.com/assets/eggHead.png')
577
+ * await alien.load()
559
578
  * GameWindowManager.addCanvasElement("alien", alien)
560
579
  * ```
561
580
  * @example
@@ -568,6 +587,7 @@ declare class CanvasSprite<Memory extends SpriteOptions & ICanvasBaseMemory = IC
568
587
  * ```
569
588
  */
570
589
  declare class CanvasImage extends CanvasSprite<ICanvasImageMemory> {
590
+ constructor(options?: SpriteOptions | Texture | undefined, imageLink?: string);
571
591
  get memory(): ICanvasImageMemory;
572
592
  set memory(memory: ICanvasImageMemory);
573
593
  imageLink: string;
@@ -1201,13 +1221,13 @@ declare function removeCanvasElement(tag: string | string[]): void;
1201
1221
  * Disolve effect is a effect that the image is shown with a fade in.
1202
1222
  * If exist a image with the same tag, then the image is replaced. And the first image is removed after the effect is done.
1203
1223
  * @param tag The unique tag of the image. You can use this tag to refer to this image
1204
- * @param imageUrl The url of the image.
1224
+ * @param image The imageUrl or the canvas element
1205
1225
  * @param args The arguments of the effect
1206
1226
  * @param duration The duration of the effect
1207
1227
  * @param priority The priority of the effect
1208
1228
  * @returns The sprite of the image.
1209
1229
  */
1210
- declare function showImageWithDissolveTransition(tag: string, imageUrl: string, speed: number, priority?: UPDATE_PRIORITY): Promise<void>;
1230
+ declare function showWithDissolveTransition<T extends CanvasBase<any> | string = string>(tag: string, image: T, speed: number, priority?: UPDATE_PRIORITY): Promise<void>;
1211
1231
 
1212
1232
  /**
1213
1233
  * Get the save data
@@ -1340,12 +1360,13 @@ declare class GameStepManager {
1340
1360
  private static increaseCurrentStepIndex;
1341
1361
  /**
1342
1362
  * Execute the next step and add it to the history.
1363
+ * @param props The props to pass to the step.
1343
1364
  * @returns StepLabelResultType or undefined.
1344
1365
  * @example
1345
1366
  * ```typescript
1346
1367
  * function nextOnClick() {
1347
1368
  * setLoading(true)
1348
- * GameStepManager.runNextStep()
1369
+ * GameStepManager.runNextStep(yourParams)
1349
1370
  * .then((result) => {
1350
1371
  * setUpdate((p) => p + 1)
1351
1372
  * setLoading(false)
@@ -1360,9 +1381,10 @@ declare class GameStepManager {
1360
1381
  * }
1361
1382
  * ```
1362
1383
  */
1363
- static runNextStep(): Promise<StepLabelResultType>;
1384
+ static runNextStep(props: StepLabelPropsType): Promise<StepLabelResultType>;
1364
1385
  /**
1365
1386
  * Execute the current step and add it to the history.
1387
+ * @param props The props to pass to the step.
1366
1388
  * @returns StepLabelResultType or undefined.
1367
1389
  */
1368
1390
  private static runCurrentStep;
@@ -1370,10 +1392,11 @@ declare class GameStepManager {
1370
1392
  * Execute the label and add it to the history.
1371
1393
  * Is a call function in Ren'Py.
1372
1394
  * @param label The label to execute.
1395
+ * @param props The props to pass to the label.
1373
1396
  * @returns StepLabelResultType or undefined.
1374
1397
  * @example
1375
1398
  * ```typescript
1376
- * GameStepManager.callLabel(StartLabel).then((result) => {
1399
+ * GameStepManager.callLabel(StartLabel, yourParams).then((result) => {
1377
1400
  * if (result) {
1378
1401
  * // your code
1379
1402
  * }
@@ -1387,15 +1410,16 @@ declare class GameStepManager {
1387
1410
  * })
1388
1411
  * ```
1389
1412
  */
1390
- static callLabel(label: typeof Label | Label): Promise<StepLabelResultType>;
1413
+ static callLabel(label: typeof Label | Label, props: StepLabelPropsType): Promise<StepLabelResultType>;
1391
1414
  /**
1392
1415
  * Execute the label, close all labels and add them to the history.
1393
1416
  * Is a jump function in Ren'Py.
1394
1417
  * @param label The label to execute.
1418
+ * @param props The props to pass to the label.
1395
1419
  * @returns StepLabelResultType or undefined.
1396
1420
  * @example
1397
1421
  * ```typescript
1398
- * GameStepManager.jumpLabel(StartLabel).then((result) => {
1422
+ * GameStepManager.jumpLabel(StartLabel, yourParams).then((result) => {
1399
1423
  * if (result) {
1400
1424
  * // your code
1401
1425
  * }
@@ -1409,7 +1433,7 @@ declare class GameStepManager {
1409
1433
  * })
1410
1434
  * ```
1411
1435
  */
1412
- static jumpLabel(label: typeof Label | Label): Promise<StepLabelResultType>;
1436
+ static jumpLabel(label: typeof Label | Label, props: StepLabelPropsType): Promise<StepLabelResultType>;
1413
1437
  /**
1414
1438
  * Go back to the last step and add it to the history.
1415
1439
  * @param navigate The navigate function.
@@ -1747,4 +1771,4 @@ declare class GameWindowManager {
1747
1771
  static import(data: object): void;
1748
1772
  }
1749
1773
 
1750
- export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel, type CharacterBaseModelProps, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueBaseModel, type ExportedCanvas, type ExportedStep, type ExportedStorage, GameStepManager, GameStorageManager, GameWindowManager, type ICanvasBaseMemory, type ICanvasContainerMemory, type ICanvasImageMemory, type ICanvasSpriteBaseMemory, type ICanvasSpriteMemory, type ICanvasTextMemory as ICanvasTextTextMemory, type IClassWithArgsHistory, type IClassWithArgsHistoryForExport, type IDialogueHistory, type IHistoryStep, type IHistoryStepData, type IOpenedLabel, type ISaveData, type ITextureMemory, type ITicker, type ITickersSteps, Label, LabelRunModeEnum, Pause, type PauseType, PauseValueType, Repeat, type RepeatType, type StepLabelResultType, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerFadeAlphaProps, TickerMove, type TickerProgrationType, TickerRotate, type TickerRotateProps, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, labelDecorator, loadImages, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag, showImageWithDissolveTransition, tickerDecorator };
1774
+ export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel, type CharacterBaseModelProps, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueBaseModel, type ExportedCanvas, type ExportedStep, type ExportedStorage, GameStepManager, GameStorageManager, GameWindowManager, type ICanvasBaseMemory, type ICanvasContainerMemory, type ICanvasImageMemory, type ICanvasSpriteBaseMemory, type ICanvasSpriteMemory, type ICanvasTextMemory as ICanvasTextTextMemory, type IClassWithArgsHistory, type IClassWithArgsHistoryForExport, type IDialogueHistory, type IHistoryStep, type IHistoryStepData, type IOpenedLabel, type ISaveData, type ITextureMemory, type ITicker, type ITickersSteps, Label, LabelRunModeEnum, Pause, type PauseType, PauseValueType, Repeat, type RepeatType, type StepLabelProps, type StepLabelResult, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerFadeAlphaProps, TickerMove, type TickerProgrationType, TickerRotate, type TickerRotateProps, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, labelDecorator, loadImages, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag, showWithDissolveTransition, tickerDecorator };
package/dist/index.d.ts CHANGED
@@ -192,20 +192,38 @@ type LabelIdType = string;
192
192
  type StepHistoryDataType = string;
193
193
 
194
194
  /**
195
- * StepLabel is a function that will be executed as the game continues.
195
+ * StepLabelPropsType is the type of the props that will be passed to the StepLabel.
196
+ * You can override this interface to add your own props.
197
+ * @example
198
+ * ```typescript
199
+ * declare module '@drincs/pixi-vn/dist' {
200
+ * navigate: (route: string) => void
201
+ * }
202
+ * ```
196
203
  */
197
- type StepLabelType = (() => StepLabelResultType | Promise<StepLabelResultType>);
204
+ interface StepLabelProps {
205
+ [key: string]: any;
206
+ }
198
207
  /**
199
208
  * StepLabelResultType is the return type of the StepLabel function.
200
209
  * It can be useful for returning to the information calling function to perform other operations that cannot be performed within the StepLabel.
210
+ * You can override this interface to add your own return types.
211
+ * @example
212
+ * ```typescript
213
+ * declare module '@drincs/pixi-vn/dist' {
214
+ * newRoute: string
215
+ * }
216
+ * ```
201
217
  */
202
- type StepLabelResultType = {
203
- /**
204
- * The new route to navigate to.
205
- */
206
- newRoute?: string;
218
+ interface StepLabelResult {
207
219
  [key: string]: any;
208
- } | void;
220
+ }
221
+ type StepLabelResultType = StepLabelResult | void;
222
+ type StepLabelPropsType = StepLabelProps;
223
+ /**
224
+ * StepLabel is a function that will be executed as the game continues.
225
+ */
226
+ type StepLabelType = ((props: StepLabelPropsType) => StepLabelResultType | Promise<StepLabelResultType>);
209
227
 
210
228
  /**
211
229
  * Label is a class that contains a list of steps, which will be performed as the game continues.
@@ -548,14 +566,15 @@ declare class CanvasSprite<Memory extends SpriteOptions & ICanvasBaseMemory = IC
548
566
  * This class is a extension of the CanvasSprite class, it has the same properties and methods,
549
567
  * but it has some features that make texture management easier.
550
568
  * You need to use CanvasImage.load() to show the image in the canvas.
551
- * This class is used for functions like addImage, loadImages and showImageWithDissolveTransition.
569
+ * This class is used for functions like addImage, loadImages and showWithDissolveTransition.
552
570
  * @example
553
571
  * ```typescript
554
- * let alien = new CanvasImage()
555
- * alien.anchor.set(0.5);
556
- * alien.x = 100
557
- * alien.y = 100
558
- * await alien.load('https://pixijs.com/assets/eggHead.png')
572
+ * let alien = new CanvasImage({
573
+ * anchor: { x: 0.5, y: 0.5 },
574
+ * x: 100,
575
+ * y: 100,
576
+ * }, 'https://pixijs.com/assets/eggHead.png')
577
+ * await alien.load()
559
578
  * GameWindowManager.addCanvasElement("alien", alien)
560
579
  * ```
561
580
  * @example
@@ -568,6 +587,7 @@ declare class CanvasSprite<Memory extends SpriteOptions & ICanvasBaseMemory = IC
568
587
  * ```
569
588
  */
570
589
  declare class CanvasImage extends CanvasSprite<ICanvasImageMemory> {
590
+ constructor(options?: SpriteOptions | Texture | undefined, imageLink?: string);
571
591
  get memory(): ICanvasImageMemory;
572
592
  set memory(memory: ICanvasImageMemory);
573
593
  imageLink: string;
@@ -1201,13 +1221,13 @@ declare function removeCanvasElement(tag: string | string[]): void;
1201
1221
  * Disolve effect is a effect that the image is shown with a fade in.
1202
1222
  * If exist a image with the same tag, then the image is replaced. And the first image is removed after the effect is done.
1203
1223
  * @param tag The unique tag of the image. You can use this tag to refer to this image
1204
- * @param imageUrl The url of the image.
1224
+ * @param image The imageUrl or the canvas element
1205
1225
  * @param args The arguments of the effect
1206
1226
  * @param duration The duration of the effect
1207
1227
  * @param priority The priority of the effect
1208
1228
  * @returns The sprite of the image.
1209
1229
  */
1210
- declare function showImageWithDissolveTransition(tag: string, imageUrl: string, speed: number, priority?: UPDATE_PRIORITY): Promise<void>;
1230
+ declare function showWithDissolveTransition<T extends CanvasBase<any> | string = string>(tag: string, image: T, speed: number, priority?: UPDATE_PRIORITY): Promise<void>;
1211
1231
 
1212
1232
  /**
1213
1233
  * Get the save data
@@ -1340,12 +1360,13 @@ declare class GameStepManager {
1340
1360
  private static increaseCurrentStepIndex;
1341
1361
  /**
1342
1362
  * Execute the next step and add it to the history.
1363
+ * @param props The props to pass to the step.
1343
1364
  * @returns StepLabelResultType or undefined.
1344
1365
  * @example
1345
1366
  * ```typescript
1346
1367
  * function nextOnClick() {
1347
1368
  * setLoading(true)
1348
- * GameStepManager.runNextStep()
1369
+ * GameStepManager.runNextStep(yourParams)
1349
1370
  * .then((result) => {
1350
1371
  * setUpdate((p) => p + 1)
1351
1372
  * setLoading(false)
@@ -1360,9 +1381,10 @@ declare class GameStepManager {
1360
1381
  * }
1361
1382
  * ```
1362
1383
  */
1363
- static runNextStep(): Promise<StepLabelResultType>;
1384
+ static runNextStep(props: StepLabelPropsType): Promise<StepLabelResultType>;
1364
1385
  /**
1365
1386
  * Execute the current step and add it to the history.
1387
+ * @param props The props to pass to the step.
1366
1388
  * @returns StepLabelResultType or undefined.
1367
1389
  */
1368
1390
  private static runCurrentStep;
@@ -1370,10 +1392,11 @@ declare class GameStepManager {
1370
1392
  * Execute the label and add it to the history.
1371
1393
  * Is a call function in Ren'Py.
1372
1394
  * @param label The label to execute.
1395
+ * @param props The props to pass to the label.
1373
1396
  * @returns StepLabelResultType or undefined.
1374
1397
  * @example
1375
1398
  * ```typescript
1376
- * GameStepManager.callLabel(StartLabel).then((result) => {
1399
+ * GameStepManager.callLabel(StartLabel, yourParams).then((result) => {
1377
1400
  * if (result) {
1378
1401
  * // your code
1379
1402
  * }
@@ -1387,15 +1410,16 @@ declare class GameStepManager {
1387
1410
  * })
1388
1411
  * ```
1389
1412
  */
1390
- static callLabel(label: typeof Label | Label): Promise<StepLabelResultType>;
1413
+ static callLabel(label: typeof Label | Label, props: StepLabelPropsType): Promise<StepLabelResultType>;
1391
1414
  /**
1392
1415
  * Execute the label, close all labels and add them to the history.
1393
1416
  * Is a jump function in Ren'Py.
1394
1417
  * @param label The label to execute.
1418
+ * @param props The props to pass to the label.
1395
1419
  * @returns StepLabelResultType or undefined.
1396
1420
  * @example
1397
1421
  * ```typescript
1398
- * GameStepManager.jumpLabel(StartLabel).then((result) => {
1422
+ * GameStepManager.jumpLabel(StartLabel, yourParams).then((result) => {
1399
1423
  * if (result) {
1400
1424
  * // your code
1401
1425
  * }
@@ -1409,7 +1433,7 @@ declare class GameStepManager {
1409
1433
  * })
1410
1434
  * ```
1411
1435
  */
1412
- static jumpLabel(label: typeof Label | Label): Promise<StepLabelResultType>;
1436
+ static jumpLabel(label: typeof Label | Label, props: StepLabelPropsType): Promise<StepLabelResultType>;
1413
1437
  /**
1414
1438
  * Go back to the last step and add it to the history.
1415
1439
  * @param navigate The navigate function.
@@ -1747,4 +1771,4 @@ declare class GameWindowManager {
1747
1771
  static import(data: object): void;
1748
1772
  }
1749
1773
 
1750
- export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel, type CharacterBaseModelProps, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueBaseModel, type ExportedCanvas, type ExportedStep, type ExportedStorage, GameStepManager, GameStorageManager, GameWindowManager, type ICanvasBaseMemory, type ICanvasContainerMemory, type ICanvasImageMemory, type ICanvasSpriteBaseMemory, type ICanvasSpriteMemory, type ICanvasTextMemory as ICanvasTextTextMemory, type IClassWithArgsHistory, type IClassWithArgsHistoryForExport, type IDialogueHistory, type IHistoryStep, type IHistoryStepData, type IOpenedLabel, type ISaveData, type ITextureMemory, type ITicker, type ITickersSteps, Label, LabelRunModeEnum, Pause, type PauseType, PauseValueType, Repeat, type RepeatType, type StepLabelResultType, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerFadeAlphaProps, TickerMove, type TickerProgrationType, TickerRotate, type TickerRotateProps, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, labelDecorator, loadImages, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag, showImageWithDissolveTransition, tickerDecorator };
1774
+ export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel, type CharacterBaseModelProps, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueBaseModel, type ExportedCanvas, type ExportedStep, type ExportedStorage, GameStepManager, GameStorageManager, GameWindowManager, type ICanvasBaseMemory, type ICanvasContainerMemory, type ICanvasImageMemory, type ICanvasSpriteBaseMemory, type ICanvasSpriteMemory, type ICanvasTextMemory as ICanvasTextTextMemory, type IClassWithArgsHistory, type IClassWithArgsHistoryForExport, type IDialogueHistory, type IHistoryStep, type IHistoryStepData, type IOpenedLabel, type ISaveData, type ITextureMemory, type ITicker, type ITickersSteps, Label, LabelRunModeEnum, Pause, type PauseType, PauseValueType, Repeat, type RepeatType, type StepLabelProps, type StepLabelResult, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerFadeAlphaProps, TickerMove, type TickerProgrationType, TickerRotate, type TickerRotateProps, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, labelDecorator, loadImages, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag, showWithDissolveTransition, tickerDecorator };
package/dist/index.js CHANGED
@@ -123,7 +123,7 @@ __export(src_exports, {
123
123
  setChoiceMenuOptions: () => setChoiceMenuOptions,
124
124
  setDialogue: () => setDialogue,
125
125
  setFlag: () => setFlag,
126
- showImageWithDissolveTransition: () => showImageWithDissolveTransition,
126
+ showWithDissolveTransition: () => showWithDissolveTransition,
127
127
  tickerDecorator: () => tickerDecorator
128
128
  });
129
129
  module.exports = __toCommonJS(src_exports);
@@ -665,9 +665,12 @@ function setMemorySprite(element, memory) {
665
665
 
666
666
  // src/classes/canvas/CanvasImage.ts
667
667
  var CanvasImage = class _CanvasImage extends CanvasSprite {
668
- constructor() {
669
- super(...arguments);
668
+ constructor(options, imageLink) {
669
+ super(options);
670
670
  this.imageLink = "";
671
+ if (imageLink) {
672
+ this.imageLink = imageLink;
673
+ }
671
674
  }
672
675
  get memory() {
673
676
  return __spreadProps(__spreadValues({}, getMemorySprite(this)), {
@@ -684,7 +687,7 @@ var CanvasImage = class _CanvasImage extends CanvasSprite {
684
687
  mySprite.texture = sprite.texture;
685
688
  return mySprite;
686
689
  }
687
- /**
690
+ /**
688
691
  * Load the image from the link and set the texture of the sprite.
689
692
  * @param image The link of the image. If it is not set, it will use the imageLink property.
690
693
  * @returns A promise that resolves when the image is loaded.
@@ -1090,36 +1093,36 @@ function loadImages(canvasImages) {
1090
1093
  function removeCanvasElement(tag) {
1091
1094
  GameWindowManager.removeCanvasElement(tag);
1092
1095
  }
1093
- function showImageWithDissolveTransition(tag, imageUrl, speed, priority) {
1096
+ function showWithDissolveTransition(tag, image, speed, priority) {
1094
1097
  return __async(this, null, function* () {
1095
- if (!GameWindowManager.getCanvasElement(tag)) {
1096
- let image2 = addImage(tag, imageUrl);
1097
- image2.alpha = 0;
1098
- let effect2 = new TickerFadeAlpha({
1099
- speed,
1100
- type: "show",
1101
- startOnlyIfHaveTexture: true
1102
- }, 1e4, priority);
1103
- GameWindowManager.addTicker(tag, effect2);
1104
- return image2.load();
1105
- }
1106
- let specialTag = tag + "_temp_disolve";
1098
+ let specialTag = void 0;
1099
+ if (GameWindowManager.getCanvasElement(tag)) {
1100
+ specialTag = tag + "_temp_disolve";
1101
+ GameWindowManager.editTagCanvasElement(tag, specialTag);
1102
+ }
1103
+ let canvasElement;
1104
+ if (typeof image === "string") {
1105
+ canvasElement = addImage(tag, image);
1106
+ } else {
1107
+ canvasElement = image;
1108
+ }
1109
+ image.alpha = 0;
1107
1110
  let effect = new TickerFadeAlpha({
1108
1111
  speed,
1109
1112
  type: "show",
1110
1113
  tagToRemoveAfter: specialTag,
1111
1114
  startOnlyIfHaveTexture: true
1112
1115
  }, 1e4, priority);
1113
- GameWindowManager.editTagCanvasElement(tag, specialTag);
1114
- let image = addImage(tag, imageUrl);
1115
- image.alpha = 0;
1116
1116
  GameWindowManager.addTicker(tag, effect);
1117
- return image.load();
1117
+ if (canvasElement instanceof CanvasImage) {
1118
+ return canvasElement.load();
1119
+ }
1120
+ return;
1118
1121
  });
1119
1122
  }
1120
1123
 
1121
1124
  // src/constants.ts
1122
- var PIXIVN_VERSION = "0.4.5";
1125
+ var PIXIVN_VERSION = "0.4.6";
1123
1126
 
1124
1127
  // src/functions/SavesUtility.ts
1125
1128
  function getSaveData() {
@@ -2081,12 +2084,13 @@ var _GameStepManager = class _GameStepManager {
2081
2084
  /* Run Methods */
2082
2085
  /**
2083
2086
  * Execute the next step and add it to the history.
2087
+ * @param props The props to pass to the step.
2084
2088
  * @returns StepLabelResultType or undefined.
2085
2089
  * @example
2086
2090
  * ```typescript
2087
2091
  * function nextOnClick() {
2088
2092
  * setLoading(true)
2089
- * GameStepManager.runNextStep()
2093
+ * GameStepManager.runNextStep(yourParams)
2090
2094
  * .then((result) => {
2091
2095
  * setUpdate((p) => p + 1)
2092
2096
  * setLoading(false)
@@ -2101,21 +2105,22 @@ var _GameStepManager = class _GameStepManager {
2101
2105
  * }
2102
2106
  * ```
2103
2107
  */
2104
- static runNextStep() {
2108
+ static runNextStep(props) {
2105
2109
  return __async(this, null, function* () {
2106
2110
  if (_GameStepManager._openedLabels.length === 0) {
2107
2111
  console.warn("[Pixi'VN] There are no labels to run");
2108
2112
  return;
2109
2113
  }
2110
2114
  _GameStepManager.increaseCurrentStepIndex();
2111
- return yield _GameStepManager.runCurrentStep();
2115
+ return yield _GameStepManager.runCurrentStep(props);
2112
2116
  });
2113
2117
  }
2114
2118
  /**
2115
2119
  * Execute the current step and add it to the history.
2120
+ * @param props The props to pass to the step.
2116
2121
  * @returns StepLabelResultType or undefined.
2117
2122
  */
2118
- static runCurrentStep() {
2123
+ static runCurrentStep(props) {
2119
2124
  return __async(this, null, function* () {
2120
2125
  if (_GameStepManager.currentLabelId) {
2121
2126
  let lasteStepsLength = _GameStepManager.currentLabelStepIndex;
@@ -2131,12 +2136,12 @@ var _GameStepManager = class _GameStepManager {
2131
2136
  let n = currentLabel.steps.length;
2132
2137
  if (n > lasteStepsLength) {
2133
2138
  let nextStep = currentLabel.steps[lasteStepsLength];
2134
- let result = yield nextStep();
2139
+ let result = yield nextStep(props);
2135
2140
  _GameStepManager.addStepHistory(nextStep);
2136
2141
  return result;
2137
2142
  } else if (n === lasteStepsLength) {
2138
2143
  _GameStepManager.closeCurrentLabel();
2139
- return yield _GameStepManager.runNextStep();
2144
+ return yield _GameStepManager.runNextStep(props);
2140
2145
  } else {
2141
2146
  console.warn("[Pixi'VN] There are no steps to run");
2142
2147
  }
@@ -2147,10 +2152,11 @@ var _GameStepManager = class _GameStepManager {
2147
2152
  * Execute the label and add it to the history.
2148
2153
  * Is a call function in Ren'Py.
2149
2154
  * @param label The label to execute.
2155
+ * @param props The props to pass to the label.
2150
2156
  * @returns StepLabelResultType or undefined.
2151
2157
  * @example
2152
2158
  * ```typescript
2153
- * GameStepManager.callLabel(StartLabel).then((result) => {
2159
+ * GameStepManager.callLabel(StartLabel, yourParams).then((result) => {
2154
2160
  * if (result) {
2155
2161
  * // your code
2156
2162
  * }
@@ -2164,7 +2170,7 @@ var _GameStepManager = class _GameStepManager {
2164
2170
  * })
2165
2171
  * ```
2166
2172
  */
2167
- static callLabel(label) {
2173
+ static callLabel(label, props) {
2168
2174
  return __async(this, null, function* () {
2169
2175
  try {
2170
2176
  if (label instanceof Label) {
@@ -2176,17 +2182,18 @@ var _GameStepManager = class _GameStepManager {
2176
2182
  console.error("[Pixi'VN] Error calling label", e);
2177
2183
  return;
2178
2184
  }
2179
- return yield _GameStepManager.runCurrentStep();
2185
+ return yield _GameStepManager.runCurrentStep(props);
2180
2186
  });
2181
2187
  }
2182
2188
  /**
2183
2189
  * Execute the label, close all labels and add them to the history.
2184
2190
  * Is a jump function in Ren'Py.
2185
2191
  * @param label The label to execute.
2192
+ * @param props The props to pass to the label.
2186
2193
  * @returns StepLabelResultType or undefined.
2187
2194
  * @example
2188
2195
  * ```typescript
2189
- * GameStepManager.jumpLabel(StartLabel).then((result) => {
2196
+ * GameStepManager.jumpLabel(StartLabel, yourParams).then((result) => {
2190
2197
  * if (result) {
2191
2198
  * // your code
2192
2199
  * }
@@ -2200,7 +2207,7 @@ var _GameStepManager = class _GameStepManager {
2200
2207
  * })
2201
2208
  * ```
2202
2209
  */
2203
- static jumpLabel(label) {
2210
+ static jumpLabel(label, props) {
2204
2211
  return __async(this, null, function* () {
2205
2212
  _GameStepManager.closeAllLabels();
2206
2213
  try {
@@ -2213,7 +2220,7 @@ var _GameStepManager = class _GameStepManager {
2213
2220
  console.error("[Pixi'VN] Error jumping label", e);
2214
2221
  return;
2215
2222
  }
2216
- return yield _GameStepManager.runCurrentStep();
2223
+ return yield _GameStepManager.runCurrentStep(props);
2217
2224
  });
2218
2225
  }
2219
2226
  /* After Update Methods */
@@ -2666,7 +2673,7 @@ var Label = class {
2666
2673
  setChoiceMenuOptions,
2667
2674
  setDialogue,
2668
2675
  setFlag,
2669
- showImageWithDissolveTransition,
2676
+ showWithDissolveTransition,
2670
2677
  tickerDecorator
2671
2678
  });
2672
2679
  //# sourceMappingURL=index.js.map