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