@drincs/pixi-vn 0.6.4 → 0.6.6
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 +56 -7
- package/dist/classes/CharacterBaseModel.js +99 -90
- package/dist/classes/CharacterBaseModel.js.map +1 -1
- package/dist/classes/CharacterBaseModel.mjs +99 -90
- package/dist/classes/CharacterBaseModel.mjs.map +1 -1
- package/dist/classes/ChoiceMenuOption.d.mts +71 -8
- package/dist/classes/ChoiceMenuOption.d.ts +71 -8
- package/dist/classes/ChoiceMenuOption.js +160 -77
- package/dist/classes/ChoiceMenuOption.js.map +1 -1
- package/dist/classes/ChoiceMenuOption.mjs +160 -77
- package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
- package/dist/classes/CloseLabel.d.mts +3 -1
- package/dist/classes/CloseLabel.d.ts +3 -1
- package/dist/classes/CloseLabel.js +77 -32
- package/dist/classes/CloseLabel.js.map +1 -1
- package/dist/classes/CloseLabel.mjs +77 -32
- package/dist/classes/CloseLabel.mjs.map +1 -1
- package/dist/classes/Label.d.mts +6 -33
- package/dist/classes/Label.d.ts +6 -33
- package/dist/classes/Label.js +74 -31
- package/dist/classes/Label.js.map +1 -1
- package/dist/classes/Label.mjs +74 -31
- package/dist/classes/Label.mjs.map +1 -1
- package/dist/classes/LabelAbstract.d.mts +50 -0
- package/dist/classes/LabelAbstract.d.ts +50 -0
- package/dist/classes/LabelAbstract.js +100 -0
- package/dist/classes/LabelAbstract.js.map +1 -0
- package/dist/classes/LabelAbstract.mjs +98 -0
- package/dist/classes/LabelAbstract.mjs.map +1 -0
- package/dist/classes/LabelJson.d.mts +30 -0
- package/dist/classes/LabelJson.d.ts +30 -0
- package/dist/classes/LabelJson.js +2766 -0
- package/dist/classes/LabelJson.js.map +1 -0
- package/dist/classes/LabelJson.mjs +2760 -0
- package/dist/classes/LabelJson.mjs.map +1 -0
- 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 +6 -1
- package/dist/classes/index.d.ts +6 -1
- package/dist/classes/index.js +945 -78
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +945 -79
- 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 +19 -5
- package/dist/decorators/LabelDecorator.d.ts +19 -5
- package/dist/decorators/LabelDecorator.js +102 -65
- package/dist/decorators/LabelDecorator.js.map +1 -1
- package/dist/decorators/LabelDecorator.mjs +102 -66
- package/dist/decorators/LabelDecorator.mjs.map +1 -1
- package/dist/decorators/index.d.mts +10 -2
- package/dist/decorators/index.d.ts +10 -2
- package/dist/decorators/index.js +98 -65
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +98 -65
- 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 +10 -8
- package/dist/functions/DialogueUtility.d.ts +10 -8
- package/dist/functions/DialogueUtility.js +268 -131
- package/dist/functions/DialogueUtility.js.map +1 -1
- package/dist/functions/DialogueUtility.mjs +268 -131
- 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/Importer.d.mts +24 -0
- package/dist/functions/Importer.d.ts +24 -0
- package/dist/functions/Importer.js +2804 -0
- package/dist/functions/Importer.js.map +1 -0
- package/dist/functions/Importer.mjs +2798 -0
- package/dist/functions/Importer.mjs.map +1 -0
- package/dist/functions/SavesUtility.d.mts +5 -3
- package/dist/functions/SavesUtility.d.ts +5 -3
- package/dist/functions/SavesUtility.js +310 -145
- package/dist/functions/SavesUtility.js.map +1 -1
- package/dist/functions/SavesUtility.mjs +310 -145
- 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 +7 -2
- package/dist/functions/index.d.ts +7 -2
- package/dist/functions/index.js +364 -140
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +364 -141
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +453 -219
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +453 -221
- package/dist/index.mjs.map +1 -1
- package/dist/interface/IHistoryStep.d.mts +3 -1
- package/dist/interface/IHistoryStep.d.ts +3 -1
- package/dist/interface/ISaveData.d.mts +3 -1
- package/dist/interface/ISaveData.d.ts +3 -1
- package/dist/interface/LabelProps.d.mts +38 -0
- package/dist/interface/LabelProps.d.ts +38 -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 +3 -1
- package/dist/interface/export/ExportedStep.d.ts +3 -1
- package/dist/interface/export/index.d.mts +3 -1
- package/dist/interface/export/index.d.ts +3 -1
- package/dist/interface/index.d.mts +3 -1
- package/dist/interface/index.d.ts +3 -1
- package/dist/labels/BaseCanvasElementTestLabel.d.mts +3 -1
- package/dist/labels/BaseCanvasElementTestLabel.d.ts +3 -1
- package/dist/labels/BaseCanvasElementTestLabel.js +303 -136
- package/dist/labels/BaseCanvasElementTestLabel.js.map +1 -1
- package/dist/labels/BaseCanvasElementTestLabel.mjs +304 -137
- package/dist/labels/BaseCanvasElementTestLabel.mjs.map +1 -1
- package/dist/labels/CanvasEventsTestLabel.d.mts +4 -5
- package/dist/labels/CanvasEventsTestLabel.d.ts +4 -5
- package/dist/labels/CanvasEventsTestLabel.js +313 -148
- package/dist/labels/CanvasEventsTestLabel.js.map +1 -1
- package/dist/labels/CanvasEventsTestLabel.mjs +314 -149
- package/dist/labels/CanvasEventsTestLabel.mjs.map +1 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.d.mts +3 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.d.ts +3 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.js +294 -133
- package/dist/labels/CustomTickerCanvasElementTestLabel.js.map +1 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs +295 -134
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs.map +1 -1
- package/dist/labels/ImagesAnimationsTestLabel.d.mts +3 -1
- package/dist/labels/ImagesAnimationsTestLabel.d.ts +3 -1
- package/dist/labels/ImagesAnimationsTestLabel.js +298 -181
- package/dist/labels/ImagesAnimationsTestLabel.js.map +1 -1
- package/dist/labels/ImagesAnimationsTestLabel.mjs +299 -182
- package/dist/labels/ImagesAnimationsTestLabel.mjs.map +1 -1
- package/dist/labels/MarkdownTest.d.mts +3 -1
- package/dist/labels/MarkdownTest.d.ts +3 -1
- package/dist/labels/MarkdownTest.js +294 -133
- package/dist/labels/MarkdownTest.js.map +1 -1
- package/dist/labels/MarkdownTest.mjs +294 -133
- package/dist/labels/MarkdownTest.mjs.map +1 -1
- package/dist/labels/StartLabel.d.mts +3 -1
- package/dist/labels/StartLabel.d.ts +3 -1
- package/dist/labels/StartLabel.js +360 -213
- package/dist/labels/StartLabel.js.map +1 -1
- package/dist/labels/StartLabel.mjs +361 -214
- package/dist/labels/StartLabel.mjs.map +1 -1
- package/dist/labels/StepLabelTest.d.mts +11 -0
- package/dist/labels/StepLabelTest.d.ts +11 -0
- package/dist/labels/StepLabelTest.js +2861 -0
- package/dist/labels/StepLabelTest.js.map +1 -0
- package/dist/labels/StepLabelTest.mjs +2855 -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 +3 -1
- package/dist/labels/index.d.ts +3 -1
- package/dist/labels/index.js +360 -213
- package/dist/labels/index.js.map +1 -1
- package/dist/labels/index.mjs +361 -214
- package/dist/labels/index.mjs.map +1 -1
- package/dist/managers/StepManager.d.mts +10 -7
- package/dist/managers/StepManager.d.ts +10 -7
- package/dist/managers/StepManager.js +300 -139
- package/dist/managers/StepManager.js.map +1 -1
- package/dist/managers/StepManager.mjs +300 -139
- 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 +7 -5
- package/dist/managers/index.d.ts +7 -5
- package/dist/managers/index.js +300 -139
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +300 -139
- package/dist/managers/index.mjs.map +1 -1
- package/dist/types/ChoiceMenuOptionsType.d.mts +3 -1
- package/dist/types/ChoiceMenuOptionsType.d.ts +3 -1
- package/dist/types/LabelJsonType.d.mts +22 -0
- package/dist/types/LabelJsonType.d.ts +22 -0
- package/dist/types/LabelJsonType.js +4 -0
- package/dist/types/LabelJsonType.js.map +1 -0
- package/dist/types/LabelJsonType.mjs +3 -0
- package/dist/types/LabelJsonType.mjs.map +1 -0
- package/dist/types/StepLabelJsonType.d.mts +30 -0
- package/dist/types/StepLabelJsonType.d.ts +30 -0
- package/dist/types/StepLabelJsonType.js +4 -0
- package/dist/types/StepLabelJsonType.js.map +1 -0
- package/dist/types/StepLabelJsonType.mjs +3 -0
- package/dist/types/StepLabelJsonType.mjs.map +1 -0
- package/dist/types/index.d.mts +4 -0
- package/dist/types/index.d.ts +4 -0
- package/package.json +7 -6
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Container, Sprite, Text, Assets, Texture, Application, FillGradient, Color,
|
|
1
|
+
import { Container, Sprite, Text, Assets, Texture, Application, TextStyle, FillGradient, Color, Rectangle } from 'pixi.js';
|
|
2
2
|
export { Assets } from 'pixi.js';
|
|
3
3
|
import { diff } from 'deep-diff';
|
|
4
4
|
import sha1 from 'crypto-js/sha1';
|
|
@@ -73,19 +73,18 @@ function checkIfStepsIsEqual(step1, step2) {
|
|
|
73
73
|
return step1 === step2;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
// src/classes/
|
|
77
|
-
var
|
|
76
|
+
// src/classes/LabelAbstract.ts
|
|
77
|
+
var LabelAbstract = class {
|
|
78
78
|
/**
|
|
79
79
|
* @param id is the id of the label
|
|
80
|
-
* @param
|
|
81
|
-
* @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
|
|
82
|
-
* @param choiseIndex is the index of the choice that the label will perform
|
|
80
|
+
* @param props is the properties of the label
|
|
83
81
|
*/
|
|
84
|
-
constructor(id,
|
|
82
|
+
constructor(id, props) {
|
|
85
83
|
this._id = id;
|
|
86
|
-
this.
|
|
87
|
-
this.
|
|
88
|
-
this.
|
|
84
|
+
this._onStepStart = props == null ? void 0 : props.onStepStart;
|
|
85
|
+
this._onLoadStep = props == null ? void 0 : props.onLoadStep;
|
|
86
|
+
this._onStepEnd = props == null ? void 0 : props.onStepEnd;
|
|
87
|
+
this._choiseIndex = props == null ? void 0 : props.choiseIndex;
|
|
89
88
|
}
|
|
90
89
|
/**
|
|
91
90
|
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
@@ -93,17 +92,6 @@ var Label = class {
|
|
|
93
92
|
get id() {
|
|
94
93
|
return this._id;
|
|
95
94
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Get the steps of the label.
|
|
98
|
-
* This class should be extended and the steps method should be overridden.
|
|
99
|
-
* Every time you update this list will also be updated when the other game versions load.
|
|
100
|
-
*/
|
|
101
|
-
get steps() {
|
|
102
|
-
if (typeof this._steps === "function") {
|
|
103
|
-
return this._steps();
|
|
104
|
-
}
|
|
105
|
-
return this._steps;
|
|
106
|
-
}
|
|
107
95
|
/**
|
|
108
96
|
* Get the corresponding steps number
|
|
109
97
|
* @param externalSteps
|
|
@@ -122,37 +110,75 @@ var Label = class {
|
|
|
122
110
|
return res;
|
|
123
111
|
}
|
|
124
112
|
/**
|
|
125
|
-
*
|
|
113
|
+
* 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.
|
|
126
114
|
* @returns Promise<void> or void
|
|
127
|
-
* @example
|
|
128
|
-
* ```typescript
|
|
129
|
-
* newLabel("id", [], () => {
|
|
130
|
-
* Assets.load('path/to/image1.png')
|
|
131
|
-
* Assets.load('path/to/image2.png')
|
|
132
|
-
* })
|
|
133
|
-
* ```
|
|
134
115
|
*/
|
|
135
|
-
get
|
|
136
|
-
return this
|
|
116
|
+
get onStepStart() {
|
|
117
|
+
return (stepIndex, label) => __async(this, null, function* () {
|
|
118
|
+
if (this._onLoadStep) {
|
|
119
|
+
yield this._onLoadStep(stepIndex, label);
|
|
120
|
+
}
|
|
121
|
+
if (this._onStepStart) {
|
|
122
|
+
return yield this._onStepStart(stepIndex, label);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* 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.
|
|
128
|
+
* @returns Promise<void> or void
|
|
129
|
+
*/
|
|
130
|
+
get onLoadStep() {
|
|
131
|
+
return this._onLoadStep;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Is a function that will be executed when the step ends.
|
|
135
|
+
* @returns Promise<void> or void
|
|
136
|
+
*/
|
|
137
|
+
get onStepEnd() {
|
|
138
|
+
return this._onStepEnd;
|
|
137
139
|
}
|
|
138
140
|
get choiseIndex() {
|
|
139
141
|
return this._choiseIndex;
|
|
140
142
|
}
|
|
141
143
|
};
|
|
142
144
|
|
|
145
|
+
// src/classes/Label.ts
|
|
146
|
+
var Label = class extends LabelAbstract {
|
|
147
|
+
/**
|
|
148
|
+
* @param id is the id of the label
|
|
149
|
+
* @param steps is the list of steps that the label will perform
|
|
150
|
+
* @param props is the properties of the label
|
|
151
|
+
*/
|
|
152
|
+
constructor(id, steps, props) {
|
|
153
|
+
super(id, props);
|
|
154
|
+
this._steps = steps;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get the steps of the label.
|
|
158
|
+
*/
|
|
159
|
+
get steps() {
|
|
160
|
+
if (typeof this._steps === "function") {
|
|
161
|
+
return this._steps();
|
|
162
|
+
}
|
|
163
|
+
return this._steps;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
|
|
143
167
|
// src/classes/CloseLabel.ts
|
|
144
168
|
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
145
169
|
function newCloseLabel(choiseIndex) {
|
|
146
|
-
return new Label(CLOSE_LABEL_ID, [],
|
|
170
|
+
return new Label(CLOSE_LABEL_ID, [], {
|
|
171
|
+
choiseIndex
|
|
172
|
+
});
|
|
147
173
|
}
|
|
148
174
|
|
|
149
175
|
// src/decorators/LabelDecorator.ts
|
|
150
176
|
var registeredLabels = {};
|
|
151
|
-
function newLabel(id, steps,
|
|
177
|
+
function newLabel(id, steps, props) {
|
|
152
178
|
if (registeredLabels[id]) {
|
|
153
179
|
console.info(`[Pixi'VN] Label ${id} already exists, it will be overwritten`);
|
|
154
180
|
}
|
|
155
|
-
let label = new Label(id, steps,
|
|
181
|
+
let label = new Label(id, steps, props);
|
|
156
182
|
registeredLabels[id] = label;
|
|
157
183
|
return label;
|
|
158
184
|
}
|
|
@@ -164,6 +190,9 @@ function getLabelById(id) {
|
|
|
164
190
|
}
|
|
165
191
|
return label;
|
|
166
192
|
}
|
|
193
|
+
function saveLabel(label) {
|
|
194
|
+
registeredLabels[label.id] = label;
|
|
195
|
+
}
|
|
167
196
|
var CanvasBase = class extends Container {
|
|
168
197
|
constructor() {
|
|
169
198
|
super(...arguments);
|
|
@@ -262,8 +291,6 @@ function getMemoryContainer(element) {
|
|
|
262
291
|
};
|
|
263
292
|
}
|
|
264
293
|
function setMemoryContainer(element, memory) {
|
|
265
|
-
memory.width && (element.width = memory.width);
|
|
266
|
-
memory.height && (element.height = memory.height);
|
|
267
294
|
memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
|
|
268
295
|
memory.blendMode && (element.blendMode = memory.blendMode);
|
|
269
296
|
memory.tint && (element.tint = memory.tint);
|
|
@@ -296,6 +323,8 @@ function setMemoryContainer(element, memory) {
|
|
|
296
323
|
memory.interactive && (element.interactive = memory.interactive);
|
|
297
324
|
memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
|
|
298
325
|
memory.hitArea && (element.hitArea = memory.hitArea);
|
|
326
|
+
memory.width && (element.width = memory.width);
|
|
327
|
+
memory.height && (element.height = memory.height);
|
|
299
328
|
}
|
|
300
329
|
function getTexture(imageUrl) {
|
|
301
330
|
return __async(this, null, function* () {
|
|
@@ -757,29 +786,57 @@ var ChoiceMenuOption = class {
|
|
|
757
786
|
/**
|
|
758
787
|
* @param text Text to be displayed in the menu
|
|
759
788
|
* @param label Label to be opened when the option is selected or the id of the label
|
|
789
|
+
* @param props Properties to be passed to the label and olther parameters that you can use when get all the choice menu options. It be converted to a JSON string, so it cannot contain functions or classes.
|
|
760
790
|
* @param type Type of the label to be opened. @default "call"
|
|
761
|
-
* @param props Properties to be passed to the label, when the label is called. it cannot contain functions or classes. @default {}
|
|
762
791
|
*/
|
|
763
|
-
constructor(text, label, type = "call"
|
|
792
|
+
constructor(text, label, props, type = "call") {
|
|
764
793
|
/**
|
|
765
|
-
* Properties to be passed to the label
|
|
794
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
795
|
+
* @example
|
|
796
|
+
* ```tsx
|
|
797
|
+
* setChoiceMenuOptions([
|
|
798
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
799
|
+
* ])
|
|
800
|
+
* return <List>
|
|
801
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
802
|
+
* return (
|
|
803
|
+
* <ChoiceButton
|
|
804
|
+
* disabled={item.props.disabled}
|
|
805
|
+
* onClick={() => {
|
|
806
|
+
* afterSelectChoice(item)
|
|
807
|
+
* }}
|
|
808
|
+
* >
|
|
809
|
+
* {item.text}
|
|
810
|
+
* </ChoiceButton>
|
|
811
|
+
* )
|
|
812
|
+
* })}
|
|
813
|
+
* </List>
|
|
814
|
+
* ```
|
|
766
815
|
*/
|
|
767
816
|
this.props = {};
|
|
768
|
-
if (typeof label === "string") {
|
|
769
|
-
let tLabel = getLabelById(label);
|
|
770
|
-
if (!tLabel) {
|
|
771
|
-
throw new Error(`[Pixi'VN] Label ${label} not found`);
|
|
772
|
-
} else {
|
|
773
|
-
label = tLabel;
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
817
|
this.text = text;
|
|
777
|
-
this.
|
|
818
|
+
this._label = label;
|
|
778
819
|
this.type = type;
|
|
779
820
|
if (props) {
|
|
780
821
|
this.props = props;
|
|
781
822
|
}
|
|
782
823
|
}
|
|
824
|
+
/**
|
|
825
|
+
* Label to be opened when the option is selected
|
|
826
|
+
*/
|
|
827
|
+
get label() {
|
|
828
|
+
let label = this._label;
|
|
829
|
+
if (typeof label === "string") {
|
|
830
|
+
let res = getLabelById(label);
|
|
831
|
+
if (res) {
|
|
832
|
+
label = res;
|
|
833
|
+
} else {
|
|
834
|
+
console.error(`Label ${label} not found, so it will be closed`);
|
|
835
|
+
label = newCloseLabel();
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
return label;
|
|
839
|
+
}
|
|
783
840
|
};
|
|
784
841
|
var ChoiceMenuOptionClose = class {
|
|
785
842
|
/**
|
|
@@ -796,7 +853,27 @@ var ChoiceMenuOptionClose = class {
|
|
|
796
853
|
*/
|
|
797
854
|
this.type = Close;
|
|
798
855
|
/**
|
|
799
|
-
* Properties to be passed to the label
|
|
856
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
857
|
+
* @example
|
|
858
|
+
* ```tsx
|
|
859
|
+
* setChoiceMenuOptions([
|
|
860
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
861
|
+
* ])
|
|
862
|
+
* return <List>
|
|
863
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
864
|
+
* return (
|
|
865
|
+
* <ChoiceButton
|
|
866
|
+
* disabled={item.props.disabled}
|
|
867
|
+
* onClick={() => {
|
|
868
|
+
* afterSelectChoice(item)
|
|
869
|
+
* }}
|
|
870
|
+
* >
|
|
871
|
+
* {item.text}
|
|
872
|
+
* </ChoiceButton>
|
|
873
|
+
* )
|
|
874
|
+
* })}
|
|
875
|
+
* </List>
|
|
876
|
+
* ```
|
|
800
877
|
*/
|
|
801
878
|
this.props = {};
|
|
802
879
|
this.text = text;
|
|
@@ -857,21 +934,18 @@ function getChoiceMenuOptions() {
|
|
|
857
934
|
d.forEach((option, index) => {
|
|
858
935
|
if (option.type === Close) {
|
|
859
936
|
let itemLabel = newCloseLabel(index);
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
type: Close,
|
|
864
|
-
closeCurrentLabel: option.closeCurrentLabel,
|
|
865
|
-
props: {}
|
|
866
|
-
});
|
|
937
|
+
let choice = new ChoiceMenuOptionClose(option.text, option.closeCurrentLabel);
|
|
938
|
+
choice.label = itemLabel;
|
|
939
|
+
options.push(choice);
|
|
867
940
|
return;
|
|
868
941
|
}
|
|
869
942
|
let label = getLabelById(option.label);
|
|
870
943
|
if (label) {
|
|
871
|
-
let itemLabel = new Label(label.id, label.steps,
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
})
|
|
944
|
+
let itemLabel = new Label(label.id, label.steps, {
|
|
945
|
+
onStepStart: label.onStepStart,
|
|
946
|
+
choiseIndex: index
|
|
947
|
+
});
|
|
948
|
+
options.push(new ChoiceMenuOption(option.text, itemLabel, option.props, option.type));
|
|
875
949
|
}
|
|
876
950
|
});
|
|
877
951
|
return options;
|
|
@@ -1024,8 +1098,9 @@ FadeAlphaTicker = __decorateClass([
|
|
|
1024
1098
|
], FadeAlphaTicker);
|
|
1025
1099
|
|
|
1026
1100
|
// src/functions/TickerUtility.ts
|
|
1027
|
-
function updateTickerProgression(args, propertyName, progression) {
|
|
1028
|
-
|
|
1101
|
+
function updateTickerProgression(args, propertyName, progression, valueConvert) {
|
|
1102
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
1103
|
+
if (args[propertyName] === void 0 || !progression || args[propertyName] === limit) {
|
|
1029
1104
|
return;
|
|
1030
1105
|
}
|
|
1031
1106
|
if (typeof args[propertyName] === "number") {
|
|
@@ -1044,22 +1119,25 @@ function updateTickerProgression(args, propertyName, progression) {
|
|
|
1044
1119
|
}
|
|
1045
1120
|
}
|
|
1046
1121
|
}
|
|
1047
|
-
function getLinearProgression(number, progression) {
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
return
|
|
1122
|
+
function getLinearProgression(number, progression, valueConvert) {
|
|
1123
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
1124
|
+
let amt = valueConvert ? valueConvert(progression.amt) : progression.amt;
|
|
1125
|
+
if (limit !== void 0) {
|
|
1126
|
+
if (number > limit && amt > 0) {
|
|
1127
|
+
return limit;
|
|
1128
|
+
} else if (number < limit && amt < 0) {
|
|
1129
|
+
return limit;
|
|
1053
1130
|
}
|
|
1054
1131
|
}
|
|
1055
|
-
return number +
|
|
1132
|
+
return number + amt;
|
|
1056
1133
|
}
|
|
1057
|
-
function getExponentialProgression(number, progression) {
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1134
|
+
function getExponentialProgression(number, progression, valueConvert) {
|
|
1135
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
1136
|
+
if (limit !== void 0) {
|
|
1137
|
+
if (number > limit && progression.percentage > 0) {
|
|
1138
|
+
return limit;
|
|
1139
|
+
} else if (number < limit && progression.percentage < 0) {
|
|
1140
|
+
return limit;
|
|
1063
1141
|
}
|
|
1064
1142
|
}
|
|
1065
1143
|
return number + number * progression.percentage;
|
|
@@ -1072,15 +1150,13 @@ var MoveTicker = class extends TickerBase {
|
|
|
1072
1150
|
let ySpeed = 1;
|
|
1073
1151
|
if (args.speed) {
|
|
1074
1152
|
if (typeof args.speed === "number") {
|
|
1075
|
-
xSpeed = args.speed;
|
|
1076
|
-
ySpeed = args.speed;
|
|
1153
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1154
|
+
ySpeed = this.speedConvert(args.speed);
|
|
1077
1155
|
} else {
|
|
1078
|
-
xSpeed = args.speed.x;
|
|
1079
|
-
ySpeed = args.speed.y;
|
|
1156
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1157
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
1080
1158
|
}
|
|
1081
1159
|
}
|
|
1082
|
-
xSpeed /= 60;
|
|
1083
|
-
ySpeed /= 60;
|
|
1084
1160
|
let destination = args.destination;
|
|
1085
1161
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
1086
1162
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -1120,7 +1196,10 @@ var MoveTicker = class extends TickerBase {
|
|
|
1120
1196
|
}
|
|
1121
1197
|
});
|
|
1122
1198
|
if (args.speedProgression)
|
|
1123
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1199
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1200
|
+
}
|
|
1201
|
+
speedConvert(speed) {
|
|
1202
|
+
return speed / 6;
|
|
1124
1203
|
}
|
|
1125
1204
|
};
|
|
1126
1205
|
MoveTicker = __decorateClass([
|
|
@@ -1128,7 +1207,7 @@ MoveTicker = __decorateClass([
|
|
|
1128
1207
|
], MoveTicker);
|
|
1129
1208
|
var RotateTicker = class extends TickerBase {
|
|
1130
1209
|
fn(ticker, args, tags, tickerId) {
|
|
1131
|
-
let speed = (args.speed === void 0 ? 1 : args.speed)
|
|
1210
|
+
let speed = this.speedConvert(args.speed === void 0 ? 1 : args.speed);
|
|
1132
1211
|
let clockwise = args.clockwise === void 0 ? true : args.clockwise;
|
|
1133
1212
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
1134
1213
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -1156,7 +1235,10 @@ var RotateTicker = class extends TickerBase {
|
|
|
1156
1235
|
}
|
|
1157
1236
|
});
|
|
1158
1237
|
if (args.speedProgression)
|
|
1159
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1238
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1239
|
+
}
|
|
1240
|
+
speedConvert(speed) {
|
|
1241
|
+
return speed / 60;
|
|
1160
1242
|
}
|
|
1161
1243
|
};
|
|
1162
1244
|
RotateTicker = __decorateClass([
|
|
@@ -1168,15 +1250,13 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1168
1250
|
let ySpeed = 0.1;
|
|
1169
1251
|
if (args.speed) {
|
|
1170
1252
|
if (typeof args.speed === "number") {
|
|
1171
|
-
xSpeed = args.speed;
|
|
1172
|
-
ySpeed = args.speed;
|
|
1253
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1254
|
+
ySpeed = this.speedConvert(args.speed);
|
|
1173
1255
|
} else {
|
|
1174
|
-
xSpeed = args.speed.x;
|
|
1175
|
-
ySpeed = args.speed.y;
|
|
1256
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1257
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
1176
1258
|
}
|
|
1177
1259
|
}
|
|
1178
|
-
xSpeed /= 60;
|
|
1179
|
-
ySpeed /= 60;
|
|
1180
1260
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
1181
1261
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
1182
1262
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
@@ -1243,7 +1323,10 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1243
1323
|
}
|
|
1244
1324
|
});
|
|
1245
1325
|
if (args.speedProgression)
|
|
1246
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1326
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1327
|
+
}
|
|
1328
|
+
speedConvert(speed) {
|
|
1329
|
+
return speed / 60;
|
|
1247
1330
|
}
|
|
1248
1331
|
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
1249
1332
|
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
@@ -1266,7 +1349,7 @@ var ZoomInOutTicker = class extends ZoomTicker {
|
|
|
1266
1349
|
};
|
|
1267
1350
|
|
|
1268
1351
|
// src/constants.ts
|
|
1269
|
-
var PIXIVN_VERSION = "0.6.
|
|
1352
|
+
var PIXIVN_VERSION = "0.6.6";
|
|
1270
1353
|
var Repeat = "repeat";
|
|
1271
1354
|
function Pause(duration) {
|
|
1272
1355
|
return {
|
|
@@ -1451,14 +1534,14 @@ function zoomIn(_0, _1) {
|
|
|
1451
1534
|
} else {
|
|
1452
1535
|
canvasElement = image;
|
|
1453
1536
|
}
|
|
1454
|
-
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1455
|
-
yield canvasElement.load();
|
|
1456
|
-
}
|
|
1457
1537
|
let container = new CanvasContainer();
|
|
1458
1538
|
container.addChild(canvasElement);
|
|
1459
1539
|
container.height = GameWindowManager.canvasHeight;
|
|
1460
1540
|
container.width = GameWindowManager.canvasWidth;
|
|
1461
1541
|
GameWindowManager.addCanvasElement(tag, container);
|
|
1542
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1543
|
+
yield canvasElement.load();
|
|
1544
|
+
}
|
|
1462
1545
|
if (props.direction == "up") {
|
|
1463
1546
|
container.pivot.y = GameWindowManager.canvasHeight;
|
|
1464
1547
|
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
@@ -1531,6 +1614,37 @@ function zoomOut(tag, props = { direction: "right" }, priority) {
|
|
|
1531
1614
|
GameWindowManager.addTicker(tag, effect);
|
|
1532
1615
|
}
|
|
1533
1616
|
|
|
1617
|
+
// src/functions/Importer.ts
|
|
1618
|
+
function importPixiVNJson(data) {
|
|
1619
|
+
if (Array.isArray(data)) {
|
|
1620
|
+
data.forEach((label) => {
|
|
1621
|
+
importPixiVNJson(label);
|
|
1622
|
+
});
|
|
1623
|
+
return;
|
|
1624
|
+
}
|
|
1625
|
+
try {
|
|
1626
|
+
if (typeof data === "string") {
|
|
1627
|
+
data = JSON.parse(data);
|
|
1628
|
+
}
|
|
1629
|
+
} catch (e) {
|
|
1630
|
+
console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON", e);
|
|
1631
|
+
return;
|
|
1632
|
+
}
|
|
1633
|
+
if (typeof data !== "object") {
|
|
1634
|
+
console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON: data is not an object");
|
|
1635
|
+
return;
|
|
1636
|
+
}
|
|
1637
|
+
for (const labelId in data) {
|
|
1638
|
+
try {
|
|
1639
|
+
const steps = data[labelId];
|
|
1640
|
+
let label = new LabelJson2(labelId, steps);
|
|
1641
|
+
saveLabel(label);
|
|
1642
|
+
} catch (e) {
|
|
1643
|
+
console.error(`[Pixi'VN] Error creating JSON label ${labelId}`, e);
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1534
1648
|
// src/functions/SavesUtility.ts
|
|
1535
1649
|
function getSaveData() {
|
|
1536
1650
|
return {
|
|
@@ -1546,13 +1660,17 @@ function getSaveJson() {
|
|
|
1546
1660
|
return JSON.stringify(saveData);
|
|
1547
1661
|
}
|
|
1548
1662
|
function loadSaveData(data, navigate) {
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1663
|
+
return __async(this, null, function* () {
|
|
1664
|
+
yield GameStepManager.import(data.stepData);
|
|
1665
|
+
GameStorageManager.import(data.storageData);
|
|
1666
|
+
GameWindowManager.import(data.canvasData);
|
|
1667
|
+
navigate(data.path);
|
|
1668
|
+
});
|
|
1553
1669
|
}
|
|
1554
1670
|
function loadSaveJson(dataString, navigate) {
|
|
1555
|
-
|
|
1671
|
+
return __async(this, null, function* () {
|
|
1672
|
+
yield loadSaveData(jsonToSaveData(dataString), navigate);
|
|
1673
|
+
});
|
|
1556
1674
|
}
|
|
1557
1675
|
function jsonToSaveData(json) {
|
|
1558
1676
|
return JSON.parse(json);
|
|
@@ -2507,6 +2625,16 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2507
2625
|
static set originalStepData(value) {
|
|
2508
2626
|
_GameStepManager._originalStepData = createExportableElement(value);
|
|
2509
2627
|
}
|
|
2628
|
+
static get currentStepData() {
|
|
2629
|
+
let currentStepData = {
|
|
2630
|
+
path: window.location.pathname,
|
|
2631
|
+
storage: GameStorageManager.export(),
|
|
2632
|
+
canvas: GameWindowManager.export(),
|
|
2633
|
+
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2634
|
+
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2635
|
+
};
|
|
2636
|
+
return currentStepData;
|
|
2637
|
+
}
|
|
2510
2638
|
/* Edit History Methods */
|
|
2511
2639
|
/**
|
|
2512
2640
|
* Add a label to the history.
|
|
@@ -2514,19 +2642,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2514
2642
|
*/
|
|
2515
2643
|
static addStepHistory(step, choiseMade) {
|
|
2516
2644
|
let stepHistory = getStepSha1(step);
|
|
2517
|
-
let
|
|
2518
|
-
path: window.location.pathname,
|
|
2519
|
-
storage: GameStorageManager.export(),
|
|
2520
|
-
canvas: GameWindowManager.export(),
|
|
2521
|
-
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2522
|
-
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2523
|
-
};
|
|
2645
|
+
let currentStepData = _GameStepManager.currentStepData;
|
|
2524
2646
|
if (_GameStepManager.originalStepData) {
|
|
2525
|
-
if (_GameStepManager.originalStepData.openedLabels.length ===
|
|
2647
|
+
if (_GameStepManager.originalStepData.openedLabels.length === currentStepData.openedLabels.length) {
|
|
2526
2648
|
try {
|
|
2527
2649
|
let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
|
|
2528
|
-
let historyStepOpenedLabelsString = JSON.stringify(
|
|
2529
|
-
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path ===
|
|
2650
|
+
let historyStepOpenedLabelsString = JSON.stringify(currentStepData.openedLabels);
|
|
2651
|
+
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === currentStepData.path && _GameStepManager.originalStepData.labelIndex === currentStepData.labelIndex) {
|
|
2530
2652
|
return;
|
|
2531
2653
|
}
|
|
2532
2654
|
} catch (e) {
|
|
@@ -2534,7 +2656,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2534
2656
|
}
|
|
2535
2657
|
}
|
|
2536
2658
|
}
|
|
2537
|
-
let data = diff(_GameStepManager.originalStepData,
|
|
2659
|
+
let data = diff(_GameStepManager.originalStepData, currentStepData);
|
|
2538
2660
|
if (data) {
|
|
2539
2661
|
let dialoge = void 0;
|
|
2540
2662
|
let requiredChoices = void 0;
|
|
@@ -2553,7 +2675,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2553
2675
|
index: _GameStepManager.lastStepIndex,
|
|
2554
2676
|
choiceIndexMade: choiseMade
|
|
2555
2677
|
});
|
|
2556
|
-
_GameStepManager.originalStepData =
|
|
2678
|
+
_GameStepManager.originalStepData = currentStepData;
|
|
2557
2679
|
}
|
|
2558
2680
|
_GameStepManager.increaseLastStepIndex();
|
|
2559
2681
|
}
|
|
@@ -2644,6 +2766,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2644
2766
|
console.warn("[Pixi'VN] The player must make a choice");
|
|
2645
2767
|
return;
|
|
2646
2768
|
}
|
|
2769
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2770
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2771
|
+
}
|
|
2647
2772
|
_GameStepManager.increaseCurrentStepIndex();
|
|
2648
2773
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2649
2774
|
});
|
|
@@ -2668,6 +2793,10 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2668
2793
|
return;
|
|
2669
2794
|
}
|
|
2670
2795
|
if (currentLabel.steps.length > currentLabelStepIndex) {
|
|
2796
|
+
let onStepRun = currentLabel.onStepStart;
|
|
2797
|
+
if (onStepRun) {
|
|
2798
|
+
yield onStepRun(currentLabelStepIndex, currentLabel);
|
|
2799
|
+
}
|
|
2671
2800
|
let step = currentLabel.steps[currentLabelStepIndex];
|
|
2672
2801
|
let result = yield step(props);
|
|
2673
2802
|
_GameStepManager.addStepHistory(step, choiseMade);
|
|
@@ -2732,6 +2861,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2732
2861
|
if (!tempLabel) {
|
|
2733
2862
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2734
2863
|
}
|
|
2864
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2865
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2866
|
+
}
|
|
2735
2867
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2736
2868
|
} catch (e) {
|
|
2737
2869
|
console.error("[Pixi'VN] Error calling label", e);
|
|
@@ -2790,6 +2922,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2790
2922
|
if (!tempLabel) {
|
|
2791
2923
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2792
2924
|
}
|
|
2925
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2926
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2927
|
+
}
|
|
2793
2928
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2794
2929
|
} catch (e) {
|
|
2795
2930
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
@@ -2895,24 +3030,29 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2895
3030
|
* ```
|
|
2896
3031
|
*/
|
|
2897
3032
|
static goBack(navigate, steps = 1) {
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
3033
|
+
return __async(this, null, function* () {
|
|
3034
|
+
if (steps <= 0) {
|
|
3035
|
+
console.warn("[Pixi'VN] Steps must be greater than 0");
|
|
3036
|
+
return;
|
|
3037
|
+
}
|
|
3038
|
+
if (_GameStepManager._stepsHistory.length <= 1) {
|
|
3039
|
+
console.warn("[Pixi'VN] No steps to go back");
|
|
3040
|
+
return;
|
|
3041
|
+
}
|
|
3042
|
+
let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
|
|
3043
|
+
if (restoredStep) {
|
|
3044
|
+
_GameStepManager._originalStepData = restoredStep;
|
|
3045
|
+
_GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
|
|
3046
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
3047
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
3048
|
+
}
|
|
3049
|
+
GameStorageManager.import(createExportableElement(restoredStep.storage));
|
|
3050
|
+
GameWindowManager.import(createExportableElement(restoredStep.canvas));
|
|
3051
|
+
navigate(restoredStep.path);
|
|
3052
|
+
} else {
|
|
3053
|
+
console.error("[Pixi'VN] Error going back");
|
|
3054
|
+
}
|
|
3055
|
+
});
|
|
2916
3056
|
}
|
|
2917
3057
|
static goBackInternal(steps, restoredStep) {
|
|
2918
3058
|
if (steps <= 0) {
|
|
@@ -2974,38 +3114,45 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2974
3114
|
* @param dataString The history in a JSON string.
|
|
2975
3115
|
*/
|
|
2976
3116
|
static importJson(dataString) {
|
|
2977
|
-
|
|
3117
|
+
return __async(this, null, function* () {
|
|
3118
|
+
yield _GameStepManager.import(JSON.parse(dataString));
|
|
3119
|
+
});
|
|
2978
3120
|
}
|
|
2979
3121
|
/**
|
|
2980
3122
|
* Import the history from an object.
|
|
2981
3123
|
* @param data The history in an object.
|
|
2982
3124
|
*/
|
|
2983
3125
|
static import(data) {
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3126
|
+
return __async(this, null, function* () {
|
|
3127
|
+
_GameStepManager.clear();
|
|
3128
|
+
try {
|
|
3129
|
+
if (data.hasOwnProperty("stepsHistory")) {
|
|
3130
|
+
_GameStepManager._stepsHistory = data["stepsHistory"];
|
|
3131
|
+
} else {
|
|
3132
|
+
console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
|
|
3133
|
+
}
|
|
3134
|
+
if (data.hasOwnProperty("openedLabels")) {
|
|
3135
|
+
_GameStepManager._openedLabels = data["openedLabels"];
|
|
3136
|
+
} else {
|
|
3137
|
+
console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
|
|
3138
|
+
}
|
|
3139
|
+
if (data.hasOwnProperty("lastStepIndex")) {
|
|
3140
|
+
_GameStepManager._lastStepIndex = data["lastStepIndex"];
|
|
3141
|
+
} else {
|
|
3142
|
+
console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
|
|
3143
|
+
}
|
|
3144
|
+
if (data.hasOwnProperty("originalStepData")) {
|
|
3145
|
+
_GameStepManager._originalStepData = data["originalStepData"];
|
|
3146
|
+
} else {
|
|
3147
|
+
console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
|
|
3148
|
+
}
|
|
3149
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
3150
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
3151
|
+
}
|
|
3152
|
+
} catch (e) {
|
|
3153
|
+
console.error("[Pixi'VN] Error importing data", e);
|
|
3005
3154
|
}
|
|
3006
|
-
}
|
|
3007
|
-
console.error("[Pixi'VN] Error importing data", e);
|
|
3008
|
-
}
|
|
3155
|
+
});
|
|
3009
3156
|
}
|
|
3010
3157
|
};
|
|
3011
3158
|
/**
|
|
@@ -3177,11 +3324,59 @@ var DialogueBaseModel = class {
|
|
|
3177
3324
|
}
|
|
3178
3325
|
};
|
|
3179
3326
|
|
|
3327
|
+
// src/classes/LabelJson.ts
|
|
3328
|
+
var LabelJson2 = class extends LabelAbstract {
|
|
3329
|
+
/**
|
|
3330
|
+
* @param id is the id of the label
|
|
3331
|
+
* @param steps is the list of steps that the label will perform
|
|
3332
|
+
* @param props is the properties of the label
|
|
3333
|
+
*/
|
|
3334
|
+
constructor(id, steps, props) {
|
|
3335
|
+
super(id, props);
|
|
3336
|
+
this._steps = steps;
|
|
3337
|
+
}
|
|
3338
|
+
/**
|
|
3339
|
+
* Get the steps of the label.
|
|
3340
|
+
*/
|
|
3341
|
+
get steps() {
|
|
3342
|
+
if (typeof this._steps === "function") {
|
|
3343
|
+
return this._steps().map(this.stepConverter);
|
|
3344
|
+
}
|
|
3345
|
+
return this._steps.map(this.stepConverter);
|
|
3346
|
+
}
|
|
3347
|
+
stepConverter(step) {
|
|
3348
|
+
return (props) => {
|
|
3349
|
+
if (step.currentChoiceMenuOptions) {
|
|
3350
|
+
setChoiceMenuOptions(step.currentChoiceMenuOptions);
|
|
3351
|
+
} else {
|
|
3352
|
+
clearChoiceMenuOptions();
|
|
3353
|
+
}
|
|
3354
|
+
if (step.dialog) {
|
|
3355
|
+
setDialogue(step.dialog);
|
|
3356
|
+
} else {
|
|
3357
|
+
clearDialogue();
|
|
3358
|
+
}
|
|
3359
|
+
if (step.labelToOpen) {
|
|
3360
|
+
if (step.labelToOpen.type === "jump") {
|
|
3361
|
+
GameStepManager.jumpLabel(step.labelToOpen.labelId, props);
|
|
3362
|
+
} else {
|
|
3363
|
+
GameStepManager.callLabel(step.labelToOpen.labelId, props);
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
if (step.end === "game_end") {
|
|
3367
|
+
console.warn("[Pixi'VN] Game end not implemented");
|
|
3368
|
+
} else if (step.end === "label_end") {
|
|
3369
|
+
GameStepManager.closeCurrentLabel();
|
|
3370
|
+
}
|
|
3371
|
+
};
|
|
3372
|
+
}
|
|
3373
|
+
};
|
|
3374
|
+
|
|
3180
3375
|
// src/labels/TestConstant.ts
|
|
3181
3376
|
var juliette = new CharacterBaseModel2("___pixivn_juliette___", {
|
|
3182
3377
|
name: "Juliette",
|
|
3183
3378
|
age: 25,
|
|
3184
|
-
icon: "https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-square.webp?alt=media
|
|
3379
|
+
icon: "https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-square.webp?alt=media",
|
|
3185
3380
|
color: "#ac0086"
|
|
3186
3381
|
});
|
|
3187
3382
|
saveCharacter(juliette);
|
|
@@ -3226,10 +3421,16 @@ var baseCanvasElementTestLabel = newLabel(
|
|
|
3226
3421
|
removeCanvasElement("container");
|
|
3227
3422
|
setDialogue({
|
|
3228
3423
|
character: juliette,
|
|
3229
|
-
text: `Here's what's going to happen: I'm going to create some
|
|
3424
|
+
text: `Here's what's going to happen: I'm going to create some CanvasText with different styles and put them on the stage.
|
|
3230
3425
|
But it will generate a warn message, because the FillGradient or FillPattern has not yet been supported by the Pixi\u2019VN ( you can see the status of the issue here: [#76](https://github.com/DRincs-Productions/pixi-vn/issues/76)).`
|
|
3231
3426
|
});
|
|
3232
|
-
const
|
|
3427
|
+
const basicStyle = new TextStyle({
|
|
3428
|
+
fill: "#ffffff"
|
|
3429
|
+
});
|
|
3430
|
+
const basicText = new CanvasText({
|
|
3431
|
+
text: "Basic text in pixi",
|
|
3432
|
+
style: basicStyle
|
|
3433
|
+
});
|
|
3233
3434
|
basicText.x = 50;
|
|
3234
3435
|
basicText.y = 100;
|
|
3235
3436
|
GameWindowManager.addCanvasElement("basicText", basicText);
|
|
@@ -3247,7 +3448,7 @@ But it will generate a warn message, because the FillGradient or FillPattern has
|
|
|
3247
3448
|
fill: { fill },
|
|
3248
3449
|
stroke: { color: "#4a1850", width: 5, join: "round" },
|
|
3249
3450
|
dropShadow: {
|
|
3250
|
-
color: "#
|
|
3451
|
+
color: "#ff5f74",
|
|
3251
3452
|
blur: 4,
|
|
3252
3453
|
angle: Math.PI / 6,
|
|
3253
3454
|
distance: 6
|
|
@@ -3300,36 +3501,30 @@ EventTest1 = __decorateClass([
|
|
|
3300
3501
|
eventDecorator("___pixi_vn_canvas_events_test_event1___")
|
|
3301
3502
|
], EventTest1);
|
|
3302
3503
|
var EventTest2 = class extends CanvasEvent {
|
|
3303
|
-
constructor() {
|
|
3304
|
-
super(...arguments);
|
|
3305
|
-
this.textureButtonDown = Texture.from("https://pixijs.com/assets/button_down.png");
|
|
3306
|
-
this.textureButtonOver = Texture.from("https://pixijs.com/assets/button_over.png");
|
|
3307
|
-
this.textureButton = Texture.from("https://pixijs.com/assets/button.png");
|
|
3308
|
-
}
|
|
3309
3504
|
fn(event, sprite) {
|
|
3310
3505
|
if (event === "pointerdown") {
|
|
3311
3506
|
sprite.isdown = true;
|
|
3312
|
-
sprite.texture =
|
|
3507
|
+
sprite.texture = Texture.from("https://pixijs.com/assets/button_down.png");
|
|
3313
3508
|
sprite.alpha = 1;
|
|
3314
3509
|
} else if (event === "pointerup" || event === "pointerupoutside") {
|
|
3315
3510
|
sprite.isdown = false;
|
|
3316
3511
|
if (sprite.isOver) {
|
|
3317
|
-
sprite.texture =
|
|
3512
|
+
sprite.texture = Texture.from("https://pixijs.com/assets/button_over.png");
|
|
3318
3513
|
} else {
|
|
3319
|
-
sprite.texture =
|
|
3514
|
+
sprite.texture = Texture.from("https://pixijs.com/assets/button.png");
|
|
3320
3515
|
}
|
|
3321
3516
|
} else if (event === "pointerover") {
|
|
3322
3517
|
sprite.isOver = true;
|
|
3323
3518
|
if (sprite.isdown) {
|
|
3324
3519
|
return;
|
|
3325
3520
|
}
|
|
3326
|
-
sprite.texture =
|
|
3521
|
+
sprite.texture = Texture.from("https://pixijs.com/assets/button_over.png");
|
|
3327
3522
|
} else if (event === "pointerout") {
|
|
3328
3523
|
sprite.isOver = false;
|
|
3329
3524
|
if (sprite.isdown) {
|
|
3330
3525
|
return;
|
|
3331
3526
|
}
|
|
3332
|
-
sprite.texture =
|
|
3527
|
+
sprite.texture = Texture.from("https://pixijs.com/assets/button.png");
|
|
3333
3528
|
}
|
|
3334
3529
|
}
|
|
3335
3530
|
};
|
|
@@ -3351,6 +3546,7 @@ var canvasEventsTestLabel = newLabel(
|
|
|
3351
3546
|
});
|
|
3352
3547
|
const texture = yield Assets.load(bunnyImage);
|
|
3353
3548
|
const sprite = CanvasSprite.from(texture);
|
|
3549
|
+
sprite.scale.set(3);
|
|
3354
3550
|
sprite.anchor.set(0.5);
|
|
3355
3551
|
sprite.x = GameWindowManager.screen.width / 2;
|
|
3356
3552
|
sprite.y = GameWindowManager.screen.height / 2;
|
|
@@ -3366,12 +3562,11 @@ var canvasEventsTestLabel = newLabel(
|
|
|
3366
3562
|
text: `This is the test of buttons in a canvas. (This example is from the official [PixiJS website](https://pixijs.com/8.x/examples/events/interactivity).)`
|
|
3367
3563
|
});
|
|
3368
3564
|
const backgroundT = yield Assets.load("https://pixijs.com/assets/bg_button.jpg");
|
|
3369
|
-
const background = CanvasSprite
|
|
3565
|
+
const background = new CanvasSprite(backgroundT);
|
|
3370
3566
|
background.width = GameWindowManager.screen.width;
|
|
3371
3567
|
background.height = GameWindowManager.screen.height;
|
|
3372
3568
|
GameWindowManager.addCanvasElement("bg", background);
|
|
3373
|
-
const
|
|
3374
|
-
const textureButton = CanvasSprite.from(textureButtonT);
|
|
3569
|
+
const textureButton = yield Assets.load("https://pixijs.com/assets/button.png");
|
|
3375
3570
|
const buttons = [];
|
|
3376
3571
|
const buttonPositions = [175, 75, 655, 75, 410, 325, 150, 465, 685, 445];
|
|
3377
3572
|
for (let i = 0; i < 5; i++) {
|
|
@@ -3391,7 +3586,17 @@ var canvasEventsTestLabel = newLabel(
|
|
|
3391
3586
|
buttons[4].scale.set(0.8, 1.2);
|
|
3392
3587
|
buttons[4].rotation = Math.PI;
|
|
3393
3588
|
})
|
|
3394
|
-
]
|
|
3589
|
+
],
|
|
3590
|
+
{
|
|
3591
|
+
onLoadStep: () => __async(void 0, null, function* () {
|
|
3592
|
+
yield Assets.load([
|
|
3593
|
+
"https://pixijs.com/assets/bg_button.jpg",
|
|
3594
|
+
"https://pixijs.com/assets/button.png",
|
|
3595
|
+
"https://pixijs.com/assets/button_down.png",
|
|
3596
|
+
"https://pixijs.com/assets/button_over.png"
|
|
3597
|
+
]);
|
|
3598
|
+
})
|
|
3599
|
+
}
|
|
3395
3600
|
);
|
|
3396
3601
|
var AlienTintingTest = class extends CanvasSprite {
|
|
3397
3602
|
constructor() {
|
|
@@ -3511,13 +3716,13 @@ var imagesAnimationsTest = newLabel(IMAGE_ANIMAIONS_TEST_LABEL, [
|
|
|
3511
3716
|
() => __async(void 0, null, function* () {
|
|
3512
3717
|
setDialogue({ character: juliette, text: "Here's what they can do." });
|
|
3513
3718
|
setChoiceMenuOptions([
|
|
3514
|
-
new ChoiceMenuOption("Dissolve effect", imagesDissolveTest),
|
|
3515
|
-
new ChoiceMenuOption("Fade effect", imagesFadeTest),
|
|
3516
|
-
new ChoiceMenuOption("Rotate", imagesRotateTest),
|
|
3517
|
-
new ChoiceMenuOption("Move", imagesMoveTest),
|
|
3518
|
-
new ChoiceMenuOption("Zoom", imagesZoomTest),
|
|
3519
|
-
new ChoiceMenuOption("Move in/out", imagesMoveInOutTest),
|
|
3520
|
-
new ChoiceMenuOption("Zoom in/out", imagesZoomInOutTest),
|
|
3719
|
+
new ChoiceMenuOption("Dissolve effect", imagesDissolveTest, {}),
|
|
3720
|
+
new ChoiceMenuOption("Fade effect", imagesFadeTest, {}),
|
|
3721
|
+
new ChoiceMenuOption("Rotate", imagesRotateTest, {}),
|
|
3722
|
+
new ChoiceMenuOption("Move", imagesMoveTest, {}),
|
|
3723
|
+
new ChoiceMenuOption("Zoom", imagesZoomTest, {}),
|
|
3724
|
+
new ChoiceMenuOption("Move in/out", imagesMoveInOutTest, {}),
|
|
3725
|
+
new ChoiceMenuOption("Zoom in/out", imagesZoomInOutTest, {}),
|
|
3521
3726
|
new ChoiceMenuOptionClose("Cancel", true)
|
|
3522
3727
|
]);
|
|
3523
3728
|
}),
|
|
@@ -3627,8 +3832,8 @@ var imagesRotateTest = newLabel("___pixi_vn_images_rotate_test___", [
|
|
|
3627
3832
|
text: `Here's what's going to happen:
|
|
3628
3833
|
- ${eggHeadName} will rotate with a anchor set to 0.
|
|
3629
3834
|
- ${flowerTopName} will rotate with a anchor set to 0.5 and a exponential speed progression.
|
|
3630
|
-
- ${helmlokName} will rotate with a anchor set to 0.5, rotate 2
|
|
3631
|
-
- ${skullyName} will rotate with a anchor set to 1, rotate 3
|
|
3835
|
+
- ${helmlokName} will rotate with a anchor set to 0.5, rotate clockwise for 2 seconds, rotate counterclockwise with a exponential (-0.05) speed progression, and when it reaches 0, it will repeat.
|
|
3836
|
+
- ${skullyName} will rotate with a anchor set to 1, rotate 3 seconds clockwise, wait for 0.5 seconds, and rotate 7 seconds counterclockwise.`
|
|
3632
3837
|
});
|
|
3633
3838
|
let eggHead = GameWindowManager.getCanvasElement("eggHead");
|
|
3634
3839
|
if (eggHead)
|
|
@@ -3681,10 +3886,10 @@ var imagesMoveTest = newLabel("___pixi_vn_images_move_test___", [
|
|
|
3681
3886
|
setDialogue({
|
|
3682
3887
|
character: juliette,
|
|
3683
3888
|
text: `Here's what's going to happen:
|
|
3684
|
-
- ${eggHeadName} will move to { x: 500, y: 100 } with a speed of
|
|
3685
|
-
- ${flowerTopName} will move to { x: 500, y: 300 } with a speed of
|
|
3686
|
-
- ${helmlokName} will move to
|
|
3687
|
-
- ${skullyName} will move to { x: 500, y: 500 } with a speed of
|
|
3889
|
+
- ${eggHeadName} will move to { x: 500, y: 100 } with a speed of 24.
|
|
3890
|
+
- ${flowerTopName} will move to { x: 500, y: 300 } with a speed of 18.
|
|
3891
|
+
- ${helmlokName} will move to { x: 100, y: 500 } with a speed of 150 and a linear speed progression of -2 ( limit 10 ), and then move to { x: 1700, y: 500 } with a speed of 10 and a linear speed progression of 2 ( limit 150 ), and repeat.
|
|
3892
|
+
- ${skullyName} will move to { x: 500, y: 500 } with a speed of 40, wait for 0.5 seconds, and move to { x: 100, y: 100 } with a speed of 40.`
|
|
3688
3893
|
});
|
|
3689
3894
|
GameWindowManager.addTicker("eggHead", new MoveTicker({
|
|
3690
3895
|
destination: { x: 500, y: 100 },
|
|
@@ -3697,25 +3902,25 @@ var imagesMoveTest = newLabel("___pixi_vn_images_move_test___", [
|
|
|
3697
3902
|
GameWindowManager.addTickersSteps("helmlok", [
|
|
3698
3903
|
new MoveTicker({
|
|
3699
3904
|
destination: { x: 100, y: 500 },
|
|
3700
|
-
speed:
|
|
3701
|
-
speedProgression: { type: "linear", amt: -
|
|
3905
|
+
speed: 150,
|
|
3906
|
+
speedProgression: { type: "linear", amt: -2, limit: 10 }
|
|
3702
3907
|
}),
|
|
3703
3908
|
new MoveTicker({
|
|
3704
3909
|
destination: { x: 1700, y: 500 },
|
|
3705
|
-
speed:
|
|
3706
|
-
speedProgression: { type: "linear", amt:
|
|
3910
|
+
speed: 10,
|
|
3911
|
+
speedProgression: { type: "linear", amt: 2, limit: 150 }
|
|
3707
3912
|
}),
|
|
3708
3913
|
Repeat
|
|
3709
3914
|
]);
|
|
3710
3915
|
GameWindowManager.addTickersSteps("skully", [
|
|
3711
3916
|
new MoveTicker({
|
|
3712
3917
|
destination: { x: 500, y: 500 },
|
|
3713
|
-
speed:
|
|
3918
|
+
speed: 40
|
|
3714
3919
|
}),
|
|
3715
3920
|
Pause(0.5),
|
|
3716
3921
|
new MoveTicker({
|
|
3717
3922
|
destination: { x: 100, y: 100 },
|
|
3718
|
-
speed:
|
|
3923
|
+
speed: 40
|
|
3719
3924
|
})
|
|
3720
3925
|
]);
|
|
3721
3926
|
}
|
|
@@ -3777,37 +3982,45 @@ var imagesMoveInOutTest = newLabel("___pixi_vn_images_move_in_out_test___", [
|
|
|
3777
3982
|
setDialogue({
|
|
3778
3983
|
character: juliette,
|
|
3779
3984
|
text: `Here's what's going to happen:
|
|
3780
|
-
- ${eggHeadName} will move in from the top with a speed of
|
|
3781
|
-
- ${flowerTopName} will move in from the right with a speed of
|
|
3782
|
-
- ${helmlokName} will move in from the left with a speed of
|
|
3783
|
-
- ${skullyName} will move in from the bottom with a speed of
|
|
3985
|
+
- ${eggHeadName} will move in from the top with a speed of 80. If you go next, ${eggHeadName} will move out from the bottom with a speed of 80.
|
|
3986
|
+
- ${flowerTopName} will move in from the right with a speed of 80 and a speed progression of 0.02. If you go next, ${flowerTopName} will move out from the left with a speed of 80 and a speed progression of 0.02.
|
|
3987
|
+
- ${helmlokName} will move in from the left with a speed of 80. If you go next, ${helmlokName} will move out from the right with a speed of 80.
|
|
3988
|
+
- ${skullyName} will move in from the bottom with a speed of 80 and a speed progression of 0.02. If you go next, ${skullyName} will move out from the top with a speed of 80 and a speed progression of 0.02.`
|
|
3784
3989
|
});
|
|
3785
3990
|
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3786
3991
|
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
3787
3992
|
let helmlok = new CanvasImage({ x: 100, y: 300 }, helmlokImage);
|
|
3788
3993
|
let skully = new CanvasImage({ x: 300, y: 300 }, skullyImage);
|
|
3789
|
-
moveIn("eggHead", eggHead, { speed:
|
|
3994
|
+
moveIn("eggHead", eggHead, { speed: 80, direction: "down" });
|
|
3790
3995
|
moveIn("flowerTop", flowerTop, {
|
|
3791
|
-
speed:
|
|
3996
|
+
speed: 80,
|
|
3792
3997
|
direction: "left",
|
|
3793
3998
|
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3794
3999
|
});
|
|
3795
|
-
moveIn("helmlok", helmlok, { speed:
|
|
4000
|
+
moveIn("helmlok", helmlok, { speed: 80, direction: "right" });
|
|
3796
4001
|
moveIn("skully", skully, {
|
|
3797
|
-
speed:
|
|
4002
|
+
speed: 80,
|
|
3798
4003
|
direction: "up",
|
|
3799
4004
|
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3800
4005
|
});
|
|
3801
4006
|
}),
|
|
3802
4007
|
() => {
|
|
3803
|
-
moveOut("eggHead", { speed:
|
|
3804
|
-
moveOut("flowerTop", { speed:
|
|
3805
|
-
moveOut("helmlok", { speed:
|
|
3806
|
-
moveOut("skully", { speed:
|
|
4008
|
+
moveOut("eggHead", { speed: 80, direction: "down" });
|
|
4009
|
+
moveOut("flowerTop", { speed: 80, direction: "left" });
|
|
4010
|
+
moveOut("helmlok", { speed: 80, direction: "right" });
|
|
4011
|
+
moveOut("skully", { speed: 80, direction: "up" });
|
|
3807
4012
|
}
|
|
3808
4013
|
]);
|
|
3809
4014
|
var imagesZoomInOutTest = newLabel("___pixi_vn_images_zoom_in_out_test___", [
|
|
3810
4015
|
() => __async(void 0, null, function* () {
|
|
4016
|
+
setDialogue({
|
|
4017
|
+
character: juliette,
|
|
4018
|
+
text: `Here's what's going to happen:
|
|
4019
|
+
- ${eggHeadName} will zoom in with a speed of 3. If you go next, ${eggHeadName} will zoom out with a speed of 3.
|
|
4020
|
+
- ${flowerTopName} will zoom in with a speed of 3 and a speed progression of 0.02. If you go next, ${flowerTopName} will zoom out with a speed of 3.
|
|
4021
|
+
- ${helmlokName} will zoom in with a speed of 3. If you go next, ${helmlokName} will zoom out with a speed of 1.
|
|
4022
|
+
- ${skullyName} will zoom in with a speed of 3 and a speed progression of 0.02. If you go next, ${skullyName} will zoom out with a speed of 3 and a speed progression of 0.02.`
|
|
4023
|
+
});
|
|
3811
4024
|
GameWindowManager.removeCanvasElements();
|
|
3812
4025
|
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3813
4026
|
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
@@ -3833,7 +4046,7 @@ var imagesZoomInOutTest = newLabel("___pixi_vn_images_zoom_in_out_test___", [
|
|
|
3833
4046
|
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3834
4047
|
});
|
|
3835
4048
|
zoomOut("flowerTop", { speed: 3, direction: "left" });
|
|
3836
|
-
zoomOut("helmlok", { speed:
|
|
4049
|
+
zoomOut("helmlok", { speed: 1, direction: "right" });
|
|
3837
4050
|
zoomOut("skully", {
|
|
3838
4051
|
speed: 3,
|
|
3839
4052
|
direction: "up",
|
|
@@ -3915,6 +4128,23 @@ Footer
|
|
|
3915
4128
|
})
|
|
3916
4129
|
]);
|
|
3917
4130
|
|
|
4131
|
+
// src/labels/StepLabelTest.ts
|
|
4132
|
+
var STEP_LABEL_TEST_LABEL = "___pixi_vn_step_label_test___";
|
|
4133
|
+
var stepLabelTestLAbel = newLabel(STEP_LABEL_TEST_LABEL, [
|
|
4134
|
+
() => __async(void 0, null, function* () {
|
|
4135
|
+
setDialogue({ character: juliette, text: `Pixi'VN manages the succession of "screens" with steps. Each step is a function that can be asynchronous.` });
|
|
4136
|
+
}),
|
|
4137
|
+
() => __async(void 0, null, function* () {
|
|
4138
|
+
setDialogue({ character: juliette, text: "The labels are containers of steps, they are used to organize the steps in a more readable way. For start a steps sequence, you must call or jump to a label." });
|
|
4139
|
+
}),
|
|
4140
|
+
() => __async(void 0, null, function* () {
|
|
4141
|
+
setDialogue({ character: juliette, text: "It is also possible to ask the player to make a choice." });
|
|
4142
|
+
}),
|
|
4143
|
+
() => __async(void 0, null, function* () {
|
|
4144
|
+
setDialogue({ character: juliette, text: "Browsing through available tests is one way to test the steps/labels system." });
|
|
4145
|
+
})
|
|
4146
|
+
]);
|
|
4147
|
+
|
|
3918
4148
|
// src/labels/StartLabel.ts
|
|
3919
4149
|
var pixivnTestStartLabel = newLabel(
|
|
3920
4150
|
"___pixi_vn_example_start_label___",
|
|
@@ -3923,25 +4153,25 @@ var pixivnTestStartLabel = newLabel(
|
|
|
3923
4153
|
let currentTimeName = "";
|
|
3924
4154
|
const hour = (/* @__PURE__ */ new Date()).getHours();
|
|
3925
4155
|
if (hour >= 5 && hour < 12) {
|
|
3926
|
-
currentTimeName = "morning";
|
|
4156
|
+
currentTimeName = "morning\u{1F505}";
|
|
3927
4157
|
} else if (hour >= 12 && hour < 18) {
|
|
3928
|
-
currentTimeName = "afternoon";
|
|
4158
|
+
currentTimeName = "afternoon\u{1F506}";
|
|
3929
4159
|
} else if (hour >= 18 && hour < 22) {
|
|
3930
|
-
currentTimeName = "evening";
|
|
4160
|
+
currentTimeName = "evening\u26C5";
|
|
3931
4161
|
} else {
|
|
3932
|
-
currentTimeName = "night";
|
|
4162
|
+
currentTimeName = "night\u{1F319}";
|
|
3933
4163
|
}
|
|
3934
4164
|
setDialogue({ character: juliette, text: `Good ${currentTimeName}! I'm ${juliette.name}, your virtual assistant. I'm here to help you with your tests.` });
|
|
3935
4165
|
},
|
|
3936
|
-
() => setDialogue({ character: juliette, text: `You are running the Pixi\u2019VN test. This test will guide you through the different features of the library.` }),
|
|
4166
|
+
() => setDialogue({ character: juliette, text: `You are running the Pixi\u2019VN v${PIXIVN_VERSION} test. This test will guide you through the different features of the library.` }),
|
|
3937
4167
|
(props) => GameStepManager.jumpLabel(pixivnTestStartLabel2, props)
|
|
3938
4168
|
]
|
|
3939
4169
|
);
|
|
3940
|
-
var
|
|
3941
|
-
"
|
|
4170
|
+
var openLink = newLabel(
|
|
4171
|
+
"___pixi_vn_open_link___",
|
|
3942
4172
|
[
|
|
3943
4173
|
(props) => {
|
|
3944
|
-
window.open(
|
|
4174
|
+
window.open(props.link);
|
|
3945
4175
|
GameStepManager.goNext(props);
|
|
3946
4176
|
}
|
|
3947
4177
|
]
|
|
@@ -3954,18 +4184,20 @@ var pixivnTestStartLabel2 = newLabel(
|
|
|
3954
4184
|
GameWindowManager.clear();
|
|
3955
4185
|
setDialogue({ character: juliette, text: "Which test would you like to start with?" });
|
|
3956
4186
|
setChoiceMenuOptions([
|
|
3957
|
-
new ChoiceMenuOption("Open Pixi\u2019VN Wiki",
|
|
3958
|
-
new ChoiceMenuOption("Images, Transitions and Animations Test", imagesAnimationsTest),
|
|
3959
|
-
new ChoiceMenuOption("Canvas Events Test
|
|
3960
|
-
new ChoiceMenuOption("Base Canvas Element Test", baseCanvasElementTestLabel),
|
|
3961
|
-
new ChoiceMenuOption("Custom Ticker Canvas Element Test", customTickerCanvasElementTestLabel),
|
|
3962
|
-
new ChoiceMenuOption("
|
|
4187
|
+
new ChoiceMenuOption("Open Pixi\u2019VN Wiki", openLink, { link: "https://pixi-vn.web.app/" }),
|
|
4188
|
+
new ChoiceMenuOption("Images, Transitions and Animations Test", imagesAnimationsTest, {}),
|
|
4189
|
+
new ChoiceMenuOption("Canvas Events Test", canvasEventsTestLabel, {}),
|
|
4190
|
+
new ChoiceMenuOption("Base Canvas Element Test", baseCanvasElementTestLabel, {}),
|
|
4191
|
+
new ChoiceMenuOption("Custom Ticker Canvas Element Test", customTickerCanvasElementTestLabel, {}),
|
|
4192
|
+
new ChoiceMenuOption("Steps and Labels Test", stepLabelTestLAbel, {}),
|
|
4193
|
+
new ChoiceMenuOption("Markdown Test", markdownTest, {}),
|
|
4194
|
+
new ChoiceMenuOption("Open Pixi\u2019VN Github Issues", openLink, { link: "https://github.com/DRincs-Productions/pixi-vn/issues" })
|
|
3963
4195
|
]);
|
|
3964
4196
|
},
|
|
3965
4197
|
(props) => GameStepManager.jumpLabel(RESTART_TEST_LABEL, props)
|
|
3966
4198
|
]
|
|
3967
4199
|
);
|
|
3968
4200
|
|
|
3969
|
-
export { CanvasBase, CanvasContainer, CanvasEvent, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel2 as CharacterBaseModel, ChoiceMenuOption, ChoiceMenuOptionClose, Close, DialogueBaseModel, FadeAlphaTicker, GameStepManager, GameStorageManager, GameWindowManager, Label, MoveTicker, Pause, Repeat, RotateTicker, StoredClassModel, TickerBase, ZoomTicker, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getLabelById, getSaveData, getSaveJson, getTexture, juliette, loadImage, loadSaveData, loadSaveJson, moveIn, moveOut, newLabel, pixivnTestStartLabel, removeCanvasElement, removeWithDissolveTransition, removeWithFadeTransition, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag, showImage, showWithDissolveTransition, showWithFadeTransition, tickerDecorator, zoomIn, zoomOut };
|
|
4201
|
+
export { CanvasBase, CanvasContainer, CanvasEvent, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel2 as CharacterBaseModel, ChoiceMenuOption, ChoiceMenuOptionClose, Close, DialogueBaseModel, FadeAlphaTicker, GameStepManager, GameStorageManager, GameWindowManager, Label, LabelJson2 as LabelJson, MoveTicker, Pause, Repeat, RotateTicker, StoredClassModel, TickerBase, ZoomTicker, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getLabelById, getSaveData, getSaveJson, getTexture, importPixiVNJson, juliette, loadImage, loadSaveData, loadSaveJson, moveIn, moveOut, newLabel, pixivnTestStartLabel, removeCanvasElement, removeWithDissolveTransition, removeWithFadeTransition, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag, showImage, showWithDissolveTransition, showWithFadeTransition, tickerDecorator, zoomIn, zoomOut };
|
|
3970
4202
|
//# sourceMappingURL=index.mjs.map
|
|
3971
4203
|
//# sourceMappingURL=index.mjs.map
|