@drincs/pixi-vn 0.6.1 → 0.6.3
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/{TickerBase-BAUiHet_.d.ts → TickerBase-3rLpDpmb.d.ts} +9 -0
- package/dist/{TickerBase-BctFf13y.d.mts → TickerBase-DKYzbzro.d.mts} +9 -0
- package/dist/classes/CanvasEvent.d.mts +6 -0
- package/dist/classes/CanvasEvent.d.ts +6 -0
- package/dist/classes/CanvasEvent.js +8 -1
- package/dist/classes/CanvasEvent.js.map +1 -1
- package/dist/classes/CanvasEvent.mjs +8 -1
- package/dist/classes/CanvasEvent.mjs.map +1 -1
- package/dist/classes/CharacterBaseModel.js +105 -77
- package/dist/classes/CharacterBaseModel.js.map +1 -1
- package/dist/classes/CharacterBaseModel.mjs +105 -77
- package/dist/classes/CharacterBaseModel.mjs.map +1 -1
- package/dist/classes/ChoiceMenuOption.js +106 -78
- package/dist/classes/ChoiceMenuOption.js.map +1 -1
- package/dist/classes/ChoiceMenuOption.mjs +106 -78
- package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
- package/dist/classes/CloseLabel.js +2 -2
- package/dist/classes/CloseLabel.js.map +1 -1
- package/dist/classes/CloseLabel.mjs +2 -2
- package/dist/classes/CloseLabel.mjs.map +1 -1
- package/dist/classes/DialogueBaseModel.d.mts +2 -2
- package/dist/classes/DialogueBaseModel.d.ts +2 -2
- package/dist/classes/DialogueBaseModel.js +6 -6
- package/dist/classes/DialogueBaseModel.js.map +1 -1
- package/dist/classes/DialogueBaseModel.mjs +6 -6
- package/dist/classes/DialogueBaseModel.mjs.map +1 -1
- package/dist/classes/Label.d.mts +1 -1
- package/dist/classes/Label.d.ts +1 -1
- package/dist/classes/Label.js +2 -2
- package/dist/classes/Label.js.map +1 -1
- package/dist/classes/Label.mjs +2 -2
- package/dist/classes/Label.mjs.map +1 -1
- package/dist/classes/StoredClassModel.js +105 -77
- package/dist/classes/StoredClassModel.js.map +1 -1
- package/dist/classes/StoredClassModel.mjs +105 -77
- package/dist/classes/StoredClassModel.mjs.map +1 -1
- package/dist/classes/canvas/CanvasBase.d.mts +5 -1
- package/dist/classes/canvas/CanvasBase.d.ts +5 -1
- package/dist/classes/canvas/CanvasBase.js +8 -1
- package/dist/classes/canvas/CanvasBase.js.map +1 -1
- package/dist/classes/canvas/CanvasBase.mjs +8 -1
- package/dist/classes/canvas/CanvasBase.mjs.map +1 -1
- package/dist/classes/canvas/CanvasContainer.d.mts +4 -1
- package/dist/classes/canvas/CanvasContainer.d.ts +4 -1
- package/dist/classes/canvas/CanvasContainer.js +67 -47
- package/dist/classes/canvas/CanvasContainer.js.map +1 -1
- package/dist/classes/canvas/CanvasContainer.mjs +67 -48
- package/dist/classes/canvas/CanvasContainer.mjs.map +1 -1
- package/dist/classes/canvas/CanvasImage.d.mts +4 -2
- package/dist/classes/canvas/CanvasImage.d.ts +4 -2
- package/dist/classes/canvas/CanvasImage.js +34 -23
- package/dist/classes/canvas/CanvasImage.js.map +1 -1
- package/dist/classes/canvas/CanvasImage.mjs +31 -23
- package/dist/classes/canvas/CanvasImage.mjs.map +1 -1
- package/dist/classes/canvas/CanvasSprite.d.mts +5 -2
- package/dist/classes/canvas/CanvasSprite.d.ts +5 -2
- package/dist/classes/canvas/CanvasSprite.js +26 -20
- package/dist/classes/canvas/CanvasSprite.js.map +1 -1
- package/dist/classes/canvas/CanvasSprite.mjs +26 -21
- package/dist/classes/canvas/CanvasSprite.mjs.map +1 -1
- package/dist/classes/canvas/CanvasText.d.mts +6 -3
- package/dist/classes/canvas/CanvasText.d.ts +6 -3
- package/dist/classes/canvas/CanvasText.js +35 -27
- package/dist/classes/canvas/CanvasText.js.map +1 -1
- package/dist/classes/canvas/CanvasText.mjs +35 -28
- package/dist/classes/canvas/CanvasText.mjs.map +1 -1
- package/dist/classes/canvas/index.js +192 -166
- package/dist/classes/canvas/index.js.map +1 -1
- package/dist/classes/canvas/index.mjs +192 -166
- package/dist/classes/canvas/index.mjs.map +1 -1
- package/dist/classes/index.d.mts +1 -0
- package/dist/classes/index.d.ts +1 -0
- package/dist/classes/index.js +118 -83
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +118 -83
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/ticker/FadeAlphaTicker.d.mts +2 -1
- package/dist/classes/ticker/FadeAlphaTicker.d.ts +2 -1
- package/dist/classes/ticker/FadeAlphaTicker.js +105 -77
- package/dist/classes/ticker/FadeAlphaTicker.js.map +1 -1
- package/dist/classes/ticker/FadeAlphaTicker.mjs +105 -77
- package/dist/classes/ticker/FadeAlphaTicker.mjs.map +1 -1
- package/dist/classes/ticker/MoveTicker.d.mts +2 -1
- package/dist/classes/ticker/MoveTicker.d.ts +2 -1
- package/dist/classes/ticker/MoveTicker.js +105 -77
- package/dist/classes/ticker/MoveTicker.js.map +1 -1
- package/dist/classes/ticker/MoveTicker.mjs +105 -77
- package/dist/classes/ticker/MoveTicker.mjs.map +1 -1
- package/dist/classes/ticker/RotateTicker.d.mts +2 -1
- package/dist/classes/ticker/RotateTicker.d.ts +2 -1
- package/dist/classes/ticker/RotateTicker.js +105 -77
- package/dist/classes/ticker/RotateTicker.js.map +1 -1
- package/dist/classes/ticker/RotateTicker.mjs +105 -77
- package/dist/classes/ticker/RotateTicker.mjs.map +1 -1
- package/dist/classes/ticker/TickerBase.d.mts +2 -1
- package/dist/classes/ticker/TickerBase.d.ts +2 -1
- package/dist/classes/ticker/TickerBase.js +6 -1
- package/dist/classes/ticker/TickerBase.js.map +1 -1
- package/dist/classes/ticker/TickerBase.mjs +6 -1
- package/dist/classes/ticker/TickerBase.mjs.map +1 -1
- package/dist/classes/ticker/ZoomTicker.d.mts +9 -3
- package/dist/classes/ticker/ZoomTicker.d.ts +9 -3
- package/dist/classes/ticker/ZoomTicker.js +120 -78
- package/dist/classes/ticker/ZoomTicker.js.map +1 -1
- package/dist/classes/ticker/ZoomTicker.mjs +118 -78
- package/dist/classes/ticker/ZoomTicker.mjs.map +1 -1
- package/dist/classes/ticker/index.d.mts +2 -1
- package/dist/classes/ticker/index.d.ts +2 -1
- package/dist/classes/ticker/index.js +242 -214
- package/dist/classes/ticker/index.js.map +1 -1
- package/dist/classes/ticker/index.mjs +242 -214
- package/dist/classes/ticker/index.mjs.map +1 -1
- package/dist/constants.d.mts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +2 -2
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +2 -2
- package/dist/constants.mjs.map +1 -1
- package/dist/decorators/CanvasElementDecorator.d.mts +3 -3
- package/dist/decorators/CanvasElementDecorator.d.ts +3 -3
- package/dist/decorators/CanvasElementDecorator.js +73 -53
- package/dist/decorators/CanvasElementDecorator.js.map +1 -1
- package/dist/decorators/CanvasElementDecorator.mjs +72 -52
- package/dist/decorators/CanvasElementDecorator.mjs.map +1 -1
- package/dist/decorators/CharacterDecorator.js +1 -1
- package/dist/decorators/CharacterDecorator.js.map +1 -1
- package/dist/decorators/CharacterDecorator.mjs +1 -1
- package/dist/decorators/CharacterDecorator.mjs.map +1 -1
- package/dist/decorators/EventDecorator.d.mts +7 -7
- package/dist/decorators/EventDecorator.d.ts +7 -7
- package/dist/decorators/EventDecorator.js +12 -11
- package/dist/decorators/EventDecorator.js.map +1 -1
- package/dist/decorators/EventDecorator.mjs +11 -10
- package/dist/decorators/EventDecorator.mjs.map +1 -1
- package/dist/decorators/LabelDecorator.js +106 -78
- package/dist/decorators/LabelDecorator.js.map +1 -1
- package/dist/decorators/LabelDecorator.mjs +106 -78
- package/dist/decorators/LabelDecorator.mjs.map +1 -1
- package/dist/decorators/TickerDecorator.d.mts +5 -5
- package/dist/decorators/TickerDecorator.d.ts +5 -5
- package/dist/decorators/TickerDecorator.js +7 -6
- package/dist/decorators/TickerDecorator.js.map +1 -1
- package/dist/decorators/TickerDecorator.mjs +7 -6
- package/dist/decorators/TickerDecorator.mjs.map +1 -1
- package/dist/decorators/index.d.mts +1 -1
- package/dist/decorators/index.d.ts +1 -1
- package/dist/decorators/index.js +108 -78
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +108 -78
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/CanvasUtility.js +66 -47
- package/dist/functions/CanvasUtility.js.map +1 -1
- package/dist/functions/CanvasUtility.mjs +66 -47
- package/dist/functions/CanvasUtility.mjs.map +1 -1
- package/dist/functions/DialogueUtility.d.mts +1 -1
- package/dist/functions/DialogueUtility.d.ts +1 -1
- package/dist/functions/DialogueUtility.js +250 -211
- package/dist/functions/DialogueUtility.js.map +1 -1
- package/dist/functions/DialogueUtility.mjs +250 -211
- package/dist/functions/DialogueUtility.mjs.map +1 -1
- package/dist/functions/DiffUtility.js +1 -1
- package/dist/functions/DiffUtility.js.map +1 -1
- package/dist/functions/DiffUtility.mjs +1 -1
- package/dist/functions/DiffUtility.mjs.map +1 -1
- package/dist/functions/EasterEgg.js +1 -1
- package/dist/functions/EasterEgg.js.map +1 -1
- package/dist/functions/EasterEgg.mjs +1 -1
- package/dist/functions/EasterEgg.mjs.map +1 -1
- package/dist/functions/ExportUtility.js +1 -1
- package/dist/functions/ExportUtility.js.map +1 -1
- package/dist/functions/ExportUtility.mjs +1 -1
- package/dist/functions/ExportUtility.mjs.map +1 -1
- package/dist/functions/FlagsUtility.js +105 -77
- package/dist/functions/FlagsUtility.js.map +1 -1
- package/dist/functions/FlagsUtility.mjs +105 -77
- package/dist/functions/FlagsUtility.mjs.map +1 -1
- package/dist/functions/GameUtility.js +105 -77
- package/dist/functions/GameUtility.js.map +1 -1
- package/dist/functions/GameUtility.mjs +105 -77
- package/dist/functions/GameUtility.mjs.map +1 -1
- package/dist/functions/ImageUtility.d.mts +35 -2
- package/dist/functions/ImageUtility.d.ts +35 -2
- package/dist/functions/ImageUtility.js +381 -196
- package/dist/functions/ImageUtility.js.map +1 -1
- package/dist/functions/ImageUtility.mjs +378 -197
- package/dist/functions/ImageUtility.mjs.map +1 -1
- package/dist/functions/SavesUtility.d.mts +2 -2
- package/dist/functions/SavesUtility.d.ts +2 -2
- package/dist/functions/SavesUtility.js +153 -83
- package/dist/functions/SavesUtility.js.map +1 -1
- package/dist/functions/SavesUtility.mjs +153 -83
- package/dist/functions/SavesUtility.mjs.map +1 -1
- package/dist/functions/StepLabelUtility.js +1 -1
- package/dist/functions/StepLabelUtility.js.map +1 -1
- package/dist/functions/StepLabelUtility.mjs +1 -1
- package/dist/functions/StepLabelUtility.mjs.map +1 -1
- package/dist/functions/TextureUtility.js +10 -8
- package/dist/functions/TextureUtility.js.map +1 -1
- package/dist/functions/TextureUtility.mjs +10 -8
- package/dist/functions/TextureUtility.mjs.map +1 -1
- package/dist/functions/TickerUtility.js +1 -1
- package/dist/functions/TickerUtility.js.map +1 -1
- package/dist/functions/TickerUtility.mjs +1 -1
- package/dist/functions/TickerUtility.mjs.map +1 -1
- package/dist/functions/index.d.mts +6 -3
- package/dist/functions/index.d.ts +6 -3
- package/dist/functions/index.js +289 -93
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +287 -95
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +758 -165
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +756 -167
- package/dist/index.mjs.map +1 -1
- package/dist/interface/CharacterBaseModelProps.js +1 -1
- package/dist/interface/CharacterBaseModelProps.js.map +1 -1
- package/dist/interface/CharacterBaseModelProps.mjs +1 -1
- package/dist/interface/CharacterBaseModelProps.mjs.map +1 -1
- package/dist/interface/DialogueHistory.js +1 -1
- package/dist/interface/DialogueHistory.js.map +1 -1
- package/dist/interface/DialogueHistory.mjs +1 -1
- package/dist/interface/DialogueHistory.mjs.map +1 -1
- package/dist/interface/IHistoryStep.d.mts +2 -2
- package/dist/interface/IHistoryStep.d.ts +2 -2
- package/dist/interface/IHistoryStep.js +1 -1
- package/dist/interface/IHistoryStep.js.map +1 -1
- package/dist/interface/IHistoryStep.mjs +1 -1
- package/dist/interface/IHistoryStep.mjs.map +1 -1
- package/dist/interface/IOpenedLabel.js +1 -1
- package/dist/interface/IOpenedLabel.js.map +1 -1
- package/dist/interface/IOpenedLabel.mjs +1 -1
- package/dist/interface/IOpenedLabel.mjs.map +1 -1
- package/dist/interface/ISaveData.d.mts +2 -2
- package/dist/interface/ISaveData.d.ts +2 -2
- package/dist/interface/ISaveData.js +1 -1
- package/dist/interface/ISaveData.js.map +1 -1
- package/dist/interface/ISaveData.mjs +1 -1
- package/dist/interface/ISaveData.mjs.map +1 -1
- package/dist/interface/ITicker.d.mts +2 -1
- package/dist/interface/ITicker.d.ts +2 -1
- package/dist/interface/ITicker.js +1 -1
- package/dist/interface/ITicker.js.map +1 -1
- package/dist/interface/ITicker.mjs +1 -1
- package/dist/interface/ITicker.mjs.map +1 -1
- package/dist/interface/ITickersSteps.d.mts +12 -3
- package/dist/interface/ITickersSteps.d.ts +12 -3
- package/dist/interface/ITickersSteps.js +1 -1
- package/dist/interface/ITickersSteps.js.map +1 -1
- package/dist/interface/ITickersSteps.mjs +1 -1
- package/dist/interface/ITickersSteps.mjs.map +1 -1
- package/dist/interface/TickerHistory.d.mts +3 -3
- package/dist/interface/TickerHistory.d.ts +3 -3
- package/dist/interface/TickerHistory.js +1 -1
- package/dist/interface/TickerHistory.js.map +1 -1
- package/dist/interface/TickerHistory.mjs +1 -1
- package/dist/interface/TickerHistory.mjs.map +1 -1
- package/dist/interface/TickerProgrationType.js +1 -1
- package/dist/interface/TickerProgrationType.js.map +1 -1
- package/dist/interface/TickerProgrationType.mjs +1 -1
- package/dist/interface/TickerProgrationType.mjs.map +1 -1
- package/dist/interface/TickerTimeoutHistory.js +1 -1
- package/dist/interface/TickerTimeoutHistory.js.map +1 -1
- package/dist/interface/TickerTimeoutHistory.mjs +1 -1
- package/dist/interface/TickerTimeoutHistory.mjs.map +1 -1
- package/dist/interface/canvas/ICanvasBaseMemory.d.mts +1 -1
- package/dist/interface/canvas/ICanvasBaseMemory.d.ts +1 -1
- package/dist/interface/canvas/ICanvasBaseMemory.js +1 -1
- package/dist/interface/canvas/ICanvasBaseMemory.js.map +1 -1
- package/dist/interface/canvas/ICanvasBaseMemory.mjs +1 -1
- package/dist/interface/canvas/ICanvasBaseMemory.mjs.map +1 -1
- package/dist/interface/canvas/ICanvasContainerMemory.js +1 -1
- package/dist/interface/canvas/ICanvasContainerMemory.js.map +1 -1
- package/dist/interface/canvas/ICanvasContainerMemory.mjs +1 -1
- package/dist/interface/canvas/ICanvasContainerMemory.mjs.map +1 -1
- package/dist/interface/canvas/ICanvasImageMemory.d.mts +2 -2
- package/dist/interface/canvas/ICanvasImageMemory.d.ts +2 -2
- package/dist/interface/canvas/ICanvasImageMemory.js +1 -1
- package/dist/interface/canvas/ICanvasImageMemory.js.map +1 -1
- package/dist/interface/canvas/ICanvasImageMemory.mjs +1 -1
- package/dist/interface/canvas/ICanvasImageMemory.mjs.map +1 -1
- package/dist/interface/canvas/ICanvasSpriteMemory.d.mts +1 -2
- package/dist/interface/canvas/ICanvasSpriteMemory.d.ts +1 -2
- package/dist/interface/canvas/ICanvasSpriteMemory.js +1 -1
- package/dist/interface/canvas/ICanvasSpriteMemory.js.map +1 -1
- package/dist/interface/canvas/ICanvasSpriteMemory.mjs +1 -1
- package/dist/interface/canvas/ICanvasSpriteMemory.mjs.map +1 -1
- package/dist/interface/canvas/ICanvasTextTextMemory.d.mts +1 -2
- package/dist/interface/canvas/ICanvasTextTextMemory.d.ts +1 -2
- package/dist/interface/canvas/ICanvasTextTextMemory.js +1 -1
- package/dist/interface/canvas/ICanvasTextTextMemory.js.map +1 -1
- package/dist/interface/canvas/ICanvasTextTextMemory.mjs +1 -1
- package/dist/interface/canvas/ICanvasTextTextMemory.mjs.map +1 -1
- package/dist/interface/canvas/ITextureMemory.js +1 -1
- package/dist/interface/canvas/ITextureMemory.js.map +1 -1
- package/dist/interface/canvas/ITextureMemory.mjs +1 -1
- package/dist/interface/canvas/ITextureMemory.mjs.map +1 -1
- package/dist/interface/canvas/index.js +1 -1
- package/dist/interface/canvas/index.js.map +1 -1
- package/dist/interface/canvas/index.mjs +1 -1
- package/dist/interface/canvas/index.mjs.map +1 -1
- package/dist/interface/export/ExportedCanvas.d.mts +2 -2
- package/dist/interface/export/ExportedCanvas.d.ts +2 -2
- package/dist/interface/export/ExportedCanvas.js +1 -1
- package/dist/interface/export/ExportedCanvas.js.map +1 -1
- package/dist/interface/export/ExportedCanvas.mjs +1 -1
- package/dist/interface/export/ExportedCanvas.mjs.map +1 -1
- package/dist/interface/export/ExportedStep.d.mts +2 -2
- package/dist/interface/export/ExportedStep.d.ts +2 -2
- package/dist/interface/export/ExportedStep.js +1 -1
- package/dist/interface/export/ExportedStep.js.map +1 -1
- package/dist/interface/export/ExportedStep.mjs +1 -1
- package/dist/interface/export/ExportedStep.mjs.map +1 -1
- package/dist/interface/export/ExportedStorage.js +1 -1
- package/dist/interface/export/ExportedStorage.js.map +1 -1
- package/dist/interface/export/ExportedStorage.mjs +1 -1
- package/dist/interface/export/ExportedStorage.mjs.map +1 -1
- package/dist/interface/export/index.d.mts +2 -2
- package/dist/interface/export/index.d.ts +2 -2
- package/dist/interface/export/index.js +1 -1
- package/dist/interface/export/index.js.map +1 -1
- package/dist/interface/export/index.mjs +1 -1
- package/dist/interface/export/index.mjs.map +1 -1
- package/dist/interface/index.d.mts +2 -2
- package/dist/interface/index.d.ts +2 -2
- package/dist/interface/index.js +1 -1
- package/dist/interface/index.js.map +1 -1
- package/dist/interface/index.mjs +1 -1
- package/dist/interface/index.mjs.map +1 -1
- package/dist/labels/BaseCanvasElementTestLabel.js +1317 -395
- package/dist/labels/BaseCanvasElementTestLabel.js.map +1 -1
- package/dist/labels/BaseCanvasElementTestLabel.mjs +1318 -396
- package/dist/labels/BaseCanvasElementTestLabel.mjs.map +1 -1
- package/dist/labels/{EventsTestLabel.d.mts → CanvasEventsTestLabel.d.mts} +4 -7
- package/dist/labels/{EventsTestLabel.d.ts → CanvasEventsTestLabel.d.ts} +4 -7
- package/dist/labels/{EventsTestLabel.js → CanvasEventsTestLabel.js} +332 -110
- package/dist/labels/CanvasEventsTestLabel.js.map +1 -0
- package/dist/labels/{EventsTestLabel.mjs → CanvasEventsTestLabel.mjs} +332 -110
- package/dist/labels/CanvasEventsTestLabel.mjs.map +1 -0
- package/dist/labels/{TintingTestLabel.d.mts → CustomTickerCanvasElementTestLabel.d.mts} +5 -4
- package/dist/labels/{TintingTestLabel.d.ts → CustomTickerCanvasElementTestLabel.d.ts} +5 -4
- package/dist/labels/{TickerTestLabel.js → CustomTickerCanvasElementTestLabel.js} +674 -490
- package/dist/labels/CustomTickerCanvasElementTestLabel.js.map +1 -0
- package/dist/labels/{TickerTestLabel.mjs → CustomTickerCanvasElementTestLabel.mjs} +675 -491
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs.map +1 -0
- package/dist/labels/{ShowImageTest.js → ImagesAnimationsTestLabel.js} +385 -94
- package/dist/labels/ImagesAnimationsTestLabel.js.map +1 -0
- package/dist/labels/{ShowImageTest.mjs → ImagesAnimationsTestLabel.mjs} +385 -94
- package/dist/labels/ImagesAnimationsTestLabel.mjs.map +1 -0
- package/dist/labels/MarkdownTest.js +162 -92
- package/dist/labels/MarkdownTest.js.map +1 -1
- package/dist/labels/MarkdownTest.mjs +162 -92
- package/dist/labels/MarkdownTest.mjs.map +1 -1
- package/dist/labels/StartLabel.js +803 -164
- package/dist/labels/StartLabel.js.map +1 -1
- package/dist/labels/StartLabel.mjs +804 -165
- package/dist/labels/StartLabel.mjs.map +1 -1
- package/dist/labels/TestConstant.d.mts +3 -1
- package/dist/labels/TestConstant.d.ts +3 -1
- package/dist/labels/TestConstant.js +109 -77
- package/dist/labels/TestConstant.js.map +1 -1
- package/dist/labels/TestConstant.mjs +108 -78
- package/dist/labels/TestConstant.mjs.map +1 -1
- package/dist/labels/index.js +803 -164
- package/dist/labels/index.js.map +1 -1
- package/dist/labels/index.mjs +804 -165
- package/dist/labels/index.mjs.map +1 -1
- package/dist/managers/StepManager.d.mts +5 -4
- package/dist/managers/StepManager.d.ts +5 -4
- package/dist/managers/StepManager.js +152 -82
- package/dist/managers/StepManager.js.map +1 -1
- package/dist/managers/StepManager.mjs +152 -82
- package/dist/managers/StepManager.mjs.map +1 -1
- package/dist/managers/StorageManager.js +1 -1
- package/dist/managers/StorageManager.js.map +1 -1
- package/dist/managers/StorageManager.mjs +1 -1
- package/dist/managers/StorageManager.mjs.map +1 -1
- package/dist/managers/WindowManager.d.mts +2 -2
- package/dist/managers/WindowManager.d.ts +2 -2
- package/dist/managers/WindowManager.js +96 -72
- package/dist/managers/WindowManager.js.map +1 -1
- package/dist/managers/WindowManager.mjs +96 -72
- package/dist/managers/WindowManager.mjs.map +1 -1
- package/dist/managers/index.d.mts +2 -2
- package/dist/managers/index.d.ts +2 -2
- package/dist/managers/index.js +152 -82
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +152 -82
- package/dist/managers/index.mjs.map +1 -1
- package/dist/override/StepLabelProps.js +1 -1
- package/dist/override/StepLabelProps.js.map +1 -1
- package/dist/override/StepLabelProps.mjs +1 -1
- package/dist/override/StepLabelProps.mjs.map +1 -1
- package/dist/override/StepLabelResult.js +1 -1
- package/dist/override/StepLabelResult.js.map +1 -1
- package/dist/override/StepLabelResult.mjs +1 -1
- package/dist/override/StepLabelResult.mjs.map +1 -1
- package/dist/override/index.js +1 -1
- package/dist/override/index.js.map +1 -1
- package/dist/override/index.mjs +1 -1
- package/dist/override/index.mjs.map +1 -1
- package/dist/types/CanvasElementTagType.js +1 -1
- package/dist/types/CanvasElementTagType.js.map +1 -1
- package/dist/types/CanvasElementTagType.mjs +1 -1
- package/dist/types/CanvasElementTagType.mjs.map +1 -1
- package/dist/types/CanvasEventNamesType.js +1 -1
- package/dist/types/CanvasEventNamesType.js.map +1 -1
- package/dist/types/CanvasEventNamesType.mjs +1 -1
- package/dist/types/CanvasEventNamesType.mjs.map +1 -1
- package/dist/types/ChoiceMenuOptionsType.js +1 -1
- package/dist/types/ChoiceMenuOptionsType.js.map +1 -1
- package/dist/types/ChoiceMenuOptionsType.mjs +1 -1
- package/dist/types/ChoiceMenuOptionsType.mjs.map +1 -1
- package/dist/types/CloseType.js +1 -1
- package/dist/types/CloseType.js.map +1 -1
- package/dist/types/CloseType.mjs +1 -1
- package/dist/types/CloseType.mjs.map +1 -1
- package/dist/types/EventIdType.js +1 -1
- package/dist/types/EventIdType.js.map +1 -1
- package/dist/types/EventIdType.mjs +1 -1
- package/dist/types/EventIdType.mjs.map +1 -1
- package/dist/types/HistoryChoiceMenuOption.js +1 -1
- package/dist/types/HistoryChoiceMenuOption.js.map +1 -1
- package/dist/types/HistoryChoiceMenuOption.mjs +1 -1
- package/dist/types/HistoryChoiceMenuOption.mjs.map +1 -1
- package/dist/types/LabelIdType.js +1 -1
- package/dist/types/LabelIdType.js.map +1 -1
- package/dist/types/LabelIdType.mjs +1 -1
- package/dist/types/LabelIdType.mjs.map +1 -1
- package/dist/types/LabelRunModeType.js +1 -1
- package/dist/types/LabelRunModeType.js.map +1 -1
- package/dist/types/LabelRunModeType.mjs +1 -1
- package/dist/types/LabelRunModeType.mjs.map +1 -1
- package/dist/types/PauseType.js +1 -1
- package/dist/types/PauseType.js.map +1 -1
- package/dist/types/PauseType.mjs +1 -1
- package/dist/types/PauseType.mjs.map +1 -1
- package/dist/types/RepeatType.js +1 -1
- package/dist/types/RepeatType.js.map +1 -1
- package/dist/types/RepeatType.mjs +1 -1
- package/dist/types/RepeatType.mjs.map +1 -1
- package/dist/types/StepHistoryDataType.js +1 -1
- package/dist/types/StepHistoryDataType.js.map +1 -1
- package/dist/types/StepHistoryDataType.mjs +1 -1
- package/dist/types/StepHistoryDataType.mjs.map +1 -1
- package/dist/types/StepLabelType.js +1 -1
- package/dist/types/StepLabelType.js.map +1 -1
- package/dist/types/StepLabelType.mjs +1 -1
- package/dist/types/StepLabelType.mjs.map +1 -1
- package/dist/types/StorageElementType.js +1 -1
- package/dist/types/StorageElementType.js.map +1 -1
- package/dist/types/StorageElementType.mjs +1 -1
- package/dist/types/StorageElementType.mjs.map +1 -1
- package/dist/types/TickerIdType.js +1 -1
- package/dist/types/TickerIdType.js.map +1 -1
- package/dist/types/TickerIdType.mjs +1 -1
- package/dist/types/TickerIdType.mjs.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/types/ticker/FadeAlphaTickerProps.js +1 -1
- package/dist/types/ticker/FadeAlphaTickerProps.js.map +1 -1
- package/dist/types/ticker/FadeAlphaTickerProps.mjs +1 -1
- package/dist/types/ticker/FadeAlphaTickerProps.mjs.map +1 -1
- package/dist/types/ticker/MoveTickerProps.d.mts +1 -1
- package/dist/types/ticker/MoveTickerProps.d.ts +1 -1
- package/dist/types/ticker/MoveTickerProps.js +1 -1
- package/dist/types/ticker/MoveTickerProps.js.map +1 -1
- package/dist/types/ticker/MoveTickerProps.mjs +1 -1
- package/dist/types/ticker/MoveTickerProps.mjs.map +1 -1
- package/dist/types/ticker/RotateTickerProps.d.mts +1 -1
- package/dist/types/ticker/RotateTickerProps.d.ts +1 -1
- package/dist/types/ticker/RotateTickerProps.js +1 -1
- package/dist/types/ticker/RotateTickerProps.js.map +1 -1
- package/dist/types/ticker/RotateTickerProps.mjs +1 -1
- package/dist/types/ticker/RotateTickerProps.mjs.map +1 -1
- package/dist/types/ticker/TagToRemoveAfterType.js +1 -1
- package/dist/types/ticker/TagToRemoveAfterType.js.map +1 -1
- package/dist/types/ticker/TagToRemoveAfterType.mjs +1 -1
- package/dist/types/ticker/TagToRemoveAfterType.mjs.map +1 -1
- package/dist/types/ticker/ZoomTickerProps.js +1 -1
- package/dist/types/ticker/ZoomTickerProps.js.map +1 -1
- package/dist/types/ticker/ZoomTickerProps.mjs +1 -1
- package/dist/types/ticker/ZoomTickerProps.mjs.map +1 -1
- package/dist/types/ticker/index.js +1 -1
- package/dist/types/ticker/index.js.map +1 -1
- package/dist/types/ticker/index.mjs +1 -1
- package/dist/types/ticker/index.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/labels/EventsTestLabel.js.map +0 -1
- package/dist/labels/EventsTestLabel.mjs.map +0 -1
- package/dist/labels/ShowImageTest.js.map +0 -1
- package/dist/labels/ShowImageTest.mjs.map +0 -1
- package/dist/labels/TickerTestLabel.d.mts +0 -9
- package/dist/labels/TickerTestLabel.d.ts +0 -9
- package/dist/labels/TickerTestLabel.js.map +0 -1
- package/dist/labels/TickerTestLabel.mjs.map +0 -1
- package/dist/labels/TintingTestLabel.js +0 -1786
- package/dist/labels/TintingTestLabel.js.map +0 -1
- package/dist/labels/TintingTestLabel.mjs +0 -1780
- package/dist/labels/TintingTestLabel.mjs.map +0 -1
- /package/dist/labels/{ShowImageTest.d.mts → ImagesAnimationsTestLabel.d.mts} +0 -0
- /package/dist/labels/{ShowImageTest.d.ts → ImagesAnimationsTestLabel.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Sprite, Container, Assets, FillGradient, Color, TextStyle, Text,
|
|
2
|
-
import 'deep-diff';
|
|
1
|
+
import { Sprite, Container, Application, Assets, FillGradient, Color, TextStyle, Text, Texture } from 'pixi.js';
|
|
2
|
+
import { diff } from 'deep-diff';
|
|
3
3
|
import sha1 from 'crypto-js/sha1';
|
|
4
4
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -50,138 +50,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
50
50
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
|
-
|
|
54
|
-
// src/decorators/CanvasElementDecorator.ts
|
|
55
|
-
var registeredCanvasElement = {};
|
|
56
|
-
function getCanvasElementInstanceByClassName(canvasName) {
|
|
57
|
-
try {
|
|
58
|
-
let eventType = registeredCanvasElement[canvasName];
|
|
59
|
-
if (!eventType) {
|
|
60
|
-
if (canvasName === "CanvasContainer") {
|
|
61
|
-
eventType = CanvasContainer;
|
|
62
|
-
} else if (canvasName === "CanvasImage") {
|
|
63
|
-
eventType = CanvasImage;
|
|
64
|
-
} else if (canvasName === "CanvasSprite") {
|
|
65
|
-
eventType = CanvasSprite;
|
|
66
|
-
} else if (canvasName === "CanvasText") {
|
|
67
|
-
eventType = CanvasText;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (!eventType) {
|
|
71
|
-
console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
let canvasElement = new eventType();
|
|
75
|
-
return canvasElement;
|
|
76
|
-
} catch (e) {
|
|
77
|
-
console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// src/functions/CanvasUtility.ts
|
|
83
|
-
function getTextureMemory(texture) {
|
|
84
|
-
let sourceTexture = texture.source;
|
|
85
|
-
let textureMemory = {
|
|
86
|
-
image: sourceTexture.label
|
|
87
|
-
};
|
|
88
|
-
return textureMemory;
|
|
89
|
-
}
|
|
90
|
-
function exportCanvasElement(element) {
|
|
91
|
-
return element.memory;
|
|
92
|
-
}
|
|
93
|
-
function importCanvasElement(memory) {
|
|
94
|
-
let element = getCanvasElementInstanceByClassName(memory.className);
|
|
95
|
-
if (element) {
|
|
96
|
-
element.memory = memory;
|
|
97
|
-
} else {
|
|
98
|
-
throw new Error("[Pixi'VN] The element " + memory.className + " could not be created");
|
|
99
|
-
}
|
|
100
|
-
return element;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// src/classes/canvas/CanvasContainer.ts
|
|
104
|
-
var CanvasContainer = class extends Container {
|
|
105
|
-
get memory() {
|
|
106
|
-
let memory = getMemoryContainer(this);
|
|
107
|
-
this.children.forEach((child) => {
|
|
108
|
-
memory.elements.push(exportCanvasElement(child));
|
|
109
|
-
});
|
|
110
|
-
return memory;
|
|
111
|
-
}
|
|
112
|
-
set memory(value) {
|
|
113
|
-
setMemoryContainer(this, value);
|
|
114
|
-
value.elements.forEach((child) => {
|
|
115
|
-
this.addChild(importCanvasElement(child));
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
function getMemoryContainer(element) {
|
|
120
|
-
return {
|
|
121
|
-
className: "CanvasContainer",
|
|
122
|
-
elements: [],
|
|
123
|
-
width: element.width,
|
|
124
|
-
height: element.height,
|
|
125
|
-
isRenderGroup: element.isRenderGroup,
|
|
126
|
-
blendMode: element.blendMode,
|
|
127
|
-
tint: element.tint,
|
|
128
|
-
alpha: element.alpha,
|
|
129
|
-
angle: element.angle,
|
|
130
|
-
renderable: element.renderable,
|
|
131
|
-
rotation: element.rotation,
|
|
132
|
-
scale: { x: element.scale.x, y: element.scale.y },
|
|
133
|
-
pivot: { x: element.pivot.x, y: element.pivot.y },
|
|
134
|
-
position: { x: element.position.x, y: element.position.y },
|
|
135
|
-
skew: { x: element.skew.x, y: element.skew.y },
|
|
136
|
-
visible: element.visible,
|
|
137
|
-
culled: element.culled,
|
|
138
|
-
x: element.x,
|
|
139
|
-
y: element.y,
|
|
140
|
-
boundsArea: element.boundsArea,
|
|
141
|
-
cursor: element.cursor,
|
|
142
|
-
eventMode: element.eventMode,
|
|
143
|
-
interactive: element.interactive,
|
|
144
|
-
interactiveChildren: element.interactiveChildren,
|
|
145
|
-
hitArea: element.hitArea
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
function setMemoryContainer(element, memory) {
|
|
149
|
-
memory.width && (element.width = memory.width);
|
|
150
|
-
memory.height && (element.height = memory.height);
|
|
151
|
-
memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
|
|
152
|
-
memory.blendMode && (element.blendMode = memory.blendMode);
|
|
153
|
-
memory.tint && (element.tint = memory.tint);
|
|
154
|
-
memory.alpha && (element.alpha = memory.alpha);
|
|
155
|
-
memory.angle && (element.angle = memory.angle);
|
|
156
|
-
memory.renderable && (element.renderable = memory.renderable);
|
|
157
|
-
memory.rotation && (element.rotation = memory.rotation);
|
|
158
|
-
if (memory.scale) {
|
|
159
|
-
if (typeof memory.scale === "number") {
|
|
160
|
-
element.scale.set(memory.scale, memory.scale);
|
|
161
|
-
} else {
|
|
162
|
-
element.scale.set(memory.scale.x, memory.scale.y);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
if (memory.pivot) {
|
|
166
|
-
if (typeof memory.pivot === "number") {
|
|
167
|
-
element.pivot.set(memory.pivot, memory.pivot);
|
|
168
|
-
} else {
|
|
169
|
-
element.pivot.set(memory.pivot.x, memory.pivot.y);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
memory.position && element.position.set(memory.position.x, memory.position.y);
|
|
173
|
-
memory.skew && element.skew.set(memory.skew.x, memory.skew.y);
|
|
174
|
-
memory.visible && (element.visible = memory.visible);
|
|
175
|
-
memory.culled && (element.culled = memory.culled);
|
|
176
|
-
memory.x && (element.x = memory.x);
|
|
177
|
-
memory.y && (element.y = memory.y);
|
|
178
|
-
memory.boundsArea && (element.boundsArea = memory.boundsArea);
|
|
179
|
-
memory.cursor && (element.cursor = memory.cursor);
|
|
180
|
-
memory.eventMode && (element.eventMode = memory.eventMode);
|
|
181
|
-
memory.interactive && (element.interactive = memory.interactive);
|
|
182
|
-
memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
|
|
183
|
-
memory.hitArea && (element.hitArea = memory.hitArea);
|
|
184
|
-
}
|
|
185
53
|
function getTexture(imageUrl) {
|
|
186
54
|
return __async(this, null, function* () {
|
|
187
55
|
if (Assets.cache.has(imageUrl)) {
|
|
@@ -203,17 +71,19 @@ function getTexture(imageUrl) {
|
|
|
203
71
|
});
|
|
204
72
|
});
|
|
205
73
|
}
|
|
206
|
-
function
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
console.warn("[Pixi'VN] CanvasText.style.fill is a FillGradient or FillPattern, this is not supported yet.", fill);
|
|
210
|
-
fill = "#00FF00";
|
|
74
|
+
function getFillGradientFillPattern(prop, propName) {
|
|
75
|
+
if (!(prop instanceof Object)) {
|
|
76
|
+
return prop;
|
|
211
77
|
}
|
|
78
|
+
console.warn(`[Pixi'VN] CanvasText.style.${propName} is a FillGradient or FillPattern, this is not supported yet.`, prop);
|
|
79
|
+
return void 0;
|
|
80
|
+
}
|
|
81
|
+
function getTextStyle(style) {
|
|
212
82
|
return {
|
|
213
83
|
align: style.align,
|
|
214
84
|
breakWords: style.breakWords,
|
|
215
85
|
dropShadow: style.dropShadow,
|
|
216
|
-
fill,
|
|
86
|
+
fill: getFillGradientFillPattern(style.stroke, "fill"),
|
|
217
87
|
fontFamily: style.fontFamily,
|
|
218
88
|
fontSize: style.fontSize,
|
|
219
89
|
fontStyle: style.fontStyle,
|
|
@@ -223,7 +93,7 @@ function getTextStyle(style) {
|
|
|
223
93
|
letterSpacing: style.letterSpacing,
|
|
224
94
|
lineHeight: style.lineHeight,
|
|
225
95
|
padding: style.padding,
|
|
226
|
-
stroke: style.stroke,
|
|
96
|
+
stroke: getFillGradientFillPattern(style.stroke, "stroke"),
|
|
227
97
|
textBaseline: style.textBaseline,
|
|
228
98
|
trim: style.trim,
|
|
229
99
|
whiteSpace: style.whiteSpace,
|
|
@@ -234,40 +104,43 @@ function getTextStyle(style) {
|
|
|
234
104
|
|
|
235
105
|
// src/decorators/EventDecorator.ts
|
|
236
106
|
var registeredEvents = {};
|
|
237
|
-
function
|
|
107
|
+
function getEventTypeById(eventId) {
|
|
238
108
|
try {
|
|
239
|
-
let eventType = registeredEvents[
|
|
109
|
+
let eventType = registeredEvents[eventId];
|
|
240
110
|
if (!eventType) {
|
|
241
|
-
console.error(`[Pixi'VN] Event ${
|
|
111
|
+
console.error(`[Pixi'VN] Event ${eventId} not found`);
|
|
242
112
|
return;
|
|
243
113
|
}
|
|
244
114
|
new eventType();
|
|
245
115
|
return eventType;
|
|
246
116
|
} catch (e) {
|
|
247
|
-
console.error(`[Pixi'VN] Error while getting Event ${
|
|
117
|
+
console.error(`[Pixi'VN] Error while getting Event ${eventId}`, e);
|
|
248
118
|
return;
|
|
249
119
|
}
|
|
250
120
|
}
|
|
251
|
-
function
|
|
121
|
+
function getEventInstanceById(eventId) {
|
|
252
122
|
try {
|
|
253
|
-
let eventType = registeredEvents[
|
|
123
|
+
let eventType = registeredEvents[eventId];
|
|
254
124
|
if (!eventType) {
|
|
255
|
-
console.error(`[Pixi'VN] Event ${
|
|
125
|
+
console.error(`[Pixi'VN] Event ${eventId} not found`);
|
|
256
126
|
return;
|
|
257
127
|
}
|
|
258
128
|
let event = new eventType();
|
|
259
129
|
return event;
|
|
260
130
|
} catch (e) {
|
|
261
|
-
console.error(`[Pixi'VN] Error while getting Event ${
|
|
131
|
+
console.error(`[Pixi'VN] Error while getting Event ${eventId}`, e);
|
|
262
132
|
return;
|
|
263
133
|
}
|
|
264
134
|
}
|
|
265
135
|
|
|
266
136
|
// src/classes/canvas/CanvasSprite.ts
|
|
137
|
+
var CANVAS_SPRITE_ID = "CanvasSprite";
|
|
267
138
|
var CanvasSprite = class _CanvasSprite extends Sprite {
|
|
268
|
-
constructor() {
|
|
269
|
-
super(
|
|
139
|
+
constructor(options) {
|
|
140
|
+
super(options);
|
|
141
|
+
this.pixivnId = CANVAS_SPRITE_ID;
|
|
270
142
|
this._onEvents = {};
|
|
143
|
+
this.pixivnId = this.constructor.prototype.pixivnId || CANVAS_SPRITE_ID;
|
|
271
144
|
}
|
|
272
145
|
get memory() {
|
|
273
146
|
return getMemorySprite(this);
|
|
@@ -308,9 +181,9 @@ var CanvasSprite = class _CanvasSprite extends Sprite {
|
|
|
308
181
|
* ```
|
|
309
182
|
*/
|
|
310
183
|
onEvent(event, eventClass) {
|
|
311
|
-
let
|
|
312
|
-
let instance =
|
|
313
|
-
this._onEvents[event] =
|
|
184
|
+
let id = eventClass.prototype.id;
|
|
185
|
+
let instance = getEventInstanceById(id);
|
|
186
|
+
this._onEvents[event] = id;
|
|
314
187
|
if (instance) {
|
|
315
188
|
super.on(event, () => {
|
|
316
189
|
instance.fn(event, this);
|
|
@@ -339,7 +212,7 @@ var CanvasSprite = class _CanvasSprite extends Sprite {
|
|
|
339
212
|
function getMemorySprite(element) {
|
|
340
213
|
let temp = getMemoryContainer(element);
|
|
341
214
|
return __spreadProps(__spreadValues({}, temp), {
|
|
342
|
-
|
|
215
|
+
pixivnId: element.pixivnId,
|
|
343
216
|
textureImage: getTextureMemory(element.texture),
|
|
344
217
|
anchor: { x: element.anchor.x, y: element.anchor.y },
|
|
345
218
|
roundPixels: element.roundPixels,
|
|
@@ -362,8 +235,8 @@ function setMemorySprite(element, memory) {
|
|
|
362
235
|
}
|
|
363
236
|
memory.roundPixels && (element.roundPixels = memory.roundPixels);
|
|
364
237
|
for (let event in memory.onEvents) {
|
|
365
|
-
let
|
|
366
|
-
let instance =
|
|
238
|
+
let id = memory.onEvents[event];
|
|
239
|
+
let instance = getEventTypeById(id);
|
|
367
240
|
if (instance) {
|
|
368
241
|
element.onEvent(event, instance);
|
|
369
242
|
}
|
|
@@ -371,9 +244,11 @@ function setMemorySprite(element, memory) {
|
|
|
371
244
|
}
|
|
372
245
|
|
|
373
246
|
// src/classes/canvas/CanvasImage.ts
|
|
247
|
+
var CANVAS_IMAGE_ID = "CanvasImage";
|
|
374
248
|
var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
375
249
|
constructor(options, imageLink) {
|
|
376
250
|
super(options);
|
|
251
|
+
this.pixivnId = CANVAS_IMAGE_ID;
|
|
377
252
|
this.imageLink = "";
|
|
378
253
|
if (imageLink) {
|
|
379
254
|
this.imageLink = imageLink;
|
|
@@ -381,12 +256,13 @@ var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
|
381
256
|
}
|
|
382
257
|
get memory() {
|
|
383
258
|
return __spreadProps(__spreadValues({}, getMemorySprite(this)), {
|
|
384
|
-
|
|
385
|
-
|
|
259
|
+
pixivnId: this.pixivnId,
|
|
260
|
+
imageLink: this.imageLink
|
|
386
261
|
});
|
|
387
262
|
}
|
|
388
263
|
set memory(memory) {
|
|
389
264
|
setMemorySprite(this, memory);
|
|
265
|
+
this.imageLink = memory.imageLink;
|
|
390
266
|
}
|
|
391
267
|
static from(source, skipCache) {
|
|
392
268
|
let sprite = Sprite.from(source, skipCache);
|
|
@@ -414,10 +290,13 @@ var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
|
414
290
|
});
|
|
415
291
|
}
|
|
416
292
|
};
|
|
293
|
+
var CANVAS_TEXT_ID = "CanvasText";
|
|
417
294
|
var CanvasText = class extends Text {
|
|
418
|
-
constructor() {
|
|
419
|
-
super(
|
|
295
|
+
constructor(options) {
|
|
296
|
+
super(options);
|
|
297
|
+
this.pixivnId = CANVAS_TEXT_ID;
|
|
420
298
|
this._onEvents = {};
|
|
299
|
+
this.pixivnId = this.constructor.prototype.pixivnId || CANVAS_TEXT_ID;
|
|
421
300
|
}
|
|
422
301
|
get memory() {
|
|
423
302
|
return getMemoryText(this);
|
|
@@ -458,9 +337,9 @@ var CanvasText = class extends Text {
|
|
|
458
337
|
* ```
|
|
459
338
|
*/
|
|
460
339
|
onEvent(event, eventClass) {
|
|
461
|
-
let
|
|
462
|
-
let instance =
|
|
463
|
-
this._onEvents[event] =
|
|
340
|
+
let id = eventClass.prototype.id;
|
|
341
|
+
let instance = getEventInstanceById(id);
|
|
342
|
+
this._onEvents[event] = id;
|
|
464
343
|
if (instance) {
|
|
465
344
|
super.on(event, () => {
|
|
466
345
|
instance.fn(event, this);
|
|
@@ -483,7 +362,7 @@ var CanvasText = class extends Text {
|
|
|
483
362
|
function getMemoryText(element) {
|
|
484
363
|
let temp = getMemoryContainer(element);
|
|
485
364
|
return __spreadProps(__spreadValues({}, temp), {
|
|
486
|
-
|
|
365
|
+
pixivnId: element.pixivnId,
|
|
487
366
|
anchor: { x: element.anchor.x, y: element.anchor.y },
|
|
488
367
|
text: element.text,
|
|
489
368
|
resolution: element.resolution,
|
|
@@ -506,13 +385,170 @@ function setMemoryText(element, memory) {
|
|
|
506
385
|
memory.style && (element.style = memory.style);
|
|
507
386
|
memory.roundPixels && (element.roundPixels = memory.roundPixels);
|
|
508
387
|
for (let event in memory.onEvents) {
|
|
509
|
-
let
|
|
510
|
-
let instance =
|
|
388
|
+
let id = memory.onEvents[event];
|
|
389
|
+
let instance = getEventTypeById(id);
|
|
511
390
|
if (instance) {
|
|
512
391
|
element.onEvent(event, instance);
|
|
513
392
|
}
|
|
514
393
|
}
|
|
515
394
|
}
|
|
395
|
+
|
|
396
|
+
// src/decorators/CanvasElementDecorator.ts
|
|
397
|
+
var registeredCanvasElement = {};
|
|
398
|
+
function getCanvasElementInstanceById(canvasId) {
|
|
399
|
+
try {
|
|
400
|
+
let eventType = registeredCanvasElement[canvasId];
|
|
401
|
+
if (!eventType) {
|
|
402
|
+
if (canvasId === CANVAS_CONTAINER_ID) {
|
|
403
|
+
eventType = CanvasContainer;
|
|
404
|
+
} else if (canvasId === CANVAS_IMAGE_ID) {
|
|
405
|
+
eventType = CanvasImage;
|
|
406
|
+
} else if (canvasId === CANVAS_SPRITE_ID) {
|
|
407
|
+
eventType = CanvasSprite;
|
|
408
|
+
} else if (canvasId === CANVAS_TEXT_ID) {
|
|
409
|
+
eventType = CanvasText;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (!eventType) {
|
|
413
|
+
console.error(`[Pixi'VN] CanvasElement ${canvasId} not found`);
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
let canvasElement = new eventType();
|
|
417
|
+
return canvasElement;
|
|
418
|
+
} catch (e) {
|
|
419
|
+
console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasId}`, e);
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// src/functions/CanvasUtility.ts
|
|
425
|
+
function getTextureMemory(texture) {
|
|
426
|
+
let sourceTexture = texture.source;
|
|
427
|
+
let textureMemory = {
|
|
428
|
+
image: sourceTexture.label
|
|
429
|
+
};
|
|
430
|
+
return textureMemory;
|
|
431
|
+
}
|
|
432
|
+
function exportCanvasElement(element) {
|
|
433
|
+
return element.memory;
|
|
434
|
+
}
|
|
435
|
+
function importCanvasElement(memory) {
|
|
436
|
+
let element = getCanvasElementInstanceById(memory.pixivnId);
|
|
437
|
+
if (element) {
|
|
438
|
+
element.memory = memory;
|
|
439
|
+
} else {
|
|
440
|
+
throw new Error("[Pixi'VN] The element " + memory.pixivnId + " could not be created");
|
|
441
|
+
}
|
|
442
|
+
return element;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// src/classes/canvas/CanvasContainer.ts
|
|
446
|
+
var CANVAS_CONTAINER_ID = "CanvasContainer";
|
|
447
|
+
var CanvasContainer = class extends Container {
|
|
448
|
+
constructor(options) {
|
|
449
|
+
super(options);
|
|
450
|
+
this.pixivnId = CANVAS_CONTAINER_ID;
|
|
451
|
+
this.pixivnId = this.constructor.prototype.pixivnId || CANVAS_CONTAINER_ID;
|
|
452
|
+
}
|
|
453
|
+
get memory() {
|
|
454
|
+
let memory = getMemoryContainer(this);
|
|
455
|
+
this.children.forEach((child) => {
|
|
456
|
+
memory.elements.push(exportCanvasElement(child));
|
|
457
|
+
});
|
|
458
|
+
return memory;
|
|
459
|
+
}
|
|
460
|
+
set memory(value) {
|
|
461
|
+
setMemoryContainer(this, value);
|
|
462
|
+
value.elements.forEach((child) => {
|
|
463
|
+
this.addChild(importCanvasElement(child));
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
function getMemoryContainer(element) {
|
|
468
|
+
let className = "CanvasContainer";
|
|
469
|
+
if (element.hasOwnProperty("pixivnId")) {
|
|
470
|
+
className = element.pixivnId;
|
|
471
|
+
}
|
|
472
|
+
return {
|
|
473
|
+
pixivnId: className,
|
|
474
|
+
elements: [],
|
|
475
|
+
width: element.width,
|
|
476
|
+
height: element.height,
|
|
477
|
+
isRenderGroup: element.isRenderGroup,
|
|
478
|
+
blendMode: element.blendMode,
|
|
479
|
+
tint: element.tint,
|
|
480
|
+
alpha: element.alpha,
|
|
481
|
+
angle: element.angle,
|
|
482
|
+
renderable: element.renderable,
|
|
483
|
+
rotation: element.rotation,
|
|
484
|
+
scale: { x: element.scale.x, y: element.scale.y },
|
|
485
|
+
pivot: { x: element.pivot.x, y: element.pivot.y },
|
|
486
|
+
position: { x: element.position.x, y: element.position.y },
|
|
487
|
+
skew: { x: element.skew.x, y: element.skew.y },
|
|
488
|
+
visible: element.visible,
|
|
489
|
+
x: element.x,
|
|
490
|
+
y: element.y,
|
|
491
|
+
boundsArea: element.boundsArea,
|
|
492
|
+
cursor: element.cursor,
|
|
493
|
+
eventMode: element.eventMode,
|
|
494
|
+
interactive: element.interactive,
|
|
495
|
+
interactiveChildren: element.interactiveChildren,
|
|
496
|
+
hitArea: element.hitArea
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
function setMemoryContainer(element, memory) {
|
|
500
|
+
memory.width && (element.width = memory.width);
|
|
501
|
+
memory.height && (element.height = memory.height);
|
|
502
|
+
memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
|
|
503
|
+
memory.blendMode && (element.blendMode = memory.blendMode);
|
|
504
|
+
memory.tint && (element.tint = memory.tint);
|
|
505
|
+
memory.alpha && (element.alpha = memory.alpha);
|
|
506
|
+
memory.angle && (element.angle = memory.angle);
|
|
507
|
+
memory.renderable && (element.renderable = memory.renderable);
|
|
508
|
+
memory.rotation && (element.rotation = memory.rotation);
|
|
509
|
+
if (memory.scale) {
|
|
510
|
+
if (typeof memory.scale === "number") {
|
|
511
|
+
element.scale.set(memory.scale, memory.scale);
|
|
512
|
+
} else {
|
|
513
|
+
element.scale.set(memory.scale.x, memory.scale.y);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
if (memory.pivot) {
|
|
517
|
+
if (typeof memory.pivot === "number") {
|
|
518
|
+
element.pivot.set(memory.pivot, memory.pivot);
|
|
519
|
+
} else {
|
|
520
|
+
element.pivot.set(memory.pivot.x, memory.pivot.y);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
memory.position && element.position.set(memory.position.x, memory.position.y);
|
|
524
|
+
memory.skew && element.skew.set(memory.skew.x, memory.skew.y);
|
|
525
|
+
memory.visible && (element.visible = memory.visible);
|
|
526
|
+
memory.x && (element.x = memory.x);
|
|
527
|
+
memory.y && (element.y = memory.y);
|
|
528
|
+
memory.boundsArea && (element.boundsArea = memory.boundsArea);
|
|
529
|
+
memory.cursor && (element.cursor = memory.cursor);
|
|
530
|
+
memory.eventMode && (element.eventMode = memory.eventMode);
|
|
531
|
+
memory.interactive && (element.interactive = memory.interactive);
|
|
532
|
+
memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
|
|
533
|
+
memory.hitArea && (element.hitArea = memory.hitArea);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
// src/decorators/CharacterDecorator.ts
|
|
537
|
+
var registeredCharacters = {};
|
|
538
|
+
function saveCharacter(character) {
|
|
539
|
+
if (Array.isArray(character)) {
|
|
540
|
+
character.forEach((c) => saveCharacter(c));
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
if (registeredCharacters[character.id]) {
|
|
544
|
+
console.info(`[Pixi'VN] Character id ${character.id} already exists, it will be overwritten`);
|
|
545
|
+
}
|
|
546
|
+
registeredCharacters[character.id] = character;
|
|
547
|
+
}
|
|
548
|
+
function getStepSha1(step) {
|
|
549
|
+
let sha1String = sha1(step.toString().toLocaleLowerCase());
|
|
550
|
+
return sha1String.toString();
|
|
551
|
+
}
|
|
516
552
|
function checkIfStepsIsEqual(step1, step2) {
|
|
517
553
|
return step1 === step2;
|
|
518
554
|
}
|
|
@@ -532,7 +568,7 @@ var Label = class {
|
|
|
532
568
|
this._choiseIndex = choiseIndex;
|
|
533
569
|
}
|
|
534
570
|
/**
|
|
535
|
-
* Get the id of the label
|
|
571
|
+
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
536
572
|
*/
|
|
537
573
|
get id() {
|
|
538
574
|
return this._id;
|
|
@@ -583,11 +619,237 @@ var Label = class {
|
|
|
583
619
|
return this._choiseIndex;
|
|
584
620
|
}
|
|
585
621
|
};
|
|
586
|
-
|
|
587
|
-
|
|
622
|
+
|
|
623
|
+
// src/classes/CloseLabel.ts
|
|
624
|
+
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
625
|
+
function newCloseLabel(choiseIndex) {
|
|
626
|
+
return new Label(CLOSE_LABEL_ID, [], void 0, choiseIndex);
|
|
588
627
|
}
|
|
589
628
|
|
|
590
|
-
// src/
|
|
629
|
+
// src/types/CloseType.ts
|
|
630
|
+
var Close = "close";
|
|
631
|
+
|
|
632
|
+
// src/functions/DialogueUtility.ts
|
|
633
|
+
function setDialogue(props) {
|
|
634
|
+
let text = "";
|
|
635
|
+
let character = void 0;
|
|
636
|
+
let dialogue;
|
|
637
|
+
if (typeof props === "string") {
|
|
638
|
+
text = props;
|
|
639
|
+
dialogue = new DialogueBaseModel(text, character);
|
|
640
|
+
} else if (!(props instanceof DialogueBaseModel)) {
|
|
641
|
+
text = props.text;
|
|
642
|
+
if (props.character) {
|
|
643
|
+
if (typeof props.character === "string") {
|
|
644
|
+
character = props.character;
|
|
645
|
+
} else {
|
|
646
|
+
character = props.character.id;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
dialogue = new DialogueBaseModel(text, character);
|
|
650
|
+
} else {
|
|
651
|
+
dialogue = props;
|
|
652
|
+
}
|
|
653
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY, dialogue);
|
|
654
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex);
|
|
655
|
+
}
|
|
656
|
+
function getDialogue() {
|
|
657
|
+
return GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY);
|
|
658
|
+
}
|
|
659
|
+
function getChoiceMenuOptions() {
|
|
660
|
+
let d = GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY);
|
|
661
|
+
if (d) {
|
|
662
|
+
let options = [];
|
|
663
|
+
d.forEach((option, index) => {
|
|
664
|
+
if (option.type === Close) {
|
|
665
|
+
let itemLabel = newCloseLabel(index);
|
|
666
|
+
options.push({
|
|
667
|
+
text: option.text,
|
|
668
|
+
label: itemLabel,
|
|
669
|
+
type: Close,
|
|
670
|
+
closeCurrentLabel: option.closeCurrentLabel,
|
|
671
|
+
props: {}
|
|
672
|
+
});
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
let label = getLabelById(option.label);
|
|
676
|
+
if (label) {
|
|
677
|
+
let itemLabel = new Label(label.id, label.steps, label.onStepRun, index);
|
|
678
|
+
options.push(__spreadProps(__spreadValues({}, option), {
|
|
679
|
+
label: itemLabel
|
|
680
|
+
}));
|
|
681
|
+
}
|
|
682
|
+
});
|
|
683
|
+
return options;
|
|
684
|
+
}
|
|
685
|
+
return void 0;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
// src/functions/TickerUtility.ts
|
|
689
|
+
function updateTickerProgression(args, propertyName, progression) {
|
|
690
|
+
if (args[propertyName] === void 0 || !progression || args[propertyName] === progression.limit) {
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
if (typeof args[propertyName] === "number") {
|
|
694
|
+
if (progression.type === "linear") {
|
|
695
|
+
args[propertyName] = getLinearProgression(args[propertyName], progression);
|
|
696
|
+
} else if (progression.type === "exponential") {
|
|
697
|
+
args[propertyName] = getExponentialProgression(args[propertyName], progression);
|
|
698
|
+
}
|
|
699
|
+
} else if (args[propertyName] !== void 0 && typeof args[propertyName] === "object" && args[propertyName].haveOwnProperty("x") && args[propertyName].haveOwnProperty("y") && typeof args[propertyName].x === "number" && typeof args[propertyName].y === "number") {
|
|
700
|
+
if (progression.type === "linear") {
|
|
701
|
+
args[propertyName].x = getLinearProgression(args[propertyName].x, progression);
|
|
702
|
+
args[propertyName].y = getLinearProgression(args[propertyName].y, progression);
|
|
703
|
+
} else if (progression.type === "exponential") {
|
|
704
|
+
args[propertyName].x = getExponentialProgression(args[propertyName].x, progression);
|
|
705
|
+
args[propertyName].y = getExponentialProgression(args[propertyName].y, progression);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
function getLinearProgression(number, progression) {
|
|
710
|
+
if (progression.limit !== void 0) {
|
|
711
|
+
if (number > progression.limit && progression.amt > 0) {
|
|
712
|
+
return progression.limit;
|
|
713
|
+
} else if (number < progression.limit && progression.amt < 0) {
|
|
714
|
+
return progression.limit;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
return number + progression.amt / 60;
|
|
718
|
+
}
|
|
719
|
+
function getExponentialProgression(number, progression) {
|
|
720
|
+
if (progression.limit !== void 0) {
|
|
721
|
+
if (number > progression.limit && progression.percentage > 0) {
|
|
722
|
+
return progression.limit;
|
|
723
|
+
} else if (number < progression.limit && progression.percentage < 0) {
|
|
724
|
+
return progression.limit;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
return number + number * progression.percentage;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// src/classes/ticker/TickerBase.ts
|
|
731
|
+
var TickerBase = class {
|
|
732
|
+
/**
|
|
733
|
+
* @param args The arguments that you want to pass to the ticker.
|
|
734
|
+
* @param duration The duration of the ticker in seconds. If is undefined, the step will end only when the animation is finished (if the animation doesn't have a goal to reach then it won't finish). @default undefined
|
|
735
|
+
* @param priority The priority of the ticker. @default UPDATE_PRIORITY.NORMAL
|
|
736
|
+
*/
|
|
737
|
+
constructor(args, duration, priority) {
|
|
738
|
+
/**
|
|
739
|
+
* Get the id of the ticker. This variable is used in the system to get the ticker by id, {@link geTickerInstanceById}
|
|
740
|
+
*/
|
|
741
|
+
this.id = "ticker_id_not_set";
|
|
742
|
+
this.args = args;
|
|
743
|
+
this.duration = duration;
|
|
744
|
+
this.priority = priority;
|
|
745
|
+
this.id = this.constructor.prototype.id;
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* The method that will be called every frame.
|
|
749
|
+
* This method should be overridden and you can use GameWindowManager.addCanvasElement() to get the canvas element of the canvas, and edit them.
|
|
750
|
+
* @param _ticker The ticker that is calling this method
|
|
751
|
+
* @param _args The arguments that you passed when you added the ticker
|
|
752
|
+
* @param _tags The tags of the canvas elements that are connected to this ticker
|
|
753
|
+
* @param _tickerId The id of the ticker. You can use this to get the ticker from the {@link GameWindowManager.currentTickers}
|
|
754
|
+
*/
|
|
755
|
+
fn(_ticker, _args, _tags, _tickerId) {
|
|
756
|
+
throw new Error("[Pixi'VN] The method TickerBase.fn() must be overridden");
|
|
757
|
+
}
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
// src/classes/ticker/ZoomTicker.ts
|
|
761
|
+
var ZoomTicker = class extends TickerBase {
|
|
762
|
+
fn(ticker, args, tags, tickerId) {
|
|
763
|
+
let xSpeed = 0.1;
|
|
764
|
+
let ySpeed = 0.1;
|
|
765
|
+
if (args.speed) {
|
|
766
|
+
if (typeof args.speed === "number") {
|
|
767
|
+
xSpeed = args.speed;
|
|
768
|
+
ySpeed = args.speed;
|
|
769
|
+
} else {
|
|
770
|
+
xSpeed = args.speed.x;
|
|
771
|
+
ySpeed = args.speed.y;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
xSpeed /= 60;
|
|
775
|
+
ySpeed /= 60;
|
|
776
|
+
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
777
|
+
if (typeof tagToRemoveAfter2 === "string") {
|
|
778
|
+
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
779
|
+
}
|
|
780
|
+
let type = args.type || "zoom";
|
|
781
|
+
let xLimit = type === "zoom" ? Infinity : 0;
|
|
782
|
+
let yLimit = type === "zoom" ? Infinity : 0;
|
|
783
|
+
if (args.limit) {
|
|
784
|
+
if (typeof args.limit === "number") {
|
|
785
|
+
xLimit = args.limit;
|
|
786
|
+
yLimit = args.limit;
|
|
787
|
+
} else {
|
|
788
|
+
xLimit = args.limit.x;
|
|
789
|
+
yLimit = args.limit.y;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
tags.filter((tag) => {
|
|
793
|
+
var _a;
|
|
794
|
+
let element = GameWindowManager.getCanvasElement(tag);
|
|
795
|
+
if (args.startOnlyIfHaveTexture) {
|
|
796
|
+
if (element && element instanceof Sprite && ((_a = element.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
797
|
+
return false;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
return true;
|
|
801
|
+
}).forEach((tag) => {
|
|
802
|
+
let element = GameWindowManager.getCanvasElement(tag);
|
|
803
|
+
if (element && element instanceof Container) {
|
|
804
|
+
if (type === "zoom" && (element.scale.x < xLimit || element.scale.y < yLimit)) {
|
|
805
|
+
element.scale.x += xSpeed * ticker.deltaTime;
|
|
806
|
+
element.scale.y += ySpeed * ticker.deltaTime;
|
|
807
|
+
} else if (type === "unzoom" && (element.scale.x > xLimit || element.scale.y > yLimit)) {
|
|
808
|
+
element.scale.x -= xSpeed * ticker.deltaTime;
|
|
809
|
+
element.scale.y -= ySpeed * ticker.deltaTime;
|
|
810
|
+
}
|
|
811
|
+
if (type === "zoom") {
|
|
812
|
+
if (element.scale.x > xLimit) {
|
|
813
|
+
element.scale.x = xLimit;
|
|
814
|
+
}
|
|
815
|
+
if (element.scale.y > yLimit) {
|
|
816
|
+
element.scale.y = yLimit;
|
|
817
|
+
}
|
|
818
|
+
if (element.scale.x >= xLimit && element.scale.y >= yLimit) {
|
|
819
|
+
element.scale.x = xLimit;
|
|
820
|
+
element.scale.y = yLimit;
|
|
821
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
822
|
+
}
|
|
823
|
+
} else if (type === "unzoom") {
|
|
824
|
+
if (element.scale.x < xLimit) {
|
|
825
|
+
element.scale.x = xLimit;
|
|
826
|
+
}
|
|
827
|
+
if (element.scale.y < yLimit) {
|
|
828
|
+
element.scale.y = yLimit;
|
|
829
|
+
}
|
|
830
|
+
if (element.scale.x <= xLimit && element.scale.y <= yLimit) {
|
|
831
|
+
element.scale.x = xLimit;
|
|
832
|
+
element.scale.y = yLimit;
|
|
833
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
if (xSpeed < 1e-5 && ySpeed < 1e-5 && !(args.speedProgression && args.speedProgression.type == "linear" && args.speedProgression.amt != 0)) {
|
|
837
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
if (args.speedProgression)
|
|
842
|
+
updateTickerProgression(args, "speed", args.speedProgression);
|
|
843
|
+
}
|
|
844
|
+
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
845
|
+
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
ZoomTicker = __decorateClass([
|
|
849
|
+
tickerDecorator()
|
|
850
|
+
], ZoomTicker);
|
|
851
|
+
|
|
852
|
+
// src/constants.ts
|
|
591
853
|
var Repeat = "repeat";
|
|
592
854
|
|
|
593
855
|
// src/functions/ImageUtility.ts
|
|
@@ -606,6 +868,47 @@ function createExportableElement(element) {
|
|
|
606
868
|
}
|
|
607
869
|
}
|
|
608
870
|
|
|
871
|
+
// src/functions/DiffUtility.ts
|
|
872
|
+
function restoreDeepDiffChanges(data, differences) {
|
|
873
|
+
let result = createExportableElement(data);
|
|
874
|
+
differences.forEach((diff2) => {
|
|
875
|
+
let dataToEdit = result;
|
|
876
|
+
if (diff2.path && diff2.path.length > 0) {
|
|
877
|
+
diff2.path.forEach((path, index) => {
|
|
878
|
+
if (diff2.path && index === diff2.path.length - 1) {
|
|
879
|
+
if (diff2.kind === "E" || diff2.kind === "D") {
|
|
880
|
+
dataToEdit[path] = diff2.lhs;
|
|
881
|
+
} else if (diff2.kind === "N") {
|
|
882
|
+
if (Number.isInteger(path)) {
|
|
883
|
+
if (Array.isArray(dataToEdit)) {
|
|
884
|
+
dataToEdit.splice(path, 1);
|
|
885
|
+
}
|
|
886
|
+
} else if (typeof path === "string") {
|
|
887
|
+
delete dataToEdit[path];
|
|
888
|
+
}
|
|
889
|
+
} else if (diff2.kind === "A") {
|
|
890
|
+
let index2 = diff2.index;
|
|
891
|
+
if (diff2.item.kind === "N") {
|
|
892
|
+
dataToEdit[path].splice(index2, 1);
|
|
893
|
+
} else if (diff2.item.kind === "E" || diff2.item.kind === "D") {
|
|
894
|
+
dataToEdit[path][index2] = diff2.item.lhs;
|
|
895
|
+
} else if (diff2.item.kind === "A") {
|
|
896
|
+
console.warn("[Pixi'VN] Nested array found, skipping diff", diff2);
|
|
897
|
+
} else {
|
|
898
|
+
console.warn("[Pixi'VN] No array found, skipping diff", diff2);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
} else {
|
|
902
|
+
dataToEdit = dataToEdit[path];
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
} else {
|
|
906
|
+
console.warn("[Pixi'VN] No path found, skipping diff", diff2);
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
return result;
|
|
910
|
+
}
|
|
911
|
+
|
|
609
912
|
// src/managers/StorageManager.ts
|
|
610
913
|
var _GameStorageManager = class _GameStorageManager {
|
|
611
914
|
constructor() {
|
|
@@ -691,31 +994,6 @@ var _GameStorageManager = class _GameStorageManager {
|
|
|
691
994
|
_GameStorageManager.storage = {};
|
|
692
995
|
var GameStorageManager = _GameStorageManager;
|
|
693
996
|
|
|
694
|
-
// src/classes/ticker/TickerBase.ts
|
|
695
|
-
var TickerBase = class {
|
|
696
|
-
/**
|
|
697
|
-
* @param args The arguments that you want to pass to the ticker.
|
|
698
|
-
* @param duration The duration of the ticker in seconds. If is undefined, the step will end only when the animation is finished (if the animation doesn't have a goal to reach then it won't finish). @default undefined
|
|
699
|
-
* @param priority The priority of the ticker. @default UPDATE_PRIORITY.NORMAL
|
|
700
|
-
*/
|
|
701
|
-
constructor(args, duration, priority) {
|
|
702
|
-
this.args = args;
|
|
703
|
-
this.duration = duration;
|
|
704
|
-
this.priority = priority;
|
|
705
|
-
}
|
|
706
|
-
/**
|
|
707
|
-
* The method that will be called every frame.
|
|
708
|
-
* This method should be overridden and you can use GameWindowManager.addCanvasElement() to get the canvas element of the canvas, and edit them.
|
|
709
|
-
* @param _ticker The ticker that is calling this method
|
|
710
|
-
* @param _args The arguments that you passed when you added the ticker
|
|
711
|
-
* @param _tags The tags of the canvas elements that are connected to this ticker
|
|
712
|
-
* @param _tickerId The id of the ticker. You can use this to get the ticker from the {@link GameWindowManager.currentTickers}
|
|
713
|
-
*/
|
|
714
|
-
fn(_ticker, _args, _tags, _tickerId) {
|
|
715
|
-
throw new Error("[Pixi'VN] The method TickerBase.fn() must be overridden");
|
|
716
|
-
}
|
|
717
|
-
};
|
|
718
|
-
|
|
719
997
|
// src/decorators/TickerDecorator.ts
|
|
720
998
|
var registeredTickers = {};
|
|
721
999
|
function tickerDecorator(name) {
|
|
@@ -726,19 +1004,20 @@ function tickerDecorator(name) {
|
|
|
726
1004
|
if (registeredTickers[name]) {
|
|
727
1005
|
console.info(`[Pixi'VN] Ticker ${name} already exists, it will be overwritten`);
|
|
728
1006
|
}
|
|
1007
|
+
target.prototype.id = name;
|
|
729
1008
|
registeredTickers[name] = target;
|
|
730
1009
|
};
|
|
731
1010
|
}
|
|
732
|
-
function
|
|
1011
|
+
function geTickerInstanceById(tickerId, args, duration, priority) {
|
|
733
1012
|
try {
|
|
734
|
-
let ticker = registeredTickers[
|
|
1013
|
+
let ticker = registeredTickers[tickerId];
|
|
735
1014
|
if (!ticker) {
|
|
736
|
-
console.error(`[Pixi'VN] Ticker ${
|
|
1015
|
+
console.error(`[Pixi'VN] Ticker ${tickerId} not found`);
|
|
737
1016
|
return;
|
|
738
1017
|
}
|
|
739
1018
|
return new ticker(args, duration, priority);
|
|
740
1019
|
} catch (e) {
|
|
741
|
-
console.error(`[Pixi'VN] Error while getting Ticker ${
|
|
1020
|
+
console.error(`[Pixi'VN] Error while getting Ticker ${tickerId}`, e);
|
|
742
1021
|
return;
|
|
743
1022
|
}
|
|
744
1023
|
}
|
|
@@ -810,7 +1089,7 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
810
1089
|
height
|
|
811
1090
|
}, options)).then(() => {
|
|
812
1091
|
_GameWindowManager._isInitialized = true;
|
|
813
|
-
this.
|
|
1092
|
+
this.addCanvasIntoHTMLElement(element);
|
|
814
1093
|
window.addEventListener("resize", _GameWindowManager.resize);
|
|
815
1094
|
_GameWindowManager.resize();
|
|
816
1095
|
asciiArtLog();
|
|
@@ -821,7 +1100,7 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
821
1100
|
* Add the canvas into a html element.
|
|
822
1101
|
* @param element it is the html element where I will put the canvas. Example: document.body
|
|
823
1102
|
*/
|
|
824
|
-
static
|
|
1103
|
+
static addCanvasIntoHTMLElement(element) {
|
|
825
1104
|
if (_GameWindowManager.isInitialized) {
|
|
826
1105
|
element.appendChild(_GameWindowManager.app.canvas);
|
|
827
1106
|
} else {
|
|
@@ -1067,18 +1346,18 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1067
1346
|
* ```
|
|
1068
1347
|
*/
|
|
1069
1348
|
static addTicker(canvasElementTag, ticker) {
|
|
1070
|
-
let
|
|
1349
|
+
let tickerId = ticker.id;
|
|
1071
1350
|
if (typeof canvasElementTag === "string") {
|
|
1072
1351
|
canvasElementTag = [canvasElementTag];
|
|
1073
1352
|
}
|
|
1074
|
-
if (!
|
|
1075
|
-
console.error(`[Pixi'VN] Ticker ${
|
|
1353
|
+
if (!geTickerInstanceById(tickerId, ticker.args, ticker.duration, ticker.priority)) {
|
|
1354
|
+
console.error(`[Pixi'VN] Ticker ${tickerId} not found`);
|
|
1076
1355
|
return;
|
|
1077
1356
|
}
|
|
1078
1357
|
let tickerHistory = {
|
|
1079
1358
|
fn: () => {
|
|
1080
1359
|
},
|
|
1081
|
-
|
|
1360
|
+
id: tickerId,
|
|
1082
1361
|
args: createExportableElement(ticker.args),
|
|
1083
1362
|
canvasElementTags: canvasElementTag,
|
|
1084
1363
|
priority: ticker.priority,
|
|
@@ -1094,11 +1373,11 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1094
1373
|
_GameWindowManager.removeTicker(id);
|
|
1095
1374
|
}
|
|
1096
1375
|
}, ticker.duration * 1e3);
|
|
1097
|
-
_GameWindowManager.addTickerTimeoutInfo(canvasElementTag,
|
|
1376
|
+
_GameWindowManager.addTickerTimeoutInfo(canvasElementTag, tickerId, timeout.toString(), true);
|
|
1098
1377
|
}
|
|
1099
1378
|
}
|
|
1100
1379
|
static pushTicker(id, tickerData, ticker) {
|
|
1101
|
-
_GameWindowManager.removeAssociationBetweenTickerCanvasElement(tickerData.canvasElementTags,
|
|
1380
|
+
_GameWindowManager.removeAssociationBetweenTickerCanvasElement(tickerData.canvasElementTags, ticker);
|
|
1102
1381
|
_GameWindowManager._currentTickers[id] = tickerData;
|
|
1103
1382
|
tickerData.fn = (t) => {
|
|
1104
1383
|
let data = _GameWindowManager._currentTickers[id];
|
|
@@ -1139,9 +1418,9 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1139
1418
|
if (step.hasOwnProperty("type") && step.type === "pause") {
|
|
1140
1419
|
return step;
|
|
1141
1420
|
}
|
|
1142
|
-
let
|
|
1421
|
+
let tickerId = step.id;
|
|
1143
1422
|
return {
|
|
1144
|
-
ticker:
|
|
1423
|
+
ticker: tickerId,
|
|
1145
1424
|
args: createExportableElement(step.args),
|
|
1146
1425
|
duration: step.duration
|
|
1147
1426
|
};
|
|
@@ -1179,16 +1458,16 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1179
1458
|
_GameWindowManager.addTickerTimeoutInfo(tag, "steps", timeout.toString(), false);
|
|
1180
1459
|
return;
|
|
1181
1460
|
}
|
|
1182
|
-
let ticker =
|
|
1461
|
+
let ticker = geTickerInstanceById(step.ticker, step.args, step.duration, step.priority);
|
|
1183
1462
|
if (!ticker) {
|
|
1184
1463
|
console.error(`[Pixi'VN] Ticker ${step.ticker} not found`);
|
|
1185
1464
|
return;
|
|
1186
1465
|
}
|
|
1187
|
-
let tickerName = ticker.
|
|
1466
|
+
let tickerName = ticker.id;
|
|
1188
1467
|
let tickerHistory = {
|
|
1189
1468
|
fn: () => {
|
|
1190
1469
|
},
|
|
1191
|
-
|
|
1470
|
+
id: tickerName,
|
|
1192
1471
|
args: createExportableElement(ticker.args),
|
|
1193
1472
|
canvasElementTags: [tag],
|
|
1194
1473
|
priority: ticker.priority,
|
|
@@ -1245,26 +1524,26 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1245
1524
|
* ```
|
|
1246
1525
|
*/
|
|
1247
1526
|
static removeAssociationBetweenTickerCanvasElement(tags, ticker) {
|
|
1248
|
-
let
|
|
1527
|
+
let tickerId;
|
|
1249
1528
|
if (typeof ticker === "string") {
|
|
1250
|
-
|
|
1529
|
+
tickerId = ticker;
|
|
1251
1530
|
} else if (ticker instanceof TickerBase) {
|
|
1252
|
-
|
|
1531
|
+
tickerId = ticker.id;
|
|
1253
1532
|
} else {
|
|
1254
|
-
|
|
1533
|
+
tickerId = ticker.prototype.id;
|
|
1255
1534
|
}
|
|
1256
1535
|
if (typeof tags === "string") {
|
|
1257
1536
|
tags = [tags];
|
|
1258
1537
|
}
|
|
1259
1538
|
for (let id in _GameWindowManager._currentTickers) {
|
|
1260
1539
|
let ticker2 = _GameWindowManager._currentTickers[id];
|
|
1261
|
-
if (ticker2.
|
|
1540
|
+
if (ticker2.id === tickerId) {
|
|
1262
1541
|
_GameWindowManager._currentTickers[id].canvasElementTags = ticker2.canvasElementTags.filter((e) => !tags.includes(e));
|
|
1263
1542
|
}
|
|
1264
1543
|
}
|
|
1265
1544
|
for (let timeout in _GameWindowManager._currentTickersTimeouts) {
|
|
1266
1545
|
let TickerTimeout = _GameWindowManager._currentTickersTimeouts[timeout];
|
|
1267
|
-
if (TickerTimeout.ticker ===
|
|
1546
|
+
if (TickerTimeout.ticker === tickerId && TickerTimeout.canBeDeletedBeforeEnd) {
|
|
1268
1547
|
_GameWindowManager._currentTickersTimeouts[timeout].tags = TickerTimeout.tags.filter((t) => !tags.includes(t));
|
|
1269
1548
|
}
|
|
1270
1549
|
}
|
|
@@ -1450,11 +1729,11 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1450
1729
|
for (let id in currentTickers) {
|
|
1451
1730
|
let t = currentTickers[id];
|
|
1452
1731
|
let tags = t.canvasElementTags;
|
|
1453
|
-
let ticker =
|
|
1732
|
+
let ticker = geTickerInstanceById(t.id, t.args, t.duration, t.priority);
|
|
1454
1733
|
if (ticker) {
|
|
1455
1734
|
_GameWindowManager.addTicker(tags, ticker);
|
|
1456
1735
|
} else {
|
|
1457
|
-
console.error(`[Pixi'VN] Ticker ${t.
|
|
1736
|
+
console.error(`[Pixi'VN] Ticker ${t.id} not found`);
|
|
1458
1737
|
}
|
|
1459
1738
|
}
|
|
1460
1739
|
}
|
|
@@ -1479,109 +1758,819 @@ _GameWindowManager._currentTickersSteps = {};
|
|
|
1479
1758
|
_GameWindowManager._currentTickersTimeouts = {};
|
|
1480
1759
|
var GameWindowManager = _GameWindowManager;
|
|
1481
1760
|
|
|
1482
|
-
// src/
|
|
1483
|
-
var
|
|
1484
|
-
|
|
1485
|
-
if (registeredLabels[id]) {
|
|
1486
|
-
console.info(`[Pixi'VN] Label ${id} already exists, it will be overwritten`);
|
|
1761
|
+
// src/managers/StepManager.ts
|
|
1762
|
+
var _GameStepManager = class _GameStepManager {
|
|
1763
|
+
constructor() {
|
|
1487
1764
|
}
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1765
|
+
static get stepsHistory() {
|
|
1766
|
+
return _GameStepManager._stepsHistory;
|
|
1767
|
+
}
|
|
1768
|
+
/**
|
|
1769
|
+
* lastStepIndex is the last step index that occurred during the progression of the steps. **Not is the length of the stepsHistory - 1.**
|
|
1770
|
+
*/
|
|
1771
|
+
static get lastStepIndex() {
|
|
1772
|
+
return _GameStepManager._lastStepIndex;
|
|
1773
|
+
}
|
|
1774
|
+
/**
|
|
1775
|
+
* Increase the last step index that occurred during the progression of the steps.
|
|
1776
|
+
*/
|
|
1777
|
+
static increaseLastStepIndex() {
|
|
1778
|
+
_GameStepManager._lastStepIndex++;
|
|
1779
|
+
}
|
|
1780
|
+
static get openedLabels() {
|
|
1781
|
+
return _GameStepManager._openedLabels;
|
|
1782
|
+
}
|
|
1783
|
+
/**
|
|
1784
|
+
* currentLabelId is the current label id that occurred during the progression of the steps.
|
|
1785
|
+
*/
|
|
1786
|
+
static get currentLabelId() {
|
|
1787
|
+
if (_GameStepManager._openedLabels.length > 0) {
|
|
1788
|
+
let item = _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1];
|
|
1789
|
+
return item.label;
|
|
1503
1790
|
}
|
|
1504
|
-
|
|
1505
|
-
|
|
1791
|
+
return void 0;
|
|
1792
|
+
}
|
|
1793
|
+
/**
|
|
1794
|
+
* currentLabel is the current label that occurred during the progression of the steps.
|
|
1795
|
+
*/
|
|
1796
|
+
static get currentLabel() {
|
|
1797
|
+
if (_GameStepManager.currentLabelId) {
|
|
1798
|
+
return getLabelById(_GameStepManager.currentLabelId);
|
|
1506
1799
|
}
|
|
1507
|
-
|
|
1508
|
-
|
|
1800
|
+
}
|
|
1801
|
+
static get currentLabelStepIndex() {
|
|
1802
|
+
if (_GameStepManager._openedLabels.length > 0) {
|
|
1803
|
+
let item = _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1];
|
|
1804
|
+
return item.currentStepIndex;
|
|
1509
1805
|
}
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1806
|
+
return null;
|
|
1807
|
+
}
|
|
1808
|
+
/**
|
|
1809
|
+
* lastHistoryStep is the last history step that occurred during the progression of the steps.
|
|
1810
|
+
*/
|
|
1811
|
+
static get lastHistoryStep() {
|
|
1812
|
+
if (_GameStepManager._stepsHistory.length > 0) {
|
|
1813
|
+
return _GameStepManager._stepsHistory[_GameStepManager._stepsHistory.length - 1];
|
|
1814
|
+
}
|
|
1815
|
+
return null;
|
|
1816
|
+
}
|
|
1817
|
+
static get originalStepData() {
|
|
1818
|
+
if (!_GameStepManager._originalStepData) {
|
|
1819
|
+
return {
|
|
1820
|
+
path: "",
|
|
1821
|
+
storage: {},
|
|
1822
|
+
canvas: {
|
|
1823
|
+
childrenTagsOrder: [],
|
|
1824
|
+
currentElements: {},
|
|
1825
|
+
currentTickers: {},
|
|
1826
|
+
currentTickersSteps: {}
|
|
1827
|
+
},
|
|
1828
|
+
labelIndex: -1,
|
|
1829
|
+
openedLabels: []
|
|
1830
|
+
};
|
|
1831
|
+
}
|
|
1832
|
+
return createExportableElement(_GameStepManager._originalStepData);
|
|
1833
|
+
}
|
|
1834
|
+
static set originalStepData(value) {
|
|
1835
|
+
_GameStepManager._originalStepData = createExportableElement(value);
|
|
1836
|
+
}
|
|
1837
|
+
/* Edit History Methods */
|
|
1838
|
+
/**
|
|
1839
|
+
* Add a label to the history.
|
|
1840
|
+
* @param label The label to add to the history.
|
|
1841
|
+
*/
|
|
1842
|
+
static addStepHistory(step, choiseMade) {
|
|
1843
|
+
let stepHistory = getStepSha1(step);
|
|
1844
|
+
let historyStep = {
|
|
1845
|
+
path: window.location.pathname,
|
|
1846
|
+
storage: GameStorageManager.export(),
|
|
1847
|
+
canvas: GameWindowManager.export(),
|
|
1848
|
+
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
1849
|
+
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
1850
|
+
};
|
|
1851
|
+
if (_GameStepManager.originalStepData) {
|
|
1852
|
+
if (_GameStepManager.originalStepData.openedLabels.length === historyStep.openedLabels.length) {
|
|
1853
|
+
try {
|
|
1854
|
+
let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
|
|
1855
|
+
let historyStepOpenedLabelsString = JSON.stringify(historyStep.openedLabels);
|
|
1856
|
+
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === historyStep.path && _GameStepManager.originalStepData.labelIndex === historyStep.labelIndex) {
|
|
1857
|
+
return;
|
|
1858
|
+
}
|
|
1859
|
+
} catch (e) {
|
|
1860
|
+
console.error("[Pixi'VN] Error comparing openedLabels", e);
|
|
1526
1861
|
}
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
let data = diff(_GameStepManager.originalStepData, historyStep);
|
|
1865
|
+
if (data) {
|
|
1866
|
+
let dialoge = void 0;
|
|
1867
|
+
let requiredChoices = void 0;
|
|
1868
|
+
if (GameStorageManager.getVariable(GameStorageManager.keysSystem.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY) === _GameStepManager.lastStepIndex) {
|
|
1869
|
+
dialoge = getDialogue();
|
|
1870
|
+
}
|
|
1871
|
+
if (GameStorageManager.getVariable(GameStorageManager.keysSystem.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY) === _GameStepManager.lastStepIndex) {
|
|
1872
|
+
requiredChoices = GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY);
|
|
1873
|
+
}
|
|
1874
|
+
_GameStepManager._stepsHistory.push({
|
|
1875
|
+
diff: data,
|
|
1876
|
+
currentLabel: _GameStepManager.currentLabelId,
|
|
1877
|
+
dialoge,
|
|
1878
|
+
choices: requiredChoices,
|
|
1879
|
+
stepSha1: stepHistory,
|
|
1880
|
+
index: _GameStepManager.lastStepIndex,
|
|
1881
|
+
choiceIndexMade: choiseMade
|
|
1882
|
+
});
|
|
1883
|
+
_GameStepManager.originalStepData = historyStep;
|
|
1884
|
+
}
|
|
1885
|
+
_GameStepManager.increaseLastStepIndex();
|
|
1886
|
+
}
|
|
1887
|
+
/**
|
|
1888
|
+
* Add a label to the history.
|
|
1889
|
+
* @param label The label to add to the history.
|
|
1890
|
+
*/
|
|
1891
|
+
static pushNewLabel(label) {
|
|
1892
|
+
let currentLabel = getLabelById(label);
|
|
1893
|
+
if (!currentLabel) {
|
|
1894
|
+
throw new Error(`[Pixi'VN] Label ${label} not found`);
|
|
1895
|
+
}
|
|
1896
|
+
_GameStepManager._openedLabels.push({
|
|
1897
|
+
label,
|
|
1898
|
+
currentStepIndex: 0
|
|
1899
|
+
});
|
|
1900
|
+
}
|
|
1901
|
+
/**
|
|
1902
|
+
* Close the current label and add it to the history.
|
|
1903
|
+
* @returns
|
|
1904
|
+
*/
|
|
1905
|
+
static closeCurrentLabel() {
|
|
1906
|
+
if (!_GameStepManager.currentLabelId) {
|
|
1907
|
+
console.warn("[Pixi'VN] No label to close");
|
|
1908
|
+
return;
|
|
1909
|
+
}
|
|
1910
|
+
if (!_GameStepManager.currentLabel) {
|
|
1911
|
+
console.error("[Pixi'VN] currentLabel not found");
|
|
1912
|
+
return;
|
|
1913
|
+
}
|
|
1914
|
+
_GameStepManager._openedLabels.pop();
|
|
1915
|
+
}
|
|
1916
|
+
/**
|
|
1917
|
+
* Close all labels and add them to the history. **Attention: This method can cause an unhandled game ending.**
|
|
1918
|
+
*/
|
|
1919
|
+
static closeAllLabels() {
|
|
1920
|
+
while (_GameStepManager._openedLabels.length > 0) {
|
|
1921
|
+
_GameStepManager.closeCurrentLabel();
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
/**
|
|
1925
|
+
* Increase the current step index of the current label.
|
|
1926
|
+
*/
|
|
1927
|
+
static increaseCurrentStepIndex() {
|
|
1928
|
+
let item = _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1];
|
|
1929
|
+
_GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1] = __spreadProps(__spreadValues({}, item), {
|
|
1930
|
+
currentStepIndex: item.currentStepIndex + 1
|
|
1931
|
+
});
|
|
1932
|
+
}
|
|
1933
|
+
static restorLastLabelList() {
|
|
1934
|
+
_GameStepManager._openedLabels = _GameStepManager.originalStepData.openedLabels;
|
|
1935
|
+
}
|
|
1936
|
+
/* Run Methods */
|
|
1937
|
+
static get canGoNext() {
|
|
1938
|
+
let options = getChoiceMenuOptions();
|
|
1939
|
+
if (options && options.length > 0) {
|
|
1940
|
+
return false;
|
|
1941
|
+
}
|
|
1942
|
+
return true;
|
|
1943
|
+
}
|
|
1944
|
+
/**
|
|
1945
|
+
* Execute the next step and add it to the history.
|
|
1946
|
+
* @param props The props to pass to the step.
|
|
1947
|
+
* @param choiseMade The index of the choise made by the player. (This params is used in the choice menu)
|
|
1948
|
+
* @returns StepLabelResultType or undefined.
|
|
1949
|
+
* @example
|
|
1950
|
+
* ```typescript
|
|
1951
|
+
* function nextOnClick() {
|
|
1952
|
+
* setLoading(true)
|
|
1953
|
+
* GameStepManager.goNext(yourParams)
|
|
1954
|
+
* .then((result) => {
|
|
1955
|
+
* setUpdate((p) => p + 1)
|
|
1956
|
+
* setLoading(false)
|
|
1957
|
+
* if (result) {
|
|
1958
|
+
* // your code
|
|
1959
|
+
* }
|
|
1960
|
+
* })
|
|
1961
|
+
* .catch((e) => {
|
|
1962
|
+
* setLoading(false)
|
|
1963
|
+
* console.error(e)
|
|
1964
|
+
* })
|
|
1965
|
+
* }
|
|
1966
|
+
* ```
|
|
1967
|
+
*/
|
|
1968
|
+
static goNext(props, choiseMade) {
|
|
1969
|
+
return __async(this, null, function* () {
|
|
1970
|
+
if (!_GameStepManager.canGoNext) {
|
|
1971
|
+
console.warn("[Pixi'VN] The player must make a choice");
|
|
1972
|
+
return;
|
|
1973
|
+
}
|
|
1974
|
+
_GameStepManager.increaseCurrentStepIndex();
|
|
1975
|
+
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
1976
|
+
});
|
|
1977
|
+
}
|
|
1978
|
+
/**
|
|
1979
|
+
* Execute the current step and add it to the history.
|
|
1980
|
+
* @param props The props to pass to the step.
|
|
1981
|
+
* @param choiseMade The choise made by the player.
|
|
1982
|
+
* @returns StepLabelResultType or undefined.
|
|
1983
|
+
*/
|
|
1984
|
+
static runCurrentStep(props, choiseMade) {
|
|
1985
|
+
return __async(this, null, function* () {
|
|
1986
|
+
if (_GameStepManager.currentLabelId) {
|
|
1987
|
+
let currentLabelStepIndex = _GameStepManager.currentLabelStepIndex;
|
|
1988
|
+
if (currentLabelStepIndex === null) {
|
|
1989
|
+
console.error("[Pixi'VN] currentLabelStepIndex is null");
|
|
1990
|
+
return;
|
|
1991
|
+
}
|
|
1992
|
+
let currentLabel = _GameStepManager.currentLabel;
|
|
1993
|
+
if (!currentLabel) {
|
|
1994
|
+
console.error("[Pixi'VN] currentLabel not found");
|
|
1995
|
+
return;
|
|
1996
|
+
}
|
|
1997
|
+
if (currentLabel.steps.length > currentLabelStepIndex) {
|
|
1998
|
+
let step = currentLabel.steps[currentLabelStepIndex];
|
|
1999
|
+
let result = yield step(props);
|
|
2000
|
+
_GameStepManager.addStepHistory(step, choiseMade);
|
|
2001
|
+
return result;
|
|
2002
|
+
} else if (_GameStepManager.openedLabels.length > 1) {
|
|
2003
|
+
_GameStepManager.closeCurrentLabel();
|
|
2004
|
+
return yield _GameStepManager.goNext(props, choiseMade);
|
|
2005
|
+
} else {
|
|
2006
|
+
_GameStepManager.restorLastLabelList();
|
|
2007
|
+
console.error("[Pixi'VN] The end of the game is not managed, so the game is blocked. Read this documentation to know how to manage the end of the game: https://pixi-vn.web.app/start/labels.html#how-manage-the-end-of-the-game");
|
|
2008
|
+
return;
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
});
|
|
2012
|
+
}
|
|
2013
|
+
/**
|
|
2014
|
+
* Execute the label and add it to the history. (It's similar to Ren'Py's call function)
|
|
2015
|
+
* @param label The label to execute or the id of the label
|
|
2016
|
+
* @param props The props to pass to the label.
|
|
2017
|
+
* @returns StepLabelResultType or undefined.
|
|
2018
|
+
* @example
|
|
2019
|
+
* ```typescript
|
|
2020
|
+
* GameStepManager.callLabel(startLabel, yourParams).then((result) => {
|
|
2021
|
+
* if (result) {
|
|
2022
|
+
* // your code
|
|
2023
|
+
* }
|
|
2024
|
+
* })
|
|
2025
|
+
* ```
|
|
2026
|
+
* @example
|
|
2027
|
+
* ```typescript
|
|
2028
|
+
* // if you use it in a step label you should return the result.
|
|
2029
|
+
* return GameStepManager.callLabel(startLabel).then((result) => {
|
|
2030
|
+
* return result
|
|
2031
|
+
* })
|
|
2032
|
+
* ```
|
|
2033
|
+
*/
|
|
2034
|
+
static callLabel(label, props) {
|
|
2035
|
+
return __async(this, null, function* () {
|
|
2036
|
+
let choiseMade = void 0;
|
|
2037
|
+
let labelId;
|
|
2038
|
+
if (typeof label === "string") {
|
|
2039
|
+
labelId = label;
|
|
2040
|
+
} else {
|
|
2041
|
+
labelId = label.id;
|
|
2042
|
+
if (typeof label.choiseIndex === "number") {
|
|
2043
|
+
choiseMade = label.choiseIndex;
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
try {
|
|
2047
|
+
if (labelId === CLOSE_LABEL_ID) {
|
|
2048
|
+
let closeCurrentLabel = newCloseLabel(choiseMade);
|
|
2049
|
+
let choice = {
|
|
2050
|
+
label: closeCurrentLabel,
|
|
2051
|
+
text: "",
|
|
2052
|
+
closeCurrentLabel: false,
|
|
2053
|
+
type: "close",
|
|
2054
|
+
props: {}
|
|
2055
|
+
};
|
|
2056
|
+
return _GameStepManager.closeChoiceMenu(choice, props);
|
|
2057
|
+
}
|
|
2058
|
+
let tempLabel = getLabelById(labelId);
|
|
2059
|
+
if (!tempLabel) {
|
|
2060
|
+
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2061
|
+
}
|
|
2062
|
+
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2063
|
+
} catch (e) {
|
|
2064
|
+
console.error("[Pixi'VN] Error calling label", e);
|
|
2065
|
+
return;
|
|
2066
|
+
}
|
|
2067
|
+
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2068
|
+
});
|
|
2069
|
+
}
|
|
2070
|
+
/**
|
|
2071
|
+
* Execute the label, close the current label, execute the new label and add the new label to the history. (It's similar to Ren'Py's jump function)
|
|
2072
|
+
* @param label The label to execute.
|
|
2073
|
+
* @param props The props to pass to the label or the id of the label
|
|
2074
|
+
* @returns StepLabelResultType or undefined.
|
|
2075
|
+
* @example
|
|
2076
|
+
* ```typescript
|
|
2077
|
+
* GameStepManager.jumpLabel(startLabel, yourParams).then((result) => {
|
|
2078
|
+
* if (result) {
|
|
2079
|
+
* // your code
|
|
2080
|
+
* }
|
|
2081
|
+
* })
|
|
2082
|
+
* ```
|
|
2083
|
+
* @example
|
|
2084
|
+
* ```typescript
|
|
2085
|
+
* // if you use it in a step label you should return the result.
|
|
2086
|
+
* return GameStepManager.jumpLabel(startLabel).then((result) => {
|
|
2087
|
+
* return result
|
|
2088
|
+
* })
|
|
2089
|
+
* ```
|
|
2090
|
+
*/
|
|
2091
|
+
static jumpLabel(label, props) {
|
|
2092
|
+
return __async(this, null, function* () {
|
|
2093
|
+
_GameStepManager.closeCurrentLabel();
|
|
2094
|
+
let choiseMade = void 0;
|
|
2095
|
+
let labelId;
|
|
2096
|
+
if (typeof label === "string") {
|
|
2097
|
+
labelId = label;
|
|
2098
|
+
} else {
|
|
2099
|
+
labelId = label.id;
|
|
2100
|
+
if (typeof label.choiseIndex === "number") {
|
|
2101
|
+
choiseMade = label.choiseIndex;
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
try {
|
|
2105
|
+
if (labelId === CLOSE_LABEL_ID) {
|
|
2106
|
+
let closeCurrentLabel = newCloseLabel(choiseMade);
|
|
2107
|
+
let choice = {
|
|
2108
|
+
label: closeCurrentLabel,
|
|
2109
|
+
text: "",
|
|
2110
|
+
closeCurrentLabel: false,
|
|
2111
|
+
type: "close",
|
|
2112
|
+
props: {}
|
|
2113
|
+
};
|
|
2114
|
+
return _GameStepManager.closeChoiceMenu(choice, props);
|
|
1533
2115
|
}
|
|
2116
|
+
let tempLabel = getLabelById(labelId);
|
|
2117
|
+
if (!tempLabel) {
|
|
2118
|
+
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2119
|
+
}
|
|
2120
|
+
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2121
|
+
} catch (e) {
|
|
2122
|
+
console.error("[Pixi'VN] Error jumping label", e);
|
|
2123
|
+
return;
|
|
1534
2124
|
}
|
|
2125
|
+
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
1535
2126
|
});
|
|
1536
2127
|
}
|
|
2128
|
+
/**
|
|
2129
|
+
* When the player is in a choice menu, can use this function to exit to the choice menu.
|
|
2130
|
+
* @param choice
|
|
2131
|
+
* @param props
|
|
2132
|
+
* @returns StepLabelResultType or undefined.
|
|
2133
|
+
* @example
|
|
2134
|
+
* ```typescript
|
|
2135
|
+
* GameStepManager.closeChoiceMenu(yourParams).then((result) => {
|
|
2136
|
+
* if (result) {
|
|
2137
|
+
* // your code
|
|
2138
|
+
* }
|
|
2139
|
+
* })
|
|
2140
|
+
* ```
|
|
2141
|
+
*/
|
|
2142
|
+
static closeChoiceMenu(choice, props) {
|
|
2143
|
+
return __async(this, null, function* () {
|
|
2144
|
+
let label = choice.label;
|
|
2145
|
+
let choiseMade = void 0;
|
|
2146
|
+
if (typeof label.choiseIndex === "number") {
|
|
2147
|
+
choiseMade = label.choiseIndex;
|
|
2148
|
+
}
|
|
2149
|
+
if (choice.closeCurrentLabel) {
|
|
2150
|
+
_GameStepManager.closeCurrentLabel();
|
|
2151
|
+
}
|
|
2152
|
+
return _GameStepManager.goNext(props, choiseMade);
|
|
2153
|
+
});
|
|
2154
|
+
}
|
|
2155
|
+
/* After Update Methods */
|
|
2156
|
+
// /**
|
|
2157
|
+
// * After the update or code edit, some steps or labels may no longer match.
|
|
2158
|
+
// * - In case of step mismatch, the game will be updated to the last matching step.
|
|
2159
|
+
// * - In case of label mismatch, the game gives an error.
|
|
2160
|
+
// * @returns
|
|
2161
|
+
// */
|
|
2162
|
+
// private static afterUpdate() {
|
|
2163
|
+
// // TODO: implement
|
|
2164
|
+
// if (!GameStepManager.currentLabel) {
|
|
2165
|
+
// // TODO: implement
|
|
2166
|
+
// return
|
|
2167
|
+
// }
|
|
2168
|
+
// let currentLabel = getLabelInstanceByClassName(GameStepManager.currentLabel)
|
|
2169
|
+
// if (!currentLabel) {
|
|
2170
|
+
// console.error("Label not found")
|
|
2171
|
+
// return
|
|
2172
|
+
// }
|
|
2173
|
+
// let oldSteps = GameStepManager.stepsAfterLastHistoryLabel
|
|
2174
|
+
// let currentStepIndex = currentLabel.getCorrespondingStepsNumber(oldSteps)
|
|
2175
|
+
// let stepToRemove = oldSteps.length - currentStepIndex
|
|
2176
|
+
// GameStepManager.removeLastHistoryNodes(stepToRemove)
|
|
2177
|
+
// GameStepManager.loadLastStep()
|
|
2178
|
+
// }
|
|
2179
|
+
// private static loadLastStep() {
|
|
2180
|
+
// // TODO: implement
|
|
2181
|
+
// }
|
|
2182
|
+
// /**
|
|
2183
|
+
// * Remove a number of items from the last of the history.
|
|
2184
|
+
// * @param itemNumber The number of items to remove from the last of the history.
|
|
2185
|
+
// */
|
|
2186
|
+
// private static removeLastHistoryNodes(itemNumber: number) {
|
|
2187
|
+
// // TODO: implement
|
|
2188
|
+
// for (let i = 0; i < itemNumber; i++) {
|
|
2189
|
+
// GameStepManager._stepsHistory.pop()
|
|
2190
|
+
// }
|
|
2191
|
+
// }
|
|
2192
|
+
// /**
|
|
2193
|
+
// * stepsAfterLastHistoryLabel is a list of steps that occurred after the last history label.
|
|
2194
|
+
// */
|
|
2195
|
+
// private static get stepsAfterLastHistoryLabel(): StepHistoryDataType[] {
|
|
2196
|
+
// let length = GameStepManager._stepsHistory.length
|
|
2197
|
+
// let steps: StepHistoryDataType[] = []
|
|
2198
|
+
// for (let i = length - 1; i >= 0; i--) {
|
|
2199
|
+
// let element = GameStepManager._stepsHistory[i]
|
|
2200
|
+
// if (typeof element === "object" && "stepSha1" in element) {
|
|
2201
|
+
// steps.push(element.stepSha1)
|
|
2202
|
+
// }
|
|
2203
|
+
// else {
|
|
2204
|
+
// break
|
|
2205
|
+
// }
|
|
2206
|
+
// }
|
|
2207
|
+
// steps = steps.reverse()
|
|
2208
|
+
// return steps
|
|
2209
|
+
// }
|
|
2210
|
+
/* Go Back & Refresh Methods */
|
|
2211
|
+
/**
|
|
2212
|
+
* Go back to the last step and add it to the history.
|
|
2213
|
+
* @param navigate The navigate function.
|
|
2214
|
+
* @param steps The number of steps to go back.
|
|
2215
|
+
* @returns
|
|
2216
|
+
* @example
|
|
2217
|
+
* ```typescript
|
|
2218
|
+
* export function goBack(navigate: (path: string) => void, afterBack?: () => void) {
|
|
2219
|
+
* GameStepManager.goBack(navigate)
|
|
2220
|
+
* afterBack && afterBack()
|
|
2221
|
+
* }
|
|
2222
|
+
* ```
|
|
2223
|
+
*/
|
|
2224
|
+
static goBack(navigate, steps = 1) {
|
|
2225
|
+
if (steps <= 0) {
|
|
2226
|
+
console.warn("[Pixi'VN] Steps must be greater than 0");
|
|
2227
|
+
return;
|
|
2228
|
+
}
|
|
2229
|
+
if (_GameStepManager._stepsHistory.length <= 1) {
|
|
2230
|
+
console.warn("[Pixi'VN] No steps to go back");
|
|
2231
|
+
return;
|
|
2232
|
+
}
|
|
2233
|
+
let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
|
|
2234
|
+
if (restoredStep) {
|
|
2235
|
+
_GameStepManager._originalStepData = restoredStep;
|
|
2236
|
+
_GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
|
|
2237
|
+
GameStorageManager.import(createExportableElement(restoredStep.storage));
|
|
2238
|
+
GameWindowManager.import(createExportableElement(restoredStep.canvas));
|
|
2239
|
+
navigate(restoredStep.path);
|
|
2240
|
+
} else {
|
|
2241
|
+
console.error("[Pixi'VN] Error going back");
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
static goBackInternal(steps, restoredStep) {
|
|
2245
|
+
if (steps <= 0) {
|
|
2246
|
+
return restoredStep;
|
|
2247
|
+
}
|
|
2248
|
+
if (_GameStepManager._stepsHistory.length == 0) {
|
|
2249
|
+
return restoredStep;
|
|
2250
|
+
}
|
|
2251
|
+
let lastHistoryStep = _GameStepManager.lastHistoryStep;
|
|
2252
|
+
if (lastHistoryStep) {
|
|
2253
|
+
try {
|
|
2254
|
+
let result = restoreDeepDiffChanges(restoredStep, lastHistoryStep.diff);
|
|
2255
|
+
_GameStepManager._lastStepIndex = lastHistoryStep.index;
|
|
2256
|
+
_GameStepManager._stepsHistory.pop();
|
|
2257
|
+
return _GameStepManager.goBackInternal(steps - 1, result);
|
|
2258
|
+
} catch (e) {
|
|
2259
|
+
console.error("[Pixi'VN] Error applying diff", e);
|
|
2260
|
+
return restoredStep;
|
|
2261
|
+
}
|
|
2262
|
+
} else {
|
|
2263
|
+
return restoredStep;
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
/**
|
|
2267
|
+
* Return true if it is possible to go back.
|
|
2268
|
+
*/
|
|
2269
|
+
static get canGoBack() {
|
|
2270
|
+
return _GameStepManager._stepsHistory.length > 1;
|
|
2271
|
+
}
|
|
2272
|
+
/**
|
|
2273
|
+
* Add a label to the history.
|
|
2274
|
+
*/
|
|
2275
|
+
static clear() {
|
|
2276
|
+
_GameStepManager._stepsHistory = [];
|
|
2277
|
+
_GameStepManager._openedLabels = [];
|
|
2278
|
+
}
|
|
2279
|
+
/* Export and Import Methods */
|
|
2280
|
+
/**
|
|
2281
|
+
* Export the history to a JSON string.
|
|
2282
|
+
* @returns The history in a JSON string.
|
|
2283
|
+
*/
|
|
2284
|
+
static exportJson() {
|
|
2285
|
+
return JSON.stringify(this.export());
|
|
2286
|
+
}
|
|
2287
|
+
/**
|
|
2288
|
+
* Export the history to an object.
|
|
2289
|
+
* @returns The history in an object.
|
|
2290
|
+
*/
|
|
2291
|
+
static export() {
|
|
2292
|
+
return {
|
|
2293
|
+
stepsHistory: _GameStepManager._stepsHistory,
|
|
2294
|
+
openedLabels: _GameStepManager._openedLabels,
|
|
2295
|
+
lastStepIndex: _GameStepManager._lastStepIndex,
|
|
2296
|
+
originalStepData: _GameStepManager._originalStepData
|
|
2297
|
+
};
|
|
2298
|
+
}
|
|
2299
|
+
/**
|
|
2300
|
+
* Import the history from a JSON string.
|
|
2301
|
+
* @param dataString The history in a JSON string.
|
|
2302
|
+
*/
|
|
2303
|
+
static importJson(dataString) {
|
|
2304
|
+
_GameStepManager.import(JSON.parse(dataString));
|
|
2305
|
+
}
|
|
2306
|
+
/**
|
|
2307
|
+
* Import the history from an object.
|
|
2308
|
+
* @param data The history in an object.
|
|
2309
|
+
*/
|
|
2310
|
+
static import(data) {
|
|
2311
|
+
_GameStepManager.clear();
|
|
2312
|
+
try {
|
|
2313
|
+
if (data.hasOwnProperty("stepsHistory")) {
|
|
2314
|
+
_GameStepManager._stepsHistory = data["stepsHistory"];
|
|
2315
|
+
} else {
|
|
2316
|
+
console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
|
|
2317
|
+
}
|
|
2318
|
+
if (data.hasOwnProperty("openedLabels")) {
|
|
2319
|
+
_GameStepManager._openedLabels = data["openedLabels"];
|
|
2320
|
+
} else {
|
|
2321
|
+
console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
|
|
2322
|
+
}
|
|
2323
|
+
if (data.hasOwnProperty("lastStepIndex")) {
|
|
2324
|
+
_GameStepManager._lastStepIndex = data["lastStepIndex"];
|
|
2325
|
+
} else {
|
|
2326
|
+
console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
|
|
2327
|
+
}
|
|
2328
|
+
if (data.hasOwnProperty("originalStepData")) {
|
|
2329
|
+
_GameStepManager._originalStepData = data["originalStepData"];
|
|
2330
|
+
} else {
|
|
2331
|
+
console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
|
|
2332
|
+
}
|
|
2333
|
+
} catch (e) {
|
|
2334
|
+
console.error("[Pixi'VN] Error importing data", e);
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
1537
2337
|
};
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
2338
|
+
/**
|
|
2339
|
+
* stepHistory is a list of label events and steps that occurred during the progression of the steps.
|
|
2340
|
+
*/
|
|
2341
|
+
_GameStepManager._stepsHistory = [];
|
|
2342
|
+
_GameStepManager._lastStepIndex = 0;
|
|
2343
|
+
_GameStepManager._openedLabels = [];
|
|
2344
|
+
_GameStepManager._originalStepData = void 0;
|
|
2345
|
+
var GameStepManager = _GameStepManager;
|
|
1541
2346
|
|
|
1542
|
-
// src/
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
2347
|
+
// src/classes/StoredClassModel.ts
|
|
2348
|
+
var StoredClassModel = class {
|
|
2349
|
+
/**
|
|
2350
|
+
* @param categoryId The id of the category. For example if you are storing a character class, you can use "characters" as categoryId. so all instances of the character class will be stored in the "characters" category.
|
|
2351
|
+
* @param id The id of instance of the class. This id must be unique for the category.
|
|
2352
|
+
*/
|
|
2353
|
+
constructor(categoryId, id) {
|
|
2354
|
+
this.categoryId = categoryId;
|
|
2355
|
+
this._id = id;
|
|
1546
2356
|
}
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
2357
|
+
/**
|
|
2358
|
+
* Is id of the stored class. is unique for this class.
|
|
2359
|
+
*/
|
|
2360
|
+
get id() {
|
|
2361
|
+
return this._id;
|
|
2362
|
+
}
|
|
2363
|
+
/**
|
|
2364
|
+
* Update a property in the storage.
|
|
2365
|
+
* @param propertyName The name of the property to set.
|
|
2366
|
+
* @param value The value to set. If is undefined, the property will be removed from the storage.
|
|
2367
|
+
*/
|
|
2368
|
+
setStorageProperty(propertyName, value) {
|
|
2369
|
+
let storage = GameStorageManager.getVariable(this.categoryId);
|
|
2370
|
+
if (!storage) {
|
|
2371
|
+
storage = {};
|
|
1552
2372
|
}
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
2373
|
+
if (!storage.hasOwnProperty(this.id)) {
|
|
2374
|
+
storage[this.id] = {};
|
|
2375
|
+
}
|
|
2376
|
+
if (value === void 0 || value === null) {
|
|
2377
|
+
if (storage[this.id].hasOwnProperty(propertyName)) {
|
|
2378
|
+
delete storage[this.id][propertyName];
|
|
2379
|
+
}
|
|
2380
|
+
} else {
|
|
2381
|
+
storage[this.id] = __spreadProps(__spreadValues({}, storage[this.id]), { [propertyName]: value });
|
|
1560
2382
|
}
|
|
2383
|
+
if (Object.keys(storage[this.id]).length === 0) {
|
|
2384
|
+
delete storage[this.id];
|
|
2385
|
+
}
|
|
2386
|
+
GameStorageManager.setVariable(this.categoryId, storage);
|
|
1561
2387
|
}
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
2388
|
+
/**
|
|
2389
|
+
* Get a property from the storage.
|
|
2390
|
+
* @param propertyName The name of the property to get.
|
|
2391
|
+
* @returns The value of the property. If the property is not found, returns undefined.
|
|
2392
|
+
*/
|
|
2393
|
+
getStorageProperty(propertyName) {
|
|
2394
|
+
let storage = GameStorageManager.getVariable(this.categoryId);
|
|
2395
|
+
if (storage && storage.hasOwnProperty(this.id) && storage[this.id].hasOwnProperty(propertyName)) {
|
|
2396
|
+
return storage[this.id][propertyName];
|
|
1569
2397
|
}
|
|
2398
|
+
return void 0;
|
|
1570
2399
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
2400
|
+
};
|
|
2401
|
+
|
|
2402
|
+
// src/classes/CharacterBaseModel.ts
|
|
2403
|
+
var CharacterBaseModel2 = class extends StoredClassModel {
|
|
2404
|
+
/**
|
|
2405
|
+
* @param id The id of the character.
|
|
2406
|
+
* @param props The properties of the character.
|
|
2407
|
+
*/
|
|
2408
|
+
constructor(id, props) {
|
|
2409
|
+
super(GameStorageManager.keysSystem.CHARACTER_CATEGORY_KEY, id);
|
|
2410
|
+
this.defaultName = "";
|
|
2411
|
+
this.defaultName = props.name;
|
|
2412
|
+
this.defaultSurname = props.surname;
|
|
2413
|
+
this.defaultAge = props.age;
|
|
2414
|
+
this._icon = props.icon;
|
|
2415
|
+
this._color = props.color;
|
|
2416
|
+
}
|
|
2417
|
+
/***
|
|
2418
|
+
* The name of the character.
|
|
2419
|
+
* If you set undefined, it will return the default name.
|
|
2420
|
+
*/
|
|
2421
|
+
get name() {
|
|
2422
|
+
return this.getStorageProperty("name") || this.defaultName;
|
|
2423
|
+
}
|
|
2424
|
+
set name(value) {
|
|
2425
|
+
this.setStorageProperty("name", value);
|
|
2426
|
+
}
|
|
2427
|
+
/**
|
|
2428
|
+
* The surname of the character.
|
|
2429
|
+
* If you set undefined, it will return the default surname.
|
|
2430
|
+
*/
|
|
2431
|
+
get surname() {
|
|
2432
|
+
return this.getStorageProperty("surname") || this.defaultSurname;
|
|
2433
|
+
}
|
|
2434
|
+
set surname(value) {
|
|
2435
|
+
this.setStorageProperty("surname", value);
|
|
2436
|
+
}
|
|
2437
|
+
/**
|
|
2438
|
+
* The age of the character.
|
|
2439
|
+
* If you set undefined, it will return the default age.
|
|
2440
|
+
*/
|
|
2441
|
+
get age() {
|
|
2442
|
+
return this.getStorageProperty("age") || this.defaultAge;
|
|
2443
|
+
}
|
|
2444
|
+
set age(value) {
|
|
2445
|
+
this.setStorageProperty("age", value);
|
|
2446
|
+
}
|
|
2447
|
+
/**
|
|
2448
|
+
* The icon of the character.
|
|
2449
|
+
*/
|
|
2450
|
+
get icon() {
|
|
2451
|
+
return this._icon;
|
|
2452
|
+
}
|
|
2453
|
+
/**
|
|
2454
|
+
* The color of the character.
|
|
2455
|
+
*/
|
|
2456
|
+
get color() {
|
|
2457
|
+
return this._color;
|
|
2458
|
+
}
|
|
2459
|
+
};
|
|
2460
|
+
|
|
2461
|
+
// src/classes/DialogueBaseModel.ts
|
|
2462
|
+
var DialogueBaseModel = class {
|
|
2463
|
+
/**
|
|
2464
|
+
* @param text The text of the dialogue.
|
|
2465
|
+
* @param character The id of the character that is speaking.
|
|
2466
|
+
* @param oltherParams Other parameters that can be stored in the dialogue.
|
|
2467
|
+
*/
|
|
2468
|
+
constructor(text, character, oltherParams = {}) {
|
|
2469
|
+
/**
|
|
2470
|
+
* The text of the dialogue.
|
|
2471
|
+
*/
|
|
2472
|
+
this.text = "";
|
|
2473
|
+
/**
|
|
2474
|
+
* Other parameters that can be stored in the dialogue.
|
|
2475
|
+
*/
|
|
2476
|
+
this.oltherParams = {};
|
|
2477
|
+
if (typeof text === "string") {
|
|
2478
|
+
this.text = text;
|
|
2479
|
+
if (typeof character === "string") {
|
|
2480
|
+
this.character = character;
|
|
2481
|
+
} else {
|
|
2482
|
+
this.character = character == null ? void 0 : character.id;
|
|
2483
|
+
}
|
|
2484
|
+
this.oltherParams = oltherParams;
|
|
2485
|
+
} else {
|
|
2486
|
+
this.text = text.text;
|
|
2487
|
+
if (text.character) {
|
|
2488
|
+
this.character = text.character;
|
|
2489
|
+
}
|
|
2490
|
+
this.oltherParams = text.oltherParams || {};
|
|
1579
2491
|
}
|
|
1580
2492
|
}
|
|
1581
|
-
|
|
2493
|
+
/**
|
|
2494
|
+
* Export the dialogue to a DialogueBaseData object.
|
|
2495
|
+
*
|
|
2496
|
+
* @returns The data of the dialogue.
|
|
2497
|
+
*/
|
|
2498
|
+
export() {
|
|
2499
|
+
return {
|
|
2500
|
+
text: this.text,
|
|
2501
|
+
character: this.character,
|
|
2502
|
+
oltherParams: this.oltherParams
|
|
2503
|
+
};
|
|
2504
|
+
}
|
|
2505
|
+
};
|
|
2506
|
+
|
|
2507
|
+
// src/decorators/LabelDecorator.ts
|
|
2508
|
+
var registeredLabels = {};
|
|
2509
|
+
function newLabel(id, steps, onStepRun) {
|
|
2510
|
+
if (registeredLabels[id]) {
|
|
2511
|
+
console.info(`[Pixi'VN] Label ${id} already exists, it will be overwritten`);
|
|
2512
|
+
}
|
|
2513
|
+
let label = new Label(id, steps, onStepRun);
|
|
2514
|
+
registeredLabels[id] = label;
|
|
2515
|
+
return label;
|
|
2516
|
+
}
|
|
2517
|
+
function getLabelById(id) {
|
|
2518
|
+
let label = registeredLabels[id];
|
|
2519
|
+
if (!label) {
|
|
2520
|
+
console.error(`[Pixi'VN] Label ${id} not found`);
|
|
2521
|
+
return;
|
|
2522
|
+
}
|
|
2523
|
+
return label;
|
|
1582
2524
|
}
|
|
1583
2525
|
|
|
1584
|
-
// src/classes/ticker/
|
|
2526
|
+
// src/classes/ticker/FadeAlphaTicker.ts
|
|
2527
|
+
var FadeAlphaTicker = class extends TickerBase {
|
|
2528
|
+
fn(ticker, args, tags, tickerId) {
|
|
2529
|
+
let type = args.type === void 0 ? "hide" : args.type;
|
|
2530
|
+
let duration = args.duration === void 0 ? 1 : args.duration;
|
|
2531
|
+
let speed = 1 / (duration * 60);
|
|
2532
|
+
let limit = args.limit === void 0 ? type === "hide" ? 0 : 1 : args.limit;
|
|
2533
|
+
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
2534
|
+
if (typeof tagToRemoveAfter2 === "string") {
|
|
2535
|
+
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
2536
|
+
}
|
|
2537
|
+
if (type === "hide" && limit < 0) {
|
|
2538
|
+
limit = 0;
|
|
2539
|
+
}
|
|
2540
|
+
if (type === "show" && limit > 1) {
|
|
2541
|
+
limit = 1;
|
|
2542
|
+
}
|
|
2543
|
+
tags.filter((tag) => {
|
|
2544
|
+
var _a;
|
|
2545
|
+
let element = GameWindowManager.getCanvasElement(tag);
|
|
2546
|
+
if (args.startOnlyIfHaveTexture) {
|
|
2547
|
+
if (element && element instanceof Sprite && ((_a = element.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
2548
|
+
return false;
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
return true;
|
|
2552
|
+
}).forEach((tag) => {
|
|
2553
|
+
let element = GameWindowManager.getCanvasElement(tag);
|
|
2554
|
+
if (element && element instanceof Container) {
|
|
2555
|
+
if (type === "show" && element.alpha < limit) {
|
|
2556
|
+
element.alpha += speed * ticker.deltaTime;
|
|
2557
|
+
} else if (type === "hide" && element.alpha > limit) {
|
|
2558
|
+
element.alpha -= speed * ticker.deltaTime;
|
|
2559
|
+
}
|
|
2560
|
+
if (type === "show" && element.alpha >= limit) {
|
|
2561
|
+
element.alpha = limit;
|
|
2562
|
+
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
2563
|
+
} else if (type === "hide" && element.alpha <= limit) {
|
|
2564
|
+
element.alpha = limit;
|
|
2565
|
+
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
});
|
|
2569
|
+
}
|
|
2570
|
+
};
|
|
2571
|
+
FadeAlphaTicker = __decorateClass([
|
|
2572
|
+
tickerDecorator()
|
|
2573
|
+
], FadeAlphaTicker);
|
|
1585
2574
|
var MoveTicker = class extends TickerBase {
|
|
1586
2575
|
fn(ticker, args, tags, tickerId) {
|
|
1587
2576
|
let xSpeed = 1;
|
|
@@ -1678,104 +2667,32 @@ var RotateTicker = class extends TickerBase {
|
|
|
1678
2667
|
RotateTicker = __decorateClass([
|
|
1679
2668
|
tickerDecorator()
|
|
1680
2669
|
], RotateTicker);
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
ySpeed = args.speed.y;
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
xSpeed /= 60;
|
|
1695
|
-
ySpeed /= 60;
|
|
1696
|
-
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
1697
|
-
if (typeof tagToRemoveAfter2 === "string") {
|
|
1698
|
-
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
1699
|
-
}
|
|
1700
|
-
let type = args.type || "zoom";
|
|
1701
|
-
let xLimit = Infinity;
|
|
1702
|
-
let yLimit = Infinity;
|
|
1703
|
-
if (args.limit) {
|
|
1704
|
-
if (typeof args.limit === "number") {
|
|
1705
|
-
xLimit = args.limit;
|
|
1706
|
-
yLimit = args.limit;
|
|
1707
|
-
} else {
|
|
1708
|
-
xLimit = args.limit.x;
|
|
1709
|
-
yLimit = args.limit.y;
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
tags.filter((tag) => {
|
|
1713
|
-
var _a;
|
|
1714
|
-
let element = GameWindowManager.getCanvasElement(tag);
|
|
1715
|
-
if (args.startOnlyIfHaveTexture) {
|
|
1716
|
-
if (element && element instanceof Sprite && ((_a = element.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1717
|
-
return false;
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
return true;
|
|
1721
|
-
}).forEach((tag) => {
|
|
1722
|
-
let element = GameWindowManager.getCanvasElement(tag);
|
|
1723
|
-
if (element && element instanceof Container) {
|
|
1724
|
-
if (type === "zoom" && (element.scale.x < xLimit || element.scale.y < yLimit)) {
|
|
1725
|
-
element.scale.x += xSpeed * ticker.deltaTime;
|
|
1726
|
-
element.scale.y += ySpeed * ticker.deltaTime;
|
|
1727
|
-
} else if (type === "unzoom" && (element.scale.x > xLimit || element.scale.y > yLimit)) {
|
|
1728
|
-
element.scale.x -= xSpeed * ticker.deltaTime;
|
|
1729
|
-
element.scale.y -= ySpeed * ticker.deltaTime;
|
|
1730
|
-
}
|
|
1731
|
-
if (type === "zoom") {
|
|
1732
|
-
if (element.scale.x > xLimit) {
|
|
1733
|
-
element.scale.x = xLimit;
|
|
1734
|
-
}
|
|
1735
|
-
if (element.scale.y > yLimit) {
|
|
1736
|
-
element.scale.y = yLimit;
|
|
1737
|
-
}
|
|
1738
|
-
if (element.scale.x >= xLimit && element.scale.y >= yLimit) {
|
|
1739
|
-
element.scale.x = xLimit;
|
|
1740
|
-
element.scale.y = yLimit;
|
|
1741
|
-
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
1742
|
-
}
|
|
1743
|
-
} else if (type === "unzoom") {
|
|
1744
|
-
if (element.scale.x < xLimit) {
|
|
1745
|
-
element.scale.x = xLimit;
|
|
1746
|
-
}
|
|
1747
|
-
if (element.scale.y < yLimit) {
|
|
1748
|
-
element.scale.y = yLimit;
|
|
1749
|
-
}
|
|
1750
|
-
if (element.scale.x <= xLimit && element.scale.y <= yLimit) {
|
|
1751
|
-
element.scale.x = xLimit;
|
|
1752
|
-
element.scale.y = yLimit;
|
|
1753
|
-
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1756
|
-
if (xSpeed < 1e-5 && ySpeed < 1e-5 && !(args.speedProgression && args.speedProgression.type == "linear" && args.speedProgression.amt != 0)) {
|
|
1757
|
-
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
1758
|
-
}
|
|
1759
|
-
}
|
|
1760
|
-
});
|
|
1761
|
-
if (args.speedProgression)
|
|
1762
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1763
|
-
}
|
|
1764
|
-
};
|
|
1765
|
-
ZoomTicker = __decorateClass([
|
|
1766
|
-
tickerDecorator()
|
|
1767
|
-
], ZoomTicker);
|
|
2670
|
+
|
|
2671
|
+
// src/labels/TestConstant.ts
|
|
2672
|
+
var juliette = new CharacterBaseModel2("___pixivn_juliette___", {
|
|
2673
|
+
name: "Juliette",
|
|
2674
|
+
age: 25,
|
|
2675
|
+
icon: "https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-square.webp?alt=media&token=5856ae7b-d99e-4563-86ec-cbc48cc9c6b4",
|
|
2676
|
+
color: "#ac0086"
|
|
2677
|
+
});
|
|
2678
|
+
saveCharacter(juliette);
|
|
2679
|
+
var bunnyImage = "https://pixijs.com/assets/bunny.png";
|
|
1768
2680
|
|
|
1769
2681
|
// src/labels/BaseCanvasElementTestLabel.ts
|
|
2682
|
+
var BASE_CANVAS_ELEMENT_LABEL = "___pixi_vn_base_canvas_element_label___";
|
|
1770
2683
|
var baseCanvasElementTestLabel = newLabel(
|
|
1771
|
-
|
|
2684
|
+
BASE_CANVAS_ELEMENT_LABEL,
|
|
1772
2685
|
[
|
|
1773
2686
|
() => __async(void 0, null, function* () {
|
|
1774
|
-
|
|
2687
|
+
let number = 25;
|
|
2688
|
+
setDialogue({
|
|
2689
|
+
character: juliette,
|
|
2690
|
+
text: `Here's what's going to happen: I'm going to create ${number} bunnies (CanvasSprites) and put them in a CanvasContainer.`
|
|
2691
|
+
});
|
|
1775
2692
|
const container = new CanvasContainer();
|
|
1776
2693
|
GameWindowManager.addCanvasElement("container", container);
|
|
1777
|
-
const texture = yield Assets.load(
|
|
1778
|
-
for (let i = 0; i <
|
|
2694
|
+
const texture = yield Assets.load(bunnyImage);
|
|
2695
|
+
for (let i = 0; i < number; i++) {
|
|
1779
2696
|
const bunny = new CanvasSprite(texture);
|
|
1780
2697
|
bunny.x = i % 5 * 40;
|
|
1781
2698
|
bunny.y = Math.floor(i / 5) * 40;
|
|
@@ -1785,10 +2702,15 @@ var baseCanvasElementTestLabel = newLabel(
|
|
|
1785
2702
|
container.y = GameWindowManager.screen.height / 2;
|
|
1786
2703
|
container.pivot.x = container.width / 2;
|
|
1787
2704
|
container.pivot.y = container.height / 2;
|
|
1788
|
-
GameWindowManager.addTicker("container", new RotateTicker({ speed:
|
|
2705
|
+
GameWindowManager.addTicker("container", new RotateTicker({ speed: 1 }));
|
|
1789
2706
|
}),
|
|
1790
2707
|
() => __async(void 0, null, function* () {
|
|
1791
2708
|
removeCanvasElement("container");
|
|
2709
|
+
setDialogue({
|
|
2710
|
+
character: juliette,
|
|
2711
|
+
text: `Here's what's going to happen: I'm going to create some text elements with different styles and put them on the stage.
|
|
2712
|
+
But it will generate a warn message, because the FillGradient or FillPattern has not yet been supported by the Pixi\u2019VN ( you can see the status of the issue here: [#76](https://github.com/DRincs-Productions/pixi-vn/issues/76)).`
|
|
2713
|
+
});
|
|
1792
2714
|
const basicText = new CanvasText({ text: "Basic text in pixi" });
|
|
1793
2715
|
basicText.x = 50;
|
|
1794
2716
|
basicText.y = 100;
|
|
@@ -1850,5 +2772,5 @@ var baseCanvasElementTestLabel = newLabel(
|
|
|
1850
2772
|
);
|
|
1851
2773
|
|
|
1852
2774
|
export { baseCanvasElementTestLabel };
|
|
1853
|
-
//# sourceMappingURL=
|
|
2775
|
+
//# sourceMappingURL=BaseCanvasElementTestLabel.mjs.map
|
|
1854
2776
|
//# sourceMappingURL=BaseCanvasElementTestLabel.mjs.map
|