@drincs/pixi-vn 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{TickerBase-RQDWNI4K.d.ts → TickerBase-3rLpDpmb.d.ts} +27 -13
- package/dist/{TickerBase-B5CQCJs8.d.mts → TickerBase-DKYzbzro.d.mts} +27 -13
- package/dist/classes/CanvasEvent.d.mts +7 -1
- package/dist/classes/CanvasEvent.d.ts +7 -1
- package/dist/classes/CanvasEvent.js +7 -0
- package/dist/classes/CanvasEvent.js.map +1 -1
- package/dist/classes/CanvasEvent.mjs +7 -0
- package/dist/classes/CanvasEvent.mjs.map +1 -1
- package/dist/classes/CharacterBaseModel.d.mts +2 -26
- package/dist/classes/CharacterBaseModel.d.ts +2 -26
- package/dist/classes/CharacterBaseModel.js +544 -241
- package/dist/classes/CharacterBaseModel.js.map +1 -1
- package/dist/classes/CharacterBaseModel.mjs +540 -241
- package/dist/classes/CharacterBaseModel.mjs.map +1 -1
- package/dist/classes/ChoiceMenuOption.d.mts +27 -17
- package/dist/classes/ChoiceMenuOption.d.ts +27 -17
- package/dist/classes/ChoiceMenuOption.js +548 -243
- package/dist/classes/ChoiceMenuOption.js.map +1 -1
- package/dist/classes/ChoiceMenuOption.mjs +544 -243
- package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
- package/dist/classes/CloseLabel.d.mts +1 -1
- package/dist/classes/CloseLabel.d.ts +1 -1
- package/dist/classes/CloseLabel.js +1 -1
- package/dist/classes/CloseLabel.js.map +1 -1
- package/dist/classes/CloseLabel.mjs +1 -1
- package/dist/classes/CloseLabel.mjs.map +1 -1
- package/dist/classes/DialogueBaseModel.d.mts +3 -2
- package/dist/classes/DialogueBaseModel.d.ts +3 -2
- package/dist/classes/DialogueBaseModel.js +5 -5
- package/dist/classes/DialogueBaseModel.js.map +1 -1
- package/dist/classes/DialogueBaseModel.mjs +5 -5
- 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 +1 -1
- package/dist/classes/Label.js.map +1 -1
- package/dist/classes/Label.mjs +1 -1
- package/dist/classes/Label.mjs.map +1 -1
- package/dist/classes/StoredClassModel.d.mts +2 -2
- package/dist/classes/StoredClassModel.d.ts +2 -2
- package/dist/classes/StoredClassModel.js +544 -241
- package/dist/classes/StoredClassModel.js.map +1 -1
- package/dist/classes/StoredClassModel.mjs +540 -241
- 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 +7 -0
- package/dist/classes/canvas/CanvasBase.js.map +1 -1
- package/dist/classes/canvas/CanvasBase.mjs +7 -0
- 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 +57 -37
- package/dist/classes/canvas/CanvasContainer.js.map +1 -1
- package/dist/classes/canvas/CanvasContainer.mjs +57 -38
- 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 +33 -20
- package/dist/classes/canvas/CanvasImage.js.map +1 -1
- package/dist/classes/canvas/CanvasImage.mjs +30 -20
- package/dist/classes/canvas/CanvasImage.mjs.map +1 -1
- package/dist/classes/canvas/CanvasSprite.d.mts +6 -3
- package/dist/classes/canvas/CanvasSprite.d.ts +6 -3
- package/dist/classes/canvas/CanvasSprite.js +25 -17
- package/dist/classes/canvas/CanvasSprite.js.map +1 -1
- package/dist/classes/canvas/CanvasSprite.mjs +25 -18
- 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 +25 -17
- package/dist/classes/canvas/CanvasText.js.map +1 -1
- package/dist/classes/canvas/CanvasText.mjs +25 -18
- package/dist/classes/canvas/CanvasText.mjs.map +1 -1
- package/dist/classes/canvas/index.js +184 -158
- package/dist/classes/canvas/index.js.map +1 -1
- package/dist/classes/canvas/index.mjs +184 -158
- package/dist/classes/canvas/index.mjs.map +1 -1
- package/dist/classes/index.d.mts +6 -4
- package/dist/classes/index.d.ts +6 -4
- package/dist/classes/index.js +560 -248
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +556 -248
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/ticker/FadeAlphaTicker.d.mts +27 -0
- package/dist/classes/ticker/FadeAlphaTicker.d.ts +27 -0
- package/dist/classes/ticker/{TickerFadeAlpha.js → FadeAlphaTicker.js} +549 -248
- package/dist/classes/ticker/FadeAlphaTicker.js.map +1 -0
- package/dist/classes/ticker/{TickerRotate.mjs → FadeAlphaTicker.mjs} +571 -274
- package/dist/classes/ticker/FadeAlphaTicker.mjs.map +1 -0
- package/dist/classes/ticker/MoveTicker.d.mts +25 -0
- package/dist/classes/ticker/MoveTicker.d.ts +25 -0
- package/dist/classes/ticker/{TickerMove.js → MoveTicker.js} +544 -241
- package/dist/classes/ticker/MoveTicker.js.map +1 -0
- package/dist/classes/ticker/{TickerFadeAlpha.mjs → MoveTicker.mjs} +568 -269
- package/dist/classes/ticker/MoveTicker.mjs.map +1 -0
- package/dist/classes/ticker/RotateTicker.d.mts +27 -0
- package/dist/classes/ticker/RotateTicker.d.ts +27 -0
- package/dist/classes/ticker/{TickerRotate.js → RotateTicker.js} +544 -241
- package/dist/classes/ticker/RotateTicker.js.map +1 -0
- package/dist/classes/ticker/{TickerMove.mjs → RotateTicker.mjs} +558 -259
- package/dist/classes/ticker/RotateTicker.mjs.map +1 -0
- package/dist/classes/ticker/TickerBase.d.mts +2 -1
- package/dist/classes/ticker/TickerBase.d.ts +2 -1
- package/dist/classes/ticker/TickerBase.js +12 -6
- package/dist/classes/ticker/TickerBase.js.map +1 -1
- package/dist/classes/ticker/TickerBase.mjs +12 -6
- package/dist/classes/ticker/TickerBase.mjs.map +1 -1
- package/dist/classes/ticker/ZoomTicker.d.mts +31 -0
- package/dist/classes/ticker/ZoomTicker.d.ts +31 -0
- package/dist/classes/ticker/ZoomTicker.js +1647 -0
- package/dist/classes/ticker/ZoomTicker.js.map +1 -0
- package/dist/classes/ticker/ZoomTicker.mjs +1639 -0
- package/dist/classes/ticker/ZoomTicker.mjs.map +1 -0
- package/dist/classes/ticker/index.d.mts +11 -8
- package/dist/classes/ticker/index.d.ts +11 -8
- package/dist/classes/ticker/index.js +567 -266
- package/dist/classes/ticker/index.js.map +1 -1
- package/dist/classes/ticker/index.mjs +564 -267
- package/dist/classes/ticker/index.mjs.map +1 -1
- package/dist/constants.d.mts +12 -2
- package/dist/constants.d.ts +12 -2
- package/dist/constants.js +10 -1
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +9 -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 +63 -43
- package/dist/decorators/CanvasElementDecorator.js.map +1 -1
- package/dist/decorators/CanvasElementDecorator.mjs +62 -42
- package/dist/decorators/CanvasElementDecorator.mjs.map +1 -1
- package/dist/decorators/CharacterDecorator.d.mts +1 -0
- package/dist/decorators/CharacterDecorator.d.ts +1 -0
- 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.d.mts +4 -3
- package/dist/decorators/LabelDecorator.d.ts +4 -3
- package/dist/decorators/LabelDecorator.js +546 -243
- package/dist/decorators/LabelDecorator.js.map +1 -1
- package/dist/decorators/LabelDecorator.mjs +542 -243
- package/dist/decorators/LabelDecorator.mjs.map +1 -1
- package/dist/decorators/TickerDecorator.d.mts +9 -6
- package/dist/decorators/TickerDecorator.d.ts +9 -6
- 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 +4 -3
- package/dist/decorators/index.d.ts +4 -3
- package/dist/decorators/index.js +550 -245
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +546 -245
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/CanvasUtility.js +56 -37
- package/dist/functions/CanvasUtility.js.map +1 -1
- package/dist/functions/CanvasUtility.mjs +56 -37
- package/dist/functions/CanvasUtility.mjs.map +1 -1
- package/dist/functions/DialogueUtility.d.mts +7 -5
- package/dist/functions/DialogueUtility.d.ts +7 -5
- package/dist/functions/DialogueUtility.js +729 -397
- package/dist/functions/DialogueUtility.js.map +1 -1
- package/dist/functions/DialogueUtility.mjs +729 -397
- package/dist/functions/DialogueUtility.mjs.map +1 -1
- package/dist/functions/FlagsUtility.js +544 -241
- package/dist/functions/FlagsUtility.js.map +1 -1
- package/dist/functions/FlagsUtility.mjs +540 -241
- package/dist/functions/FlagsUtility.mjs.map +1 -1
- package/dist/functions/GameUtility.js +544 -241
- package/dist/functions/GameUtility.js.map +1 -1
- package/dist/functions/GameUtility.mjs +540 -241
- package/dist/functions/GameUtility.mjs.map +1 -1
- package/dist/functions/ImageUtility.d.mts +81 -8
- package/dist/functions/ImageUtility.d.ts +81 -8
- package/dist/functions/ImageUtility.js +911 -387
- package/dist/functions/ImageUtility.js.map +1 -1
- package/dist/functions/ImageUtility.mjs +899 -387
- package/dist/functions/ImageUtility.mjs.map +1 -1
- package/dist/functions/SavesUtility.d.mts +9 -5
- package/dist/functions/SavesUtility.d.ts +9 -5
- package/dist/functions/SavesUtility.js +611 -252
- package/dist/functions/SavesUtility.js.map +1 -1
- package/dist/functions/SavesUtility.mjs +611 -252
- package/dist/functions/SavesUtility.mjs.map +1 -1
- package/dist/functions/TickerUtility.d.mts +1 -1
- package/dist/functions/TickerUtility.d.ts +1 -1
- package/dist/functions/TickerUtility.js +32 -18
- package/dist/functions/TickerUtility.js.map +1 -1
- package/dist/functions/TickerUtility.mjs +32 -18
- package/dist/functions/TickerUtility.mjs.map +1 -1
- package/dist/functions/index.d.mts +18 -8
- package/dist/functions/index.d.ts +18 -8
- package/dist/functions/index.js +832 -279
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +825 -280
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +25 -16
- package/dist/index.d.ts +25 -16
- package/dist/index.js +1547 -290
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1538 -290
- package/dist/index.mjs.map +1 -1
- package/dist/interface/CharacterBaseModelProps.d.mts +27 -0
- package/dist/interface/CharacterBaseModelProps.d.ts +27 -0
- package/dist/interface/CharacterBaseModelProps.js +4 -0
- package/dist/interface/CharacterBaseModelProps.mjs +3 -0
- package/dist/interface/DialogueHistory.d.mts +3 -7
- package/dist/interface/DialogueHistory.d.ts +3 -7
- package/dist/interface/IHistoryStep.d.mts +12 -8
- package/dist/interface/IHistoryStep.d.ts +12 -8
- package/dist/interface/ISaveData.d.mts +8 -4
- package/dist/interface/ISaveData.d.ts +8 -4
- package/dist/interface/ITicker.d.mts +2 -1
- package/dist/interface/ITicker.d.ts +2 -1
- package/dist/interface/ITickersSteps.d.mts +14 -5
- package/dist/interface/ITickersSteps.d.ts +14 -5
- package/dist/interface/TickerHistory.d.mts +29 -0
- package/dist/interface/TickerHistory.d.ts +29 -0
- package/dist/{types/ticker/TickerMoveProps.js → interface/TickerHistory.js} +1 -1
- package/dist/interface/TickerHistory.mjs +3 -0
- package/dist/interface/TickerProgrationType.d.mts +13 -1
- package/dist/interface/TickerProgrationType.d.ts +13 -1
- package/dist/interface/TickerTimeoutHistory.d.mts +7 -0
- package/dist/interface/TickerTimeoutHistory.d.ts +7 -0
- package/dist/interface/TickerTimeoutHistory.js +4 -0
- package/dist/interface/TickerTimeoutHistory.mjs +3 -0
- package/dist/interface/canvas/ICanvasBaseMemory.d.mts +1 -1
- package/dist/interface/canvas/ICanvasBaseMemory.d.ts +1 -1
- package/dist/interface/canvas/ICanvasImageMemory.d.mts +1 -1
- package/dist/interface/canvas/ICanvasImageMemory.d.ts +1 -1
- package/dist/interface/canvas/ICanvasSpriteMemory.d.mts +0 -1
- package/dist/interface/canvas/ICanvasSpriteMemory.d.ts +0 -1
- package/dist/interface/canvas/ICanvasTextTextMemory.d.mts +0 -1
- package/dist/interface/canvas/ICanvasTextTextMemory.d.ts +0 -1
- package/dist/interface/export/ExportedCanvas.d.mts +11 -3
- package/dist/interface/export/ExportedCanvas.d.ts +11 -3
- package/dist/interface/export/ExportedStep.d.mts +7 -3
- package/dist/interface/export/ExportedStep.d.ts +7 -3
- package/dist/interface/export/index.d.mts +8 -4
- package/dist/interface/export/index.d.ts +8 -4
- package/dist/interface/index.d.mts +14 -11
- package/dist/interface/index.d.ts +14 -11
- package/dist/labels/BaseCanvasElementTestLabel.d.mts +9 -0
- package/dist/labels/BaseCanvasElementTestLabel.d.ts +9 -0
- package/dist/labels/BaseCanvasElementTestLabel.js +1888 -0
- package/dist/labels/BaseCanvasElementTestLabel.js.map +1 -0
- package/dist/labels/BaseCanvasElementTestLabel.mjs +1882 -0
- package/dist/labels/BaseCanvasElementTestLabel.mjs.map +1 -0
- package/dist/labels/CanvasEventsTestLabel.d.mts +27 -0
- package/dist/labels/CanvasEventsTestLabel.d.ts +27 -0
- package/dist/labels/CanvasEventsTestLabel.js +2822 -0
- package/dist/labels/CanvasEventsTestLabel.js.map +1 -0
- package/dist/labels/CanvasEventsTestLabel.mjs +2816 -0
- package/dist/labels/CanvasEventsTestLabel.mjs.map +1 -0
- package/dist/labels/CustomTickerCanvasElementTestLabel.d.mts +20 -0
- package/dist/labels/CustomTickerCanvasElementTestLabel.d.ts +20 -0
- package/dist/labels/CustomTickerCanvasElementTestLabel.js +2792 -0
- package/dist/labels/CustomTickerCanvasElementTestLabel.js.map +1 -0
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs +2786 -0
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs.map +1 -0
- package/dist/labels/ImagesAnimationsTestLabel.d.mts +9 -0
- package/dist/labels/ImagesAnimationsTestLabel.d.ts +9 -0
- package/dist/labels/ImagesAnimationsTestLabel.js +3378 -0
- package/dist/labels/ImagesAnimationsTestLabel.js.map +1 -0
- package/dist/labels/ImagesAnimationsTestLabel.mjs +3372 -0
- package/dist/labels/ImagesAnimationsTestLabel.mjs.map +1 -0
- package/dist/labels/MarkdownTest.d.mts +9 -0
- package/dist/labels/MarkdownTest.d.ts +9 -0
- package/dist/labels/MarkdownTest.js +2756 -0
- package/dist/labels/MarkdownTest.js.map +1 -0
- package/dist/labels/MarkdownTest.mjs +2750 -0
- package/dist/labels/MarkdownTest.mjs.map +1 -0
- package/dist/labels/StartLabel.d.mts +10 -0
- package/dist/labels/StartLabel.d.ts +10 -0
- package/dist/labels/StartLabel.js +3736 -0
- package/dist/labels/StartLabel.js.map +1 -0
- package/dist/labels/StartLabel.mjs +3729 -0
- package/dist/labels/StartLabel.mjs.map +1 -0
- package/dist/labels/TestConstant.d.mts +17 -0
- package/dist/labels/TestConstant.d.ts +17 -0
- package/dist/labels/TestConstant.js +1872 -0
- package/dist/labels/TestConstant.js.map +1 -0
- package/dist/labels/TestConstant.mjs +1856 -0
- package/dist/labels/TestConstant.mjs.map +1 -0
- package/dist/labels/TickerTestLabel.d.mts +9 -0
- package/dist/labels/TickerTestLabel.d.ts +9 -0
- package/dist/labels/TickerTestLabel.js +2675 -0
- package/dist/labels/TickerTestLabel.js.map +1 -0
- package/dist/labels/TickerTestLabel.mjs +2669 -0
- package/dist/labels/TickerTestLabel.mjs.map +1 -0
- package/dist/labels/index.d.mts +10 -0
- package/dist/labels/index.d.ts +10 -0
- package/dist/labels/index.js +3736 -0
- package/dist/labels/index.js.map +1 -0
- package/dist/labels/index.mjs +3729 -0
- package/dist/labels/index.mjs.map +1 -0
- package/dist/managers/StepManager.d.mts +21 -15
- package/dist/managers/StepManager.d.ts +21 -15
- package/dist/managers/StepManager.js +610 -251
- package/dist/managers/StepManager.js.map +1 -1
- package/dist/managers/StepManager.mjs +610 -251
- package/dist/managers/StepManager.mjs.map +1 -1
- package/dist/managers/WindowManager.d.mts +38 -24
- package/dist/managers/WindowManager.d.ts +38 -24
- package/dist/managers/WindowManager.js +356 -170
- package/dist/managers/WindowManager.js.map +1 -1
- package/dist/managers/WindowManager.mjs +352 -170
- package/dist/managers/WindowManager.mjs.map +1 -1
- package/dist/managers/index.d.mts +15 -14
- package/dist/managers/index.d.ts +15 -14
- package/dist/managers/index.js +612 -251
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +612 -251
- package/dist/managers/index.mjs.map +1 -1
- package/dist/types/CanvasEventNamesType.d.mts +1 -1
- package/dist/types/CanvasEventNamesType.d.ts +1 -1
- package/dist/types/ChoiceMenuOptionsType.d.mts +2 -2
- package/dist/types/ChoiceMenuOptionsType.d.ts +2 -2
- package/dist/types/HistoryChoiceMenuOption.d.mts +22 -0
- package/dist/types/HistoryChoiceMenuOption.d.ts +22 -0
- package/dist/types/HistoryChoiceMenuOption.js +4 -0
- package/dist/types/HistoryChoiceMenuOption.mjs +3 -0
- package/dist/types/PauseType.d.mts +8 -4
- package/dist/types/PauseType.d.ts +8 -4
- package/dist/types/PauseType.js +0 -11
- package/dist/types/PauseType.js.map +1 -1
- package/dist/types/PauseType.mjs +0 -9
- package/dist/types/PauseType.mjs.map +1 -1
- package/dist/types/RepeatType.d.mts +1 -2
- package/dist/types/RepeatType.d.ts +1 -2
- package/dist/types/RepeatType.js +0 -4
- package/dist/types/RepeatType.js.map +1 -1
- package/dist/types/RepeatType.mjs +0 -3
- package/dist/types/RepeatType.mjs.map +1 -1
- package/dist/types/index.d.mts +5 -4
- package/dist/types/index.d.ts +5 -4
- package/dist/types/index.js +0 -15
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +1 -13
- package/dist/types/index.mjs.map +1 -1
- package/dist/types/ticker/{TickerFadeAlphaProps.d.mts → FadeAlphaTickerProps.d.mts} +9 -5
- package/dist/types/ticker/{TickerFadeAlphaProps.d.ts → FadeAlphaTickerProps.d.ts} +9 -5
- package/dist/types/ticker/FadeAlphaTickerProps.js +4 -0
- package/dist/types/ticker/FadeAlphaTickerProps.js.map +1 -0
- package/dist/types/ticker/FadeAlphaTickerProps.mjs +3 -0
- package/dist/types/ticker/FadeAlphaTickerProps.mjs.map +1 -0
- package/dist/types/ticker/{TickerMoveProps.d.mts → MoveTickerProps.d.mts} +14 -5
- package/dist/types/ticker/{TickerMoveProps.d.ts → MoveTickerProps.d.ts} +14 -5
- package/dist/types/ticker/{TickerRotateProps.js → MoveTickerProps.js} +1 -1
- package/dist/types/ticker/MoveTickerProps.js.map +1 -0
- package/dist/types/ticker/MoveTickerProps.mjs +3 -0
- package/dist/types/ticker/MoveTickerProps.mjs.map +1 -0
- package/dist/types/ticker/{TickerRotateProps.d.mts → RotateTickerProps.d.mts} +10 -4
- package/dist/types/ticker/{TickerRotateProps.d.ts → RotateTickerProps.d.ts} +10 -4
- package/dist/types/ticker/RotateTickerProps.js +4 -0
- package/dist/types/ticker/RotateTickerProps.js.map +1 -0
- package/dist/types/ticker/RotateTickerProps.mjs +3 -0
- package/dist/types/ticker/RotateTickerProps.mjs.map +1 -0
- package/dist/types/ticker/TagToRemoveAfterType.d.mts +4 -0
- package/dist/types/ticker/TagToRemoveAfterType.d.ts +4 -0
- package/dist/types/ticker/TagToRemoveAfterType.js +8 -0
- package/dist/types/ticker/TagToRemoveAfterType.js.map +1 -0
- package/dist/types/ticker/TagToRemoveAfterType.mjs +6 -0
- package/dist/types/ticker/TagToRemoveAfterType.mjs.map +1 -0
- package/dist/types/ticker/ZoomTickerProps.d.mts +45 -0
- package/dist/types/ticker/ZoomTickerProps.d.ts +45 -0
- package/dist/types/ticker/ZoomTickerProps.js +4 -0
- package/dist/types/ticker/ZoomTickerProps.js.map +1 -0
- package/dist/types/ticker/ZoomTickerProps.mjs +3 -0
- package/dist/types/ticker/ZoomTickerProps.mjs.map +1 -0
- package/dist/types/ticker/index.d.mts +4 -2
- package/dist/types/ticker/index.d.ts +4 -2
- package/package.json +7 -7
- package/dist/classes/ticker/TickerFadeAlpha.d.mts +0 -31
- package/dist/classes/ticker/TickerFadeAlpha.d.ts +0 -31
- package/dist/classes/ticker/TickerFadeAlpha.js.map +0 -1
- package/dist/classes/ticker/TickerFadeAlpha.mjs.map +0 -1
- package/dist/classes/ticker/TickerMove.d.mts +0 -29
- package/dist/classes/ticker/TickerMove.d.ts +0 -29
- package/dist/classes/ticker/TickerMove.js.map +0 -1
- package/dist/classes/ticker/TickerMove.mjs.map +0 -1
- package/dist/classes/ticker/TickerRotate.d.mts +0 -30
- package/dist/classes/ticker/TickerRotate.d.ts +0 -30
- package/dist/classes/ticker/TickerRotate.js.map +0 -1
- package/dist/classes/ticker/TickerRotate.mjs.map +0 -1
- package/dist/functions/ErrorUtility.d.mts +0 -24
- package/dist/functions/ErrorUtility.d.ts +0 -24
- package/dist/functions/ErrorUtility.js +0 -261
- package/dist/functions/ErrorUtility.js.map +0 -1
- package/dist/functions/ErrorUtility.mjs +0 -258
- package/dist/functions/ErrorUtility.mjs.map +0 -1
- package/dist/interface/IClassWithArgsHistory.d.mts +0 -25
- package/dist/interface/IClassWithArgsHistory.d.ts +0 -25
- package/dist/interface/IClassWithArgsHistory.js +0 -4
- package/dist/interface/IClassWithArgsHistory.mjs +0 -3
- package/dist/types/ticker/TickerFadeAlphaProps.js +0 -4
- package/dist/types/ticker/TickerFadeAlphaProps.mjs +0 -3
- package/dist/types/ticker/TickerMoveProps.mjs +0 -3
- package/dist/types/ticker/TickerRotateProps.mjs +0 -3
- /package/dist/interface/{IClassWithArgsHistory.js.map → CharacterBaseModelProps.js.map} +0 -0
- /package/dist/interface/{IClassWithArgsHistory.mjs.map → CharacterBaseModelProps.mjs.map} +0 -0
- /package/dist/{types/ticker/TickerFadeAlphaProps.js.map → interface/TickerHistory.js.map} +0 -0
- /package/dist/{types/ticker/TickerFadeAlphaProps.mjs.map → interface/TickerHistory.mjs.map} +0 -0
- /package/dist/{types/ticker/TickerMoveProps.js.map → interface/TickerTimeoutHistory.js.map} +0 -0
- /package/dist/{types/ticker/TickerMoveProps.mjs.map → interface/TickerTimeoutHistory.mjs.map} +0 -0
- /package/dist/types/{ticker/TickerRotateProps.js.map → HistoryChoiceMenuOption.js.map} +0 -0
- /package/dist/types/{ticker/TickerRotateProps.mjs.map → HistoryChoiceMenuOption.mjs.map} +0 -0
|
@@ -0,0 +1,3372 @@
|
|
|
1
|
+
import { diff } from 'deep-diff';
|
|
2
|
+
import sha1 from 'crypto-js/sha1';
|
|
3
|
+
import { Sprite, Container, Application, Assets, Texture, Text } from 'pixi.js';
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __defProps = Object.defineProperties;
|
|
7
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
9
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
26
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
27
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
28
|
+
if (decorator = decorators[i])
|
|
29
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
30
|
+
if (kind && result) __defProp(target, key, result);
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
var __async = (__this, __arguments, generator) => {
|
|
34
|
+
return new Promise((resolve, reject) => {
|
|
35
|
+
var fulfilled = (value) => {
|
|
36
|
+
try {
|
|
37
|
+
step(generator.next(value));
|
|
38
|
+
} catch (e) {
|
|
39
|
+
reject(e);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var rejected = (value) => {
|
|
43
|
+
try {
|
|
44
|
+
step(generator.throw(value));
|
|
45
|
+
} catch (e) {
|
|
46
|
+
reject(e);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
50
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
function getStepSha1(step) {
|
|
54
|
+
let sha1String = sha1(step.toString().toLocaleLowerCase());
|
|
55
|
+
return sha1String.toString();
|
|
56
|
+
}
|
|
57
|
+
function checkIfStepsIsEqual(step1, step2) {
|
|
58
|
+
return step1 === step2;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// src/classes/Label.ts
|
|
62
|
+
var Label = class {
|
|
63
|
+
/**
|
|
64
|
+
* @param id is the id of the label
|
|
65
|
+
* @param steps is the list of steps that the label will perform
|
|
66
|
+
* @param onStepRun is a function that will be executed before any step is executed, is useful for example to make sure all images used have been cached
|
|
67
|
+
* @param choiseIndex is the index of the choice that the label will perform
|
|
68
|
+
*/
|
|
69
|
+
constructor(id, steps, onStepRun, choiseIndex) {
|
|
70
|
+
this._id = id;
|
|
71
|
+
this._steps = steps;
|
|
72
|
+
this._onStepRun = onStepRun;
|
|
73
|
+
this._choiseIndex = choiseIndex;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
77
|
+
*/
|
|
78
|
+
get id() {
|
|
79
|
+
return this._id;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get the steps of the label.
|
|
83
|
+
* This class should be extended and the steps method should be overridden.
|
|
84
|
+
* Every time you update this list will also be updated when the other game versions load.
|
|
85
|
+
*/
|
|
86
|
+
get steps() {
|
|
87
|
+
if (typeof this._steps === "function") {
|
|
88
|
+
return this._steps();
|
|
89
|
+
}
|
|
90
|
+
return this._steps;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get the corresponding steps number
|
|
94
|
+
* @param externalSteps
|
|
95
|
+
* @returns Numer of corresponding steps, for example, if externalSteps is [ABC, DEF, GHI] and the steps of the label is [ABC, GHT], the result will be 1
|
|
96
|
+
*/
|
|
97
|
+
getCorrespondingStepsNumber(externalSteps) {
|
|
98
|
+
if (externalSteps.length === 0) {
|
|
99
|
+
return 0;
|
|
100
|
+
}
|
|
101
|
+
let res = 0;
|
|
102
|
+
externalSteps.forEach((step, index) => {
|
|
103
|
+
if (checkIfStepsIsEqual(step, this.steps[index])) {
|
|
104
|
+
res = index;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
return res;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get the function that will be executed before any step is executed, is useful for example to make sure all images used have been cached
|
|
111
|
+
* @returns Promise<void> or void
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* newLabel("id", [], () => {
|
|
115
|
+
* Assets.load('path/to/image1.png')
|
|
116
|
+
* Assets.load('path/to/image2.png')
|
|
117
|
+
* })
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
get onStepRun() {
|
|
121
|
+
return this._onStepRun;
|
|
122
|
+
}
|
|
123
|
+
get choiseIndex() {
|
|
124
|
+
return this._choiseIndex;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// src/classes/CloseLabel.ts
|
|
129
|
+
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
130
|
+
function newCloseLabel(choiseIndex) {
|
|
131
|
+
return new Label(CLOSE_LABEL_ID, [], void 0, choiseIndex);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// src/decorators/LabelDecorator.ts
|
|
135
|
+
var registeredLabels = {};
|
|
136
|
+
function newLabel(id, steps, onStepRun) {
|
|
137
|
+
if (registeredLabels[id]) {
|
|
138
|
+
console.info(`[Pixi'VN] Label ${id} already exists, it will be overwritten`);
|
|
139
|
+
}
|
|
140
|
+
let label = new Label(id, steps, onStepRun);
|
|
141
|
+
registeredLabels[id] = label;
|
|
142
|
+
return label;
|
|
143
|
+
}
|
|
144
|
+
function getLabelById(id) {
|
|
145
|
+
let label = registeredLabels[id];
|
|
146
|
+
if (!label) {
|
|
147
|
+
console.error(`[Pixi'VN] Label ${id} not found`);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
return label;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// src/functions/CanvasUtility.ts
|
|
154
|
+
function getTextureMemory(texture) {
|
|
155
|
+
let sourceTexture = texture.source;
|
|
156
|
+
let textureMemory = {
|
|
157
|
+
image: sourceTexture.label
|
|
158
|
+
};
|
|
159
|
+
return textureMemory;
|
|
160
|
+
}
|
|
161
|
+
function exportCanvasElement(element) {
|
|
162
|
+
return element.memory;
|
|
163
|
+
}
|
|
164
|
+
function importCanvasElement(memory) {
|
|
165
|
+
let element = getCanvasElementInstanceById(memory.pixivnId);
|
|
166
|
+
if (element) {
|
|
167
|
+
element.memory = memory;
|
|
168
|
+
} else {
|
|
169
|
+
throw new Error("[Pixi'VN] The element " + memory.pixivnId + " could not be created");
|
|
170
|
+
}
|
|
171
|
+
return element;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// src/classes/canvas/CanvasContainer.ts
|
|
175
|
+
var CANVAS_CONTAINER_ID = "CanvasContainer";
|
|
176
|
+
var CanvasContainer = class extends Container {
|
|
177
|
+
constructor(options) {
|
|
178
|
+
super(options);
|
|
179
|
+
this.pixivnId = CANVAS_CONTAINER_ID;
|
|
180
|
+
this.pixivnId = this.constructor.prototype.pixivnId;
|
|
181
|
+
}
|
|
182
|
+
get memory() {
|
|
183
|
+
let memory = getMemoryContainer(this);
|
|
184
|
+
this.children.forEach((child) => {
|
|
185
|
+
memory.elements.push(exportCanvasElement(child));
|
|
186
|
+
});
|
|
187
|
+
return memory;
|
|
188
|
+
}
|
|
189
|
+
set memory(value) {
|
|
190
|
+
setMemoryContainer(this, value);
|
|
191
|
+
value.elements.forEach((child) => {
|
|
192
|
+
this.addChild(importCanvasElement(child));
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
function getMemoryContainer(element) {
|
|
197
|
+
let className = "CanvasContainer";
|
|
198
|
+
if (element.hasOwnProperty("pixivnId")) {
|
|
199
|
+
className = element.pixivnId;
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
pixivnId: className,
|
|
203
|
+
elements: [],
|
|
204
|
+
width: element.width,
|
|
205
|
+
height: element.height,
|
|
206
|
+
isRenderGroup: element.isRenderGroup,
|
|
207
|
+
blendMode: element.blendMode,
|
|
208
|
+
tint: element.tint,
|
|
209
|
+
alpha: element.alpha,
|
|
210
|
+
angle: element.angle,
|
|
211
|
+
renderable: element.renderable,
|
|
212
|
+
rotation: element.rotation,
|
|
213
|
+
scale: { x: element.scale.x, y: element.scale.y },
|
|
214
|
+
pivot: { x: element.pivot.x, y: element.pivot.y },
|
|
215
|
+
position: { x: element.position.x, y: element.position.y },
|
|
216
|
+
skew: { x: element.skew.x, y: element.skew.y },
|
|
217
|
+
visible: element.visible,
|
|
218
|
+
culled: element.culled,
|
|
219
|
+
x: element.x,
|
|
220
|
+
y: element.y,
|
|
221
|
+
boundsArea: element.boundsArea,
|
|
222
|
+
cursor: element.cursor,
|
|
223
|
+
eventMode: element.eventMode,
|
|
224
|
+
interactive: element.interactive,
|
|
225
|
+
interactiveChildren: element.interactiveChildren,
|
|
226
|
+
hitArea: element.hitArea
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
function setMemoryContainer(element, memory) {
|
|
230
|
+
memory.width && (element.width = memory.width);
|
|
231
|
+
memory.height && (element.height = memory.height);
|
|
232
|
+
memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
|
|
233
|
+
memory.blendMode && (element.blendMode = memory.blendMode);
|
|
234
|
+
memory.tint && (element.tint = memory.tint);
|
|
235
|
+
memory.alpha && (element.alpha = memory.alpha);
|
|
236
|
+
memory.angle && (element.angle = memory.angle);
|
|
237
|
+
memory.renderable && (element.renderable = memory.renderable);
|
|
238
|
+
memory.rotation && (element.rotation = memory.rotation);
|
|
239
|
+
if (memory.scale) {
|
|
240
|
+
if (typeof memory.scale === "number") {
|
|
241
|
+
element.scale.set(memory.scale, memory.scale);
|
|
242
|
+
} else {
|
|
243
|
+
element.scale.set(memory.scale.x, memory.scale.y);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (memory.pivot) {
|
|
247
|
+
if (typeof memory.pivot === "number") {
|
|
248
|
+
element.pivot.set(memory.pivot, memory.pivot);
|
|
249
|
+
} else {
|
|
250
|
+
element.pivot.set(memory.pivot.x, memory.pivot.y);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
memory.position && element.position.set(memory.position.x, memory.position.y);
|
|
254
|
+
memory.skew && element.skew.set(memory.skew.x, memory.skew.y);
|
|
255
|
+
memory.visible && (element.visible = memory.visible);
|
|
256
|
+
memory.culled && (element.culled = memory.culled);
|
|
257
|
+
memory.x && (element.x = memory.x);
|
|
258
|
+
memory.y && (element.y = memory.y);
|
|
259
|
+
memory.boundsArea && (element.boundsArea = memory.boundsArea);
|
|
260
|
+
memory.cursor && (element.cursor = memory.cursor);
|
|
261
|
+
memory.eventMode && (element.eventMode = memory.eventMode);
|
|
262
|
+
memory.interactive && (element.interactive = memory.interactive);
|
|
263
|
+
memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
|
|
264
|
+
memory.hitArea && (element.hitArea = memory.hitArea);
|
|
265
|
+
}
|
|
266
|
+
function getTexture(imageUrl) {
|
|
267
|
+
return __async(this, null, function* () {
|
|
268
|
+
if (Assets.cache.has(imageUrl)) {
|
|
269
|
+
return Assets.get(imageUrl);
|
|
270
|
+
}
|
|
271
|
+
return Assets.load(imageUrl).then((texture) => {
|
|
272
|
+
if (!texture) {
|
|
273
|
+
console.error("[Pixi'VN] Texture not found", imageUrl);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (!(texture instanceof Texture)) {
|
|
277
|
+
console.error("[Pixi'VN] File not is a image", imageUrl);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
return texture;
|
|
281
|
+
}).catch((e) => {
|
|
282
|
+
console.error("[Pixi'VN] Error loading image", e);
|
|
283
|
+
return;
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
function getTextStyle(style) {
|
|
288
|
+
let fill = style.fill;
|
|
289
|
+
if (fill instanceof Object) {
|
|
290
|
+
console.warn("[Pixi'VN] CanvasText.style.fill is a FillGradient or FillPattern, this is not supported yet.", fill);
|
|
291
|
+
fill = "#00FF00";
|
|
292
|
+
}
|
|
293
|
+
return {
|
|
294
|
+
align: style.align,
|
|
295
|
+
breakWords: style.breakWords,
|
|
296
|
+
dropShadow: style.dropShadow,
|
|
297
|
+
fill,
|
|
298
|
+
fontFamily: style.fontFamily,
|
|
299
|
+
fontSize: style.fontSize,
|
|
300
|
+
fontStyle: style.fontStyle,
|
|
301
|
+
fontVariant: style.fontVariant,
|
|
302
|
+
fontWeight: style.fontWeight,
|
|
303
|
+
leading: style.leading,
|
|
304
|
+
letterSpacing: style.letterSpacing,
|
|
305
|
+
lineHeight: style.lineHeight,
|
|
306
|
+
padding: style.padding,
|
|
307
|
+
stroke: style.stroke,
|
|
308
|
+
textBaseline: style.textBaseline,
|
|
309
|
+
trim: style.trim,
|
|
310
|
+
whiteSpace: style.whiteSpace,
|
|
311
|
+
wordWrap: style.wordWrap,
|
|
312
|
+
wordWrapWidth: style.wordWrapWidth
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// src/decorators/EventDecorator.ts
|
|
317
|
+
var registeredEvents = {};
|
|
318
|
+
function getEventTypeById(eventId) {
|
|
319
|
+
try {
|
|
320
|
+
let eventType = registeredEvents[eventId];
|
|
321
|
+
if (!eventType) {
|
|
322
|
+
console.error(`[Pixi'VN] Event ${eventId} not found`);
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
new eventType();
|
|
326
|
+
return eventType;
|
|
327
|
+
} catch (e) {
|
|
328
|
+
console.error(`[Pixi'VN] Error while getting Event ${eventId}`, e);
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
function getEventInstanceById(eventId) {
|
|
333
|
+
try {
|
|
334
|
+
let eventType = registeredEvents[eventId];
|
|
335
|
+
if (!eventType) {
|
|
336
|
+
console.error(`[Pixi'VN] Event ${eventId} not found`);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
let event = new eventType();
|
|
340
|
+
return event;
|
|
341
|
+
} catch (e) {
|
|
342
|
+
console.error(`[Pixi'VN] Error while getting Event ${eventId}`, e);
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// src/classes/canvas/CanvasSprite.ts
|
|
348
|
+
var CANVAS_SPRITE_ID = "CanvasSprite";
|
|
349
|
+
var CanvasSprite = class _CanvasSprite extends Sprite {
|
|
350
|
+
constructor(options) {
|
|
351
|
+
super(options);
|
|
352
|
+
this.pixivnId = CANVAS_SPRITE_ID;
|
|
353
|
+
this._onEvents = {};
|
|
354
|
+
this.pixivnId = this.constructor.prototype.pixivnId;
|
|
355
|
+
}
|
|
356
|
+
get memory() {
|
|
357
|
+
return getMemorySprite(this);
|
|
358
|
+
}
|
|
359
|
+
set memory(value) {
|
|
360
|
+
setMemorySprite(this, value);
|
|
361
|
+
}
|
|
362
|
+
get onEvents() {
|
|
363
|
+
return this._onEvents;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* is same function as on(), but it keeps in memory the children.
|
|
367
|
+
* @param event The event type, e.g., 'click', 'mousedown', 'mouseup', 'pointerdown', etc.
|
|
368
|
+
* @param eventClass The class that extends CanvasEvent.
|
|
369
|
+
* @returns
|
|
370
|
+
* @example
|
|
371
|
+
* ```typescript
|
|
372
|
+
* \@eventDecorator()
|
|
373
|
+
* export class EventTest extends CanvasEvent<CanvasSprite> {
|
|
374
|
+
* override fn(event: CanvasEventNamesType, sprite: CanvasSprite): void {
|
|
375
|
+
* if (event === 'pointerdown') {
|
|
376
|
+
* sprite.scale.x *= 1.25;
|
|
377
|
+
* sprite.scale.y *= 1.25;
|
|
378
|
+
* }
|
|
379
|
+
* }
|
|
380
|
+
* }
|
|
381
|
+
* ```
|
|
382
|
+
*
|
|
383
|
+
* ```typescript
|
|
384
|
+
* let sprite = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
|
|
385
|
+
* await sprite.load()
|
|
386
|
+
*
|
|
387
|
+
* sprite.eventMode = 'static';
|
|
388
|
+
* sprite.cursor = 'pointer';
|
|
389
|
+
* sprite.onEvent('pointerdown', EventTest);
|
|
390
|
+
*
|
|
391
|
+
* GameWindowManager.addCanvasElement("bunny", sprite);
|
|
392
|
+
* ```
|
|
393
|
+
*/
|
|
394
|
+
onEvent(event, eventClass) {
|
|
395
|
+
let id = eventClass.prototype.id;
|
|
396
|
+
let instance = getEventInstanceById(id);
|
|
397
|
+
this._onEvents[event] = id;
|
|
398
|
+
if (instance) {
|
|
399
|
+
super.on(event, () => {
|
|
400
|
+
instance.fn(event, this);
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
return this;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* on() does not keep in memory the event class, use onEvent() instead
|
|
407
|
+
* @deprecated
|
|
408
|
+
* @private
|
|
409
|
+
* @param event
|
|
410
|
+
* @param fn
|
|
411
|
+
* @param context
|
|
412
|
+
*/
|
|
413
|
+
on(event, fn, context) {
|
|
414
|
+
return super.on(event, fn, context);
|
|
415
|
+
}
|
|
416
|
+
static from(source, skipCache) {
|
|
417
|
+
let sprite = Sprite.from(source, skipCache);
|
|
418
|
+
let mySprite = new _CanvasSprite();
|
|
419
|
+
mySprite.texture = sprite.texture;
|
|
420
|
+
return mySprite;
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
function getMemorySprite(element) {
|
|
424
|
+
let temp = getMemoryContainer(element);
|
|
425
|
+
return __spreadProps(__spreadValues({}, temp), {
|
|
426
|
+
pixivnId: element.pixivnId,
|
|
427
|
+
textureImage: getTextureMemory(element.texture),
|
|
428
|
+
anchor: { x: element.anchor.x, y: element.anchor.y },
|
|
429
|
+
roundPixels: element.roundPixels,
|
|
430
|
+
onEvents: element.onEvents
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
function setMemorySprite(element, memory) {
|
|
434
|
+
setMemoryContainer(element, memory);
|
|
435
|
+
getTexture(memory.textureImage.image).then((texture) => {
|
|
436
|
+
if (texture) {
|
|
437
|
+
element.texture = texture;
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
if (memory.anchor) {
|
|
441
|
+
if (typeof memory.anchor === "number") {
|
|
442
|
+
element.anchor.set(memory.anchor, memory.anchor);
|
|
443
|
+
} else {
|
|
444
|
+
element.anchor.set(memory.anchor.x, memory.anchor.y);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
memory.roundPixels && (element.roundPixels = memory.roundPixels);
|
|
448
|
+
for (let event in memory.onEvents) {
|
|
449
|
+
let id = memory.onEvents[event];
|
|
450
|
+
let instance = getEventTypeById(id);
|
|
451
|
+
if (instance) {
|
|
452
|
+
element.onEvent(event, instance);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// src/classes/canvas/CanvasImage.ts
|
|
458
|
+
var CANVAS_IMAGE_ID = "CanvasImage";
|
|
459
|
+
var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
460
|
+
constructor(options, imageLink) {
|
|
461
|
+
super(options);
|
|
462
|
+
this.pixivnId = CANVAS_IMAGE_ID;
|
|
463
|
+
this.imageLink = "";
|
|
464
|
+
if (imageLink) {
|
|
465
|
+
this.imageLink = imageLink;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
get memory() {
|
|
469
|
+
return __spreadProps(__spreadValues({}, getMemorySprite(this)), {
|
|
470
|
+
pixivnId: this.pixivnId,
|
|
471
|
+
imageLink: this.imageLink
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
set memory(memory) {
|
|
475
|
+
setMemorySprite(this, memory);
|
|
476
|
+
this.imageLink = memory.imageLink;
|
|
477
|
+
}
|
|
478
|
+
static from(source, skipCache) {
|
|
479
|
+
let sprite = Sprite.from(source, skipCache);
|
|
480
|
+
let mySprite = new _CanvasImage();
|
|
481
|
+
mySprite.texture = sprite.texture;
|
|
482
|
+
return mySprite;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Load the image from the link and set the texture of the sprite.
|
|
486
|
+
* @param image The link of the image. If it is not set, it will use the imageLink property.
|
|
487
|
+
* @returns A promise that resolves when the image is loaded.
|
|
488
|
+
*/
|
|
489
|
+
load(image) {
|
|
490
|
+
return __async(this, null, function* () {
|
|
491
|
+
if (!image) {
|
|
492
|
+
image = this.imageLink;
|
|
493
|
+
}
|
|
494
|
+
return getTexture(this.imageLink).then((texture) => {
|
|
495
|
+
if (texture) {
|
|
496
|
+
this.texture = texture;
|
|
497
|
+
}
|
|
498
|
+
}).catch((e) => {
|
|
499
|
+
console.error("[Pixi'VN] Error into CanvasImage.load()", e);
|
|
500
|
+
});
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
var CANVAS_TEXT_ID = "CanvasText";
|
|
505
|
+
var CanvasText = class extends Text {
|
|
506
|
+
constructor(options) {
|
|
507
|
+
super(options);
|
|
508
|
+
this.pixivnId = CANVAS_TEXT_ID;
|
|
509
|
+
this._onEvents = {};
|
|
510
|
+
this.pixivnId = this.constructor.prototype.pixivnId;
|
|
511
|
+
}
|
|
512
|
+
get memory() {
|
|
513
|
+
return getMemoryText(this);
|
|
514
|
+
}
|
|
515
|
+
set memory(value) {
|
|
516
|
+
setMemoryText(this, value);
|
|
517
|
+
}
|
|
518
|
+
get onEvents() {
|
|
519
|
+
return this._onEvents;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* is same function as on(), but it keeps in memory the children.
|
|
523
|
+
* @param event The event type, e.g., 'click', 'mousedown', 'mouseup', 'pointerdown', etc.
|
|
524
|
+
* @param eventClass The class that extends CanvasEvent.
|
|
525
|
+
* @returns
|
|
526
|
+
* @example
|
|
527
|
+
* ```typescript
|
|
528
|
+
* \@eventDecorator()
|
|
529
|
+
* export class EventTest extends CanvasEvent<CanvasText> {
|
|
530
|
+
* override fn(event: CanvasEventNamesType, text: CanvasText): void {
|
|
531
|
+
* if (event === 'pointerdown') {
|
|
532
|
+
* text.scale.x *= 1.25;
|
|
533
|
+
* text.scale.y *= 1.25;
|
|
534
|
+
* }
|
|
535
|
+
* }
|
|
536
|
+
* }
|
|
537
|
+
* ```
|
|
538
|
+
*
|
|
539
|
+
* ```typescript
|
|
540
|
+
* const text = new CanvasText();
|
|
541
|
+
* text.text = "Hello World"
|
|
542
|
+
*
|
|
543
|
+
* text.eventMode = 'static';
|
|
544
|
+
* text.cursor = 'pointer';
|
|
545
|
+
* text.onEvent('pointerdown', EventTest);
|
|
546
|
+
*
|
|
547
|
+
* GameWindowManager.addCanvasElement("text", text);
|
|
548
|
+
* ```
|
|
549
|
+
*/
|
|
550
|
+
onEvent(event, eventClass) {
|
|
551
|
+
let id = eventClass.prototype.id;
|
|
552
|
+
let instance = getEventInstanceById(id);
|
|
553
|
+
this._onEvents[event] = id;
|
|
554
|
+
if (instance) {
|
|
555
|
+
super.on(event, () => {
|
|
556
|
+
instance.fn(event, this);
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
return this;
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* on() does not keep in memory the event class, use onEvent() instead
|
|
563
|
+
* @deprecated
|
|
564
|
+
* @private
|
|
565
|
+
* @param event
|
|
566
|
+
* @param fn
|
|
567
|
+
* @param context
|
|
568
|
+
*/
|
|
569
|
+
on(event, fn, context) {
|
|
570
|
+
return super.on(event, fn, context);
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
function getMemoryText(element) {
|
|
574
|
+
let temp = getMemoryContainer(element);
|
|
575
|
+
return __spreadProps(__spreadValues({}, temp), {
|
|
576
|
+
pixivnId: element.pixivnId,
|
|
577
|
+
anchor: { x: element.anchor.x, y: element.anchor.y },
|
|
578
|
+
text: element.text,
|
|
579
|
+
resolution: element.resolution,
|
|
580
|
+
style: getTextStyle(element.style),
|
|
581
|
+
roundPixels: element.roundPixels,
|
|
582
|
+
onEvents: element.onEvents
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
function setMemoryText(element, memory) {
|
|
586
|
+
setMemoryContainer(element, memory);
|
|
587
|
+
if (memory.anchor) {
|
|
588
|
+
if (typeof memory.anchor === "number") {
|
|
589
|
+
element.anchor.set(memory.anchor, memory.anchor);
|
|
590
|
+
} else {
|
|
591
|
+
element.anchor.set(memory.anchor.x, memory.anchor.y);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
memory.text && (element.text = memory.text);
|
|
595
|
+
memory.resolution && (element.resolution = memory.resolution);
|
|
596
|
+
memory.style && (element.style = memory.style);
|
|
597
|
+
memory.roundPixels && (element.roundPixels = memory.roundPixels);
|
|
598
|
+
for (let event in memory.onEvents) {
|
|
599
|
+
let id = memory.onEvents[event];
|
|
600
|
+
let instance = getEventTypeById(id);
|
|
601
|
+
if (instance) {
|
|
602
|
+
element.onEvent(event, instance);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// src/decorators/CanvasElementDecorator.ts
|
|
608
|
+
var registeredCanvasElement = {};
|
|
609
|
+
function getCanvasElementInstanceById(canvasId) {
|
|
610
|
+
try {
|
|
611
|
+
let eventType = registeredCanvasElement[canvasId];
|
|
612
|
+
if (!eventType) {
|
|
613
|
+
if (canvasId === CANVAS_CONTAINER_ID) {
|
|
614
|
+
eventType = CanvasContainer;
|
|
615
|
+
} else if (canvasId === CANVAS_IMAGE_ID) {
|
|
616
|
+
eventType = CanvasImage;
|
|
617
|
+
} else if (canvasId === CANVAS_SPRITE_ID) {
|
|
618
|
+
eventType = CanvasSprite;
|
|
619
|
+
} else if (canvasId === CANVAS_TEXT_ID) {
|
|
620
|
+
eventType = CanvasText;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
if (!eventType) {
|
|
624
|
+
console.error(`[Pixi'VN] CanvasElement ${canvasId} not found`);
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
let canvasElement = new eventType();
|
|
628
|
+
return canvasElement;
|
|
629
|
+
} catch (e) {
|
|
630
|
+
console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasId}`, e);
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
// src/decorators/CharacterDecorator.ts
|
|
636
|
+
var registeredCharacters = {};
|
|
637
|
+
function saveCharacter(character) {
|
|
638
|
+
if (Array.isArray(character)) {
|
|
639
|
+
character.forEach((c) => saveCharacter(c));
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
if (registeredCharacters[character.id]) {
|
|
643
|
+
console.info(`[Pixi'VN] Character id ${character.id} already exists, it will be overwritten`);
|
|
644
|
+
}
|
|
645
|
+
registeredCharacters[character.id] = character;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
// src/decorators/TickerDecorator.ts
|
|
649
|
+
var registeredTickers = {};
|
|
650
|
+
function tickerDecorator(name) {
|
|
651
|
+
return function(target) {
|
|
652
|
+
if (!name) {
|
|
653
|
+
name = target.name;
|
|
654
|
+
}
|
|
655
|
+
if (registeredTickers[name]) {
|
|
656
|
+
console.info(`[Pixi'VN] Ticker ${name} already exists, it will be overwritten`);
|
|
657
|
+
}
|
|
658
|
+
target.prototype.id = name;
|
|
659
|
+
registeredTickers[name] = target;
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
function geTickerInstanceById(tickerId, args, duration, priority) {
|
|
663
|
+
try {
|
|
664
|
+
let ticker = registeredTickers[tickerId];
|
|
665
|
+
if (!ticker) {
|
|
666
|
+
console.error(`[Pixi'VN] Ticker ${tickerId} not found`);
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
return new ticker(args, duration, priority);
|
|
670
|
+
} catch (e) {
|
|
671
|
+
console.error(`[Pixi'VN] Error while getting Ticker ${tickerId}`, e);
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
// src/types/CloseType.ts
|
|
677
|
+
var Close = "close";
|
|
678
|
+
|
|
679
|
+
// src/classes/ChoiceMenuOption.ts
|
|
680
|
+
var ChoiceMenuOption = class {
|
|
681
|
+
/**
|
|
682
|
+
* @param text Text to be displayed in the menu
|
|
683
|
+
* @param label Label to be opened when the option is selected or the id of the label
|
|
684
|
+
* @param type Type of the label to be opened. @default "call"
|
|
685
|
+
* @param props Properties to be passed to the label, when the label is called. it cannot contain functions or classes. @default {}
|
|
686
|
+
*/
|
|
687
|
+
constructor(text, label, type = "call", props) {
|
|
688
|
+
/**
|
|
689
|
+
* Properties to be passed to the label
|
|
690
|
+
*/
|
|
691
|
+
this.props = {};
|
|
692
|
+
if (typeof label === "string") {
|
|
693
|
+
let tLabel = getLabelById(label);
|
|
694
|
+
if (!tLabel) {
|
|
695
|
+
throw new Error(`[Pixi'VN] Label ${label} not found`);
|
|
696
|
+
} else {
|
|
697
|
+
label = tLabel;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
this.text = text;
|
|
701
|
+
this.label = label;
|
|
702
|
+
this.type = type;
|
|
703
|
+
if (props) {
|
|
704
|
+
this.props = props;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
var ChoiceMenuOptionClose = class {
|
|
709
|
+
/**
|
|
710
|
+
* @param text Text to be displayed in the menu
|
|
711
|
+
* @param closeCurrentLabel If true, the current label will be closed. @default false
|
|
712
|
+
*/
|
|
713
|
+
constructor(text, closeCurrentLabel = false) {
|
|
714
|
+
/**
|
|
715
|
+
* Label to be opened when the option is selected
|
|
716
|
+
*/
|
|
717
|
+
this.label = newCloseLabel();
|
|
718
|
+
/**
|
|
719
|
+
* Type of the label to be opened
|
|
720
|
+
*/
|
|
721
|
+
this.type = Close;
|
|
722
|
+
/**
|
|
723
|
+
* Properties to be passed to the label
|
|
724
|
+
*/
|
|
725
|
+
this.props = {};
|
|
726
|
+
this.text = text;
|
|
727
|
+
this.closeCurrentLabel = closeCurrentLabel;
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
|
|
731
|
+
// src/functions/DialogueUtility.ts
|
|
732
|
+
function setDialogue(props) {
|
|
733
|
+
let text = "";
|
|
734
|
+
let character = void 0;
|
|
735
|
+
let dialogue;
|
|
736
|
+
if (typeof props === "string") {
|
|
737
|
+
text = props;
|
|
738
|
+
dialogue = new DialogueBaseModel(text, character);
|
|
739
|
+
} else if (!(props instanceof DialogueBaseModel)) {
|
|
740
|
+
text = props.text;
|
|
741
|
+
if (props.character) {
|
|
742
|
+
if (typeof props.character === "string") {
|
|
743
|
+
character = props.character;
|
|
744
|
+
} else {
|
|
745
|
+
character = props.character.id;
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
dialogue = new DialogueBaseModel(text, character);
|
|
749
|
+
} else {
|
|
750
|
+
dialogue = props;
|
|
751
|
+
}
|
|
752
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY, dialogue);
|
|
753
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex);
|
|
754
|
+
}
|
|
755
|
+
function getDialogue() {
|
|
756
|
+
return GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY);
|
|
757
|
+
}
|
|
758
|
+
function setChoiceMenuOptions(options) {
|
|
759
|
+
let value = options.map((option) => {
|
|
760
|
+
if (option instanceof ChoiceMenuOptionClose) {
|
|
761
|
+
return {
|
|
762
|
+
text: option.text,
|
|
763
|
+
type: Close,
|
|
764
|
+
closeCurrentLabel: option.closeCurrentLabel
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
return __spreadProps(__spreadValues({}, option), {
|
|
768
|
+
label: option.label.id
|
|
769
|
+
});
|
|
770
|
+
});
|
|
771
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY, value);
|
|
772
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex);
|
|
773
|
+
}
|
|
774
|
+
function getChoiceMenuOptions() {
|
|
775
|
+
let d = GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY);
|
|
776
|
+
if (d) {
|
|
777
|
+
let options = [];
|
|
778
|
+
d.forEach((option, index) => {
|
|
779
|
+
if (option.type === Close) {
|
|
780
|
+
let itemLabel = newCloseLabel(index);
|
|
781
|
+
options.push({
|
|
782
|
+
text: option.text,
|
|
783
|
+
label: itemLabel,
|
|
784
|
+
type: Close,
|
|
785
|
+
closeCurrentLabel: option.closeCurrentLabel,
|
|
786
|
+
props: {}
|
|
787
|
+
});
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
let label = getLabelById(option.label);
|
|
791
|
+
if (label) {
|
|
792
|
+
let itemLabel = new Label(label.id, label.steps, label.onStepRun, index);
|
|
793
|
+
options.push(__spreadProps(__spreadValues({}, option), {
|
|
794
|
+
label: itemLabel
|
|
795
|
+
}));
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
return options;
|
|
799
|
+
}
|
|
800
|
+
return void 0;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
// src/classes/ticker/TickerBase.ts
|
|
804
|
+
var TickerBase = class {
|
|
805
|
+
/**
|
|
806
|
+
* @param args The arguments that you want to pass to the ticker.
|
|
807
|
+
* @param duration The duration of the ticker 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
|
|
808
|
+
* @param priority The priority of the ticker. @default UPDATE_PRIORITY.NORMAL
|
|
809
|
+
*/
|
|
810
|
+
constructor(args, duration, priority) {
|
|
811
|
+
/**
|
|
812
|
+
* Get the id of the ticker. This variable is used in the system to get the ticker by id, {@link geTickerInstanceById}
|
|
813
|
+
*/
|
|
814
|
+
this.id = "ticker_id_not_set";
|
|
815
|
+
this.args = args;
|
|
816
|
+
this.duration = duration;
|
|
817
|
+
this.priority = priority;
|
|
818
|
+
this.id = this.constructor.prototype.id;
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* The method that will be called every frame.
|
|
822
|
+
* This method should be overridden and you can use GameWindowManager.addCanvasElement() to get the canvas element of the canvas, and edit them.
|
|
823
|
+
* @param _ticker The ticker that is calling this method
|
|
824
|
+
* @param _args The arguments that you passed when you added the ticker
|
|
825
|
+
* @param _tags The tags of the canvas elements that are connected to this ticker
|
|
826
|
+
* @param _tickerId The id of the ticker. You can use this to get the ticker from the {@link GameWindowManager.currentTickers}
|
|
827
|
+
*/
|
|
828
|
+
fn(_ticker, _args, _tags, _tickerId) {
|
|
829
|
+
throw new Error("[Pixi'VN] The method TickerBase.fn() must be overridden");
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
// src/classes/ticker/FadeAlphaTicker.ts
|
|
834
|
+
var FadeAlphaTicker = class extends TickerBase {
|
|
835
|
+
fn(ticker, args, tags, tickerId) {
|
|
836
|
+
let type = args.type === void 0 ? "hide" : args.type;
|
|
837
|
+
let duration = args.duration === void 0 ? 1 : args.duration;
|
|
838
|
+
let speed = 1 / (duration * 60);
|
|
839
|
+
let limit = args.limit === void 0 ? type === "hide" ? 0 : 1 : args.limit;
|
|
840
|
+
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
841
|
+
if (typeof tagToRemoveAfter2 === "string") {
|
|
842
|
+
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
843
|
+
}
|
|
844
|
+
if (type === "hide" && limit < 0) {
|
|
845
|
+
limit = 0;
|
|
846
|
+
}
|
|
847
|
+
if (type === "show" && limit > 1) {
|
|
848
|
+
limit = 1;
|
|
849
|
+
}
|
|
850
|
+
tags.filter((tag) => {
|
|
851
|
+
var _a;
|
|
852
|
+
let element = GameWindowManager.getCanvasElement(tag);
|
|
853
|
+
if (args.startOnlyIfHaveTexture) {
|
|
854
|
+
if (element && element instanceof Sprite && ((_a = element.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
855
|
+
return false;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
return true;
|
|
859
|
+
}).forEach((tag) => {
|
|
860
|
+
let element = GameWindowManager.getCanvasElement(tag);
|
|
861
|
+
if (element && element instanceof Container) {
|
|
862
|
+
if (type === "show" && element.alpha < limit) {
|
|
863
|
+
element.alpha += speed * ticker.deltaTime;
|
|
864
|
+
} else if (type === "hide" && element.alpha > limit) {
|
|
865
|
+
element.alpha -= speed * ticker.deltaTime;
|
|
866
|
+
}
|
|
867
|
+
if (type === "show" && element.alpha >= limit) {
|
|
868
|
+
element.alpha = limit;
|
|
869
|
+
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
870
|
+
} else if (type === "hide" && element.alpha <= limit) {
|
|
871
|
+
element.alpha = limit;
|
|
872
|
+
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
FadeAlphaTicker = __decorateClass([
|
|
879
|
+
tickerDecorator()
|
|
880
|
+
], FadeAlphaTicker);
|
|
881
|
+
|
|
882
|
+
// src/functions/TickerUtility.ts
|
|
883
|
+
function updateTickerProgression(args, propertyName, progression) {
|
|
884
|
+
if (args[propertyName] === void 0 || !progression || args[propertyName] === progression.limit) {
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
if (typeof args[propertyName] === "number") {
|
|
888
|
+
if (progression.type === "linear") {
|
|
889
|
+
args[propertyName] = getLinearProgression(args[propertyName], progression);
|
|
890
|
+
} else if (progression.type === "exponential") {
|
|
891
|
+
args[propertyName] = getExponentialProgression(args[propertyName], progression);
|
|
892
|
+
}
|
|
893
|
+
} 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") {
|
|
894
|
+
if (progression.type === "linear") {
|
|
895
|
+
args[propertyName].x = getLinearProgression(args[propertyName].x, progression);
|
|
896
|
+
args[propertyName].y = getLinearProgression(args[propertyName].y, progression);
|
|
897
|
+
} else if (progression.type === "exponential") {
|
|
898
|
+
args[propertyName].x = getExponentialProgression(args[propertyName].x, progression);
|
|
899
|
+
args[propertyName].y = getExponentialProgression(args[propertyName].y, progression);
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
function getLinearProgression(number, progression) {
|
|
904
|
+
if (progression.limit !== void 0) {
|
|
905
|
+
if (number > progression.limit && progression.amt > 0) {
|
|
906
|
+
return progression.limit;
|
|
907
|
+
} else if (number < progression.limit && progression.amt < 0) {
|
|
908
|
+
return progression.limit;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
return number + progression.amt / 60;
|
|
912
|
+
}
|
|
913
|
+
function getExponentialProgression(number, progression) {
|
|
914
|
+
if (progression.limit !== void 0) {
|
|
915
|
+
if (number > progression.limit && progression.percentage > 0) {
|
|
916
|
+
return progression.limit;
|
|
917
|
+
} else if (number < progression.limit && progression.percentage < 0) {
|
|
918
|
+
return progression.limit;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
return number + number * progression.percentage;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
// src/classes/ticker/MoveTicker.ts
|
|
925
|
+
var MoveTicker = class extends TickerBase {
|
|
926
|
+
fn(ticker, args, tags, tickerId) {
|
|
927
|
+
let xSpeed = 1;
|
|
928
|
+
let ySpeed = 1;
|
|
929
|
+
if (args.speed) {
|
|
930
|
+
if (typeof args.speed === "number") {
|
|
931
|
+
xSpeed = args.speed;
|
|
932
|
+
ySpeed = args.speed;
|
|
933
|
+
} else {
|
|
934
|
+
xSpeed = args.speed.x;
|
|
935
|
+
ySpeed = args.speed.y;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
xSpeed /= 60;
|
|
939
|
+
ySpeed /= 60;
|
|
940
|
+
let destination = args.destination;
|
|
941
|
+
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
942
|
+
if (typeof tagToRemoveAfter2 === "string") {
|
|
943
|
+
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
944
|
+
}
|
|
945
|
+
tags.filter((tag) => {
|
|
946
|
+
var _a;
|
|
947
|
+
let element = GameWindowManager.getCanvasElement(tag);
|
|
948
|
+
if (args.startOnlyIfHaveTexture) {
|
|
949
|
+
if (element && element instanceof Sprite && ((_a = element.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
950
|
+
return false;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
return true;
|
|
954
|
+
}).forEach((tag) => {
|
|
955
|
+
let element = GameWindowManager.getCanvasElement(tag);
|
|
956
|
+
if (element && element instanceof Container) {
|
|
957
|
+
let xDistance = destination.x - element.x > 0 ? 1 : -1;
|
|
958
|
+
if (xDistance != 0) {
|
|
959
|
+
element.x += xDistance * xSpeed * ticker.deltaTime;
|
|
960
|
+
let newDistance = destination.x - element.x;
|
|
961
|
+
if (xDistance < 0 && newDistance > 0 || xDistance > 0 && newDistance < 0) {
|
|
962
|
+
element.x = destination.x;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
let yDistance = destination.y - element.y > 0 ? 1 : -1;
|
|
966
|
+
if (yDistance != 0) {
|
|
967
|
+
element.y += yDistance * ySpeed * ticker.deltaTime;
|
|
968
|
+
let newDistance = destination.y - element.y;
|
|
969
|
+
if (yDistance < 0 && newDistance > 0 || yDistance > 0 && newDistance < 0) {
|
|
970
|
+
element.y = destination.y;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
if (element.x == destination.x && element.y == destination.y) {
|
|
974
|
+
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
});
|
|
978
|
+
if (args.speedProgression)
|
|
979
|
+
updateTickerProgression(args, "speed", args.speedProgression);
|
|
980
|
+
}
|
|
981
|
+
};
|
|
982
|
+
MoveTicker = __decorateClass([
|
|
983
|
+
tickerDecorator()
|
|
984
|
+
], MoveTicker);
|
|
985
|
+
var RotateTicker = class extends TickerBase {
|
|
986
|
+
fn(ticker, args, tags, tickerId) {
|
|
987
|
+
let speed = (args.speed === void 0 ? 1 : args.speed) / 60;
|
|
988
|
+
let clockwise = args.clockwise === void 0 ? true : args.clockwise;
|
|
989
|
+
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
990
|
+
if (typeof tagToRemoveAfter2 === "string") {
|
|
991
|
+
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
992
|
+
}
|
|
993
|
+
tags.filter((tag) => {
|
|
994
|
+
var _a;
|
|
995
|
+
let element = GameWindowManager.getCanvasElement(tag);
|
|
996
|
+
if (args.startOnlyIfHaveTexture) {
|
|
997
|
+
if (element && element instanceof Sprite && ((_a = element.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
998
|
+
return false;
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
return true;
|
|
1002
|
+
}).forEach((tag) => {
|
|
1003
|
+
let element = GameWindowManager.getCanvasElement(tag);
|
|
1004
|
+
if (element && element instanceof Container) {
|
|
1005
|
+
if (clockwise)
|
|
1006
|
+
element.rotation += speed * ticker.deltaTime;
|
|
1007
|
+
else
|
|
1008
|
+
element.rotation -= speed * ticker.deltaTime;
|
|
1009
|
+
if (speed < 1e-5 && !(args.speedProgression && args.speedProgression.type == "linear" && args.speedProgression.amt != 0)) {
|
|
1010
|
+
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
});
|
|
1014
|
+
if (args.speedProgression)
|
|
1015
|
+
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
1018
|
+
RotateTicker = __decorateClass([
|
|
1019
|
+
tickerDecorator()
|
|
1020
|
+
], RotateTicker);
|
|
1021
|
+
var ZoomTicker = class extends TickerBase {
|
|
1022
|
+
fn(ticker, args, tags, tickerId) {
|
|
1023
|
+
let xSpeed = 0.1;
|
|
1024
|
+
let ySpeed = 0.1;
|
|
1025
|
+
if (args.speed) {
|
|
1026
|
+
if (typeof args.speed === "number") {
|
|
1027
|
+
xSpeed = args.speed;
|
|
1028
|
+
ySpeed = args.speed;
|
|
1029
|
+
} else {
|
|
1030
|
+
xSpeed = args.speed.x;
|
|
1031
|
+
ySpeed = args.speed.y;
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
xSpeed /= 60;
|
|
1035
|
+
ySpeed /= 60;
|
|
1036
|
+
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
1037
|
+
if (typeof tagToRemoveAfter2 === "string") {
|
|
1038
|
+
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
1039
|
+
}
|
|
1040
|
+
let type = args.type || "zoom";
|
|
1041
|
+
let xLimit = type === "zoom" ? Infinity : 0;
|
|
1042
|
+
let yLimit = type === "zoom" ? Infinity : 0;
|
|
1043
|
+
if (args.limit) {
|
|
1044
|
+
if (typeof args.limit === "number") {
|
|
1045
|
+
xLimit = args.limit;
|
|
1046
|
+
yLimit = args.limit;
|
|
1047
|
+
} else {
|
|
1048
|
+
xLimit = args.limit.x;
|
|
1049
|
+
yLimit = args.limit.y;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
tags.filter((tag) => {
|
|
1053
|
+
var _a;
|
|
1054
|
+
let element = GameWindowManager.getCanvasElement(tag);
|
|
1055
|
+
if (args.startOnlyIfHaveTexture) {
|
|
1056
|
+
if (element && element instanceof Sprite && ((_a = element.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1057
|
+
return false;
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
return true;
|
|
1061
|
+
}).forEach((tag) => {
|
|
1062
|
+
let element = GameWindowManager.getCanvasElement(tag);
|
|
1063
|
+
if (element && element instanceof Container) {
|
|
1064
|
+
if (type === "zoom" && (element.scale.x < xLimit || element.scale.y < yLimit)) {
|
|
1065
|
+
element.scale.x += xSpeed * ticker.deltaTime;
|
|
1066
|
+
element.scale.y += ySpeed * ticker.deltaTime;
|
|
1067
|
+
} else if (type === "unzoom" && (element.scale.x > xLimit || element.scale.y > yLimit)) {
|
|
1068
|
+
element.scale.x -= xSpeed * ticker.deltaTime;
|
|
1069
|
+
element.scale.y -= ySpeed * ticker.deltaTime;
|
|
1070
|
+
}
|
|
1071
|
+
if (type === "zoom") {
|
|
1072
|
+
if (element.scale.x > xLimit) {
|
|
1073
|
+
element.scale.x = xLimit;
|
|
1074
|
+
}
|
|
1075
|
+
if (element.scale.y > yLimit) {
|
|
1076
|
+
element.scale.y = yLimit;
|
|
1077
|
+
}
|
|
1078
|
+
if (element.scale.x >= xLimit && element.scale.y >= yLimit) {
|
|
1079
|
+
element.scale.x = xLimit;
|
|
1080
|
+
element.scale.y = yLimit;
|
|
1081
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1082
|
+
}
|
|
1083
|
+
} else if (type === "unzoom") {
|
|
1084
|
+
if (element.scale.x < xLimit) {
|
|
1085
|
+
element.scale.x = xLimit;
|
|
1086
|
+
}
|
|
1087
|
+
if (element.scale.y < yLimit) {
|
|
1088
|
+
element.scale.y = yLimit;
|
|
1089
|
+
}
|
|
1090
|
+
if (element.scale.x <= xLimit && element.scale.y <= yLimit) {
|
|
1091
|
+
element.scale.x = xLimit;
|
|
1092
|
+
element.scale.y = yLimit;
|
|
1093
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
if (xSpeed < 1e-5 && ySpeed < 1e-5 && !(args.speedProgression && args.speedProgression.type == "linear" && args.speedProgression.amt != 0)) {
|
|
1097
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1101
|
+
if (args.speedProgression)
|
|
1102
|
+
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1103
|
+
}
|
|
1104
|
+
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
1105
|
+
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
ZoomTicker = __decorateClass([
|
|
1109
|
+
tickerDecorator()
|
|
1110
|
+
], ZoomTicker);
|
|
1111
|
+
var ZoomInOutTicker = class extends ZoomTicker {
|
|
1112
|
+
constructor(props, duration, priority) {
|
|
1113
|
+
super(props, duration, priority);
|
|
1114
|
+
}
|
|
1115
|
+
onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2) {
|
|
1116
|
+
if (element.children.length > 0) {
|
|
1117
|
+
let elementChild = element.children[0];
|
|
1118
|
+
GameWindowManager.addCanvasElement(tag, elementChild);
|
|
1119
|
+
}
|
|
1120
|
+
super.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1121
|
+
}
|
|
1122
|
+
};
|
|
1123
|
+
|
|
1124
|
+
// src/constants.ts
|
|
1125
|
+
var Repeat = "repeat";
|
|
1126
|
+
function Pause(duration) {
|
|
1127
|
+
return {
|
|
1128
|
+
type: "pause",
|
|
1129
|
+
duration
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
// src/functions/ImageUtility.ts
|
|
1134
|
+
function addImage(tag, imageUrl) {
|
|
1135
|
+
let image = new CanvasImage();
|
|
1136
|
+
image.imageLink = imageUrl;
|
|
1137
|
+
GameWindowManager.addCanvasElement(tag, image);
|
|
1138
|
+
return image;
|
|
1139
|
+
}
|
|
1140
|
+
function loadImage(canvasImages) {
|
|
1141
|
+
return __async(this, null, function* () {
|
|
1142
|
+
if (!Array.isArray(canvasImages)) {
|
|
1143
|
+
return [canvasImages];
|
|
1144
|
+
}
|
|
1145
|
+
let promises = Array(canvasImages.length);
|
|
1146
|
+
for (let i = 0; i < canvasImages.length; i++) {
|
|
1147
|
+
promises[i] = getTexture(canvasImages[i].imageLink);
|
|
1148
|
+
}
|
|
1149
|
+
return Promise.all(promises).then((textures) => {
|
|
1150
|
+
return textures.map((texture, index) => {
|
|
1151
|
+
if (texture) {
|
|
1152
|
+
canvasImages[index].texture = texture;
|
|
1153
|
+
return canvasImages[index];
|
|
1154
|
+
}
|
|
1155
|
+
canvasImages[index].load();
|
|
1156
|
+
return canvasImages[index];
|
|
1157
|
+
});
|
|
1158
|
+
});
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
function showWithDissolveTransition(_0, _1) {
|
|
1162
|
+
return __async(this, arguments, function* (tag, image, props = {}, priority) {
|
|
1163
|
+
var _a;
|
|
1164
|
+
let oldCanvasTag = void 0;
|
|
1165
|
+
if (GameWindowManager.getCanvasElement(tag)) {
|
|
1166
|
+
oldCanvasTag = tag + "_temp_disolve";
|
|
1167
|
+
GameWindowManager.editCanvasElementTag(tag, oldCanvasTag);
|
|
1168
|
+
}
|
|
1169
|
+
let canvasElement;
|
|
1170
|
+
if (typeof image === "string") {
|
|
1171
|
+
canvasElement = addImage(tag, image);
|
|
1172
|
+
} else {
|
|
1173
|
+
canvasElement = image;
|
|
1174
|
+
GameWindowManager.addCanvasElement(tag, canvasElement);
|
|
1175
|
+
}
|
|
1176
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1177
|
+
yield canvasElement.load();
|
|
1178
|
+
}
|
|
1179
|
+
canvasElement.alpha = 0;
|
|
1180
|
+
let effect = new FadeAlphaTicker(__spreadProps(__spreadValues({}, props), {
|
|
1181
|
+
type: "show",
|
|
1182
|
+
tagToRemoveAfter: oldCanvasTag,
|
|
1183
|
+
startOnlyIfHaveTexture: true
|
|
1184
|
+
}), 10, priority);
|
|
1185
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1186
|
+
return;
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
function removeWithDissolveTransition(tag, props = {}, priority) {
|
|
1190
|
+
if (typeof tag === "string") {
|
|
1191
|
+
tag = [tag];
|
|
1192
|
+
}
|
|
1193
|
+
let effect = new FadeAlphaTicker(__spreadProps(__spreadValues({}, props), {
|
|
1194
|
+
type: "hide",
|
|
1195
|
+
tagToRemoveAfter: tag,
|
|
1196
|
+
startOnlyIfHaveTexture: true
|
|
1197
|
+
}), 10, priority);
|
|
1198
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1199
|
+
}
|
|
1200
|
+
function showWithFadeTransition(_0, _1) {
|
|
1201
|
+
return __async(this, arguments, function* (tag, image, props = {}, priority) {
|
|
1202
|
+
var _a;
|
|
1203
|
+
if (!GameWindowManager.getCanvasElement(tag)) {
|
|
1204
|
+
return showWithDissolveTransition(tag, image, props, priority);
|
|
1205
|
+
}
|
|
1206
|
+
let oldCanvasTag = tag + "_temp_fade";
|
|
1207
|
+
GameWindowManager.editCanvasElementTag(tag, oldCanvasTag);
|
|
1208
|
+
let canvasElement;
|
|
1209
|
+
if (typeof image === "string") {
|
|
1210
|
+
canvasElement = addImage(tag, image);
|
|
1211
|
+
} else {
|
|
1212
|
+
canvasElement = image;
|
|
1213
|
+
GameWindowManager.addCanvasElement(tag, canvasElement);
|
|
1214
|
+
}
|
|
1215
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1216
|
+
yield canvasElement.load();
|
|
1217
|
+
}
|
|
1218
|
+
canvasElement.alpha = 0;
|
|
1219
|
+
GameWindowManager.addTickersSteps(oldCanvasTag, [
|
|
1220
|
+
new FadeAlphaTicker(__spreadProps(__spreadValues({}, props), {
|
|
1221
|
+
type: "hide",
|
|
1222
|
+
startOnlyIfHaveTexture: true
|
|
1223
|
+
}))
|
|
1224
|
+
]);
|
|
1225
|
+
GameWindowManager.addTickersSteps(tag, [
|
|
1226
|
+
Pause(props.duration || 1),
|
|
1227
|
+
new FadeAlphaTicker(__spreadProps(__spreadValues({}, props), {
|
|
1228
|
+
type: "show",
|
|
1229
|
+
startOnlyIfHaveTexture: true
|
|
1230
|
+
}))
|
|
1231
|
+
]);
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
function removeWithFadeTransition(tag, props = {}, priority) {
|
|
1235
|
+
return removeWithDissolveTransition(tag, props, priority);
|
|
1236
|
+
}
|
|
1237
|
+
function moveIn(_0, _1) {
|
|
1238
|
+
return __async(this, arguments, function* (tag, image, props = { direction: "right" }, priority) {
|
|
1239
|
+
var _a;
|
|
1240
|
+
let canvasElement;
|
|
1241
|
+
if (typeof image === "string") {
|
|
1242
|
+
canvasElement = addImage(tag, image);
|
|
1243
|
+
} else {
|
|
1244
|
+
canvasElement = image;
|
|
1245
|
+
GameWindowManager.addCanvasElement(tag, canvasElement);
|
|
1246
|
+
}
|
|
1247
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1248
|
+
yield canvasElement.load();
|
|
1249
|
+
}
|
|
1250
|
+
let destination = { x: canvasElement.x, y: canvasElement.y };
|
|
1251
|
+
if (props.direction == "up") {
|
|
1252
|
+
canvasElement.y = GameWindowManager.canvasHeight + canvasElement.height;
|
|
1253
|
+
} else if (props.direction == "down") {
|
|
1254
|
+
canvasElement.y = -canvasElement.height;
|
|
1255
|
+
} else if (props.direction == "left") {
|
|
1256
|
+
canvasElement.x = GameWindowManager.canvasWidth + canvasElement.width;
|
|
1257
|
+
} else if (props.direction == "right") {
|
|
1258
|
+
canvasElement.x = -canvasElement.width;
|
|
1259
|
+
}
|
|
1260
|
+
let effect = new MoveTicker(__spreadProps(__spreadValues({}, props), {
|
|
1261
|
+
destination,
|
|
1262
|
+
startOnlyIfHaveTexture: true
|
|
1263
|
+
}), priority);
|
|
1264
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
function moveOut(tag, props = { direction: "right" }, priority) {
|
|
1268
|
+
let canvasElement = GameWindowManager.getCanvasElement(tag);
|
|
1269
|
+
if (!canvasElement) {
|
|
1270
|
+
console.warn("[Pixi'VN] The canvas element is not found.");
|
|
1271
|
+
return;
|
|
1272
|
+
}
|
|
1273
|
+
let destination = { x: canvasElement.x, y: canvasElement.y };
|
|
1274
|
+
if (props.direction == "up") {
|
|
1275
|
+
destination.y = -canvasElement.height;
|
|
1276
|
+
} else if (props.direction == "down") {
|
|
1277
|
+
destination.y = GameWindowManager.canvasHeight + canvasElement.height;
|
|
1278
|
+
} else if (props.direction == "left") {
|
|
1279
|
+
destination.x = -canvasElement.width;
|
|
1280
|
+
} else if (props.direction == "right") {
|
|
1281
|
+
destination.x = GameWindowManager.canvasWidth + canvasElement.width;
|
|
1282
|
+
}
|
|
1283
|
+
let effect = new MoveTicker(__spreadProps(__spreadValues({}, props), {
|
|
1284
|
+
destination,
|
|
1285
|
+
startOnlyIfHaveTexture: true,
|
|
1286
|
+
tagToRemoveAfter: tag
|
|
1287
|
+
}), priority);
|
|
1288
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1289
|
+
}
|
|
1290
|
+
function zoomIn(_0, _1) {
|
|
1291
|
+
return __async(this, arguments, function* (tag, image, props = { direction: "right" }, priority) {
|
|
1292
|
+
var _a;
|
|
1293
|
+
let canvasElement;
|
|
1294
|
+
if (typeof image === "string") {
|
|
1295
|
+
canvasElement = new CanvasImage({}, image);
|
|
1296
|
+
} else {
|
|
1297
|
+
canvasElement = image;
|
|
1298
|
+
}
|
|
1299
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1300
|
+
yield canvasElement.load();
|
|
1301
|
+
}
|
|
1302
|
+
let container = new CanvasContainer();
|
|
1303
|
+
container.addChild(canvasElement);
|
|
1304
|
+
container.height = GameWindowManager.canvasHeight;
|
|
1305
|
+
container.width = GameWindowManager.canvasWidth;
|
|
1306
|
+
GameWindowManager.addCanvasElement(tag, container);
|
|
1307
|
+
if (props.direction == "up") {
|
|
1308
|
+
container.pivot.y = GameWindowManager.canvasHeight;
|
|
1309
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1310
|
+
container.y = GameWindowManager.canvasHeight;
|
|
1311
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1312
|
+
} else if (props.direction == "down") {
|
|
1313
|
+
container.pivot.y = 0;
|
|
1314
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1315
|
+
container.y = 0;
|
|
1316
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1317
|
+
} else if (props.direction == "left") {
|
|
1318
|
+
container.pivot.x = GameWindowManager.canvasWidth;
|
|
1319
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1320
|
+
container.x = GameWindowManager.canvasWidth;
|
|
1321
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1322
|
+
} else if (props.direction == "right") {
|
|
1323
|
+
container.pivot.x = 0;
|
|
1324
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1325
|
+
container.x = 0;
|
|
1326
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1327
|
+
}
|
|
1328
|
+
container.scale.set(0);
|
|
1329
|
+
let effect = new ZoomInOutTicker(__spreadProps(__spreadValues({}, props), {
|
|
1330
|
+
startOnlyIfHaveTexture: true,
|
|
1331
|
+
type: "zoom",
|
|
1332
|
+
limit: 1
|
|
1333
|
+
}), priority);
|
|
1334
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1335
|
+
});
|
|
1336
|
+
}
|
|
1337
|
+
function zoomOut(tag, props = { direction: "right" }, priority) {
|
|
1338
|
+
let canvasElement = GameWindowManager.getCanvasElement(tag);
|
|
1339
|
+
if (!canvasElement) {
|
|
1340
|
+
console.warn("[Pixi'VN] The canvas element is not found.");
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
let container = new CanvasContainer();
|
|
1344
|
+
container.addChild(canvasElement);
|
|
1345
|
+
container.height = GameWindowManager.canvasHeight;
|
|
1346
|
+
container.width = GameWindowManager.canvasWidth;
|
|
1347
|
+
GameWindowManager.addCanvasElement(tag, container);
|
|
1348
|
+
if (props.direction == "up") {
|
|
1349
|
+
container.pivot.y = GameWindowManager.canvasHeight;
|
|
1350
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1351
|
+
container.y = GameWindowManager.canvasHeight;
|
|
1352
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1353
|
+
} else if (props.direction == "down") {
|
|
1354
|
+
container.pivot.y = 0;
|
|
1355
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1356
|
+
container.y = 0;
|
|
1357
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1358
|
+
} else if (props.direction == "left") {
|
|
1359
|
+
container.pivot.x = GameWindowManager.canvasWidth;
|
|
1360
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1361
|
+
container.x = GameWindowManager.canvasWidth;
|
|
1362
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1363
|
+
} else if (props.direction == "right") {
|
|
1364
|
+
container.pivot.x = 0;
|
|
1365
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1366
|
+
container.x = 0;
|
|
1367
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1368
|
+
}
|
|
1369
|
+
container.scale.set(1);
|
|
1370
|
+
let effect = new ZoomInOutTicker(__spreadProps(__spreadValues({}, props), {
|
|
1371
|
+
startOnlyIfHaveTexture: true,
|
|
1372
|
+
type: "unzoom",
|
|
1373
|
+
limit: 0,
|
|
1374
|
+
tagToRemoveAfter: tag
|
|
1375
|
+
}), priority);
|
|
1376
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
// src/functions/ExportUtility.ts
|
|
1380
|
+
function createExportableElement(element) {
|
|
1381
|
+
try {
|
|
1382
|
+
let elementString = JSON.stringify(element);
|
|
1383
|
+
return JSON.parse(elementString);
|
|
1384
|
+
} catch (e) {
|
|
1385
|
+
console.error("[Pixi'VN] Error creating exportable element", e);
|
|
1386
|
+
throw new Error("[Pixi'VN] Error creating exportable element");
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
// src/functions/DiffUtility.ts
|
|
1391
|
+
function restoreDeepDiffChanges(data, differences) {
|
|
1392
|
+
let result = createExportableElement(data);
|
|
1393
|
+
differences.forEach((diff2) => {
|
|
1394
|
+
let dataToEdit = result;
|
|
1395
|
+
if (diff2.path && diff2.path.length > 0) {
|
|
1396
|
+
diff2.path.forEach((path, index) => {
|
|
1397
|
+
if (diff2.path && index === diff2.path.length - 1) {
|
|
1398
|
+
if (diff2.kind === "E" || diff2.kind === "D") {
|
|
1399
|
+
dataToEdit[path] = diff2.lhs;
|
|
1400
|
+
} else if (diff2.kind === "N") {
|
|
1401
|
+
if (Number.isInteger(path)) {
|
|
1402
|
+
if (Array.isArray(dataToEdit)) {
|
|
1403
|
+
dataToEdit.splice(path, 1);
|
|
1404
|
+
}
|
|
1405
|
+
} else if (typeof path === "string") {
|
|
1406
|
+
delete dataToEdit[path];
|
|
1407
|
+
}
|
|
1408
|
+
} else if (diff2.kind === "A") {
|
|
1409
|
+
let index2 = diff2.index;
|
|
1410
|
+
if (diff2.item.kind === "N") {
|
|
1411
|
+
dataToEdit[path].splice(index2, 1);
|
|
1412
|
+
} else if (diff2.item.kind === "E" || diff2.item.kind === "D") {
|
|
1413
|
+
dataToEdit[path][index2] = diff2.item.lhs;
|
|
1414
|
+
} else if (diff2.item.kind === "A") {
|
|
1415
|
+
console.warn("[Pixi'VN] Nested array found, skipping diff", diff2);
|
|
1416
|
+
} else {
|
|
1417
|
+
console.warn("[Pixi'VN] No array found, skipping diff", diff2);
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
} else {
|
|
1421
|
+
dataToEdit = dataToEdit[path];
|
|
1422
|
+
}
|
|
1423
|
+
});
|
|
1424
|
+
} else {
|
|
1425
|
+
console.warn("[Pixi'VN] No path found, skipping diff", diff2);
|
|
1426
|
+
}
|
|
1427
|
+
});
|
|
1428
|
+
return result;
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
// src/managers/StorageManager.ts
|
|
1432
|
+
var _GameStorageManager = class _GameStorageManager {
|
|
1433
|
+
constructor() {
|
|
1434
|
+
}
|
|
1435
|
+
static get keysSystem() {
|
|
1436
|
+
return {
|
|
1437
|
+
CURRENT_DIALOGUE_MEMORY_KEY: "___current_dialogue_memory___",
|
|
1438
|
+
LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY: "___last_dialogue_added_in_step_memory___",
|
|
1439
|
+
CURRENT_MENU_OPTIONS_MEMORY_KEY: "___current_menu_options_memory___",
|
|
1440
|
+
LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY: "___last_menu_options_added_in_step_memory___",
|
|
1441
|
+
CHARACTER_CATEGORY_KEY: "___character___",
|
|
1442
|
+
FLAGS_CATEGORY_KEY: "___flags___"
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1445
|
+
/**
|
|
1446
|
+
* Set a variable in the storage
|
|
1447
|
+
* @param key The key of the variable
|
|
1448
|
+
* @param value The value of the variable. If undefined, the variable will be removed
|
|
1449
|
+
* @returns
|
|
1450
|
+
*/
|
|
1451
|
+
static setVariable(key, value) {
|
|
1452
|
+
key = key.toLowerCase();
|
|
1453
|
+
if (value === void 0 || value === null) {
|
|
1454
|
+
if (_GameStorageManager.storage.hasOwnProperty(key)) {
|
|
1455
|
+
delete _GameStorageManager.storage[key];
|
|
1456
|
+
}
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1459
|
+
_GameStorageManager.storage[key] = value;
|
|
1460
|
+
}
|
|
1461
|
+
/**
|
|
1462
|
+
* Get a variable from the storage
|
|
1463
|
+
* @param key The key of the variable
|
|
1464
|
+
* @returns The value of the variable. If the variable does not exist, it will return undefined
|
|
1465
|
+
*/
|
|
1466
|
+
static getVariable(key) {
|
|
1467
|
+
key = key.toLowerCase();
|
|
1468
|
+
if (_GameStorageManager.storage.hasOwnProperty(key)) {
|
|
1469
|
+
return _GameStorageManager.storage[key];
|
|
1470
|
+
}
|
|
1471
|
+
return void 0;
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* Remove a variable from the storage
|
|
1475
|
+
* @param key The key of the variable
|
|
1476
|
+
* @returns
|
|
1477
|
+
*/
|
|
1478
|
+
static removeVariable(key) {
|
|
1479
|
+
key = key.toLowerCase();
|
|
1480
|
+
if (_GameStorageManager.storage.hasOwnProperty(key)) {
|
|
1481
|
+
delete _GameStorageManager.storage[key];
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
/**
|
|
1485
|
+
* Clear the storage and the oidsUsed
|
|
1486
|
+
* @returns
|
|
1487
|
+
*/
|
|
1488
|
+
static clear() {
|
|
1489
|
+
_GameStorageManager.storage = {};
|
|
1490
|
+
}
|
|
1491
|
+
static exportJson() {
|
|
1492
|
+
return JSON.stringify(this.export());
|
|
1493
|
+
}
|
|
1494
|
+
static export() {
|
|
1495
|
+
return createExportableElement(_GameStorageManager.storage);
|
|
1496
|
+
}
|
|
1497
|
+
static importJson(dataString) {
|
|
1498
|
+
_GameStorageManager.import(JSON.parse(dataString));
|
|
1499
|
+
}
|
|
1500
|
+
static import(data) {
|
|
1501
|
+
_GameStorageManager.clear();
|
|
1502
|
+
try {
|
|
1503
|
+
if (data) {
|
|
1504
|
+
_GameStorageManager.storage = data;
|
|
1505
|
+
} else {
|
|
1506
|
+
console.warn("[Pixi'VN] No storage data found");
|
|
1507
|
+
}
|
|
1508
|
+
} catch (e) {
|
|
1509
|
+
console.error("[Pixi'VN] Error importing data", e);
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
};
|
|
1513
|
+
_GameStorageManager.storage = {};
|
|
1514
|
+
var GameStorageManager = _GameStorageManager;
|
|
1515
|
+
|
|
1516
|
+
// src/functions/EasterEgg.ts
|
|
1517
|
+
function asciiArtLog() {
|
|
1518
|
+
console.info(`
|
|
1519
|
+
____ _ _ ___ ___ _
|
|
1520
|
+
| _ \\(_)_ _(_| ) \\ / / \\ | |
|
|
1521
|
+
| |_) | \\ \\/ / |/ \\ \\ / /| \\| |
|
|
1522
|
+
| __/| |> <| | \\ V / | |\\ |
|
|
1523
|
+
|_| |_/_/\\_\\_| \\_/ |_| \\_|
|
|
1524
|
+
`);
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
// src/types/ticker/TagToRemoveAfterType.ts
|
|
1528
|
+
var tagToRemoveAfter = "tagToRemoveAfter";
|
|
1529
|
+
|
|
1530
|
+
// src/managers/WindowManager.ts
|
|
1531
|
+
var _GameWindowManager = class _GameWindowManager {
|
|
1532
|
+
constructor() {
|
|
1533
|
+
}
|
|
1534
|
+
/**
|
|
1535
|
+
* The PIXI Application instance.
|
|
1536
|
+
* It not recommended to use this property directly.
|
|
1537
|
+
*/
|
|
1538
|
+
static get app() {
|
|
1539
|
+
if (!_GameWindowManager._app) {
|
|
1540
|
+
throw new Error("[Pixi'VN] GameWindowManager.app is undefined");
|
|
1541
|
+
}
|
|
1542
|
+
return _GameWindowManager._app;
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* If the manager is initialized.
|
|
1546
|
+
*/
|
|
1547
|
+
static get isInitialized() {
|
|
1548
|
+
return _GameWindowManager._isInitialized;
|
|
1549
|
+
}
|
|
1550
|
+
static get screen() {
|
|
1551
|
+
return _GameWindowManager.app.screen;
|
|
1552
|
+
}
|
|
1553
|
+
/**
|
|
1554
|
+
* Initialize the PIXI Application and the interface div.
|
|
1555
|
+
* This method should be called before any other method.
|
|
1556
|
+
* @param element The html element where I will put the canvas. Example: document.body
|
|
1557
|
+
* @param width The width of the canvas
|
|
1558
|
+
* @param height The height of the canvas
|
|
1559
|
+
* @param options The options of PIXI Application
|
|
1560
|
+
* @example
|
|
1561
|
+
* ```typescript
|
|
1562
|
+
* const body = document.body
|
|
1563
|
+
* if (!body) {
|
|
1564
|
+
* throw new Error('body element not found')
|
|
1565
|
+
* }
|
|
1566
|
+
* await GameWindowManager.initialize(body, 1920, 1080, {
|
|
1567
|
+
* backgroundColor: "#303030"
|
|
1568
|
+
* })
|
|
1569
|
+
* ```
|
|
1570
|
+
*/
|
|
1571
|
+
static initialize(element, width, height, options) {
|
|
1572
|
+
return __async(this, null, function* () {
|
|
1573
|
+
_GameWindowManager.canvasWidth = width;
|
|
1574
|
+
_GameWindowManager.canvasHeight = height;
|
|
1575
|
+
_GameWindowManager._app = new Application();
|
|
1576
|
+
return _GameWindowManager.app.init(__spreadValues({
|
|
1577
|
+
resolution: window.devicePixelRatio || 1,
|
|
1578
|
+
autoDensity: true,
|
|
1579
|
+
width,
|
|
1580
|
+
height
|
|
1581
|
+
}, options)).then(() => {
|
|
1582
|
+
_GameWindowManager._isInitialized = true;
|
|
1583
|
+
this.addCanvasIntoElement(element);
|
|
1584
|
+
window.addEventListener("resize", _GameWindowManager.resize);
|
|
1585
|
+
_GameWindowManager.resize();
|
|
1586
|
+
asciiArtLog();
|
|
1587
|
+
});
|
|
1588
|
+
});
|
|
1589
|
+
}
|
|
1590
|
+
/**
|
|
1591
|
+
* Add the canvas into a html element.
|
|
1592
|
+
* @param element it is the html element where I will put the canvas. Example: document.body
|
|
1593
|
+
*/
|
|
1594
|
+
static addCanvasIntoElement(element) {
|
|
1595
|
+
if (_GameWindowManager.isInitialized) {
|
|
1596
|
+
element.appendChild(_GameWindowManager.app.canvas);
|
|
1597
|
+
} else {
|
|
1598
|
+
console.error("[Pixi'VN] GameWindowManager is not initialized");
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
/**
|
|
1602
|
+
* Initialize the interface div and add it into a html element.
|
|
1603
|
+
* @param element it is the html element where I will put the interface div. Example: document.getElementById('root')
|
|
1604
|
+
* @example
|
|
1605
|
+
* ```tsx
|
|
1606
|
+
* const root = document.getElementById('root')
|
|
1607
|
+
* if (!root) {
|
|
1608
|
+
* throw new Error('root element not found')
|
|
1609
|
+
* }
|
|
1610
|
+
* GameWindowManager.initializeHTMLLayout(root)
|
|
1611
|
+
* const reactRoot = createRoot(GameWindowManager.htmlLayout)
|
|
1612
|
+
* reactRoot.render(
|
|
1613
|
+
* <App />
|
|
1614
|
+
* )
|
|
1615
|
+
* ```
|
|
1616
|
+
*/
|
|
1617
|
+
static initializeHTMLLayout(element) {
|
|
1618
|
+
let div = document.createElement("div");
|
|
1619
|
+
div.style.position = "absolute";
|
|
1620
|
+
div.style.pointerEvents = "none";
|
|
1621
|
+
element.appendChild(div);
|
|
1622
|
+
_GameWindowManager.htmlLayout = div;
|
|
1623
|
+
_GameWindowManager.resize();
|
|
1624
|
+
}
|
|
1625
|
+
/* Resize Metods */
|
|
1626
|
+
/**
|
|
1627
|
+
* This method returns the scale of the screen.
|
|
1628
|
+
*/
|
|
1629
|
+
static get screenScale() {
|
|
1630
|
+
let screenWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
|
|
1631
|
+
let screenHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
|
1632
|
+
return Math.min(screenWidth / _GameWindowManager.canvasWidth, screenHeight / _GameWindowManager.canvasHeight);
|
|
1633
|
+
}
|
|
1634
|
+
/**
|
|
1635
|
+
* This method returns the width of the screen enlarged by the scale.
|
|
1636
|
+
*/
|
|
1637
|
+
static get screenWidth() {
|
|
1638
|
+
return Math.floor(_GameWindowManager.screenScale * _GameWindowManager.canvasWidth);
|
|
1639
|
+
}
|
|
1640
|
+
/**
|
|
1641
|
+
* This method returns the height of the screen enlarged by the scale.
|
|
1642
|
+
*/
|
|
1643
|
+
static get screenHeight() {
|
|
1644
|
+
return Math.floor(_GameWindowManager.screenScale * _GameWindowManager.canvasHeight);
|
|
1645
|
+
}
|
|
1646
|
+
/**
|
|
1647
|
+
* This method returns the horizontal margin of the screen.
|
|
1648
|
+
*/
|
|
1649
|
+
static get horizontalMargin() {
|
|
1650
|
+
let screenWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
|
|
1651
|
+
return (screenWidth - _GameWindowManager.screenWidth) / 2;
|
|
1652
|
+
}
|
|
1653
|
+
/**
|
|
1654
|
+
* This method returns the vertical margin of the screen.
|
|
1655
|
+
*/
|
|
1656
|
+
static get verticalMargin() {
|
|
1657
|
+
let screenHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
|
1658
|
+
return (screenHeight - _GameWindowManager.screenHeight) / 2;
|
|
1659
|
+
}
|
|
1660
|
+
/**
|
|
1661
|
+
* This method is called when the screen is resized.
|
|
1662
|
+
*/
|
|
1663
|
+
static resize() {
|
|
1664
|
+
if (_GameWindowManager.isInitialized) {
|
|
1665
|
+
let style = _GameWindowManager.app.canvas.style;
|
|
1666
|
+
style.width = `${_GameWindowManager.screenWidth}px`;
|
|
1667
|
+
style.height = `${_GameWindowManager.screenHeight}px`;
|
|
1668
|
+
style.marginLeft = `${_GameWindowManager.horizontalMargin}px`;
|
|
1669
|
+
style.marginRight = `${_GameWindowManager.horizontalMargin}px`;
|
|
1670
|
+
style.marginTop = `${_GameWindowManager.verticalMargin}px`;
|
|
1671
|
+
style.marginBottom = `${_GameWindowManager.verticalMargin}px`;
|
|
1672
|
+
}
|
|
1673
|
+
if (_GameWindowManager.htmlLayout) {
|
|
1674
|
+
_GameWindowManager.htmlLayout.style.width = `${_GameWindowManager.screenWidth}px`;
|
|
1675
|
+
_GameWindowManager.htmlLayout.style.height = `${_GameWindowManager.screenHeight}px`;
|
|
1676
|
+
_GameWindowManager.htmlLayout.style.marginLeft = `${_GameWindowManager.horizontalMargin}px`;
|
|
1677
|
+
_GameWindowManager.htmlLayout.style.marginRight = `${_GameWindowManager.horizontalMargin}px`;
|
|
1678
|
+
_GameWindowManager.htmlLayout.style.marginTop = `${_GameWindowManager.verticalMargin}px`;
|
|
1679
|
+
_GameWindowManager.htmlLayout.style.marginBottom = `${_GameWindowManager.verticalMargin}px`;
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
/* Edit Canvas Elements Methods */
|
|
1683
|
+
/**
|
|
1684
|
+
* This is a dictionary that contains all Canvas Elements of Canvas, currently.
|
|
1685
|
+
*/
|
|
1686
|
+
static get currentCanvasElements() {
|
|
1687
|
+
return _GameWindowManager._children;
|
|
1688
|
+
}
|
|
1689
|
+
/**
|
|
1690
|
+
* Add a canvas element to the canvas.
|
|
1691
|
+
* If there is a canvas element with the same tag, it will be removed.
|
|
1692
|
+
* @param tag The tag of the canvas element.
|
|
1693
|
+
* @param canvasElement The canvas elements to be added.
|
|
1694
|
+
* @example
|
|
1695
|
+
* ```typescript
|
|
1696
|
+
* const texture = await Assets.load('https://pixijs.com/assets/bunny.png');
|
|
1697
|
+
* const sprite = CanvasSprite.from(texture);
|
|
1698
|
+
* GameWindowManager.addCanvasElement("bunny", sprite);
|
|
1699
|
+
* ```
|
|
1700
|
+
*/
|
|
1701
|
+
static addCanvasElement(tag, canvasElement) {
|
|
1702
|
+
if (_GameWindowManager._children[tag]) {
|
|
1703
|
+
_GameWindowManager.removeCanvasElement(tag);
|
|
1704
|
+
}
|
|
1705
|
+
_GameWindowManager.app.stage.addChild(canvasElement);
|
|
1706
|
+
_GameWindowManager._children[tag] = canvasElement;
|
|
1707
|
+
_GameWindowManager.childrenTagsOrder.push(tag);
|
|
1708
|
+
}
|
|
1709
|
+
/**
|
|
1710
|
+
* Remove a canvas element from the canvas.
|
|
1711
|
+
* And remove all tickers that are not connected to any canvas element.
|
|
1712
|
+
* @param tags The tag of the canvas element to be removed.
|
|
1713
|
+
* @returns
|
|
1714
|
+
* @example
|
|
1715
|
+
* ```typescript
|
|
1716
|
+
* GameWindowManager.removeCanvasElement("bunny");
|
|
1717
|
+
* ```
|
|
1718
|
+
*/
|
|
1719
|
+
static removeCanvasElement(tags) {
|
|
1720
|
+
if (typeof tags === "string") {
|
|
1721
|
+
tags = [tags];
|
|
1722
|
+
}
|
|
1723
|
+
tags.forEach((tag) => {
|
|
1724
|
+
if (_GameWindowManager._children[tag]) {
|
|
1725
|
+
_GameWindowManager.app.stage.removeChild(_GameWindowManager._children[tag]);
|
|
1726
|
+
delete _GameWindowManager._children[tag];
|
|
1727
|
+
_GameWindowManager.removeTickerByCanvasElement(tag);
|
|
1728
|
+
}
|
|
1729
|
+
});
|
|
1730
|
+
_GameWindowManager.childrenTagsOrder = _GameWindowManager.childrenTagsOrder.filter((t) => !tags.includes(t));
|
|
1731
|
+
}
|
|
1732
|
+
/**
|
|
1733
|
+
* Get a canvas element by the tag.
|
|
1734
|
+
* @param tag The tag of the canvas element.
|
|
1735
|
+
* @returns The canvas element.
|
|
1736
|
+
* @example
|
|
1737
|
+
* ```typescript
|
|
1738
|
+
* const sprite = GameWindowManager.getCanvasElement<CanvasSprite>("bunny");
|
|
1739
|
+
* ```
|
|
1740
|
+
*/
|
|
1741
|
+
static getCanvasElement(tag) {
|
|
1742
|
+
return _GameWindowManager._children[tag];
|
|
1743
|
+
}
|
|
1744
|
+
/**
|
|
1745
|
+
* Check if a DisplayObject is on the canvas.
|
|
1746
|
+
* @param pixiElement The DisplayObject to be checked.
|
|
1747
|
+
* @returns If the DisplayObject is on the canvas.
|
|
1748
|
+
*/
|
|
1749
|
+
static canvasElementIsOnCanvas(pixiElement) {
|
|
1750
|
+
return _GameWindowManager.app.stage.children.includes(pixiElement);
|
|
1751
|
+
}
|
|
1752
|
+
/**
|
|
1753
|
+
* Remove all canvas elements from the canvas.
|
|
1754
|
+
* And remove all tickers that are not connected to any canvas element.
|
|
1755
|
+
*/
|
|
1756
|
+
static removeCanvasElements() {
|
|
1757
|
+
_GameWindowManager.app.stage.removeChildren();
|
|
1758
|
+
_GameWindowManager._children = {};
|
|
1759
|
+
_GameWindowManager.childrenTagsOrder = [];
|
|
1760
|
+
_GameWindowManager.removeAllTickers();
|
|
1761
|
+
}
|
|
1762
|
+
/**
|
|
1763
|
+
* Edit the tag of a canvas element.
|
|
1764
|
+
* @param oldTag The old tag of the canvas element.
|
|
1765
|
+
* @param newTag The new tag of the canvas element.
|
|
1766
|
+
*/
|
|
1767
|
+
static editCanvasElementTag(oldTag, newTag) {
|
|
1768
|
+
if (_GameWindowManager._children[oldTag]) {
|
|
1769
|
+
_GameWindowManager._children[newTag] = _GameWindowManager._children[oldTag];
|
|
1770
|
+
delete _GameWindowManager._children[oldTag];
|
|
1771
|
+
}
|
|
1772
|
+
if (_GameWindowManager._currentTickersSteps[oldTag]) {
|
|
1773
|
+
_GameWindowManager._currentTickersSteps[newTag] = _GameWindowManager._currentTickersSteps[oldTag];
|
|
1774
|
+
delete _GameWindowManager._currentTickersSteps[oldTag];
|
|
1775
|
+
}
|
|
1776
|
+
for (let id in _GameWindowManager._currentTickers) {
|
|
1777
|
+
let ticker = _GameWindowManager._currentTickers[id];
|
|
1778
|
+
if (ticker.canvasElementTags.includes(oldTag)) {
|
|
1779
|
+
ticker.canvasElementTags = ticker.canvasElementTags.map((t) => t === oldTag ? newTag : t);
|
|
1780
|
+
if (ticker.args.hasOwnProperty(tagToRemoveAfter)) {
|
|
1781
|
+
let tagToRemoveAfter2 = ticker.args.tagToRemoveAfter;
|
|
1782
|
+
if (typeof tagToRemoveAfter2 === "string") {
|
|
1783
|
+
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
1784
|
+
}
|
|
1785
|
+
if (Array.isArray(tagToRemoveAfter2)) {
|
|
1786
|
+
ticker.args.tagToRemoveAfter = tagToRemoveAfter2.map((t) => t === oldTag ? newTag : t);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
for (let timeout in _GameWindowManager._currentTickersTimeouts) {
|
|
1792
|
+
let TickerTimeout = _GameWindowManager._currentTickersTimeouts[timeout];
|
|
1793
|
+
if (TickerTimeout.tags.includes(oldTag)) {
|
|
1794
|
+
TickerTimeout.tags = TickerTimeout.tags.map((t) => t === oldTag ? newTag : t);
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
/** Edit Tickers Methods */
|
|
1799
|
+
/**
|
|
1800
|
+
* Currently tickers that are running.
|
|
1801
|
+
*/
|
|
1802
|
+
static get currentTickers() {
|
|
1803
|
+
return _GameWindowManager._currentTickers;
|
|
1804
|
+
}
|
|
1805
|
+
static get currentTickersList() {
|
|
1806
|
+
return Object.values(_GameWindowManager._currentTickers);
|
|
1807
|
+
}
|
|
1808
|
+
static get currentTickersWithoutCreatedBySteps() {
|
|
1809
|
+
return Object.fromEntries(Object.entries(_GameWindowManager._currentTickers).filter(([_, ticker]) => !ticker.createdByTicketStepsId));
|
|
1810
|
+
}
|
|
1811
|
+
/**
|
|
1812
|
+
* The steps of the tickers
|
|
1813
|
+
*/
|
|
1814
|
+
static get currentTickersSteps() {
|
|
1815
|
+
return _GameWindowManager._currentTickersSteps;
|
|
1816
|
+
}
|
|
1817
|
+
static generateTickerId(tickerData) {
|
|
1818
|
+
try {
|
|
1819
|
+
return sha1(JSON.stringify(tickerData)).toString() + "_" + Math.random().toString(36).substring(7);
|
|
1820
|
+
} catch (e) {
|
|
1821
|
+
throw new Error(`[Pixi'VN] Error to generate ticker id: ${e}`);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
/**
|
|
1825
|
+
* Run a ticker. You can run multiple addTicker with the same tag and different tickerClasses.
|
|
1826
|
+
* If you run a ticker with the same tag and tickerClass, the old ticker will be removed.
|
|
1827
|
+
* If already exists a sequence of tickers with the same tag, it will be removed.
|
|
1828
|
+
* @param canvasEslementTag The tag of the canvas element that will use the ticker.
|
|
1829
|
+
* @param ticker The ticker class to be run.
|
|
1830
|
+
* @param args The arguments to be used in the ticker.
|
|
1831
|
+
* @param duration The time to be used in the ticker. This number is in seconds. If it is undefined, the ticker will run forever.
|
|
1832
|
+
* @param priority The priority to be used in the ticker.
|
|
1833
|
+
* @returns
|
|
1834
|
+
* @example
|
|
1835
|
+
* ```typescript
|
|
1836
|
+
* GameWindowManager.addTicker("alien", new RotateTicker({ speed: 0.2 }))
|
|
1837
|
+
* ```
|
|
1838
|
+
*/
|
|
1839
|
+
static addTicker(canvasElementTag, ticker) {
|
|
1840
|
+
let tickerId = ticker.id;
|
|
1841
|
+
if (typeof canvasElementTag === "string") {
|
|
1842
|
+
canvasElementTag = [canvasElementTag];
|
|
1843
|
+
}
|
|
1844
|
+
if (!geTickerInstanceById(tickerId, ticker.args, ticker.duration, ticker.priority)) {
|
|
1845
|
+
console.error(`[Pixi'VN] Ticker ${tickerId} not found`);
|
|
1846
|
+
return;
|
|
1847
|
+
}
|
|
1848
|
+
let tickerHistory = {
|
|
1849
|
+
fn: () => {
|
|
1850
|
+
},
|
|
1851
|
+
id: tickerId,
|
|
1852
|
+
args: createExportableElement(ticker.args),
|
|
1853
|
+
canvasElementTags: canvasElementTag,
|
|
1854
|
+
priority: ticker.priority,
|
|
1855
|
+
duration: ticker.duration
|
|
1856
|
+
};
|
|
1857
|
+
let id = _GameWindowManager.generateTickerId(tickerHistory);
|
|
1858
|
+
_GameWindowManager.pushTicker(id, tickerHistory, ticker);
|
|
1859
|
+
if (ticker.duration) {
|
|
1860
|
+
let timeout = setTimeout(() => {
|
|
1861
|
+
_GameWindowManager.removeTickerTimeoutInfo(timeout);
|
|
1862
|
+
let tickerTimeoutInfo = _GameWindowManager._currentTickersTimeouts[timeout.toString()];
|
|
1863
|
+
if (tickerTimeoutInfo) {
|
|
1864
|
+
_GameWindowManager.removeTicker(id);
|
|
1865
|
+
}
|
|
1866
|
+
}, ticker.duration * 1e3);
|
|
1867
|
+
_GameWindowManager.addTickerTimeoutInfo(canvasElementTag, tickerId, timeout.toString(), true);
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
static pushTicker(id, tickerData, ticker) {
|
|
1871
|
+
_GameWindowManager.removeAssociationBetweenTickerCanvasElement(tickerData.canvasElementTags, ticker);
|
|
1872
|
+
_GameWindowManager._currentTickers[id] = tickerData;
|
|
1873
|
+
tickerData.fn = (t) => {
|
|
1874
|
+
let data = _GameWindowManager._currentTickers[id];
|
|
1875
|
+
if (data) {
|
|
1876
|
+
ticker == null ? void 0 : ticker.fn(t, data.args, data.canvasElementTags, id);
|
|
1877
|
+
}
|
|
1878
|
+
};
|
|
1879
|
+
_GameWindowManager.app.ticker.add(tickerData.fn, void 0, tickerData.priority);
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* Run a sequence of tickers. If exists a ticker steps with the same tag, it will be removed.
|
|
1883
|
+
* @param tag The tag of canvas element that will use the tickers.
|
|
1884
|
+
* @param steps The steps of the tickers.
|
|
1885
|
+
* @param currentStepNumber The current step number. It is used to continue the sequence of tickers.
|
|
1886
|
+
* @returns
|
|
1887
|
+
* @example
|
|
1888
|
+
* ```typescript
|
|
1889
|
+
* GameWindowManager.addTickersSteps("alien", [
|
|
1890
|
+
* new RotateTicker({ speed: 0.1, clockwise: true }, 2), // 2 seconds
|
|
1891
|
+
* Pause(1), // 1 second
|
|
1892
|
+
* new RotateTicker({ speed: 0.2, clockwise: false }, 2),
|
|
1893
|
+
* Repeat,
|
|
1894
|
+
* ])
|
|
1895
|
+
* ```
|
|
1896
|
+
*/
|
|
1897
|
+
static addTickersSteps(tag, steps, currentStepNumber = 0) {
|
|
1898
|
+
if (steps.length == 0) {
|
|
1899
|
+
console.warn("[Pixi'VN] The steps of the tickers is empty");
|
|
1900
|
+
return;
|
|
1901
|
+
}
|
|
1902
|
+
_GameWindowManager.removeTickerStepByCanvasElement(tag);
|
|
1903
|
+
_GameWindowManager._currentTickersSteps[tag] = {
|
|
1904
|
+
currentStepNumber,
|
|
1905
|
+
steps: steps.map((step) => {
|
|
1906
|
+
if (step === Repeat) {
|
|
1907
|
+
return step;
|
|
1908
|
+
}
|
|
1909
|
+
if (step.hasOwnProperty("type") && step.type === "pause") {
|
|
1910
|
+
return step;
|
|
1911
|
+
}
|
|
1912
|
+
let tickerId = step.id;
|
|
1913
|
+
return {
|
|
1914
|
+
ticker: tickerId,
|
|
1915
|
+
args: createExportableElement(step.args),
|
|
1916
|
+
duration: step.duration
|
|
1917
|
+
};
|
|
1918
|
+
})
|
|
1919
|
+
};
|
|
1920
|
+
_GameWindowManager.runTickersSteps(tag);
|
|
1921
|
+
}
|
|
1922
|
+
static restoneTickersSteps(data) {
|
|
1923
|
+
for (let tag in data) {
|
|
1924
|
+
let steps = data[tag];
|
|
1925
|
+
_GameWindowManager._currentTickersSteps[tag] = steps;
|
|
1926
|
+
_GameWindowManager.runTickersSteps(tag);
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
static runTickersSteps(tag) {
|
|
1930
|
+
let step = _GameWindowManager._currentTickersSteps[tag].steps[_GameWindowManager._currentTickersSteps[tag].currentStepNumber];
|
|
1931
|
+
if (step === Repeat) {
|
|
1932
|
+
step = _GameWindowManager._currentTickersSteps[tag].steps[0];
|
|
1933
|
+
_GameWindowManager._currentTickersSteps[tag].currentStepNumber = 0;
|
|
1934
|
+
if (step === Repeat) {
|
|
1935
|
+
console.error("[Pixi'VN] TikersSteps has a RepeatType in the first step");
|
|
1936
|
+
return;
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
if (step.hasOwnProperty("type") && step.type === "pause") {
|
|
1940
|
+
let timeout = setTimeout(() => {
|
|
1941
|
+
let tickerTimeoutInfo = _GameWindowManager._currentTickersTimeouts[timeout.toString()];
|
|
1942
|
+
if (tickerTimeoutInfo) {
|
|
1943
|
+
tickerTimeoutInfo.tags.forEach((tag2) => {
|
|
1944
|
+
_GameWindowManager.nextTickerStep(tag2);
|
|
1945
|
+
});
|
|
1946
|
+
}
|
|
1947
|
+
_GameWindowManager.removeTickerTimeoutInfo(timeout);
|
|
1948
|
+
}, step.duration * 1e3);
|
|
1949
|
+
_GameWindowManager.addTickerTimeoutInfo(tag, "steps", timeout.toString(), false);
|
|
1950
|
+
return;
|
|
1951
|
+
}
|
|
1952
|
+
let ticker = geTickerInstanceById(step.ticker, step.args, step.duration, step.priority);
|
|
1953
|
+
if (!ticker) {
|
|
1954
|
+
console.error(`[Pixi'VN] Ticker ${step.ticker} not found`);
|
|
1955
|
+
return;
|
|
1956
|
+
}
|
|
1957
|
+
let tickerName = ticker.id;
|
|
1958
|
+
let tickerHistory = {
|
|
1959
|
+
fn: () => {
|
|
1960
|
+
},
|
|
1961
|
+
id: tickerName,
|
|
1962
|
+
args: createExportableElement(ticker.args),
|
|
1963
|
+
canvasElementTags: [tag],
|
|
1964
|
+
priority: ticker.priority,
|
|
1965
|
+
duration: ticker.duration,
|
|
1966
|
+
createdByTicketStepsId: tag
|
|
1967
|
+
};
|
|
1968
|
+
let id = _GameWindowManager.generateTickerId(tickerHistory);
|
|
1969
|
+
_GameWindowManager.pushTicker(id, tickerHistory, ticker);
|
|
1970
|
+
if (ticker.duration) {
|
|
1971
|
+
let timeout = setTimeout(() => {
|
|
1972
|
+
let tickerTimeoutInfo = _GameWindowManager._currentTickersTimeouts[timeout.toString()];
|
|
1973
|
+
if (tickerTimeoutInfo) {
|
|
1974
|
+
_GameWindowManager.removeTicker(id);
|
|
1975
|
+
tickerTimeoutInfo.tags.forEach((tag2) => {
|
|
1976
|
+
_GameWindowManager.nextTickerStep(tag2);
|
|
1977
|
+
});
|
|
1978
|
+
}
|
|
1979
|
+
_GameWindowManager.removeTickerTimeoutInfo(timeout);
|
|
1980
|
+
}, ticker.duration * 1e3);
|
|
1981
|
+
_GameWindowManager.addTickerTimeoutInfo(tag, tickerName, timeout.toString(), false);
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
static nextTickerStep(tag) {
|
|
1985
|
+
if (_GameWindowManager._currentTickersSteps[tag]) {
|
|
1986
|
+
let steps = _GameWindowManager._currentTickersSteps[tag];
|
|
1987
|
+
if (steps.currentStepNumber + 1 < steps.steps.length) {
|
|
1988
|
+
steps.currentStepNumber++;
|
|
1989
|
+
_GameWindowManager._currentTickersSteps[tag] = steps;
|
|
1990
|
+
_GameWindowManager.runTickersSteps(tag);
|
|
1991
|
+
} else {
|
|
1992
|
+
_GameWindowManager.removeTickerStepByCanvasElement(tag);
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
static onEndOfTicker(canvasElementTags, ticker, canvasElementTagsToDelete, tickerId) {
|
|
1997
|
+
let tickerData = _GameWindowManager._currentTickers[tickerId];
|
|
1998
|
+
_GameWindowManager.removeAssociationBetweenTickerCanvasElement(canvasElementTags, ticker);
|
|
1999
|
+
_GameWindowManager.removeCanvasElement(canvasElementTagsToDelete);
|
|
2000
|
+
if (tickerData) {
|
|
2001
|
+
_GameWindowManager.removeTicker(tickerId);
|
|
2002
|
+
if (tickerData.duration == void 0 && tickerData.createdByTicketStepsId) {
|
|
2003
|
+
_GameWindowManager.nextTickerStep(tickerData.createdByTicketStepsId);
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
/**
|
|
2008
|
+
* Remove a connection between a canvas element and a ticker.
|
|
2009
|
+
* And remove the ticker if there is no canvas element connected to it.
|
|
2010
|
+
* @param tags The tag of the canvas element that will use the ticker.
|
|
2011
|
+
* @param ticker The ticker class to be removed.
|
|
2012
|
+
* @example
|
|
2013
|
+
* ```typescript
|
|
2014
|
+
* GameWindowManager.removeAssociationBetweenTickerCanvasElement("alien", RotateTicker)
|
|
2015
|
+
* ```
|
|
2016
|
+
*/
|
|
2017
|
+
static removeAssociationBetweenTickerCanvasElement(tags, ticker) {
|
|
2018
|
+
let tickerId;
|
|
2019
|
+
if (typeof ticker === "string") {
|
|
2020
|
+
tickerId = ticker;
|
|
2021
|
+
} else if (ticker instanceof TickerBase) {
|
|
2022
|
+
tickerId = ticker.id;
|
|
2023
|
+
} else {
|
|
2024
|
+
tickerId = ticker.prototype.id;
|
|
2025
|
+
}
|
|
2026
|
+
if (typeof tags === "string") {
|
|
2027
|
+
tags = [tags];
|
|
2028
|
+
}
|
|
2029
|
+
for (let id in _GameWindowManager._currentTickers) {
|
|
2030
|
+
let ticker2 = _GameWindowManager._currentTickers[id];
|
|
2031
|
+
if (ticker2.id === tickerId) {
|
|
2032
|
+
_GameWindowManager._currentTickers[id].canvasElementTags = ticker2.canvasElementTags.filter((e) => !tags.includes(e));
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
for (let timeout in _GameWindowManager._currentTickersTimeouts) {
|
|
2036
|
+
let TickerTimeout = _GameWindowManager._currentTickersTimeouts[timeout];
|
|
2037
|
+
if (TickerTimeout.ticker === tickerId && TickerTimeout.canBeDeletedBeforeEnd) {
|
|
2038
|
+
_GameWindowManager._currentTickersTimeouts[timeout].tags = TickerTimeout.tags.filter((t) => !tags.includes(t));
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
_GameWindowManager.removeTickersWithoutAssociatedCanvasElement();
|
|
2042
|
+
}
|
|
2043
|
+
/**
|
|
2044
|
+
* Remove all tickers that are not connected to any existing canvas element.
|
|
2045
|
+
*/
|
|
2046
|
+
static removeTickersWithoutAssociatedCanvasElement() {
|
|
2047
|
+
for (let id in _GameWindowManager._currentTickers) {
|
|
2048
|
+
let ticker = _GameWindowManager._currentTickers[id];
|
|
2049
|
+
ticker.canvasElementTags = ticker.canvasElementTags.filter((e) => _GameWindowManager._children[e]);
|
|
2050
|
+
if (ticker.canvasElementTags.length === 0) {
|
|
2051
|
+
_GameWindowManager.removeTicker(id);
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
for (let tag in _GameWindowManager._currentTickersSteps) {
|
|
2055
|
+
if (_GameWindowManager._children[tag] === void 0) {
|
|
2056
|
+
delete _GameWindowManager._currentTickersSteps[tag];
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
Object.entries(_GameWindowManager._currentTickersTimeouts).forEach(([timeout, { tags }]) => {
|
|
2060
|
+
if (tags.length === 0) {
|
|
2061
|
+
_GameWindowManager.removeTickerTimeout(timeout);
|
|
2062
|
+
}
|
|
2063
|
+
});
|
|
2064
|
+
}
|
|
2065
|
+
static addTickerTimeoutInfo(tags, ticker, timeout, canBeDeletedBeforeEnd) {
|
|
2066
|
+
if (typeof tags === "string") {
|
|
2067
|
+
tags = [tags];
|
|
2068
|
+
}
|
|
2069
|
+
_GameWindowManager._currentTickersTimeouts[timeout] = {
|
|
2070
|
+
tags,
|
|
2071
|
+
ticker,
|
|
2072
|
+
canBeDeletedBeforeEnd
|
|
2073
|
+
};
|
|
2074
|
+
}
|
|
2075
|
+
static removeTickerTimeoutInfo(timeout) {
|
|
2076
|
+
if (typeof timeout !== "string") {
|
|
2077
|
+
timeout = timeout.toString();
|
|
2078
|
+
}
|
|
2079
|
+
if (_GameWindowManager._currentTickersTimeouts[timeout]) {
|
|
2080
|
+
delete _GameWindowManager._currentTickersTimeouts[timeout];
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
static removeTickerTimeout(timeout) {
|
|
2084
|
+
if (typeof timeout !== "string") {
|
|
2085
|
+
timeout = timeout.toString();
|
|
2086
|
+
}
|
|
2087
|
+
clearTimeout(Number(timeout));
|
|
2088
|
+
_GameWindowManager.removeTickerTimeoutInfo(timeout);
|
|
2089
|
+
}
|
|
2090
|
+
static removeTickerTimeoutsByTag(tag, checkCanBeDeletedBeforeEnd) {
|
|
2091
|
+
for (let timeout in _GameWindowManager._currentTickersTimeouts) {
|
|
2092
|
+
let tagsWithoutTagToRemove = _GameWindowManager._currentTickersTimeouts[timeout].tags.filter((t) => t !== tag);
|
|
2093
|
+
if (tagsWithoutTagToRemove.length === 0) {
|
|
2094
|
+
let canBeDeletedBeforeEnd = _GameWindowManager._currentTickersTimeouts[timeout].canBeDeletedBeforeEnd;
|
|
2095
|
+
if (!checkCanBeDeletedBeforeEnd || canBeDeletedBeforeEnd) {
|
|
2096
|
+
_GameWindowManager.removeTickerTimeout(timeout);
|
|
2097
|
+
}
|
|
2098
|
+
} else {
|
|
2099
|
+
_GameWindowManager._currentTickersTimeouts[timeout].tags = tagsWithoutTagToRemove;
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
/**
|
|
2104
|
+
* Remove all tickers from the canvas.
|
|
2105
|
+
*/
|
|
2106
|
+
static removeAllTickers() {
|
|
2107
|
+
_GameWindowManager._currentTickersSteps = {};
|
|
2108
|
+
Object.keys(_GameWindowManager._currentTickers).forEach((id) => {
|
|
2109
|
+
_GameWindowManager.removeTicker(id);
|
|
2110
|
+
});
|
|
2111
|
+
_GameWindowManager._currentTickers = {};
|
|
2112
|
+
for (let timeout in _GameWindowManager._currentTickersTimeouts) {
|
|
2113
|
+
_GameWindowManager.removeTickerTimeout(timeout);
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
/**
|
|
2117
|
+
* Remove all tickers from a canvas element.
|
|
2118
|
+
* @param tag The tag of the canvas element that will use the ticker.
|
|
2119
|
+
*/
|
|
2120
|
+
static removeTickerByCanvasElement(tag) {
|
|
2121
|
+
if (typeof tag === "string") {
|
|
2122
|
+
tag = [tag];
|
|
2123
|
+
}
|
|
2124
|
+
tag.forEach((tag2) => {
|
|
2125
|
+
for (let id in _GameWindowManager._currentTickers) {
|
|
2126
|
+
let ticker = _GameWindowManager._currentTickers[id];
|
|
2127
|
+
if (ticker.canvasElementTags.includes(tag2)) {
|
|
2128
|
+
_GameWindowManager.removeTicker(id);
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
if (_GameWindowManager._currentTickersSteps[tag2]) {
|
|
2132
|
+
delete _GameWindowManager._currentTickersSteps[tag2];
|
|
2133
|
+
}
|
|
2134
|
+
_GameWindowManager.removeTickerTimeoutsByTag(tag2, false);
|
|
2135
|
+
delete _GameWindowManager._currentTickersSteps[tag2];
|
|
2136
|
+
});
|
|
2137
|
+
}
|
|
2138
|
+
static removeTickerStepByCanvasElement(tag) {
|
|
2139
|
+
if (_GameWindowManager._currentTickersSteps[tag]) {
|
|
2140
|
+
delete _GameWindowManager._currentTickersSteps[tag];
|
|
2141
|
+
}
|
|
2142
|
+
for (let id in _GameWindowManager._currentTickers) {
|
|
2143
|
+
let ticker = _GameWindowManager._currentTickers[id];
|
|
2144
|
+
if (ticker.createdByTicketStepsId === tag) {
|
|
2145
|
+
_GameWindowManager.removeTicker(id);
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
static removeTicker(tickerId) {
|
|
2150
|
+
let ticker = _GameWindowManager._currentTickers[tickerId];
|
|
2151
|
+
if (ticker) {
|
|
2152
|
+
if (ticker.args.hasOwnProperty(tagToRemoveAfter)) {
|
|
2153
|
+
let tagToRemoveAfter2 = ticker.args.tagToRemoveAfter;
|
|
2154
|
+
_GameWindowManager.removeCanvasElement(tagToRemoveAfter2);
|
|
2155
|
+
}
|
|
2156
|
+
_GameWindowManager.app.ticker.remove(ticker.fn);
|
|
2157
|
+
delete _GameWindowManager._currentTickers[tickerId];
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
/**
|
|
2161
|
+
* Clear the canvas and the tickers.
|
|
2162
|
+
*/
|
|
2163
|
+
static clear() {
|
|
2164
|
+
_GameWindowManager.removeCanvasElements();
|
|
2165
|
+
}
|
|
2166
|
+
/* Export and Import Methods */
|
|
2167
|
+
/**
|
|
2168
|
+
* Export the canvas and the tickers to a JSON string.
|
|
2169
|
+
* @returns The JSON string.
|
|
2170
|
+
*/
|
|
2171
|
+
static exportJson() {
|
|
2172
|
+
return JSON.stringify(this.export());
|
|
2173
|
+
}
|
|
2174
|
+
/**
|
|
2175
|
+
* Export the canvas and the tickers to an object.
|
|
2176
|
+
* @returns The object.
|
|
2177
|
+
*/
|
|
2178
|
+
static export() {
|
|
2179
|
+
let currentElements = {};
|
|
2180
|
+
for (let tag in _GameWindowManager._children) {
|
|
2181
|
+
currentElements[tag] = exportCanvasElement(_GameWindowManager._children[tag]);
|
|
2182
|
+
}
|
|
2183
|
+
return {
|
|
2184
|
+
currentTickers: createExportableElement(_GameWindowManager.currentTickersWithoutCreatedBySteps),
|
|
2185
|
+
currentTickersSteps: createExportableElement(_GameWindowManager._currentTickersSteps),
|
|
2186
|
+
currentElements: createExportableElement(currentElements),
|
|
2187
|
+
childrenTagsOrder: createExportableElement(_GameWindowManager.childrenTagsOrder)
|
|
2188
|
+
};
|
|
2189
|
+
}
|
|
2190
|
+
/**
|
|
2191
|
+
* Import the canvas and the tickers from a JSON string.
|
|
2192
|
+
* @param dataString The JSON string.
|
|
2193
|
+
*/
|
|
2194
|
+
static importJson(dataString) {
|
|
2195
|
+
_GameWindowManager.import(JSON.parse(dataString));
|
|
2196
|
+
}
|
|
2197
|
+
/**
|
|
2198
|
+
* Import the canvas and the tickers from an object.
|
|
2199
|
+
* @param data The object.
|
|
2200
|
+
*/
|
|
2201
|
+
static import(data) {
|
|
2202
|
+
_GameWindowManager.clear();
|
|
2203
|
+
try {
|
|
2204
|
+
if (data.hasOwnProperty("childrenTagsOrder") && data.hasOwnProperty("currentElements")) {
|
|
2205
|
+
let currentElements = data["currentElements"];
|
|
2206
|
+
let childrenTagsOrder = data["childrenTagsOrder"];
|
|
2207
|
+
childrenTagsOrder.forEach((tag) => {
|
|
2208
|
+
if (currentElements[tag]) {
|
|
2209
|
+
let element = importCanvasElement(currentElements[tag]);
|
|
2210
|
+
_GameWindowManager.addCanvasElement(tag, element);
|
|
2211
|
+
_GameWindowManager.childrenTagsOrder.push(tag);
|
|
2212
|
+
}
|
|
2213
|
+
});
|
|
2214
|
+
} else {
|
|
2215
|
+
console.error("[Pixi'VN] The data does not have the properties childrenTagsOrder and currentElements");
|
|
2216
|
+
return;
|
|
2217
|
+
}
|
|
2218
|
+
if (data.hasOwnProperty("currentTickers")) {
|
|
2219
|
+
let currentTickers = data["currentTickers"];
|
|
2220
|
+
for (let id in currentTickers) {
|
|
2221
|
+
let t = currentTickers[id];
|
|
2222
|
+
let tags = t.canvasElementTags;
|
|
2223
|
+
let ticker = geTickerInstanceById(t.id, t.args, t.duration, t.priority);
|
|
2224
|
+
if (ticker) {
|
|
2225
|
+
_GameWindowManager.addTicker(tags, ticker);
|
|
2226
|
+
} else {
|
|
2227
|
+
console.error(`[Pixi'VN] Ticker ${t.id} not found`);
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2231
|
+
if (data.hasOwnProperty("currentTickersSteps")) {
|
|
2232
|
+
let currentTickersSteps = data["currentTickersSteps"];
|
|
2233
|
+
_GameWindowManager.restoneTickersSteps(currentTickersSteps);
|
|
2234
|
+
}
|
|
2235
|
+
} catch (e) {
|
|
2236
|
+
console.error("[Pixi'VN] Error importing data", e);
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
};
|
|
2240
|
+
_GameWindowManager._app = void 0;
|
|
2241
|
+
_GameWindowManager._isInitialized = false;
|
|
2242
|
+
_GameWindowManager._children = {};
|
|
2243
|
+
/**
|
|
2244
|
+
* The order of the children tags.
|
|
2245
|
+
*/
|
|
2246
|
+
_GameWindowManager.childrenTagsOrder = [];
|
|
2247
|
+
_GameWindowManager._currentTickers = {};
|
|
2248
|
+
_GameWindowManager._currentTickersSteps = {};
|
|
2249
|
+
_GameWindowManager._currentTickersTimeouts = {};
|
|
2250
|
+
var GameWindowManager = _GameWindowManager;
|
|
2251
|
+
|
|
2252
|
+
// src/managers/StepManager.ts
|
|
2253
|
+
var _GameStepManager = class _GameStepManager {
|
|
2254
|
+
constructor() {
|
|
2255
|
+
}
|
|
2256
|
+
static get stepsHistory() {
|
|
2257
|
+
return _GameStepManager._stepsHistory;
|
|
2258
|
+
}
|
|
2259
|
+
/**
|
|
2260
|
+
* lastStepIndex is the last step index that occurred during the progression of the steps. **Not is the length of the stepsHistory - 1.**
|
|
2261
|
+
*/
|
|
2262
|
+
static get lastStepIndex() {
|
|
2263
|
+
return _GameStepManager._lastStepIndex;
|
|
2264
|
+
}
|
|
2265
|
+
/**
|
|
2266
|
+
* Increase the last step index that occurred during the progression of the steps.
|
|
2267
|
+
*/
|
|
2268
|
+
static increaseLastStepIndex() {
|
|
2269
|
+
_GameStepManager._lastStepIndex++;
|
|
2270
|
+
}
|
|
2271
|
+
static get openedLabels() {
|
|
2272
|
+
return _GameStepManager._openedLabels;
|
|
2273
|
+
}
|
|
2274
|
+
/**
|
|
2275
|
+
* currentLabelId is the current label id that occurred during the progression of the steps.
|
|
2276
|
+
*/
|
|
2277
|
+
static get currentLabelId() {
|
|
2278
|
+
if (_GameStepManager._openedLabels.length > 0) {
|
|
2279
|
+
let item = _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1];
|
|
2280
|
+
return item.label;
|
|
2281
|
+
}
|
|
2282
|
+
return void 0;
|
|
2283
|
+
}
|
|
2284
|
+
/**
|
|
2285
|
+
* currentLabel is the current label that occurred during the progression of the steps.
|
|
2286
|
+
*/
|
|
2287
|
+
static get currentLabel() {
|
|
2288
|
+
if (_GameStepManager.currentLabelId) {
|
|
2289
|
+
return getLabelById(_GameStepManager.currentLabelId);
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
static get currentLabelStepIndex() {
|
|
2293
|
+
if (_GameStepManager._openedLabels.length > 0) {
|
|
2294
|
+
let item = _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1];
|
|
2295
|
+
return item.currentStepIndex;
|
|
2296
|
+
}
|
|
2297
|
+
return null;
|
|
2298
|
+
}
|
|
2299
|
+
/**
|
|
2300
|
+
* lastHistoryStep is the last history step that occurred during the progression of the steps.
|
|
2301
|
+
*/
|
|
2302
|
+
static get lastHistoryStep() {
|
|
2303
|
+
if (_GameStepManager._stepsHistory.length > 0) {
|
|
2304
|
+
return _GameStepManager._stepsHistory[_GameStepManager._stepsHistory.length - 1];
|
|
2305
|
+
}
|
|
2306
|
+
return null;
|
|
2307
|
+
}
|
|
2308
|
+
static get originalStepData() {
|
|
2309
|
+
if (!_GameStepManager._originalStepData) {
|
|
2310
|
+
return {
|
|
2311
|
+
path: "",
|
|
2312
|
+
storage: {},
|
|
2313
|
+
canvas: {
|
|
2314
|
+
childrenTagsOrder: [],
|
|
2315
|
+
currentElements: {},
|
|
2316
|
+
currentTickers: {},
|
|
2317
|
+
currentTickersSteps: {}
|
|
2318
|
+
},
|
|
2319
|
+
labelIndex: -1,
|
|
2320
|
+
openedLabels: []
|
|
2321
|
+
};
|
|
2322
|
+
}
|
|
2323
|
+
return createExportableElement(_GameStepManager._originalStepData);
|
|
2324
|
+
}
|
|
2325
|
+
static set originalStepData(value) {
|
|
2326
|
+
_GameStepManager._originalStepData = createExportableElement(value);
|
|
2327
|
+
}
|
|
2328
|
+
/* Edit History Methods */
|
|
2329
|
+
/**
|
|
2330
|
+
* Add a label to the history.
|
|
2331
|
+
* @param label The label to add to the history.
|
|
2332
|
+
*/
|
|
2333
|
+
static addStepHistory(step, choiseMade) {
|
|
2334
|
+
let stepHistory = getStepSha1(step);
|
|
2335
|
+
let historyStep = {
|
|
2336
|
+
path: window.location.pathname,
|
|
2337
|
+
storage: GameStorageManager.export(),
|
|
2338
|
+
canvas: GameWindowManager.export(),
|
|
2339
|
+
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2340
|
+
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2341
|
+
};
|
|
2342
|
+
if (_GameStepManager.originalStepData) {
|
|
2343
|
+
if (_GameStepManager.originalStepData.openedLabels.length === historyStep.openedLabels.length) {
|
|
2344
|
+
try {
|
|
2345
|
+
let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
|
|
2346
|
+
let historyStepOpenedLabelsString = JSON.stringify(historyStep.openedLabels);
|
|
2347
|
+
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === historyStep.path && _GameStepManager.originalStepData.labelIndex === historyStep.labelIndex) {
|
|
2348
|
+
return;
|
|
2349
|
+
}
|
|
2350
|
+
} catch (e) {
|
|
2351
|
+
console.error("[Pixi'VN] Error comparing openedLabels", e);
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
let data = diff(_GameStepManager.originalStepData, historyStep);
|
|
2356
|
+
if (data) {
|
|
2357
|
+
let dialoge = void 0;
|
|
2358
|
+
let requiredChoices = void 0;
|
|
2359
|
+
if (GameStorageManager.getVariable(GameStorageManager.keysSystem.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY) === _GameStepManager.lastStepIndex) {
|
|
2360
|
+
dialoge = getDialogue();
|
|
2361
|
+
}
|
|
2362
|
+
if (GameStorageManager.getVariable(GameStorageManager.keysSystem.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY) === _GameStepManager.lastStepIndex) {
|
|
2363
|
+
requiredChoices = GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY);
|
|
2364
|
+
}
|
|
2365
|
+
_GameStepManager._stepsHistory.push({
|
|
2366
|
+
diff: data,
|
|
2367
|
+
currentLabel: _GameStepManager.currentLabelId,
|
|
2368
|
+
dialoge,
|
|
2369
|
+
choices: requiredChoices,
|
|
2370
|
+
stepSha1: stepHistory,
|
|
2371
|
+
index: _GameStepManager.lastStepIndex,
|
|
2372
|
+
choiceIndexMade: choiseMade
|
|
2373
|
+
});
|
|
2374
|
+
_GameStepManager.originalStepData = historyStep;
|
|
2375
|
+
}
|
|
2376
|
+
_GameStepManager.increaseLastStepIndex();
|
|
2377
|
+
}
|
|
2378
|
+
/**
|
|
2379
|
+
* Add a label to the history.
|
|
2380
|
+
* @param label The label to add to the history.
|
|
2381
|
+
*/
|
|
2382
|
+
static pushNewLabel(label) {
|
|
2383
|
+
let currentLabel = getLabelById(label);
|
|
2384
|
+
if (!currentLabel) {
|
|
2385
|
+
throw new Error(`[Pixi'VN] Label ${label} not found`);
|
|
2386
|
+
}
|
|
2387
|
+
_GameStepManager._openedLabels.push({
|
|
2388
|
+
label,
|
|
2389
|
+
currentStepIndex: 0
|
|
2390
|
+
});
|
|
2391
|
+
}
|
|
2392
|
+
/**
|
|
2393
|
+
* Close the current label and add it to the history.
|
|
2394
|
+
* @returns
|
|
2395
|
+
*/
|
|
2396
|
+
static closeCurrentLabel() {
|
|
2397
|
+
if (!_GameStepManager.currentLabelId) {
|
|
2398
|
+
console.warn("[Pixi'VN] No label to close");
|
|
2399
|
+
return;
|
|
2400
|
+
}
|
|
2401
|
+
if (!_GameStepManager.currentLabel) {
|
|
2402
|
+
console.error("[Pixi'VN] currentLabel not found");
|
|
2403
|
+
return;
|
|
2404
|
+
}
|
|
2405
|
+
_GameStepManager._openedLabels.pop();
|
|
2406
|
+
}
|
|
2407
|
+
/**
|
|
2408
|
+
* Close all labels and add them to the history. **Attention: This method can cause an unhandled game ending.**
|
|
2409
|
+
*/
|
|
2410
|
+
static closeAllLabels() {
|
|
2411
|
+
while (_GameStepManager._openedLabels.length > 0) {
|
|
2412
|
+
_GameStepManager.closeCurrentLabel();
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
/**
|
|
2416
|
+
* Increase the current step index of the current label.
|
|
2417
|
+
*/
|
|
2418
|
+
static increaseCurrentStepIndex() {
|
|
2419
|
+
let item = _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1];
|
|
2420
|
+
_GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1] = __spreadProps(__spreadValues({}, item), {
|
|
2421
|
+
currentStepIndex: item.currentStepIndex + 1
|
|
2422
|
+
});
|
|
2423
|
+
}
|
|
2424
|
+
static restorLastLabelList() {
|
|
2425
|
+
_GameStepManager._openedLabels = _GameStepManager.originalStepData.openedLabels;
|
|
2426
|
+
}
|
|
2427
|
+
/* Run Methods */
|
|
2428
|
+
static get canGoNext() {
|
|
2429
|
+
let options = getChoiceMenuOptions();
|
|
2430
|
+
if (options && options.length > 0) {
|
|
2431
|
+
return false;
|
|
2432
|
+
}
|
|
2433
|
+
return true;
|
|
2434
|
+
}
|
|
2435
|
+
/**
|
|
2436
|
+
* Execute the next step and add it to the history.
|
|
2437
|
+
* @param props The props to pass to the step.
|
|
2438
|
+
* @param choiseMade The index of the choise made by the player. (This params is used in the choice menu)
|
|
2439
|
+
* @returns StepLabelResultType or undefined.
|
|
2440
|
+
* @example
|
|
2441
|
+
* ```typescript
|
|
2442
|
+
* function nextOnClick() {
|
|
2443
|
+
* setLoading(true)
|
|
2444
|
+
* GameStepManager.goNext(yourParams)
|
|
2445
|
+
* .then((result) => {
|
|
2446
|
+
* setUpdate((p) => p + 1)
|
|
2447
|
+
* setLoading(false)
|
|
2448
|
+
* if (result) {
|
|
2449
|
+
* // your code
|
|
2450
|
+
* }
|
|
2451
|
+
* })
|
|
2452
|
+
* .catch((e) => {
|
|
2453
|
+
* setLoading(false)
|
|
2454
|
+
* console.error(e)
|
|
2455
|
+
* })
|
|
2456
|
+
* }
|
|
2457
|
+
* ```
|
|
2458
|
+
*/
|
|
2459
|
+
static goNext(props, choiseMade) {
|
|
2460
|
+
return __async(this, null, function* () {
|
|
2461
|
+
if (!_GameStepManager.canGoNext) {
|
|
2462
|
+
console.warn("[Pixi'VN] The player must make a choice");
|
|
2463
|
+
return;
|
|
2464
|
+
}
|
|
2465
|
+
_GameStepManager.increaseCurrentStepIndex();
|
|
2466
|
+
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2467
|
+
});
|
|
2468
|
+
}
|
|
2469
|
+
/**
|
|
2470
|
+
* Execute the current step and add it to the history.
|
|
2471
|
+
* @param props The props to pass to the step.
|
|
2472
|
+
* @param choiseMade The choise made by the player.
|
|
2473
|
+
* @returns StepLabelResultType or undefined.
|
|
2474
|
+
*/
|
|
2475
|
+
static runCurrentStep(props, choiseMade) {
|
|
2476
|
+
return __async(this, null, function* () {
|
|
2477
|
+
if (_GameStepManager.currentLabelId) {
|
|
2478
|
+
let currentLabelStepIndex = _GameStepManager.currentLabelStepIndex;
|
|
2479
|
+
if (currentLabelStepIndex === null) {
|
|
2480
|
+
console.error("[Pixi'VN] currentLabelStepIndex is null");
|
|
2481
|
+
return;
|
|
2482
|
+
}
|
|
2483
|
+
let currentLabel = _GameStepManager.currentLabel;
|
|
2484
|
+
if (!currentLabel) {
|
|
2485
|
+
console.error("[Pixi'VN] currentLabel not found");
|
|
2486
|
+
return;
|
|
2487
|
+
}
|
|
2488
|
+
if (currentLabel.steps.length > currentLabelStepIndex) {
|
|
2489
|
+
let step = currentLabel.steps[currentLabelStepIndex];
|
|
2490
|
+
let result = yield step(props);
|
|
2491
|
+
_GameStepManager.addStepHistory(step, choiseMade);
|
|
2492
|
+
return result;
|
|
2493
|
+
} else if (_GameStepManager.openedLabels.length > 1) {
|
|
2494
|
+
_GameStepManager.closeCurrentLabel();
|
|
2495
|
+
return yield _GameStepManager.goNext(props, choiseMade);
|
|
2496
|
+
} else {
|
|
2497
|
+
_GameStepManager.restorLastLabelList();
|
|
2498
|
+
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");
|
|
2499
|
+
return;
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
});
|
|
2503
|
+
}
|
|
2504
|
+
/**
|
|
2505
|
+
* Execute the label and add it to the history. (It's similar to Ren'Py's call function)
|
|
2506
|
+
* @param label The label to execute or the id of the label
|
|
2507
|
+
* @param props The props to pass to the label.
|
|
2508
|
+
* @returns StepLabelResultType or undefined.
|
|
2509
|
+
* @example
|
|
2510
|
+
* ```typescript
|
|
2511
|
+
* GameStepManager.callLabel(startLabel, yourParams).then((result) => {
|
|
2512
|
+
* if (result) {
|
|
2513
|
+
* // your code
|
|
2514
|
+
* }
|
|
2515
|
+
* })
|
|
2516
|
+
* ```
|
|
2517
|
+
* @example
|
|
2518
|
+
* ```typescript
|
|
2519
|
+
* // if you use it in a step label you should return the result.
|
|
2520
|
+
* return GameStepManager.callLabel(startLabel).then((result) => {
|
|
2521
|
+
* return result
|
|
2522
|
+
* })
|
|
2523
|
+
* ```
|
|
2524
|
+
*/
|
|
2525
|
+
static callLabel(label, props) {
|
|
2526
|
+
return __async(this, null, function* () {
|
|
2527
|
+
let choiseMade = void 0;
|
|
2528
|
+
let labelId;
|
|
2529
|
+
if (typeof label === "string") {
|
|
2530
|
+
labelId = label;
|
|
2531
|
+
} else {
|
|
2532
|
+
labelId = label.id;
|
|
2533
|
+
if (typeof label.choiseIndex === "number") {
|
|
2534
|
+
choiseMade = label.choiseIndex;
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
try {
|
|
2538
|
+
if (labelId === CLOSE_LABEL_ID) {
|
|
2539
|
+
let closeCurrentLabel = newCloseLabel(choiseMade);
|
|
2540
|
+
let choice = {
|
|
2541
|
+
label: closeCurrentLabel,
|
|
2542
|
+
text: "",
|
|
2543
|
+
closeCurrentLabel: false,
|
|
2544
|
+
type: "close",
|
|
2545
|
+
props: {}
|
|
2546
|
+
};
|
|
2547
|
+
return _GameStepManager.closeChoiceMenu(choice, props);
|
|
2548
|
+
}
|
|
2549
|
+
let tempLabel = getLabelById(labelId);
|
|
2550
|
+
if (!tempLabel) {
|
|
2551
|
+
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2552
|
+
}
|
|
2553
|
+
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2554
|
+
} catch (e) {
|
|
2555
|
+
console.error("[Pixi'VN] Error calling label", e);
|
|
2556
|
+
return;
|
|
2557
|
+
}
|
|
2558
|
+
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2559
|
+
});
|
|
2560
|
+
}
|
|
2561
|
+
/**
|
|
2562
|
+
* 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)
|
|
2563
|
+
* @param label The label to execute.
|
|
2564
|
+
* @param props The props to pass to the label or the id of the label
|
|
2565
|
+
* @returns StepLabelResultType or undefined.
|
|
2566
|
+
* @example
|
|
2567
|
+
* ```typescript
|
|
2568
|
+
* GameStepManager.jumpLabel(startLabel, yourParams).then((result) => {
|
|
2569
|
+
* if (result) {
|
|
2570
|
+
* // your code
|
|
2571
|
+
* }
|
|
2572
|
+
* })
|
|
2573
|
+
* ```
|
|
2574
|
+
* @example
|
|
2575
|
+
* ```typescript
|
|
2576
|
+
* // if you use it in a step label you should return the result.
|
|
2577
|
+
* return GameStepManager.jumpLabel(startLabel).then((result) => {
|
|
2578
|
+
* return result
|
|
2579
|
+
* })
|
|
2580
|
+
* ```
|
|
2581
|
+
*/
|
|
2582
|
+
static jumpLabel(label, props) {
|
|
2583
|
+
return __async(this, null, function* () {
|
|
2584
|
+
_GameStepManager.closeCurrentLabel();
|
|
2585
|
+
let choiseMade = void 0;
|
|
2586
|
+
let labelId;
|
|
2587
|
+
if (typeof label === "string") {
|
|
2588
|
+
labelId = label;
|
|
2589
|
+
} else {
|
|
2590
|
+
labelId = label.id;
|
|
2591
|
+
if (typeof label.choiseIndex === "number") {
|
|
2592
|
+
choiseMade = label.choiseIndex;
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
try {
|
|
2596
|
+
if (labelId === CLOSE_LABEL_ID) {
|
|
2597
|
+
let closeCurrentLabel = newCloseLabel(choiseMade);
|
|
2598
|
+
let choice = {
|
|
2599
|
+
label: closeCurrentLabel,
|
|
2600
|
+
text: "",
|
|
2601
|
+
closeCurrentLabel: false,
|
|
2602
|
+
type: "close",
|
|
2603
|
+
props: {}
|
|
2604
|
+
};
|
|
2605
|
+
return _GameStepManager.closeChoiceMenu(choice, props);
|
|
2606
|
+
}
|
|
2607
|
+
let tempLabel = getLabelById(labelId);
|
|
2608
|
+
if (!tempLabel) {
|
|
2609
|
+
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2610
|
+
}
|
|
2611
|
+
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2612
|
+
} catch (e) {
|
|
2613
|
+
console.error("[Pixi'VN] Error jumping label", e);
|
|
2614
|
+
return;
|
|
2615
|
+
}
|
|
2616
|
+
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2617
|
+
});
|
|
2618
|
+
}
|
|
2619
|
+
/**
|
|
2620
|
+
* When the player is in a choice menu, can use this function to exit to the choice menu.
|
|
2621
|
+
* @param choice
|
|
2622
|
+
* @param props
|
|
2623
|
+
* @returns StepLabelResultType or undefined.
|
|
2624
|
+
* @example
|
|
2625
|
+
* ```typescript
|
|
2626
|
+
* GameStepManager.closeChoiceMenu(yourParams).then((result) => {
|
|
2627
|
+
* if (result) {
|
|
2628
|
+
* // your code
|
|
2629
|
+
* }
|
|
2630
|
+
* })
|
|
2631
|
+
* ```
|
|
2632
|
+
*/
|
|
2633
|
+
static closeChoiceMenu(choice, props) {
|
|
2634
|
+
return __async(this, null, function* () {
|
|
2635
|
+
let label = choice.label;
|
|
2636
|
+
let choiseMade = void 0;
|
|
2637
|
+
if (typeof label.choiseIndex === "number") {
|
|
2638
|
+
choiseMade = label.choiseIndex;
|
|
2639
|
+
}
|
|
2640
|
+
if (choice.closeCurrentLabel) {
|
|
2641
|
+
_GameStepManager.closeCurrentLabel();
|
|
2642
|
+
}
|
|
2643
|
+
return _GameStepManager.goNext(props, choiseMade);
|
|
2644
|
+
});
|
|
2645
|
+
}
|
|
2646
|
+
/* After Update Methods */
|
|
2647
|
+
// /**
|
|
2648
|
+
// * After the update or code edit, some steps or labels may no longer match.
|
|
2649
|
+
// * - In case of step mismatch, the game will be updated to the last matching step.
|
|
2650
|
+
// * - In case of label mismatch, the game gives an error.
|
|
2651
|
+
// * @returns
|
|
2652
|
+
// */
|
|
2653
|
+
// private static afterUpdate() {
|
|
2654
|
+
// // TODO: implement
|
|
2655
|
+
// if (!GameStepManager.currentLabel) {
|
|
2656
|
+
// // TODO: implement
|
|
2657
|
+
// return
|
|
2658
|
+
// }
|
|
2659
|
+
// let currentLabel = getLabelInstanceByClassName(GameStepManager.currentLabel)
|
|
2660
|
+
// if (!currentLabel) {
|
|
2661
|
+
// console.error("Label not found")
|
|
2662
|
+
// return
|
|
2663
|
+
// }
|
|
2664
|
+
// let oldSteps = GameStepManager.stepsAfterLastHistoryLabel
|
|
2665
|
+
// let currentStepIndex = currentLabel.getCorrespondingStepsNumber(oldSteps)
|
|
2666
|
+
// let stepToRemove = oldSteps.length - currentStepIndex
|
|
2667
|
+
// GameStepManager.removeLastHistoryNodes(stepToRemove)
|
|
2668
|
+
// GameStepManager.loadLastStep()
|
|
2669
|
+
// }
|
|
2670
|
+
// private static loadLastStep() {
|
|
2671
|
+
// // TODO: implement
|
|
2672
|
+
// }
|
|
2673
|
+
// /**
|
|
2674
|
+
// * Remove a number of items from the last of the history.
|
|
2675
|
+
// * @param itemNumber The number of items to remove from the last of the history.
|
|
2676
|
+
// */
|
|
2677
|
+
// private static removeLastHistoryNodes(itemNumber: number) {
|
|
2678
|
+
// // TODO: implement
|
|
2679
|
+
// for (let i = 0; i < itemNumber; i++) {
|
|
2680
|
+
// GameStepManager._stepsHistory.pop()
|
|
2681
|
+
// }
|
|
2682
|
+
// }
|
|
2683
|
+
// /**
|
|
2684
|
+
// * stepsAfterLastHistoryLabel is a list of steps that occurred after the last history label.
|
|
2685
|
+
// */
|
|
2686
|
+
// private static get stepsAfterLastHistoryLabel(): StepHistoryDataType[] {
|
|
2687
|
+
// let length = GameStepManager._stepsHistory.length
|
|
2688
|
+
// let steps: StepHistoryDataType[] = []
|
|
2689
|
+
// for (let i = length - 1; i >= 0; i--) {
|
|
2690
|
+
// let element = GameStepManager._stepsHistory[i]
|
|
2691
|
+
// if (typeof element === "object" && "stepSha1" in element) {
|
|
2692
|
+
// steps.push(element.stepSha1)
|
|
2693
|
+
// }
|
|
2694
|
+
// else {
|
|
2695
|
+
// break
|
|
2696
|
+
// }
|
|
2697
|
+
// }
|
|
2698
|
+
// steps = steps.reverse()
|
|
2699
|
+
// return steps
|
|
2700
|
+
// }
|
|
2701
|
+
/* Go Back & Refresh Methods */
|
|
2702
|
+
/**
|
|
2703
|
+
* Go back to the last step and add it to the history.
|
|
2704
|
+
* @param navigate The navigate function.
|
|
2705
|
+
* @param steps The number of steps to go back.
|
|
2706
|
+
* @returns
|
|
2707
|
+
* @example
|
|
2708
|
+
* ```typescript
|
|
2709
|
+
* export function goBack(navigate: (path: string) => void, afterBack?: () => void) {
|
|
2710
|
+
* GameStepManager.goBack(navigate)
|
|
2711
|
+
* afterBack && afterBack()
|
|
2712
|
+
* }
|
|
2713
|
+
* ```
|
|
2714
|
+
*/
|
|
2715
|
+
static goBack(navigate, steps = 1) {
|
|
2716
|
+
if (steps <= 0) {
|
|
2717
|
+
console.warn("[Pixi'VN] Steps must be greater than 0");
|
|
2718
|
+
return;
|
|
2719
|
+
}
|
|
2720
|
+
if (_GameStepManager._stepsHistory.length <= 1) {
|
|
2721
|
+
console.warn("[Pixi'VN] No steps to go back");
|
|
2722
|
+
return;
|
|
2723
|
+
}
|
|
2724
|
+
let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
|
|
2725
|
+
if (restoredStep) {
|
|
2726
|
+
_GameStepManager._originalStepData = restoredStep;
|
|
2727
|
+
_GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
|
|
2728
|
+
GameStorageManager.import(createExportableElement(restoredStep.storage));
|
|
2729
|
+
GameWindowManager.import(createExportableElement(restoredStep.canvas));
|
|
2730
|
+
navigate(restoredStep.path);
|
|
2731
|
+
} else {
|
|
2732
|
+
console.error("[Pixi'VN] Error going back");
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
static goBackInternal(steps, restoredStep) {
|
|
2736
|
+
if (steps <= 0) {
|
|
2737
|
+
return restoredStep;
|
|
2738
|
+
}
|
|
2739
|
+
if (_GameStepManager._stepsHistory.length == 0) {
|
|
2740
|
+
return restoredStep;
|
|
2741
|
+
}
|
|
2742
|
+
let lastHistoryStep = _GameStepManager.lastHistoryStep;
|
|
2743
|
+
if (lastHistoryStep) {
|
|
2744
|
+
try {
|
|
2745
|
+
let result = restoreDeepDiffChanges(restoredStep, lastHistoryStep.diff);
|
|
2746
|
+
_GameStepManager._lastStepIndex = lastHistoryStep.index;
|
|
2747
|
+
_GameStepManager._stepsHistory.pop();
|
|
2748
|
+
return _GameStepManager.goBackInternal(steps - 1, result);
|
|
2749
|
+
} catch (e) {
|
|
2750
|
+
console.error("[Pixi'VN] Error applying diff", e);
|
|
2751
|
+
return restoredStep;
|
|
2752
|
+
}
|
|
2753
|
+
} else {
|
|
2754
|
+
return restoredStep;
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
/**
|
|
2758
|
+
* Return true if it is possible to go back.
|
|
2759
|
+
*/
|
|
2760
|
+
static get canGoBack() {
|
|
2761
|
+
return _GameStepManager._stepsHistory.length > 1;
|
|
2762
|
+
}
|
|
2763
|
+
/**
|
|
2764
|
+
* Add a label to the history.
|
|
2765
|
+
*/
|
|
2766
|
+
static clear() {
|
|
2767
|
+
_GameStepManager._stepsHistory = [];
|
|
2768
|
+
_GameStepManager._openedLabels = [];
|
|
2769
|
+
}
|
|
2770
|
+
/* Export and Import Methods */
|
|
2771
|
+
/**
|
|
2772
|
+
* Export the history to a JSON string.
|
|
2773
|
+
* @returns The history in a JSON string.
|
|
2774
|
+
*/
|
|
2775
|
+
static exportJson() {
|
|
2776
|
+
return JSON.stringify(this.export());
|
|
2777
|
+
}
|
|
2778
|
+
/**
|
|
2779
|
+
* Export the history to an object.
|
|
2780
|
+
* @returns The history in an object.
|
|
2781
|
+
*/
|
|
2782
|
+
static export() {
|
|
2783
|
+
return {
|
|
2784
|
+
stepsHistory: _GameStepManager._stepsHistory,
|
|
2785
|
+
openedLabels: _GameStepManager._openedLabels,
|
|
2786
|
+
lastStepIndex: _GameStepManager._lastStepIndex,
|
|
2787
|
+
originalStepData: _GameStepManager._originalStepData
|
|
2788
|
+
};
|
|
2789
|
+
}
|
|
2790
|
+
/**
|
|
2791
|
+
* Import the history from a JSON string.
|
|
2792
|
+
* @param dataString The history in a JSON string.
|
|
2793
|
+
*/
|
|
2794
|
+
static importJson(dataString) {
|
|
2795
|
+
_GameStepManager.import(JSON.parse(dataString));
|
|
2796
|
+
}
|
|
2797
|
+
/**
|
|
2798
|
+
* Import the history from an object.
|
|
2799
|
+
* @param data The history in an object.
|
|
2800
|
+
*/
|
|
2801
|
+
static import(data) {
|
|
2802
|
+
_GameStepManager.clear();
|
|
2803
|
+
try {
|
|
2804
|
+
if (data.hasOwnProperty("stepsHistory")) {
|
|
2805
|
+
_GameStepManager._stepsHistory = data["stepsHistory"];
|
|
2806
|
+
} else {
|
|
2807
|
+
console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
|
|
2808
|
+
}
|
|
2809
|
+
if (data.hasOwnProperty("openedLabels")) {
|
|
2810
|
+
_GameStepManager._openedLabels = data["openedLabels"];
|
|
2811
|
+
} else {
|
|
2812
|
+
console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
|
|
2813
|
+
}
|
|
2814
|
+
if (data.hasOwnProperty("lastStepIndex")) {
|
|
2815
|
+
_GameStepManager._lastStepIndex = data["lastStepIndex"];
|
|
2816
|
+
} else {
|
|
2817
|
+
console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
|
|
2818
|
+
}
|
|
2819
|
+
if (data.hasOwnProperty("originalStepData")) {
|
|
2820
|
+
_GameStepManager._originalStepData = data["originalStepData"];
|
|
2821
|
+
} else {
|
|
2822
|
+
console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
|
|
2823
|
+
}
|
|
2824
|
+
} catch (e) {
|
|
2825
|
+
console.error("[Pixi'VN] Error importing data", e);
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
};
|
|
2829
|
+
/**
|
|
2830
|
+
* stepHistory is a list of label events and steps that occurred during the progression of the steps.
|
|
2831
|
+
*/
|
|
2832
|
+
_GameStepManager._stepsHistory = [];
|
|
2833
|
+
_GameStepManager._lastStepIndex = 0;
|
|
2834
|
+
_GameStepManager._openedLabels = [];
|
|
2835
|
+
_GameStepManager._originalStepData = void 0;
|
|
2836
|
+
var GameStepManager = _GameStepManager;
|
|
2837
|
+
|
|
2838
|
+
// src/classes/StoredClassModel.ts
|
|
2839
|
+
var StoredClassModel = class {
|
|
2840
|
+
/**
|
|
2841
|
+
* @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.
|
|
2842
|
+
* @param id The id of instance of the class. This id must be unique for the category.
|
|
2843
|
+
*/
|
|
2844
|
+
constructor(categoryId, id) {
|
|
2845
|
+
this.categoryId = categoryId;
|
|
2846
|
+
this._id = id;
|
|
2847
|
+
}
|
|
2848
|
+
/**
|
|
2849
|
+
* Is id of the stored class. is unique for this class.
|
|
2850
|
+
*/
|
|
2851
|
+
get id() {
|
|
2852
|
+
return this._id;
|
|
2853
|
+
}
|
|
2854
|
+
/**
|
|
2855
|
+
* Update a property in the storage.
|
|
2856
|
+
* @param propertyName The name of the property to set.
|
|
2857
|
+
* @param value The value to set. If is undefined, the property will be removed from the storage.
|
|
2858
|
+
*/
|
|
2859
|
+
setStorageProperty(propertyName, value) {
|
|
2860
|
+
let storage = GameStorageManager.getVariable(this.categoryId);
|
|
2861
|
+
if (!storage) {
|
|
2862
|
+
storage = {};
|
|
2863
|
+
}
|
|
2864
|
+
if (!storage.hasOwnProperty(this.id)) {
|
|
2865
|
+
storage[this.id] = {};
|
|
2866
|
+
}
|
|
2867
|
+
if (value === void 0 || value === null) {
|
|
2868
|
+
if (storage[this.id].hasOwnProperty(propertyName)) {
|
|
2869
|
+
delete storage[this.id][propertyName];
|
|
2870
|
+
}
|
|
2871
|
+
} else {
|
|
2872
|
+
storage[this.id] = __spreadProps(__spreadValues({}, storage[this.id]), { [propertyName]: value });
|
|
2873
|
+
}
|
|
2874
|
+
if (Object.keys(storage[this.id]).length === 0) {
|
|
2875
|
+
delete storage[this.id];
|
|
2876
|
+
}
|
|
2877
|
+
GameStorageManager.setVariable(this.categoryId, storage);
|
|
2878
|
+
}
|
|
2879
|
+
/**
|
|
2880
|
+
* Get a property from the storage.
|
|
2881
|
+
* @param propertyName The name of the property to get.
|
|
2882
|
+
* @returns The value of the property. If the property is not found, returns undefined.
|
|
2883
|
+
*/
|
|
2884
|
+
getStorageProperty(propertyName) {
|
|
2885
|
+
let storage = GameStorageManager.getVariable(this.categoryId);
|
|
2886
|
+
if (storage && storage.hasOwnProperty(this.id) && storage[this.id].hasOwnProperty(propertyName)) {
|
|
2887
|
+
return storage[this.id][propertyName];
|
|
2888
|
+
}
|
|
2889
|
+
return void 0;
|
|
2890
|
+
}
|
|
2891
|
+
};
|
|
2892
|
+
|
|
2893
|
+
// src/classes/CharacterBaseModel.ts
|
|
2894
|
+
var CharacterBaseModel2 = class extends StoredClassModel {
|
|
2895
|
+
/**
|
|
2896
|
+
* @param id The id of the character.
|
|
2897
|
+
* @param props The properties of the character.
|
|
2898
|
+
*/
|
|
2899
|
+
constructor(id, props) {
|
|
2900
|
+
super(GameStorageManager.keysSystem.CHARACTER_CATEGORY_KEY, id);
|
|
2901
|
+
this.defaultName = "";
|
|
2902
|
+
this.defaultName = props.name;
|
|
2903
|
+
this.defaultSurname = props.surname;
|
|
2904
|
+
this.defaultAge = props.age;
|
|
2905
|
+
this._icon = props.icon;
|
|
2906
|
+
this._color = props.color;
|
|
2907
|
+
}
|
|
2908
|
+
/***
|
|
2909
|
+
* The name of the character.
|
|
2910
|
+
* If you set undefined, it will return the default name.
|
|
2911
|
+
*/
|
|
2912
|
+
get name() {
|
|
2913
|
+
return this.getStorageProperty("name") || this.defaultName;
|
|
2914
|
+
}
|
|
2915
|
+
set name(value) {
|
|
2916
|
+
this.setStorageProperty("name", value);
|
|
2917
|
+
}
|
|
2918
|
+
/**
|
|
2919
|
+
* The surname of the character.
|
|
2920
|
+
* If you set undefined, it will return the default surname.
|
|
2921
|
+
*/
|
|
2922
|
+
get surname() {
|
|
2923
|
+
return this.getStorageProperty("surname") || this.defaultSurname;
|
|
2924
|
+
}
|
|
2925
|
+
set surname(value) {
|
|
2926
|
+
this.setStorageProperty("surname", value);
|
|
2927
|
+
}
|
|
2928
|
+
/**
|
|
2929
|
+
* The age of the character.
|
|
2930
|
+
* If you set undefined, it will return the default age.
|
|
2931
|
+
*/
|
|
2932
|
+
get age() {
|
|
2933
|
+
return this.getStorageProperty("age") || this.defaultAge;
|
|
2934
|
+
}
|
|
2935
|
+
set age(value) {
|
|
2936
|
+
this.setStorageProperty("age", value);
|
|
2937
|
+
}
|
|
2938
|
+
/**
|
|
2939
|
+
* The icon of the character.
|
|
2940
|
+
*/
|
|
2941
|
+
get icon() {
|
|
2942
|
+
return this._icon;
|
|
2943
|
+
}
|
|
2944
|
+
/**
|
|
2945
|
+
* The color of the character.
|
|
2946
|
+
*/
|
|
2947
|
+
get color() {
|
|
2948
|
+
return this._color;
|
|
2949
|
+
}
|
|
2950
|
+
};
|
|
2951
|
+
|
|
2952
|
+
// src/classes/DialogueBaseModel.ts
|
|
2953
|
+
var DialogueBaseModel = class {
|
|
2954
|
+
/**
|
|
2955
|
+
* @param text The text of the dialogue.
|
|
2956
|
+
* @param character The id of the character that is speaking.
|
|
2957
|
+
* @param oltherParams Other parameters that can be stored in the dialogue.
|
|
2958
|
+
*/
|
|
2959
|
+
constructor(text, character, oltherParams = {}) {
|
|
2960
|
+
/**
|
|
2961
|
+
* The text of the dialogue.
|
|
2962
|
+
*/
|
|
2963
|
+
this.text = "";
|
|
2964
|
+
/**
|
|
2965
|
+
* Other parameters that can be stored in the dialogue.
|
|
2966
|
+
*/
|
|
2967
|
+
this.oltherParams = {};
|
|
2968
|
+
if (typeof text === "string") {
|
|
2969
|
+
this.text = text;
|
|
2970
|
+
if (typeof character === "string") {
|
|
2971
|
+
this.character = character;
|
|
2972
|
+
} else {
|
|
2973
|
+
this.character = character == null ? void 0 : character.id;
|
|
2974
|
+
}
|
|
2975
|
+
this.oltherParams = oltherParams;
|
|
2976
|
+
} else {
|
|
2977
|
+
this.text = text.text;
|
|
2978
|
+
if (text.character) {
|
|
2979
|
+
this.character = text.character;
|
|
2980
|
+
}
|
|
2981
|
+
this.oltherParams = text.oltherParams || {};
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2984
|
+
/**
|
|
2985
|
+
* Export the dialogue to a DialogueBaseData object.
|
|
2986
|
+
*
|
|
2987
|
+
* @returns The data of the dialogue.
|
|
2988
|
+
*/
|
|
2989
|
+
export() {
|
|
2990
|
+
return {
|
|
2991
|
+
text: this.text,
|
|
2992
|
+
character: this.character,
|
|
2993
|
+
oltherParams: this.oltherParams
|
|
2994
|
+
};
|
|
2995
|
+
}
|
|
2996
|
+
};
|
|
2997
|
+
|
|
2998
|
+
// src/labels/TestConstant.ts
|
|
2999
|
+
var juliette = new CharacterBaseModel2("___pixivn_juliette___", {
|
|
3000
|
+
name: "Juliette",
|
|
3001
|
+
age: 25,
|
|
3002
|
+
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",
|
|
3003
|
+
color: "#ac0086"
|
|
3004
|
+
});
|
|
3005
|
+
saveCharacter(juliette);
|
|
3006
|
+
var eggHeadImage = "https://pixijs.com/assets/eggHead.png";
|
|
3007
|
+
var eggHeadName = `<span style="color:purple">Egg Head</span>`;
|
|
3008
|
+
var flowerTopImage = "https://pixijs.com/assets/flowerTop.png";
|
|
3009
|
+
var flowerTopName = `<span style="color:green">Flower Top</span>`;
|
|
3010
|
+
var helmlokImage = "https://pixijs.com/assets/helmlok.png";
|
|
3011
|
+
var helmlokName = `<span style="color:blue">Helmlok</span>`;
|
|
3012
|
+
var skullyImage = "https://pixijs.com/assets/skully.png";
|
|
3013
|
+
var skullyName = `<span style="color:red">Skully</span>`;
|
|
3014
|
+
|
|
3015
|
+
// src/labels/ImagesAnimationsTestLabel.ts
|
|
3016
|
+
var IMAGE_ANIMAIONS_TEST_LABEL = "___pixi_vn_images_animations_test___";
|
|
3017
|
+
var imagesAnimationsTest = newLabel(IMAGE_ANIMAIONS_TEST_LABEL, [
|
|
3018
|
+
() => __async(void 0, null, function* () {
|
|
3019
|
+
setDialogue({ character: juliette, text: `These are my 4 puppets: ${eggHeadName}, ${flowerTopName}, ${helmlokName} and ${skullyName}. They can appear, disappear and animate at my will.` });
|
|
3020
|
+
let eggHead = addImage("eggHead", eggHeadImage);
|
|
3021
|
+
yield eggHead.load();
|
|
3022
|
+
eggHead.x = 100;
|
|
3023
|
+
eggHead.y = 100;
|
|
3024
|
+
let flowerTop = addImage("flowerTop", flowerTopImage);
|
|
3025
|
+
flowerTop.x = 300;
|
|
3026
|
+
flowerTop.y = 100;
|
|
3027
|
+
flowerTop.load();
|
|
3028
|
+
let helmlok = addImage("helmlok", helmlokImage);
|
|
3029
|
+
helmlok.x = 100;
|
|
3030
|
+
helmlok.y = 300;
|
|
3031
|
+
let skully = addImage("skully", skullyImage);
|
|
3032
|
+
skully.x = 300;
|
|
3033
|
+
skully.y = 300;
|
|
3034
|
+
yield loadImage([helmlok, skully]);
|
|
3035
|
+
}),
|
|
3036
|
+
() => __async(void 0, null, function* () {
|
|
3037
|
+
setDialogue({ character: juliette, text: "Here's what they can do." });
|
|
3038
|
+
setChoiceMenuOptions([
|
|
3039
|
+
new ChoiceMenuOption("Dissolve effect", imagesDissolveTest),
|
|
3040
|
+
new ChoiceMenuOption("Fade effect", imagesFadeTest),
|
|
3041
|
+
new ChoiceMenuOption("Rotate", imagesRotateTest),
|
|
3042
|
+
new ChoiceMenuOption("Move", imagesMoveTest),
|
|
3043
|
+
new ChoiceMenuOption("Zoom", imagesZoomTest),
|
|
3044
|
+
new ChoiceMenuOption("Move in/out", imagesMoveInOutTest),
|
|
3045
|
+
new ChoiceMenuOption("Zoom in/out", imagesZoomInOutTest),
|
|
3046
|
+
new ChoiceMenuOptionClose("Cancel", true)
|
|
3047
|
+
]);
|
|
3048
|
+
}),
|
|
3049
|
+
(props) => GameStepManager.jumpLabel(IMAGE_ANIMAIONS_TEST_LABEL, props)
|
|
3050
|
+
]);
|
|
3051
|
+
var imagesDissolveTest = newLabel("___pixi_vn_images_dissolve_test___", [
|
|
3052
|
+
() => {
|
|
3053
|
+
setDialogue({
|
|
3054
|
+
character: juliette,
|
|
3055
|
+
text: `Here's what's going to happen:
|
|
3056
|
+
- ${eggHeadName} will disappear with a dissolve effect. If you go next, ${eggHeadName} reappears with a dissolve effect without stopping the dissolve effect
|
|
3057
|
+
- ${eggHeadName} will appear instead of ${flowerTopName}.
|
|
3058
|
+
- ${helmlokName} will disappear with a fade effect and reappear with a fade effect, and repeat.
|
|
3059
|
+
- ${skullyName} will disappear with a fade effect, wait for 0.5 seconds, and reappear with a fade effect.`
|
|
3060
|
+
});
|
|
3061
|
+
removeWithDissolveTransition(["eggHead"], { duration: 2 });
|
|
3062
|
+
let eggHead = new CanvasImage({ x: 300, y: 100 }, eggHeadImage);
|
|
3063
|
+
showWithDissolveTransition("flowerTop", eggHead, { duration: 1 });
|
|
3064
|
+
GameWindowManager.addTickersSteps(
|
|
3065
|
+
"helmlok",
|
|
3066
|
+
[
|
|
3067
|
+
new FadeAlphaTicker({
|
|
3068
|
+
duration: 1,
|
|
3069
|
+
type: "hide"
|
|
3070
|
+
}, 1),
|
|
3071
|
+
new FadeAlphaTicker({
|
|
3072
|
+
duration: 1,
|
|
3073
|
+
type: "show"
|
|
3074
|
+
}, 1),
|
|
3075
|
+
Repeat
|
|
3076
|
+
]
|
|
3077
|
+
);
|
|
3078
|
+
GameWindowManager.addTickersSteps(
|
|
3079
|
+
"skully",
|
|
3080
|
+
[
|
|
3081
|
+
new FadeAlphaTicker({
|
|
3082
|
+
duration: 0.5,
|
|
3083
|
+
type: "hide",
|
|
3084
|
+
limit: 0.3
|
|
3085
|
+
}, 1),
|
|
3086
|
+
Pause(0.5),
|
|
3087
|
+
new FadeAlphaTicker({
|
|
3088
|
+
duration: 1,
|
|
3089
|
+
type: "show"
|
|
3090
|
+
}, 1)
|
|
3091
|
+
]
|
|
3092
|
+
);
|
|
3093
|
+
},
|
|
3094
|
+
() => __async(void 0, null, function* () {
|
|
3095
|
+
showWithDissolveTransition("eggHead", eggHeadImage, { duration: 0.5 });
|
|
3096
|
+
})
|
|
3097
|
+
]);
|
|
3098
|
+
var imagesFadeTest = newLabel("___pixi_vn_images_fade_test___", [
|
|
3099
|
+
() => {
|
|
3100
|
+
setDialogue({
|
|
3101
|
+
character: juliette,
|
|
3102
|
+
text: `Here's what's going to happen:
|
|
3103
|
+
- ${eggHeadName} will disappear with a dissolve effect. If you go next, ${eggHeadName} reappears with a dissolve effect with stopping the dissolve effect
|
|
3104
|
+
- ${eggHeadName} will appear instead of ${flowerTopName}.
|
|
3105
|
+
- ${helmlokName} will disappear with a fade effect and reappear with a fade effect, and repeat.
|
|
3106
|
+
- ${skullyName} will disappear with a fade effect, wait for 0.5 seconds, and reappear with a fade effect.`
|
|
3107
|
+
});
|
|
3108
|
+
removeWithFadeTransition(["eggHead"], { duration: 2 });
|
|
3109
|
+
let eggHead = new CanvasImage({ x: 300, y: 100 }, eggHeadImage);
|
|
3110
|
+
showWithFadeTransition("flowerTop", eggHead, { duration: 1 });
|
|
3111
|
+
GameWindowManager.addTickersSteps(
|
|
3112
|
+
"helmlok",
|
|
3113
|
+
[
|
|
3114
|
+
new FadeAlphaTicker({
|
|
3115
|
+
duration: 1,
|
|
3116
|
+
type: "hide"
|
|
3117
|
+
}),
|
|
3118
|
+
new FadeAlphaTicker({
|
|
3119
|
+
duration: 1,
|
|
3120
|
+
type: "show"
|
|
3121
|
+
}),
|
|
3122
|
+
Repeat
|
|
3123
|
+
]
|
|
3124
|
+
);
|
|
3125
|
+
GameWindowManager.addTickersSteps(
|
|
3126
|
+
"skully",
|
|
3127
|
+
[
|
|
3128
|
+
new FadeAlphaTicker({
|
|
3129
|
+
duration: 0.5,
|
|
3130
|
+
type: "hide",
|
|
3131
|
+
limit: 0.3
|
|
3132
|
+
}),
|
|
3133
|
+
Pause(0.5),
|
|
3134
|
+
new FadeAlphaTicker({
|
|
3135
|
+
duration: 1,
|
|
3136
|
+
type: "show"
|
|
3137
|
+
})
|
|
3138
|
+
]
|
|
3139
|
+
);
|
|
3140
|
+
},
|
|
3141
|
+
() => __async(void 0, null, function* () {
|
|
3142
|
+
let eggHeadOld = GameWindowManager.getCanvasElement("eggHead");
|
|
3143
|
+
if (eggHeadOld)
|
|
3144
|
+
eggHeadOld.alpha = 0;
|
|
3145
|
+
showWithFadeTransition("eggHead", eggHeadImage, { duration: 0.5 });
|
|
3146
|
+
})
|
|
3147
|
+
]);
|
|
3148
|
+
var imagesRotateTest = newLabel("___pixi_vn_images_rotate_test___", [
|
|
3149
|
+
() => {
|
|
3150
|
+
setDialogue({
|
|
3151
|
+
character: juliette,
|
|
3152
|
+
text: `Here's what's going to happen:
|
|
3153
|
+
- ${eggHeadName} will rotate with a anchor set to 0.
|
|
3154
|
+
- ${flowerTopName} will rotate with a anchor set to 0.5 and a exponential speed progression.
|
|
3155
|
+
- ${helmlokName} will rotate with a anchor set to 0.5, rotate 2 times, move to the right, rotate 5 times, and repeat.
|
|
3156
|
+
- ${skullyName} will rotate with a anchor set to 1, rotate 3 times, wait for 0.5 seconds, rotate 7 times.`
|
|
3157
|
+
});
|
|
3158
|
+
let eggHead = GameWindowManager.getCanvasElement("eggHead");
|
|
3159
|
+
if (eggHead)
|
|
3160
|
+
eggHead.anchor.set(0);
|
|
3161
|
+
let flowerTop = GameWindowManager.getCanvasElement("flowerTop");
|
|
3162
|
+
if (flowerTop)
|
|
3163
|
+
flowerTop.anchor.set(0.5);
|
|
3164
|
+
let helmlok = GameWindowManager.getCanvasElement("helmlok");
|
|
3165
|
+
if (helmlok)
|
|
3166
|
+
helmlok.anchor.set(0.5);
|
|
3167
|
+
let skully = GameWindowManager.getCanvasElement("skully");
|
|
3168
|
+
if (skully)
|
|
3169
|
+
skully.anchor.set(1);
|
|
3170
|
+
GameWindowManager.addTicker("eggHead", new RotateTicker({
|
|
3171
|
+
speed: 6,
|
|
3172
|
+
clockwise: true
|
|
3173
|
+
}));
|
|
3174
|
+
GameWindowManager.addTicker("flowerTop", new RotateTicker({
|
|
3175
|
+
speed: 6,
|
|
3176
|
+
clockwise: false,
|
|
3177
|
+
speedProgression: { type: "exponential", percentage: 0.01, limit: 300 }
|
|
3178
|
+
}));
|
|
3179
|
+
GameWindowManager.addTickersSteps("helmlok", [
|
|
3180
|
+
new RotateTicker({
|
|
3181
|
+
speed: 6,
|
|
3182
|
+
clockwise: true
|
|
3183
|
+
}, 2),
|
|
3184
|
+
new RotateTicker({
|
|
3185
|
+
speed: 100,
|
|
3186
|
+
clockwise: false,
|
|
3187
|
+
speedProgression: { type: "exponential", percentage: -0.05 }
|
|
3188
|
+
}),
|
|
3189
|
+
Repeat
|
|
3190
|
+
]);
|
|
3191
|
+
GameWindowManager.addTickersSteps("skully", [
|
|
3192
|
+
new RotateTicker({
|
|
3193
|
+
speed: 6,
|
|
3194
|
+
clockwise: true
|
|
3195
|
+
}, 3),
|
|
3196
|
+
Pause(0.5),
|
|
3197
|
+
new RotateTicker({
|
|
3198
|
+
speed: 6,
|
|
3199
|
+
clockwise: false
|
|
3200
|
+
}, 7)
|
|
3201
|
+
]);
|
|
3202
|
+
}
|
|
3203
|
+
]);
|
|
3204
|
+
var imagesMoveTest = newLabel("___pixi_vn_images_move_test___", [
|
|
3205
|
+
() => {
|
|
3206
|
+
setDialogue({
|
|
3207
|
+
character: juliette,
|
|
3208
|
+
text: `Here's what's going to happen:
|
|
3209
|
+
- ${eggHeadName} will move to { x: 500, y: 100 } with a speed of 0.4.
|
|
3210
|
+
- ${flowerTopName} will move to { x: 500, y: 300 } with a speed of 0.3.
|
|
3211
|
+
- ${helmlokName} will move to the right with a speed of 20 and a linear speed progression of -0.2, and then move to the left with a speed of 0.1 and a linear speed progression of 0.05.
|
|
3212
|
+
- ${skullyName} will move to { x: 500, y: 500 } with a speed of 0.5, wait for 0.5 seconds, and move to { x: 100, y: 100 } with a speed of 0.5.`
|
|
3213
|
+
});
|
|
3214
|
+
GameWindowManager.addTicker("eggHead", new MoveTicker({
|
|
3215
|
+
destination: { x: 500, y: 100 },
|
|
3216
|
+
speed: 24
|
|
3217
|
+
}));
|
|
3218
|
+
GameWindowManager.addTicker("flowerTop", new MoveTicker({
|
|
3219
|
+
destination: { x: 500, y: 300 },
|
|
3220
|
+
speed: 18
|
|
3221
|
+
}));
|
|
3222
|
+
GameWindowManager.addTickersSteps("helmlok", [
|
|
3223
|
+
new MoveTicker({
|
|
3224
|
+
destination: { x: 100, y: 500 },
|
|
3225
|
+
speed: 1200,
|
|
3226
|
+
speedProgression: { type: "linear", amt: -12, limit: 60 }
|
|
3227
|
+
}),
|
|
3228
|
+
new MoveTicker({
|
|
3229
|
+
destination: { x: 1700, y: 500 },
|
|
3230
|
+
speed: 6,
|
|
3231
|
+
speedProgression: { type: "linear", amt: 3 }
|
|
3232
|
+
}),
|
|
3233
|
+
Repeat
|
|
3234
|
+
]);
|
|
3235
|
+
GameWindowManager.addTickersSteps("skully", [
|
|
3236
|
+
new MoveTicker({
|
|
3237
|
+
destination: { x: 500, y: 500 },
|
|
3238
|
+
speed: 60
|
|
3239
|
+
}),
|
|
3240
|
+
Pause(0.5),
|
|
3241
|
+
new MoveTicker({
|
|
3242
|
+
destination: { x: 100, y: 100 },
|
|
3243
|
+
speed: 60
|
|
3244
|
+
})
|
|
3245
|
+
]);
|
|
3246
|
+
}
|
|
3247
|
+
]);
|
|
3248
|
+
var imagesZoomTest = newLabel("___pixi_vn_images_zoom_test___", [
|
|
3249
|
+
() => {
|
|
3250
|
+
setDialogue({
|
|
3251
|
+
character: juliette,
|
|
3252
|
+
text: `Here's what's going to happen:
|
|
3253
|
+
- ${eggHeadName} will zoom out with a speed of 3 and a limit of -0.5.
|
|
3254
|
+
- ${flowerTopName} will zoom in with a speed of 3 and a limit of 2.
|
|
3255
|
+
- ${helmlokName} will unzoom with a speed of 3 and a limit of -1, and zoom in with a speed of 3 and a limit of 1, and repeat.
|
|
3256
|
+
- ${skullyName} will zoom in with a speed of 0.1 and a limit of 5, wait for 0.5 seconds, and zoom out with a speed of 3 and a limit of 1.`
|
|
3257
|
+
});
|
|
3258
|
+
let eggHead = GameWindowManager.getCanvasElement("eggHead");
|
|
3259
|
+
if (eggHead)
|
|
3260
|
+
eggHead.scale.set(2);
|
|
3261
|
+
let helmlok = GameWindowManager.getCanvasElement("helmlok");
|
|
3262
|
+
if (helmlok)
|
|
3263
|
+
helmlok.anchor.set(0.5);
|
|
3264
|
+
GameWindowManager.addTicker("eggHead", new ZoomTicker({
|
|
3265
|
+
speed: 3,
|
|
3266
|
+
limit: -0.5,
|
|
3267
|
+
type: "unzoom"
|
|
3268
|
+
}));
|
|
3269
|
+
GameWindowManager.addTicker("flowerTop", new ZoomTicker({
|
|
3270
|
+
speed: 3,
|
|
3271
|
+
limit: 2
|
|
3272
|
+
}));
|
|
3273
|
+
GameWindowManager.addTickersSteps("helmlok", [
|
|
3274
|
+
new ZoomTicker({
|
|
3275
|
+
speed: 3,
|
|
3276
|
+
limit: -1,
|
|
3277
|
+
type: "unzoom"
|
|
3278
|
+
}),
|
|
3279
|
+
new ZoomTicker({
|
|
3280
|
+
speed: 3,
|
|
3281
|
+
limit: 1
|
|
3282
|
+
}),
|
|
3283
|
+
Repeat
|
|
3284
|
+
]);
|
|
3285
|
+
GameWindowManager.addTickersSteps("skully", [
|
|
3286
|
+
new ZoomTicker({
|
|
3287
|
+
speed: 0.1,
|
|
3288
|
+
limit: 5,
|
|
3289
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3290
|
+
}),
|
|
3291
|
+
Pause(0.5),
|
|
3292
|
+
new ZoomTicker({
|
|
3293
|
+
"type": "unzoom",
|
|
3294
|
+
speed: 3,
|
|
3295
|
+
limit: 1
|
|
3296
|
+
})
|
|
3297
|
+
]);
|
|
3298
|
+
}
|
|
3299
|
+
]);
|
|
3300
|
+
var imagesMoveInOutTest = newLabel("___pixi_vn_images_move_in_out_test___", [
|
|
3301
|
+
() => __async(void 0, null, function* () {
|
|
3302
|
+
setDialogue({
|
|
3303
|
+
character: juliette,
|
|
3304
|
+
text: `Here's what's going to happen:
|
|
3305
|
+
- ${eggHeadName} will move in from the top with a speed of 800. If you go next, ${eggHeadName} will move out from the bottom with a speed of 800.
|
|
3306
|
+
- ${flowerTopName} will move in from the right with a speed of 800 and a speed progression of 0.02. If you go next, ${flowerTopName} will move out from the left with a speed of 800 and a speed progression of 0.02.
|
|
3307
|
+
- ${helmlokName} will move in from the left with a speed of 800. If you go next, ${helmlokName} will move out from the right with a speed of 800.
|
|
3308
|
+
- ${skullyName} will move in from the bottom with a speed of 800 and a speed progression of 0.02. If you go next, ${skullyName} will move out from the top with a speed of 800 and a speed progression of 0.02.`
|
|
3309
|
+
});
|
|
3310
|
+
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3311
|
+
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
3312
|
+
let helmlok = new CanvasImage({ x: 100, y: 300 }, helmlokImage);
|
|
3313
|
+
let skully = new CanvasImage({ x: 300, y: 300 }, skullyImage);
|
|
3314
|
+
moveIn("eggHead", eggHead, { speed: 800, direction: "down" });
|
|
3315
|
+
moveIn("flowerTop", flowerTop, {
|
|
3316
|
+
speed: 800,
|
|
3317
|
+
direction: "left",
|
|
3318
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3319
|
+
});
|
|
3320
|
+
moveIn("helmlok", helmlok, { speed: 800, direction: "right" });
|
|
3321
|
+
moveIn("skully", skully, {
|
|
3322
|
+
speed: 800,
|
|
3323
|
+
direction: "up",
|
|
3324
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3325
|
+
});
|
|
3326
|
+
}),
|
|
3327
|
+
() => {
|
|
3328
|
+
moveOut("eggHead", { speed: 800, direction: "down" });
|
|
3329
|
+
moveOut("flowerTop", { speed: 800, direction: "left" });
|
|
3330
|
+
moveOut("helmlok", { speed: 800, direction: "right" });
|
|
3331
|
+
moveOut("skully", { speed: 800, direction: "up" });
|
|
3332
|
+
}
|
|
3333
|
+
]);
|
|
3334
|
+
var imagesZoomInOutTest = newLabel("___pixi_vn_images_zoom_in_out_test___", [
|
|
3335
|
+
() => __async(void 0, null, function* () {
|
|
3336
|
+
GameWindowManager.removeCanvasElements();
|
|
3337
|
+
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3338
|
+
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
3339
|
+
let helmlok = new CanvasImage({ x: 100, y: 300 }, helmlokImage);
|
|
3340
|
+
let skully = new CanvasImage({ x: 300, y: 300 }, skullyImage);
|
|
3341
|
+
zoomIn("eggHead", eggHead, { speed: 3, direction: "down" });
|
|
3342
|
+
zoomIn("flowerTop", flowerTop, {
|
|
3343
|
+
speed: 3,
|
|
3344
|
+
direction: "left",
|
|
3345
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3346
|
+
});
|
|
3347
|
+
zoomIn("helmlok", helmlok, { speed: 3, direction: "right" });
|
|
3348
|
+
zoomIn("skully", skully, {
|
|
3349
|
+
speed: 3,
|
|
3350
|
+
direction: "up",
|
|
3351
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3352
|
+
});
|
|
3353
|
+
}),
|
|
3354
|
+
() => __async(void 0, null, function* () {
|
|
3355
|
+
zoomOut("eggHead", {
|
|
3356
|
+
speed: 3,
|
|
3357
|
+
direction: "down",
|
|
3358
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3359
|
+
});
|
|
3360
|
+
zoomOut("flowerTop", { speed: 3, direction: "left" });
|
|
3361
|
+
zoomOut("helmlok", { speed: 3, direction: "right" });
|
|
3362
|
+
zoomOut("skully", {
|
|
3363
|
+
speed: 3,
|
|
3364
|
+
direction: "up",
|
|
3365
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3366
|
+
});
|
|
3367
|
+
})
|
|
3368
|
+
]);
|
|
3369
|
+
|
|
3370
|
+
export { imagesAnimationsTest };
|
|
3371
|
+
//# sourceMappingURL=out.js.map
|
|
3372
|
+
//# sourceMappingURL=ImagesAnimationsTestLabel.mjs.map
|