@drincs/pixi-vn 0.6.4 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -5
- package/dist/LabelProps-CFV-zRjG.d.ts +113 -0
- package/dist/LabelProps-CmRpvUJm.d.mts +113 -0
- package/dist/classes/CharacterBaseModel.js +42 -33
- package/dist/classes/CharacterBaseModel.js.map +1 -1
- package/dist/classes/CharacterBaseModel.mjs +42 -33
- package/dist/classes/CharacterBaseModel.mjs.map +1 -1
- package/dist/classes/ChoiceMenuOption.d.mts +68 -8
- package/dist/classes/ChoiceMenuOption.d.ts +68 -8
- package/dist/classes/ChoiceMenuOption.js +119 -53
- package/dist/classes/ChoiceMenuOption.js.map +1 -1
- package/dist/classes/ChoiceMenuOption.mjs +119 -53
- package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
- package/dist/classes/CloseLabel.d.mts +2 -2
- package/dist/classes/CloseLabel.d.ts +2 -2
- package/dist/classes/CloseLabel.js +53 -17
- package/dist/classes/CloseLabel.js.map +1 -1
- package/dist/classes/CloseLabel.mjs +53 -17
- package/dist/classes/CloseLabel.mjs.map +1 -1
- package/dist/classes/Label.d.mts +4 -72
- package/dist/classes/Label.d.ts +4 -72
- package/dist/classes/Label.js +50 -16
- package/dist/classes/Label.js.map +1 -1
- package/dist/classes/Label.mjs +50 -16
- package/dist/classes/Label.mjs.map +1 -1
- package/dist/classes/StoredClassModel.js +42 -33
- package/dist/classes/StoredClassModel.js.map +1 -1
- package/dist/classes/StoredClassModel.mjs +42 -33
- package/dist/classes/StoredClassModel.mjs.map +1 -1
- package/dist/classes/canvas/CanvasContainer.js +2 -2
- package/dist/classes/canvas/CanvasContainer.js.map +1 -1
- package/dist/classes/canvas/CanvasContainer.mjs +2 -2
- package/dist/classes/canvas/CanvasContainer.mjs.map +1 -1
- package/dist/classes/canvas/CanvasImage.js +2 -2
- package/dist/classes/canvas/CanvasImage.js.map +1 -1
- package/dist/classes/canvas/CanvasImage.mjs +2 -2
- package/dist/classes/canvas/CanvasImage.mjs.map +1 -1
- package/dist/classes/canvas/CanvasSprite.js +2 -2
- package/dist/classes/canvas/CanvasSprite.js.map +1 -1
- package/dist/classes/canvas/CanvasSprite.mjs +2 -2
- package/dist/classes/canvas/CanvasSprite.mjs.map +1 -1
- package/dist/classes/canvas/CanvasText.js +2 -2
- package/dist/classes/canvas/CanvasText.js.map +1 -1
- package/dist/classes/canvas/CanvasText.mjs +2 -2
- package/dist/classes/canvas/CanvasText.mjs.map +1 -1
- package/dist/classes/canvas/index.js +2 -2
- package/dist/classes/canvas/index.js.map +1 -1
- package/dist/classes/canvas/index.mjs +2 -2
- package/dist/classes/canvas/index.mjs.map +1 -1
- package/dist/classes/index.d.mts +2 -2
- package/dist/classes/index.d.ts +2 -2
- package/dist/classes/index.js +119 -53
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +119 -53
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/ticker/FadeAlphaTicker.js +42 -33
- package/dist/classes/ticker/FadeAlphaTicker.js.map +1 -1
- package/dist/classes/ticker/FadeAlphaTicker.mjs +42 -33
- package/dist/classes/ticker/FadeAlphaTicker.mjs.map +1 -1
- package/dist/classes/ticker/MoveTicker.d.mts +1 -0
- package/dist/classes/ticker/MoveTicker.d.ts +1 -0
- package/dist/classes/ticker/MoveTicker.js +42 -33
- package/dist/classes/ticker/MoveTicker.js.map +1 -1
- package/dist/classes/ticker/MoveTicker.mjs +42 -33
- package/dist/classes/ticker/MoveTicker.mjs.map +1 -1
- package/dist/classes/ticker/RotateTicker.d.mts +1 -0
- package/dist/classes/ticker/RotateTicker.d.ts +1 -0
- package/dist/classes/ticker/RotateTicker.js +42 -33
- package/dist/classes/ticker/RotateTicker.js.map +1 -1
- package/dist/classes/ticker/RotateTicker.mjs +42 -33
- package/dist/classes/ticker/RotateTicker.mjs.map +1 -1
- package/dist/classes/ticker/ZoomTicker.d.mts +1 -0
- package/dist/classes/ticker/ZoomTicker.d.ts +1 -0
- package/dist/classes/ticker/ZoomTicker.js +42 -33
- package/dist/classes/ticker/ZoomTicker.js.map +1 -1
- package/dist/classes/ticker/ZoomTicker.mjs +42 -33
- package/dist/classes/ticker/ZoomTicker.mjs.map +1 -1
- package/dist/classes/ticker/index.js +42 -33
- package/dist/classes/ticker/index.js.map +1 -1
- package/dist/classes/ticker/index.mjs +42 -33
- 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 +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/constants.mjs.map +1 -1
- package/dist/decorators/CanvasElementDecorator.js +2 -2
- package/dist/decorators/CanvasElementDecorator.js.map +1 -1
- package/dist/decorators/CanvasElementDecorator.mjs +2 -2
- package/dist/decorators/CanvasElementDecorator.mjs.map +1 -1
- package/dist/decorators/LabelDecorator.d.mts +3 -3
- package/dist/decorators/LabelDecorator.d.ts +3 -3
- package/dist/decorators/LabelDecorator.js +74 -50
- package/dist/decorators/LabelDecorator.js.map +1 -1
- package/dist/decorators/LabelDecorator.mjs +74 -50
- package/dist/decorators/LabelDecorator.mjs.map +1 -1
- package/dist/decorators/index.d.mts +2 -2
- package/dist/decorators/index.d.ts +2 -2
- package/dist/decorators/index.js +74 -50
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +74 -50
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/CanvasUtility.js +2 -2
- package/dist/functions/CanvasUtility.js.map +1 -1
- package/dist/functions/CanvasUtility.mjs +2 -2
- package/dist/functions/CanvasUtility.mjs.map +1 -1
- package/dist/functions/DialogueUtility.d.mts +9 -9
- package/dist/functions/DialogueUtility.d.ts +9 -9
- package/dist/functions/DialogueUtility.js +184 -106
- package/dist/functions/DialogueUtility.js.map +1 -1
- package/dist/functions/DialogueUtility.mjs +184 -106
- package/dist/functions/DialogueUtility.mjs.map +1 -1
- package/dist/functions/FlagsUtility.js +42 -33
- package/dist/functions/FlagsUtility.js.map +1 -1
- package/dist/functions/FlagsUtility.mjs +42 -33
- package/dist/functions/FlagsUtility.mjs.map +1 -1
- package/dist/functions/GameUtility.js +42 -33
- package/dist/functions/GameUtility.js.map +1 -1
- package/dist/functions/GameUtility.mjs +42 -33
- package/dist/functions/GameUtility.mjs.map +1 -1
- package/dist/functions/ImageUtility.js +45 -36
- package/dist/functions/ImageUtility.js.map +1 -1
- package/dist/functions/ImageUtility.mjs +45 -36
- package/dist/functions/ImageUtility.mjs.map +1 -1
- package/dist/functions/SavesUtility.d.mts +4 -4
- package/dist/functions/SavesUtility.d.ts +4 -4
- package/dist/functions/SavesUtility.js +173 -111
- package/dist/functions/SavesUtility.js.map +1 -1
- package/dist/functions/SavesUtility.mjs +173 -111
- package/dist/functions/SavesUtility.mjs.map +1 -1
- package/dist/functions/TickerUtility.d.mts +2 -1
- package/dist/functions/TickerUtility.d.ts +2 -1
- package/dist/functions/TickerUtility.js +19 -15
- package/dist/functions/TickerUtility.js.map +1 -1
- package/dist/functions/TickerUtility.mjs +19 -15
- package/dist/functions/TickerUtility.mjs.map +1 -1
- package/dist/functions/index.d.mts +3 -3
- package/dist/functions/index.d.ts +3 -3
- package/dist/functions/index.js +197 -115
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +197 -115
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +324 -185
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +325 -186
- package/dist/index.mjs.map +1 -1
- package/dist/interface/IHistoryStep.d.mts +1 -1
- package/dist/interface/IHistoryStep.d.ts +1 -1
- package/dist/interface/ISaveData.d.mts +2 -2
- package/dist/interface/ISaveData.d.ts +2 -2
- package/dist/interface/LabelProps.d.mts +5 -0
- package/dist/interface/LabelProps.d.ts +5 -0
- package/dist/interface/LabelProps.js +4 -0
- package/dist/interface/LabelProps.js.map +1 -0
- package/dist/interface/LabelProps.mjs +3 -0
- package/dist/interface/LabelProps.mjs.map +1 -0
- package/dist/interface/export/ExportedStep.d.mts +2 -2
- package/dist/interface/export/ExportedStep.d.ts +2 -2
- package/dist/interface/export/index.d.mts +2 -2
- package/dist/interface/export/index.d.ts +2 -2
- package/dist/interface/index.d.mts +4 -4
- package/dist/interface/index.d.ts +4 -4
- package/dist/labels/BaseCanvasElementTestLabel.d.mts +2 -2
- package/dist/labels/BaseCanvasElementTestLabel.d.ts +2 -2
- package/dist/labels/BaseCanvasElementTestLabel.js +175 -111
- package/dist/labels/BaseCanvasElementTestLabel.js.map +1 -1
- package/dist/labels/BaseCanvasElementTestLabel.mjs +176 -112
- package/dist/labels/BaseCanvasElementTestLabel.mjs.map +1 -1
- package/dist/labels/CanvasEventsTestLabel.d.mts +3 -6
- package/dist/labels/CanvasEventsTestLabel.d.ts +3 -6
- package/dist/labels/CanvasEventsTestLabel.js +185 -123
- package/dist/labels/CanvasEventsTestLabel.js.map +1 -1
- package/dist/labels/CanvasEventsTestLabel.mjs +186 -124
- package/dist/labels/CanvasEventsTestLabel.mjs.map +1 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.d.mts +2 -2
- package/dist/labels/CustomTickerCanvasElementTestLabel.d.ts +2 -2
- package/dist/labels/CustomTickerCanvasElementTestLabel.js +166 -108
- package/dist/labels/CustomTickerCanvasElementTestLabel.js.map +1 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs +166 -108
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs.map +1 -1
- package/dist/labels/ImagesAnimationsTestLabel.d.mts +2 -2
- package/dist/labels/ImagesAnimationsTestLabel.d.ts +2 -2
- package/dist/labels/ImagesAnimationsTestLabel.js +253 -147
- package/dist/labels/ImagesAnimationsTestLabel.js.map +1 -1
- package/dist/labels/ImagesAnimationsTestLabel.mjs +253 -147
- package/dist/labels/ImagesAnimationsTestLabel.mjs.map +1 -1
- package/dist/labels/MarkdownTest.d.mts +2 -2
- package/dist/labels/MarkdownTest.d.ts +2 -2
- package/dist/labels/MarkdownTest.js +166 -108
- package/dist/labels/MarkdownTest.js.map +1 -1
- package/dist/labels/MarkdownTest.mjs +166 -108
- package/dist/labels/MarkdownTest.mjs.map +1 -1
- package/dist/labels/StartLabel.d.mts +2 -2
- package/dist/labels/StartLabel.d.ts +2 -2
- package/dist/labels/StartLabel.js +315 -179
- package/dist/labels/StartLabel.js.map +1 -1
- package/dist/labels/StartLabel.mjs +316 -180
- package/dist/labels/StartLabel.mjs.map +1 -1
- package/dist/labels/StepLabelTest.d.mts +9 -0
- package/dist/labels/StepLabelTest.d.ts +9 -0
- package/dist/labels/StepLabelTest.js +2758 -0
- package/dist/labels/StepLabelTest.js.map +1 -0
- package/dist/labels/StepLabelTest.mjs +2752 -0
- package/dist/labels/StepLabelTest.mjs.map +1 -0
- package/dist/labels/TestConstant.js +43 -34
- package/dist/labels/TestConstant.js.map +1 -1
- package/dist/labels/TestConstant.mjs +43 -34
- package/dist/labels/TestConstant.mjs.map +1 -1
- package/dist/labels/index.d.mts +2 -2
- package/dist/labels/index.d.ts +2 -2
- package/dist/labels/index.js +315 -179
- package/dist/labels/index.js.map +1 -1
- package/dist/labels/index.mjs +316 -180
- package/dist/labels/index.mjs.map +1 -1
- package/dist/managers/StepManager.d.mts +6 -5
- package/dist/managers/StepManager.d.ts +6 -5
- package/dist/managers/StepManager.js +163 -105
- package/dist/managers/StepManager.js.map +1 -1
- package/dist/managers/StepManager.mjs +163 -105
- package/dist/managers/StepManager.mjs.map +1 -1
- package/dist/managers/WindowManager.js +2 -2
- package/dist/managers/WindowManager.js.map +1 -1
- package/dist/managers/WindowManager.mjs +2 -2
- package/dist/managers/WindowManager.mjs.map +1 -1
- package/dist/managers/index.d.mts +2 -2
- package/dist/managers/index.d.ts +2 -2
- package/dist/managers/index.js +163 -105
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +163 -105
- package/dist/managers/index.mjs.map +1 -1
- package/dist/types/ChoiceMenuOptionsType.d.mts +2 -2
- package/dist/types/ChoiceMenuOptionsType.d.ts +2 -2
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
# Pixi'VN - PixiJS Visual Novel Engine
|
|
2
2
|
|
|
3
|
-
Pixi
|
|
3
|
+
Pixi’VN is a npm package that provides various features for creating visual novels, has functions to manage story steps, saving and loading, variable storage, dialogues, character,canvas management, and much more.
|
|
4
4
|
|
|
5
|
-
Pixi
|
|
5
|
+
Pixi’VN + [Templates](https://pixi-vn.web.app/start/getting-started.html#pivi-vn-templates) provides a complete solution and is in effect a visual novel engine.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
It is designed for web developers, with basic experience in JavaScript/TypeScript, who want to create a visual novel with a modern 2D rendering engine and their favorite JavaScript framework.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
It is based on [Pixi.js](https://pixijs.com/), a rendering engine that allows you to create fast 2D graphics. It is based on WebGL and is very fast and efficient. It is used by many developers to create games, websites, and applications.
|
|
10
|
+
|
|
11
|
+
In addition to managing the Pixi.js "Canvas", Pixi’VN offers the possibility of adding an HTML Element with the same dimensions as the "Canvas" to add interactions with the user.
|
|
12
|
+
|
|
13
|
+
This allows the use of systems such as React, Vue, Angular, etc. to create much more complex **interface screens** with excellent performance.
|
|
11
14
|
|
|
12
15
|
## Wiki
|
|
13
16
|
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { LabelIdType } from './types/LabelIdType.js';
|
|
2
|
+
import { StepLabelType } from './types/StepLabelType.js';
|
|
3
|
+
import { StepHistoryDataType } from './types/StepHistoryDataType.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Label is a class that contains a list of steps, which will be performed as the game continues.
|
|
7
|
+
* For Ren'py this is the equivalent of a label.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const START_LABEL_ID = "StartLabel"
|
|
11
|
+
*
|
|
12
|
+
* export const startLabel = newLabel(START_LABEL_ID,
|
|
13
|
+
* [
|
|
14
|
+
* (props) => {
|
|
15
|
+
* GameWindowManager.clear()
|
|
16
|
+
* setDialogue({ character: liam, text: "Which test do you want to perform?" })
|
|
17
|
+
* setChoiceMenuOptions([
|
|
18
|
+
* new ChoiceMenuOption("Events Test", eventsTestLabel),
|
|
19
|
+
* new ChoiceMenuOption("Show Image Test", showImageTest),
|
|
20
|
+
* ])
|
|
21
|
+
* },
|
|
22
|
+
* (props) => GameStepManager.jumpLabel(START_LABEL_ID, props),
|
|
23
|
+
* ]
|
|
24
|
+
* )
|
|
25
|
+
*
|
|
26
|
+
* GameStepManager.callLabel(StartLabel)
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare class Label<T extends {} = {}> {
|
|
30
|
+
/**
|
|
31
|
+
* @param id is the id of the label
|
|
32
|
+
* @param steps is the list of steps that the label will perform
|
|
33
|
+
* @param props is the properties of the label
|
|
34
|
+
*/
|
|
35
|
+
constructor(id: LabelIdType, steps: StepLabelType<T>[] | (() => StepLabelType<T>[]), props?: LabelProps<T>);
|
|
36
|
+
private _id;
|
|
37
|
+
/**
|
|
38
|
+
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
39
|
+
*/
|
|
40
|
+
get id(): LabelIdType;
|
|
41
|
+
private _steps;
|
|
42
|
+
/**
|
|
43
|
+
* Get the steps of the label.
|
|
44
|
+
* This class should be extended and the steps method should be overridden.
|
|
45
|
+
* Every time you update this list will also be updated when the other game versions load.
|
|
46
|
+
*/
|
|
47
|
+
get steps(): StepLabelType<T>[];
|
|
48
|
+
/**
|
|
49
|
+
* Get the corresponding steps number
|
|
50
|
+
* @param externalSteps
|
|
51
|
+
* @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
|
|
52
|
+
*/
|
|
53
|
+
getCorrespondingStepsNumber(externalSteps: StepHistoryDataType[] | StepLabelType[]): number;
|
|
54
|
+
private _onStepStart;
|
|
55
|
+
/**
|
|
56
|
+
* Is a function that will be executed in {@link Label#onStepStart} and when the user goes back to it or when the user laods a save file.
|
|
57
|
+
* @returns Promise<void> or void
|
|
58
|
+
*/
|
|
59
|
+
get onStepStart(): ((stepIndex: number, label: Label<T>) => void | Promise<void>) | undefined;
|
|
60
|
+
private _onLoadStep;
|
|
61
|
+
/**
|
|
62
|
+
* Get the function that will be executed a old step is reloaded. A step is reloaded when the user goes back to it or when the user laods a save file.
|
|
63
|
+
* @returns Promise<void> or void
|
|
64
|
+
*/
|
|
65
|
+
get onLoadStep(): ((stepIndex: number, label: Label<T>) => void | Promise<void>) | undefined;
|
|
66
|
+
private _onStepEnd;
|
|
67
|
+
/**
|
|
68
|
+
* Is a function that will be executed when the step ends.
|
|
69
|
+
* @returns Promise<void> or void
|
|
70
|
+
*/
|
|
71
|
+
get onStepEnd(): ((stepIndex: number, label: Label<T>) => void | Promise<void>) | undefined;
|
|
72
|
+
private _choiseIndex;
|
|
73
|
+
get choiseIndex(): number | undefined;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface LabelProps<T extends {}> {
|
|
77
|
+
/**
|
|
78
|
+
* 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.
|
|
79
|
+
* @param stepIndex Step index
|
|
80
|
+
* @param label Label
|
|
81
|
+
* @returns
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* newLabel("id", [], {
|
|
85
|
+
* onStepStart: async (stepIndex, label) => {
|
|
86
|
+
* await Assets.load('path/to/image1.png')
|
|
87
|
+
* await Assets.load('path/to/image2.png')
|
|
88
|
+
* }
|
|
89
|
+
* })
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
onStepStart?: (stepIndex: number, label: Label<T>) => void | Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Is a function that will be executed in {@link Label#onStepStart} and when the user goes back to it or when the user laods a save file.
|
|
95
|
+
* @param stepIndex Step index
|
|
96
|
+
* @param label Label
|
|
97
|
+
* @returns
|
|
98
|
+
*/
|
|
99
|
+
onLoadStep?: (stepIndex: number, label: Label<T>) => void | Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Is a function that will be executed when the step ends.
|
|
102
|
+
* @param stepIndex Step index
|
|
103
|
+
* @param label Label
|
|
104
|
+
* @returns
|
|
105
|
+
*/
|
|
106
|
+
onStepEnd?: (stepIndex: number, label: Label<T>) => void | Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Is the index of the choice that the label will perform. This variable is used in the system.
|
|
109
|
+
*/
|
|
110
|
+
choiseIndex?: number;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export { Label as L, type LabelProps as a };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { LabelIdType } from './types/LabelIdType.mjs';
|
|
2
|
+
import { StepLabelType } from './types/StepLabelType.mjs';
|
|
3
|
+
import { StepHistoryDataType } from './types/StepHistoryDataType.mjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Label is a class that contains a list of steps, which will be performed as the game continues.
|
|
7
|
+
* For Ren'py this is the equivalent of a label.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const START_LABEL_ID = "StartLabel"
|
|
11
|
+
*
|
|
12
|
+
* export const startLabel = newLabel(START_LABEL_ID,
|
|
13
|
+
* [
|
|
14
|
+
* (props) => {
|
|
15
|
+
* GameWindowManager.clear()
|
|
16
|
+
* setDialogue({ character: liam, text: "Which test do you want to perform?" })
|
|
17
|
+
* setChoiceMenuOptions([
|
|
18
|
+
* new ChoiceMenuOption("Events Test", eventsTestLabel),
|
|
19
|
+
* new ChoiceMenuOption("Show Image Test", showImageTest),
|
|
20
|
+
* ])
|
|
21
|
+
* },
|
|
22
|
+
* (props) => GameStepManager.jumpLabel(START_LABEL_ID, props),
|
|
23
|
+
* ]
|
|
24
|
+
* )
|
|
25
|
+
*
|
|
26
|
+
* GameStepManager.callLabel(StartLabel)
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare class Label<T extends {} = {}> {
|
|
30
|
+
/**
|
|
31
|
+
* @param id is the id of the label
|
|
32
|
+
* @param steps is the list of steps that the label will perform
|
|
33
|
+
* @param props is the properties of the label
|
|
34
|
+
*/
|
|
35
|
+
constructor(id: LabelIdType, steps: StepLabelType<T>[] | (() => StepLabelType<T>[]), props?: LabelProps<T>);
|
|
36
|
+
private _id;
|
|
37
|
+
/**
|
|
38
|
+
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
39
|
+
*/
|
|
40
|
+
get id(): LabelIdType;
|
|
41
|
+
private _steps;
|
|
42
|
+
/**
|
|
43
|
+
* Get the steps of the label.
|
|
44
|
+
* This class should be extended and the steps method should be overridden.
|
|
45
|
+
* Every time you update this list will also be updated when the other game versions load.
|
|
46
|
+
*/
|
|
47
|
+
get steps(): StepLabelType<T>[];
|
|
48
|
+
/**
|
|
49
|
+
* Get the corresponding steps number
|
|
50
|
+
* @param externalSteps
|
|
51
|
+
* @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
|
|
52
|
+
*/
|
|
53
|
+
getCorrespondingStepsNumber(externalSteps: StepHistoryDataType[] | StepLabelType[]): number;
|
|
54
|
+
private _onStepStart;
|
|
55
|
+
/**
|
|
56
|
+
* Is a function that will be executed in {@link Label#onStepStart} and when the user goes back to it or when the user laods a save file.
|
|
57
|
+
* @returns Promise<void> or void
|
|
58
|
+
*/
|
|
59
|
+
get onStepStart(): ((stepIndex: number, label: Label<T>) => void | Promise<void>) | undefined;
|
|
60
|
+
private _onLoadStep;
|
|
61
|
+
/**
|
|
62
|
+
* Get the function that will be executed a old step is reloaded. A step is reloaded when the user goes back to it or when the user laods a save file.
|
|
63
|
+
* @returns Promise<void> or void
|
|
64
|
+
*/
|
|
65
|
+
get onLoadStep(): ((stepIndex: number, label: Label<T>) => void | Promise<void>) | undefined;
|
|
66
|
+
private _onStepEnd;
|
|
67
|
+
/**
|
|
68
|
+
* Is a function that will be executed when the step ends.
|
|
69
|
+
* @returns Promise<void> or void
|
|
70
|
+
*/
|
|
71
|
+
get onStepEnd(): ((stepIndex: number, label: Label<T>) => void | Promise<void>) | undefined;
|
|
72
|
+
private _choiseIndex;
|
|
73
|
+
get choiseIndex(): number | undefined;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface LabelProps<T extends {}> {
|
|
77
|
+
/**
|
|
78
|
+
* 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.
|
|
79
|
+
* @param stepIndex Step index
|
|
80
|
+
* @param label Label
|
|
81
|
+
* @returns
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* newLabel("id", [], {
|
|
85
|
+
* onStepStart: async (stepIndex, label) => {
|
|
86
|
+
* await Assets.load('path/to/image1.png')
|
|
87
|
+
* await Assets.load('path/to/image2.png')
|
|
88
|
+
* }
|
|
89
|
+
* })
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
onStepStart?: (stepIndex: number, label: Label<T>) => void | Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Is a function that will be executed in {@link Label#onStepStart} and when the user goes back to it or when the user laods a save file.
|
|
95
|
+
* @param stepIndex Step index
|
|
96
|
+
* @param label Label
|
|
97
|
+
* @returns
|
|
98
|
+
*/
|
|
99
|
+
onLoadStep?: (stepIndex: number, label: Label<T>) => void | Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Is a function that will be executed when the step ends.
|
|
102
|
+
* @param stepIndex Step index
|
|
103
|
+
* @param label Label
|
|
104
|
+
* @returns
|
|
105
|
+
*/
|
|
106
|
+
onStepEnd?: (stepIndex: number, label: Label<T>) => void | Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Is the index of the choice that the label will perform. This variable is used in the system.
|
|
109
|
+
*/
|
|
110
|
+
choiseIndex?: number;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export { Label as L, type LabelProps as a };
|
|
@@ -133,8 +133,6 @@ function getMemoryContainer(element) {
|
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
135
|
function setMemoryContainer(element, memory) {
|
|
136
|
-
memory.width && (element.width = memory.width);
|
|
137
|
-
memory.height && (element.height = memory.height);
|
|
138
136
|
memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
|
|
139
137
|
memory.blendMode && (element.blendMode = memory.blendMode);
|
|
140
138
|
memory.tint && (element.tint = memory.tint);
|
|
@@ -167,6 +165,8 @@ function setMemoryContainer(element, memory) {
|
|
|
167
165
|
memory.interactive && (element.interactive = memory.interactive);
|
|
168
166
|
memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
|
|
169
167
|
memory.hitArea && (element.hitArea = memory.hitArea);
|
|
168
|
+
memory.width && (element.width = memory.width);
|
|
169
|
+
memory.height && (element.height = memory.height);
|
|
170
170
|
}
|
|
171
171
|
function getTexture(imageUrl) {
|
|
172
172
|
return __async(this, null, function* () {
|
|
@@ -702,8 +702,9 @@ FadeAlphaTicker = __decorateClass([
|
|
|
702
702
|
], FadeAlphaTicker);
|
|
703
703
|
|
|
704
704
|
// src/functions/TickerUtility.ts
|
|
705
|
-
function updateTickerProgression(args, propertyName, progression) {
|
|
706
|
-
|
|
705
|
+
function updateTickerProgression(args, propertyName, progression, valueConvert) {
|
|
706
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
707
|
+
if (args[propertyName] === void 0 || !progression || args[propertyName] === limit) {
|
|
707
708
|
return;
|
|
708
709
|
}
|
|
709
710
|
if (typeof args[propertyName] === "number") {
|
|
@@ -722,22 +723,25 @@ function updateTickerProgression(args, propertyName, progression) {
|
|
|
722
723
|
}
|
|
723
724
|
}
|
|
724
725
|
}
|
|
725
|
-
function getLinearProgression(number, progression) {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
return
|
|
726
|
+
function getLinearProgression(number, progression, valueConvert) {
|
|
727
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
728
|
+
let amt = valueConvert ? valueConvert(progression.amt) : progression.amt;
|
|
729
|
+
if (limit !== void 0) {
|
|
730
|
+
if (number > limit && amt > 0) {
|
|
731
|
+
return limit;
|
|
732
|
+
} else if (number < limit && amt < 0) {
|
|
733
|
+
return limit;
|
|
731
734
|
}
|
|
732
735
|
}
|
|
733
|
-
return number +
|
|
736
|
+
return number + amt;
|
|
734
737
|
}
|
|
735
|
-
function getExponentialProgression(number, progression) {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
738
|
+
function getExponentialProgression(number, progression, valueConvert) {
|
|
739
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
740
|
+
if (limit !== void 0) {
|
|
741
|
+
if (number > limit && progression.percentage > 0) {
|
|
742
|
+
return limit;
|
|
743
|
+
} else if (number < limit && progression.percentage < 0) {
|
|
744
|
+
return limit;
|
|
741
745
|
}
|
|
742
746
|
}
|
|
743
747
|
return number + number * progression.percentage;
|
|
@@ -750,15 +754,13 @@ var MoveTicker = class extends TickerBase {
|
|
|
750
754
|
let ySpeed = 1;
|
|
751
755
|
if (args.speed) {
|
|
752
756
|
if (typeof args.speed === "number") {
|
|
753
|
-
xSpeed = args.speed;
|
|
754
|
-
ySpeed = args.speed;
|
|
757
|
+
xSpeed = this.speedConvert(args.speed);
|
|
758
|
+
ySpeed = this.speedConvert(args.speed);
|
|
755
759
|
} else {
|
|
756
|
-
xSpeed = args.speed.x;
|
|
757
|
-
ySpeed = args.speed.y;
|
|
760
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
761
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
758
762
|
}
|
|
759
763
|
}
|
|
760
|
-
xSpeed /= 60;
|
|
761
|
-
ySpeed /= 60;
|
|
762
764
|
let destination = args.destination;
|
|
763
765
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
764
766
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -798,7 +800,10 @@ var MoveTicker = class extends TickerBase {
|
|
|
798
800
|
}
|
|
799
801
|
});
|
|
800
802
|
if (args.speedProgression)
|
|
801
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
803
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
804
|
+
}
|
|
805
|
+
speedConvert(speed) {
|
|
806
|
+
return speed / 6;
|
|
802
807
|
}
|
|
803
808
|
};
|
|
804
809
|
MoveTicker = __decorateClass([
|
|
@@ -806,7 +811,7 @@ MoveTicker = __decorateClass([
|
|
|
806
811
|
], MoveTicker);
|
|
807
812
|
var RotateTicker = class extends TickerBase {
|
|
808
813
|
fn(ticker, args, tags, tickerId) {
|
|
809
|
-
let speed = (args.speed === void 0 ? 1 : args.speed)
|
|
814
|
+
let speed = this.speedConvert(args.speed === void 0 ? 1 : args.speed);
|
|
810
815
|
let clockwise = args.clockwise === void 0 ? true : args.clockwise;
|
|
811
816
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
812
817
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -834,7 +839,10 @@ var RotateTicker = class extends TickerBase {
|
|
|
834
839
|
}
|
|
835
840
|
});
|
|
836
841
|
if (args.speedProgression)
|
|
837
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
842
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
843
|
+
}
|
|
844
|
+
speedConvert(speed) {
|
|
845
|
+
return speed / 60;
|
|
838
846
|
}
|
|
839
847
|
};
|
|
840
848
|
RotateTicker = __decorateClass([
|
|
@@ -846,15 +854,13 @@ var ZoomTicker = class extends TickerBase {
|
|
|
846
854
|
let ySpeed = 0.1;
|
|
847
855
|
if (args.speed) {
|
|
848
856
|
if (typeof args.speed === "number") {
|
|
849
|
-
xSpeed = args.speed;
|
|
850
|
-
ySpeed = args.speed;
|
|
857
|
+
xSpeed = this.speedConvert(args.speed);
|
|
858
|
+
ySpeed = this.speedConvert(args.speed);
|
|
851
859
|
} else {
|
|
852
|
-
xSpeed = args.speed.x;
|
|
853
|
-
ySpeed = args.speed.y;
|
|
860
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
861
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
854
862
|
}
|
|
855
863
|
}
|
|
856
|
-
xSpeed /= 60;
|
|
857
|
-
ySpeed /= 60;
|
|
858
864
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
859
865
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
860
866
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
@@ -921,7 +927,10 @@ var ZoomTicker = class extends TickerBase {
|
|
|
921
927
|
}
|
|
922
928
|
});
|
|
923
929
|
if (args.speedProgression)
|
|
924
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
930
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
931
|
+
}
|
|
932
|
+
speedConvert(speed) {
|
|
933
|
+
return speed / 60;
|
|
925
934
|
}
|
|
926
935
|
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
927
936
|
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|