@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.js
CHANGED
|
@@ -78,19 +78,18 @@ function checkIfStepsIsEqual(step1, step2) {
|
|
|
78
78
|
return step1 === step2;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
// src/classes/
|
|
82
|
-
var
|
|
81
|
+
// src/classes/LabelAbstract.ts
|
|
82
|
+
var LabelAbstract = class {
|
|
83
83
|
/**
|
|
84
84
|
* @param id is the id of the label
|
|
85
|
-
* @param
|
|
86
|
-
* @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
|
|
87
|
-
* @param choiseIndex is the index of the choice that the label will perform
|
|
85
|
+
* @param props is the properties of the label
|
|
88
86
|
*/
|
|
89
|
-
constructor(id,
|
|
87
|
+
constructor(id, props) {
|
|
90
88
|
this._id = id;
|
|
91
|
-
this.
|
|
92
|
-
this.
|
|
93
|
-
this.
|
|
89
|
+
this._onStepStart = props == null ? void 0 : props.onStepStart;
|
|
90
|
+
this._onLoadStep = props == null ? void 0 : props.onLoadStep;
|
|
91
|
+
this._onStepEnd = props == null ? void 0 : props.onStepEnd;
|
|
92
|
+
this._choiseIndex = props == null ? void 0 : props.choiseIndex;
|
|
94
93
|
}
|
|
95
94
|
/**
|
|
96
95
|
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
@@ -98,17 +97,6 @@ var Label = class {
|
|
|
98
97
|
get id() {
|
|
99
98
|
return this._id;
|
|
100
99
|
}
|
|
101
|
-
/**
|
|
102
|
-
* Get the steps of the label.
|
|
103
|
-
* This class should be extended and the steps method should be overridden.
|
|
104
|
-
* Every time you update this list will also be updated when the other game versions load.
|
|
105
|
-
*/
|
|
106
|
-
get steps() {
|
|
107
|
-
if (typeof this._steps === "function") {
|
|
108
|
-
return this._steps();
|
|
109
|
-
}
|
|
110
|
-
return this._steps;
|
|
111
|
-
}
|
|
112
100
|
/**
|
|
113
101
|
* Get the corresponding steps number
|
|
114
102
|
* @param externalSteps
|
|
@@ -127,37 +115,75 @@ var Label = class {
|
|
|
127
115
|
return res;
|
|
128
116
|
}
|
|
129
117
|
/**
|
|
130
|
-
*
|
|
118
|
+
* 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.
|
|
131
119
|
* @returns Promise<void> or void
|
|
132
|
-
* @example
|
|
133
|
-
* ```typescript
|
|
134
|
-
* newLabel("id", [], () => {
|
|
135
|
-
* Assets.load('path/to/image1.png')
|
|
136
|
-
* Assets.load('path/to/image2.png')
|
|
137
|
-
* })
|
|
138
|
-
* ```
|
|
139
120
|
*/
|
|
140
|
-
get
|
|
141
|
-
return this
|
|
121
|
+
get onStepStart() {
|
|
122
|
+
return (stepIndex, label) => __async(this, null, function* () {
|
|
123
|
+
if (this._onLoadStep) {
|
|
124
|
+
yield this._onLoadStep(stepIndex, label);
|
|
125
|
+
}
|
|
126
|
+
if (this._onStepStart) {
|
|
127
|
+
return yield this._onStepStart(stepIndex, label);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* 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.
|
|
133
|
+
* @returns Promise<void> or void
|
|
134
|
+
*/
|
|
135
|
+
get onLoadStep() {
|
|
136
|
+
return this._onLoadStep;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Is a function that will be executed when the step ends.
|
|
140
|
+
* @returns Promise<void> or void
|
|
141
|
+
*/
|
|
142
|
+
get onStepEnd() {
|
|
143
|
+
return this._onStepEnd;
|
|
142
144
|
}
|
|
143
145
|
get choiseIndex() {
|
|
144
146
|
return this._choiseIndex;
|
|
145
147
|
}
|
|
146
148
|
};
|
|
147
149
|
|
|
150
|
+
// src/classes/Label.ts
|
|
151
|
+
var Label = class extends LabelAbstract {
|
|
152
|
+
/**
|
|
153
|
+
* @param id is the id of the label
|
|
154
|
+
* @param steps is the list of steps that the label will perform
|
|
155
|
+
* @param props is the properties of the label
|
|
156
|
+
*/
|
|
157
|
+
constructor(id, steps, props) {
|
|
158
|
+
super(id, props);
|
|
159
|
+
this._steps = steps;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Get the steps of the label.
|
|
163
|
+
*/
|
|
164
|
+
get steps() {
|
|
165
|
+
if (typeof this._steps === "function") {
|
|
166
|
+
return this._steps();
|
|
167
|
+
}
|
|
168
|
+
return this._steps;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
148
172
|
// src/classes/CloseLabel.ts
|
|
149
173
|
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
150
174
|
function newCloseLabel(choiseIndex) {
|
|
151
|
-
return new Label(CLOSE_LABEL_ID, [],
|
|
175
|
+
return new Label(CLOSE_LABEL_ID, [], {
|
|
176
|
+
choiseIndex
|
|
177
|
+
});
|
|
152
178
|
}
|
|
153
179
|
|
|
154
180
|
// src/decorators/LabelDecorator.ts
|
|
155
181
|
var registeredLabels = {};
|
|
156
|
-
function newLabel(id, steps,
|
|
182
|
+
function newLabel(id, steps, props) {
|
|
157
183
|
if (registeredLabels[id]) {
|
|
158
184
|
console.info(`[Pixi'VN] Label ${id} already exists, it will be overwritten`);
|
|
159
185
|
}
|
|
160
|
-
let label = new Label(id, steps,
|
|
186
|
+
let label = new Label(id, steps, props);
|
|
161
187
|
registeredLabels[id] = label;
|
|
162
188
|
return label;
|
|
163
189
|
}
|
|
@@ -169,6 +195,9 @@ function getLabelById(id) {
|
|
|
169
195
|
}
|
|
170
196
|
return label;
|
|
171
197
|
}
|
|
198
|
+
function saveLabel(label) {
|
|
199
|
+
registeredLabels[label.id] = label;
|
|
200
|
+
}
|
|
172
201
|
var CanvasBase = class extends pixi_js.Container {
|
|
173
202
|
constructor() {
|
|
174
203
|
super(...arguments);
|
|
@@ -267,8 +296,6 @@ function getMemoryContainer(element) {
|
|
|
267
296
|
};
|
|
268
297
|
}
|
|
269
298
|
function setMemoryContainer(element, memory) {
|
|
270
|
-
memory.width && (element.width = memory.width);
|
|
271
|
-
memory.height && (element.height = memory.height);
|
|
272
299
|
memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
|
|
273
300
|
memory.blendMode && (element.blendMode = memory.blendMode);
|
|
274
301
|
memory.tint && (element.tint = memory.tint);
|
|
@@ -301,6 +328,8 @@ function setMemoryContainer(element, memory) {
|
|
|
301
328
|
memory.interactive && (element.interactive = memory.interactive);
|
|
302
329
|
memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
|
|
303
330
|
memory.hitArea && (element.hitArea = memory.hitArea);
|
|
331
|
+
memory.width && (element.width = memory.width);
|
|
332
|
+
memory.height && (element.height = memory.height);
|
|
304
333
|
}
|
|
305
334
|
function getTexture(imageUrl) {
|
|
306
335
|
return __async(this, null, function* () {
|
|
@@ -762,29 +791,57 @@ var ChoiceMenuOption = class {
|
|
|
762
791
|
/**
|
|
763
792
|
* @param text Text to be displayed in the menu
|
|
764
793
|
* @param label Label to be opened when the option is selected or the id of the label
|
|
794
|
+
* @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.
|
|
765
795
|
* @param type Type of the label to be opened. @default "call"
|
|
766
|
-
* @param props Properties to be passed to the label, when the label is called. it cannot contain functions or classes. @default {}
|
|
767
796
|
*/
|
|
768
|
-
constructor(text, label, type = "call"
|
|
797
|
+
constructor(text, label, props, type = "call") {
|
|
769
798
|
/**
|
|
770
|
-
* Properties to be passed to the label
|
|
799
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
800
|
+
* @example
|
|
801
|
+
* ```tsx
|
|
802
|
+
* setChoiceMenuOptions([
|
|
803
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
804
|
+
* ])
|
|
805
|
+
* return <List>
|
|
806
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
807
|
+
* return (
|
|
808
|
+
* <ChoiceButton
|
|
809
|
+
* disabled={item.props.disabled}
|
|
810
|
+
* onClick={() => {
|
|
811
|
+
* afterSelectChoice(item)
|
|
812
|
+
* }}
|
|
813
|
+
* >
|
|
814
|
+
* {item.text}
|
|
815
|
+
* </ChoiceButton>
|
|
816
|
+
* )
|
|
817
|
+
* })}
|
|
818
|
+
* </List>
|
|
819
|
+
* ```
|
|
771
820
|
*/
|
|
772
821
|
this.props = {};
|
|
773
|
-
if (typeof label === "string") {
|
|
774
|
-
let tLabel = getLabelById(label);
|
|
775
|
-
if (!tLabel) {
|
|
776
|
-
throw new Error(`[Pixi'VN] Label ${label} not found`);
|
|
777
|
-
} else {
|
|
778
|
-
label = tLabel;
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
822
|
this.text = text;
|
|
782
|
-
this.
|
|
823
|
+
this._label = label;
|
|
783
824
|
this.type = type;
|
|
784
825
|
if (props) {
|
|
785
826
|
this.props = props;
|
|
786
827
|
}
|
|
787
828
|
}
|
|
829
|
+
/**
|
|
830
|
+
* Label to be opened when the option is selected
|
|
831
|
+
*/
|
|
832
|
+
get label() {
|
|
833
|
+
let label = this._label;
|
|
834
|
+
if (typeof label === "string") {
|
|
835
|
+
let res = getLabelById(label);
|
|
836
|
+
if (res) {
|
|
837
|
+
label = res;
|
|
838
|
+
} else {
|
|
839
|
+
console.error(`Label ${label} not found, so it will be closed`);
|
|
840
|
+
label = newCloseLabel();
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
return label;
|
|
844
|
+
}
|
|
788
845
|
};
|
|
789
846
|
var ChoiceMenuOptionClose = class {
|
|
790
847
|
/**
|
|
@@ -801,7 +858,27 @@ var ChoiceMenuOptionClose = class {
|
|
|
801
858
|
*/
|
|
802
859
|
this.type = Close;
|
|
803
860
|
/**
|
|
804
|
-
* Properties to be passed to the label
|
|
861
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
862
|
+
* @example
|
|
863
|
+
* ```tsx
|
|
864
|
+
* setChoiceMenuOptions([
|
|
865
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
866
|
+
* ])
|
|
867
|
+
* return <List>
|
|
868
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
869
|
+
* return (
|
|
870
|
+
* <ChoiceButton
|
|
871
|
+
* disabled={item.props.disabled}
|
|
872
|
+
* onClick={() => {
|
|
873
|
+
* afterSelectChoice(item)
|
|
874
|
+
* }}
|
|
875
|
+
* >
|
|
876
|
+
* {item.text}
|
|
877
|
+
* </ChoiceButton>
|
|
878
|
+
* )
|
|
879
|
+
* })}
|
|
880
|
+
* </List>
|
|
881
|
+
* ```
|
|
805
882
|
*/
|
|
806
883
|
this.props = {};
|
|
807
884
|
this.text = text;
|
|
@@ -862,21 +939,18 @@ function getChoiceMenuOptions() {
|
|
|
862
939
|
d.forEach((option, index) => {
|
|
863
940
|
if (option.type === Close) {
|
|
864
941
|
let itemLabel = newCloseLabel(index);
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
type: Close,
|
|
869
|
-
closeCurrentLabel: option.closeCurrentLabel,
|
|
870
|
-
props: {}
|
|
871
|
-
});
|
|
942
|
+
let choice = new ChoiceMenuOptionClose(option.text, option.closeCurrentLabel);
|
|
943
|
+
choice.label = itemLabel;
|
|
944
|
+
options.push(choice);
|
|
872
945
|
return;
|
|
873
946
|
}
|
|
874
947
|
let label = getLabelById(option.label);
|
|
875
948
|
if (label) {
|
|
876
|
-
let itemLabel = new Label(label.id, label.steps,
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
})
|
|
949
|
+
let itemLabel = new Label(label.id, label.steps, {
|
|
950
|
+
onStepStart: label.onStepStart,
|
|
951
|
+
choiseIndex: index
|
|
952
|
+
});
|
|
953
|
+
options.push(new ChoiceMenuOption(option.text, itemLabel, option.props, option.type));
|
|
880
954
|
}
|
|
881
955
|
});
|
|
882
956
|
return options;
|
|
@@ -1029,8 +1103,9 @@ exports.FadeAlphaTicker = __decorateClass([
|
|
|
1029
1103
|
], exports.FadeAlphaTicker);
|
|
1030
1104
|
|
|
1031
1105
|
// src/functions/TickerUtility.ts
|
|
1032
|
-
function updateTickerProgression(args, propertyName, progression) {
|
|
1033
|
-
|
|
1106
|
+
function updateTickerProgression(args, propertyName, progression, valueConvert) {
|
|
1107
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
1108
|
+
if (args[propertyName] === void 0 || !progression || args[propertyName] === limit) {
|
|
1034
1109
|
return;
|
|
1035
1110
|
}
|
|
1036
1111
|
if (typeof args[propertyName] === "number") {
|
|
@@ -1049,22 +1124,25 @@ function updateTickerProgression(args, propertyName, progression) {
|
|
|
1049
1124
|
}
|
|
1050
1125
|
}
|
|
1051
1126
|
}
|
|
1052
|
-
function getLinearProgression(number, progression) {
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
return
|
|
1127
|
+
function getLinearProgression(number, progression, valueConvert) {
|
|
1128
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
1129
|
+
let amt = valueConvert ? valueConvert(progression.amt) : progression.amt;
|
|
1130
|
+
if (limit !== void 0) {
|
|
1131
|
+
if (number > limit && amt > 0) {
|
|
1132
|
+
return limit;
|
|
1133
|
+
} else if (number < limit && amt < 0) {
|
|
1134
|
+
return limit;
|
|
1058
1135
|
}
|
|
1059
1136
|
}
|
|
1060
|
-
return number +
|
|
1137
|
+
return number + amt;
|
|
1061
1138
|
}
|
|
1062
|
-
function getExponentialProgression(number, progression) {
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1139
|
+
function getExponentialProgression(number, progression, valueConvert) {
|
|
1140
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
1141
|
+
if (limit !== void 0) {
|
|
1142
|
+
if (number > limit && progression.percentage > 0) {
|
|
1143
|
+
return limit;
|
|
1144
|
+
} else if (number < limit && progression.percentage < 0) {
|
|
1145
|
+
return limit;
|
|
1068
1146
|
}
|
|
1069
1147
|
}
|
|
1070
1148
|
return number + number * progression.percentage;
|
|
@@ -1077,15 +1155,13 @@ exports.MoveTicker = class MoveTicker extends TickerBase {
|
|
|
1077
1155
|
let ySpeed = 1;
|
|
1078
1156
|
if (args.speed) {
|
|
1079
1157
|
if (typeof args.speed === "number") {
|
|
1080
|
-
xSpeed = args.speed;
|
|
1081
|
-
ySpeed = args.speed;
|
|
1158
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1159
|
+
ySpeed = this.speedConvert(args.speed);
|
|
1082
1160
|
} else {
|
|
1083
|
-
xSpeed = args.speed.x;
|
|
1084
|
-
ySpeed = args.speed.y;
|
|
1161
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1162
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
1085
1163
|
}
|
|
1086
1164
|
}
|
|
1087
|
-
xSpeed /= 60;
|
|
1088
|
-
ySpeed /= 60;
|
|
1089
1165
|
let destination = args.destination;
|
|
1090
1166
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
1091
1167
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -1125,7 +1201,10 @@ exports.MoveTicker = class MoveTicker extends TickerBase {
|
|
|
1125
1201
|
}
|
|
1126
1202
|
});
|
|
1127
1203
|
if (args.speedProgression)
|
|
1128
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1204
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1205
|
+
}
|
|
1206
|
+
speedConvert(speed) {
|
|
1207
|
+
return speed / 6;
|
|
1129
1208
|
}
|
|
1130
1209
|
};
|
|
1131
1210
|
exports.MoveTicker = __decorateClass([
|
|
@@ -1133,7 +1212,7 @@ exports.MoveTicker = __decorateClass([
|
|
|
1133
1212
|
], exports.MoveTicker);
|
|
1134
1213
|
exports.RotateTicker = class RotateTicker extends TickerBase {
|
|
1135
1214
|
fn(ticker, args, tags, tickerId) {
|
|
1136
|
-
let speed = (args.speed === void 0 ? 1 : args.speed)
|
|
1215
|
+
let speed = this.speedConvert(args.speed === void 0 ? 1 : args.speed);
|
|
1137
1216
|
let clockwise = args.clockwise === void 0 ? true : args.clockwise;
|
|
1138
1217
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
1139
1218
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -1161,7 +1240,10 @@ exports.RotateTicker = class RotateTicker extends TickerBase {
|
|
|
1161
1240
|
}
|
|
1162
1241
|
});
|
|
1163
1242
|
if (args.speedProgression)
|
|
1164
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1243
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1244
|
+
}
|
|
1245
|
+
speedConvert(speed) {
|
|
1246
|
+
return speed / 60;
|
|
1165
1247
|
}
|
|
1166
1248
|
};
|
|
1167
1249
|
exports.RotateTicker = __decorateClass([
|
|
@@ -1173,15 +1255,13 @@ exports.ZoomTicker = class ZoomTicker extends TickerBase {
|
|
|
1173
1255
|
let ySpeed = 0.1;
|
|
1174
1256
|
if (args.speed) {
|
|
1175
1257
|
if (typeof args.speed === "number") {
|
|
1176
|
-
xSpeed = args.speed;
|
|
1177
|
-
ySpeed = args.speed;
|
|
1258
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1259
|
+
ySpeed = this.speedConvert(args.speed);
|
|
1178
1260
|
} else {
|
|
1179
|
-
xSpeed = args.speed.x;
|
|
1180
|
-
ySpeed = args.speed.y;
|
|
1261
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1262
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
1181
1263
|
}
|
|
1182
1264
|
}
|
|
1183
|
-
xSpeed /= 60;
|
|
1184
|
-
ySpeed /= 60;
|
|
1185
1265
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
1186
1266
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
1187
1267
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
@@ -1248,7 +1328,10 @@ exports.ZoomTicker = class ZoomTicker extends TickerBase {
|
|
|
1248
1328
|
}
|
|
1249
1329
|
});
|
|
1250
1330
|
if (args.speedProgression)
|
|
1251
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1331
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1332
|
+
}
|
|
1333
|
+
speedConvert(speed) {
|
|
1334
|
+
return speed / 60;
|
|
1252
1335
|
}
|
|
1253
1336
|
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
1254
1337
|
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
@@ -1271,7 +1354,7 @@ var ZoomInOutTicker = class extends exports.ZoomTicker {
|
|
|
1271
1354
|
};
|
|
1272
1355
|
|
|
1273
1356
|
// src/constants.ts
|
|
1274
|
-
var PIXIVN_VERSION = "0.6.
|
|
1357
|
+
var PIXIVN_VERSION = "0.6.6";
|
|
1275
1358
|
var Repeat = "repeat";
|
|
1276
1359
|
function Pause(duration) {
|
|
1277
1360
|
return {
|
|
@@ -1456,14 +1539,14 @@ function zoomIn(_0, _1) {
|
|
|
1456
1539
|
} else {
|
|
1457
1540
|
canvasElement = image;
|
|
1458
1541
|
}
|
|
1459
|
-
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1460
|
-
yield canvasElement.load();
|
|
1461
|
-
}
|
|
1462
1542
|
let container = new CanvasContainer();
|
|
1463
1543
|
container.addChild(canvasElement);
|
|
1464
1544
|
container.height = GameWindowManager.canvasHeight;
|
|
1465
1545
|
container.width = GameWindowManager.canvasWidth;
|
|
1466
1546
|
GameWindowManager.addCanvasElement(tag, container);
|
|
1547
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1548
|
+
yield canvasElement.load();
|
|
1549
|
+
}
|
|
1467
1550
|
if (props.direction == "up") {
|
|
1468
1551
|
container.pivot.y = GameWindowManager.canvasHeight;
|
|
1469
1552
|
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
@@ -1536,6 +1619,37 @@ function zoomOut(tag, props = { direction: "right" }, priority) {
|
|
|
1536
1619
|
GameWindowManager.addTicker(tag, effect);
|
|
1537
1620
|
}
|
|
1538
1621
|
|
|
1622
|
+
// src/functions/Importer.ts
|
|
1623
|
+
function importPixiVNJson(data) {
|
|
1624
|
+
if (Array.isArray(data)) {
|
|
1625
|
+
data.forEach((label) => {
|
|
1626
|
+
importPixiVNJson(label);
|
|
1627
|
+
});
|
|
1628
|
+
return;
|
|
1629
|
+
}
|
|
1630
|
+
try {
|
|
1631
|
+
if (typeof data === "string") {
|
|
1632
|
+
data = JSON.parse(data);
|
|
1633
|
+
}
|
|
1634
|
+
} catch (e) {
|
|
1635
|
+
console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON", e);
|
|
1636
|
+
return;
|
|
1637
|
+
}
|
|
1638
|
+
if (typeof data !== "object") {
|
|
1639
|
+
console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON: data is not an object");
|
|
1640
|
+
return;
|
|
1641
|
+
}
|
|
1642
|
+
for (const labelId in data) {
|
|
1643
|
+
try {
|
|
1644
|
+
const steps = data[labelId];
|
|
1645
|
+
let label = new LabelJson2(labelId, steps);
|
|
1646
|
+
saveLabel(label);
|
|
1647
|
+
} catch (e) {
|
|
1648
|
+
console.error(`[Pixi'VN] Error creating JSON label ${labelId}`, e);
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1539
1653
|
// src/functions/SavesUtility.ts
|
|
1540
1654
|
function getSaveData() {
|
|
1541
1655
|
return {
|
|
@@ -1551,13 +1665,17 @@ function getSaveJson() {
|
|
|
1551
1665
|
return JSON.stringify(saveData);
|
|
1552
1666
|
}
|
|
1553
1667
|
function loadSaveData(data, navigate) {
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1668
|
+
return __async(this, null, function* () {
|
|
1669
|
+
yield GameStepManager.import(data.stepData);
|
|
1670
|
+
GameStorageManager.import(data.storageData);
|
|
1671
|
+
GameWindowManager.import(data.canvasData);
|
|
1672
|
+
navigate(data.path);
|
|
1673
|
+
});
|
|
1558
1674
|
}
|
|
1559
1675
|
function loadSaveJson(dataString, navigate) {
|
|
1560
|
-
|
|
1676
|
+
return __async(this, null, function* () {
|
|
1677
|
+
yield loadSaveData(jsonToSaveData(dataString), navigate);
|
|
1678
|
+
});
|
|
1561
1679
|
}
|
|
1562
1680
|
function jsonToSaveData(json) {
|
|
1563
1681
|
return JSON.parse(json);
|
|
@@ -2512,6 +2630,16 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2512
2630
|
static set originalStepData(value) {
|
|
2513
2631
|
_GameStepManager._originalStepData = createExportableElement(value);
|
|
2514
2632
|
}
|
|
2633
|
+
static get currentStepData() {
|
|
2634
|
+
let currentStepData = {
|
|
2635
|
+
path: window.location.pathname,
|
|
2636
|
+
storage: GameStorageManager.export(),
|
|
2637
|
+
canvas: GameWindowManager.export(),
|
|
2638
|
+
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2639
|
+
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2640
|
+
};
|
|
2641
|
+
return currentStepData;
|
|
2642
|
+
}
|
|
2515
2643
|
/* Edit History Methods */
|
|
2516
2644
|
/**
|
|
2517
2645
|
* Add a label to the history.
|
|
@@ -2519,19 +2647,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2519
2647
|
*/
|
|
2520
2648
|
static addStepHistory(step, choiseMade) {
|
|
2521
2649
|
let stepHistory = getStepSha1(step);
|
|
2522
|
-
let
|
|
2523
|
-
path: window.location.pathname,
|
|
2524
|
-
storage: GameStorageManager.export(),
|
|
2525
|
-
canvas: GameWindowManager.export(),
|
|
2526
|
-
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2527
|
-
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2528
|
-
};
|
|
2650
|
+
let currentStepData = _GameStepManager.currentStepData;
|
|
2529
2651
|
if (_GameStepManager.originalStepData) {
|
|
2530
|
-
if (_GameStepManager.originalStepData.openedLabels.length ===
|
|
2652
|
+
if (_GameStepManager.originalStepData.openedLabels.length === currentStepData.openedLabels.length) {
|
|
2531
2653
|
try {
|
|
2532
2654
|
let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
|
|
2533
|
-
let historyStepOpenedLabelsString = JSON.stringify(
|
|
2534
|
-
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path ===
|
|
2655
|
+
let historyStepOpenedLabelsString = JSON.stringify(currentStepData.openedLabels);
|
|
2656
|
+
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === currentStepData.path && _GameStepManager.originalStepData.labelIndex === currentStepData.labelIndex) {
|
|
2535
2657
|
return;
|
|
2536
2658
|
}
|
|
2537
2659
|
} catch (e) {
|
|
@@ -2539,7 +2661,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2539
2661
|
}
|
|
2540
2662
|
}
|
|
2541
2663
|
}
|
|
2542
|
-
let data = deepDiff.diff(_GameStepManager.originalStepData,
|
|
2664
|
+
let data = deepDiff.diff(_GameStepManager.originalStepData, currentStepData);
|
|
2543
2665
|
if (data) {
|
|
2544
2666
|
let dialoge = void 0;
|
|
2545
2667
|
let requiredChoices = void 0;
|
|
@@ -2558,7 +2680,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2558
2680
|
index: _GameStepManager.lastStepIndex,
|
|
2559
2681
|
choiceIndexMade: choiseMade
|
|
2560
2682
|
});
|
|
2561
|
-
_GameStepManager.originalStepData =
|
|
2683
|
+
_GameStepManager.originalStepData = currentStepData;
|
|
2562
2684
|
}
|
|
2563
2685
|
_GameStepManager.increaseLastStepIndex();
|
|
2564
2686
|
}
|
|
@@ -2649,6 +2771,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2649
2771
|
console.warn("[Pixi'VN] The player must make a choice");
|
|
2650
2772
|
return;
|
|
2651
2773
|
}
|
|
2774
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2775
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2776
|
+
}
|
|
2652
2777
|
_GameStepManager.increaseCurrentStepIndex();
|
|
2653
2778
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2654
2779
|
});
|
|
@@ -2673,6 +2798,10 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2673
2798
|
return;
|
|
2674
2799
|
}
|
|
2675
2800
|
if (currentLabel.steps.length > currentLabelStepIndex) {
|
|
2801
|
+
let onStepRun = currentLabel.onStepStart;
|
|
2802
|
+
if (onStepRun) {
|
|
2803
|
+
yield onStepRun(currentLabelStepIndex, currentLabel);
|
|
2804
|
+
}
|
|
2676
2805
|
let step = currentLabel.steps[currentLabelStepIndex];
|
|
2677
2806
|
let result = yield step(props);
|
|
2678
2807
|
_GameStepManager.addStepHistory(step, choiseMade);
|
|
@@ -2737,6 +2866,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2737
2866
|
if (!tempLabel) {
|
|
2738
2867
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2739
2868
|
}
|
|
2869
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2870
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2871
|
+
}
|
|
2740
2872
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2741
2873
|
} catch (e) {
|
|
2742
2874
|
console.error("[Pixi'VN] Error calling label", e);
|
|
@@ -2795,6 +2927,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2795
2927
|
if (!tempLabel) {
|
|
2796
2928
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2797
2929
|
}
|
|
2930
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2931
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2932
|
+
}
|
|
2798
2933
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2799
2934
|
} catch (e) {
|
|
2800
2935
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
@@ -2900,24 +3035,29 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2900
3035
|
* ```
|
|
2901
3036
|
*/
|
|
2902
3037
|
static goBack(navigate, steps = 1) {
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
3038
|
+
return __async(this, null, function* () {
|
|
3039
|
+
if (steps <= 0) {
|
|
3040
|
+
console.warn("[Pixi'VN] Steps must be greater than 0");
|
|
3041
|
+
return;
|
|
3042
|
+
}
|
|
3043
|
+
if (_GameStepManager._stepsHistory.length <= 1) {
|
|
3044
|
+
console.warn("[Pixi'VN] No steps to go back");
|
|
3045
|
+
return;
|
|
3046
|
+
}
|
|
3047
|
+
let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
|
|
3048
|
+
if (restoredStep) {
|
|
3049
|
+
_GameStepManager._originalStepData = restoredStep;
|
|
3050
|
+
_GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
|
|
3051
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
3052
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
3053
|
+
}
|
|
3054
|
+
GameStorageManager.import(createExportableElement(restoredStep.storage));
|
|
3055
|
+
GameWindowManager.import(createExportableElement(restoredStep.canvas));
|
|
3056
|
+
navigate(restoredStep.path);
|
|
3057
|
+
} else {
|
|
3058
|
+
console.error("[Pixi'VN] Error going back");
|
|
3059
|
+
}
|
|
3060
|
+
});
|
|
2921
3061
|
}
|
|
2922
3062
|
static goBackInternal(steps, restoredStep) {
|
|
2923
3063
|
if (steps <= 0) {
|
|
@@ -2979,38 +3119,45 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2979
3119
|
* @param dataString The history in a JSON string.
|
|
2980
3120
|
*/
|
|
2981
3121
|
static importJson(dataString) {
|
|
2982
|
-
|
|
3122
|
+
return __async(this, null, function* () {
|
|
3123
|
+
yield _GameStepManager.import(JSON.parse(dataString));
|
|
3124
|
+
});
|
|
2983
3125
|
}
|
|
2984
3126
|
/**
|
|
2985
3127
|
* Import the history from an object.
|
|
2986
3128
|
* @param data The history in an object.
|
|
2987
3129
|
*/
|
|
2988
3130
|
static import(data) {
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3131
|
+
return __async(this, null, function* () {
|
|
3132
|
+
_GameStepManager.clear();
|
|
3133
|
+
try {
|
|
3134
|
+
if (data.hasOwnProperty("stepsHistory")) {
|
|
3135
|
+
_GameStepManager._stepsHistory = data["stepsHistory"];
|
|
3136
|
+
} else {
|
|
3137
|
+
console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
|
|
3138
|
+
}
|
|
3139
|
+
if (data.hasOwnProperty("openedLabels")) {
|
|
3140
|
+
_GameStepManager._openedLabels = data["openedLabels"];
|
|
3141
|
+
} else {
|
|
3142
|
+
console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
|
|
3143
|
+
}
|
|
3144
|
+
if (data.hasOwnProperty("lastStepIndex")) {
|
|
3145
|
+
_GameStepManager._lastStepIndex = data["lastStepIndex"];
|
|
3146
|
+
} else {
|
|
3147
|
+
console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
|
|
3148
|
+
}
|
|
3149
|
+
if (data.hasOwnProperty("originalStepData")) {
|
|
3150
|
+
_GameStepManager._originalStepData = data["originalStepData"];
|
|
3151
|
+
} else {
|
|
3152
|
+
console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
|
|
3153
|
+
}
|
|
3154
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
3155
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
3156
|
+
}
|
|
3157
|
+
} catch (e) {
|
|
3158
|
+
console.error("[Pixi'VN] Error importing data", e);
|
|
3010
3159
|
}
|
|
3011
|
-
}
|
|
3012
|
-
console.error("[Pixi'VN] Error importing data", e);
|
|
3013
|
-
}
|
|
3160
|
+
});
|
|
3014
3161
|
}
|
|
3015
3162
|
};
|
|
3016
3163
|
/**
|
|
@@ -3182,11 +3329,59 @@ var DialogueBaseModel = class {
|
|
|
3182
3329
|
}
|
|
3183
3330
|
};
|
|
3184
3331
|
|
|
3332
|
+
// src/classes/LabelJson.ts
|
|
3333
|
+
var LabelJson2 = class extends LabelAbstract {
|
|
3334
|
+
/**
|
|
3335
|
+
* @param id is the id of the label
|
|
3336
|
+
* @param steps is the list of steps that the label will perform
|
|
3337
|
+
* @param props is the properties of the label
|
|
3338
|
+
*/
|
|
3339
|
+
constructor(id, steps, props) {
|
|
3340
|
+
super(id, props);
|
|
3341
|
+
this._steps = steps;
|
|
3342
|
+
}
|
|
3343
|
+
/**
|
|
3344
|
+
* Get the steps of the label.
|
|
3345
|
+
*/
|
|
3346
|
+
get steps() {
|
|
3347
|
+
if (typeof this._steps === "function") {
|
|
3348
|
+
return this._steps().map(this.stepConverter);
|
|
3349
|
+
}
|
|
3350
|
+
return this._steps.map(this.stepConverter);
|
|
3351
|
+
}
|
|
3352
|
+
stepConverter(step) {
|
|
3353
|
+
return (props) => {
|
|
3354
|
+
if (step.currentChoiceMenuOptions) {
|
|
3355
|
+
setChoiceMenuOptions(step.currentChoiceMenuOptions);
|
|
3356
|
+
} else {
|
|
3357
|
+
clearChoiceMenuOptions();
|
|
3358
|
+
}
|
|
3359
|
+
if (step.dialog) {
|
|
3360
|
+
setDialogue(step.dialog);
|
|
3361
|
+
} else {
|
|
3362
|
+
clearDialogue();
|
|
3363
|
+
}
|
|
3364
|
+
if (step.labelToOpen) {
|
|
3365
|
+
if (step.labelToOpen.type === "jump") {
|
|
3366
|
+
GameStepManager.jumpLabel(step.labelToOpen.labelId, props);
|
|
3367
|
+
} else {
|
|
3368
|
+
GameStepManager.callLabel(step.labelToOpen.labelId, props);
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
if (step.end === "game_end") {
|
|
3372
|
+
console.warn("[Pixi'VN] Game end not implemented");
|
|
3373
|
+
} else if (step.end === "label_end") {
|
|
3374
|
+
GameStepManager.closeCurrentLabel();
|
|
3375
|
+
}
|
|
3376
|
+
};
|
|
3377
|
+
}
|
|
3378
|
+
};
|
|
3379
|
+
|
|
3185
3380
|
// src/labels/TestConstant.ts
|
|
3186
3381
|
var juliette = new CharacterBaseModel2("___pixivn_juliette___", {
|
|
3187
3382
|
name: "Juliette",
|
|
3188
3383
|
age: 25,
|
|
3189
|
-
icon: "https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-square.webp?alt=media
|
|
3384
|
+
icon: "https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-square.webp?alt=media",
|
|
3190
3385
|
color: "#ac0086"
|
|
3191
3386
|
});
|
|
3192
3387
|
saveCharacter(juliette);
|
|
@@ -3231,10 +3426,16 @@ var baseCanvasElementTestLabel = newLabel(
|
|
|
3231
3426
|
removeCanvasElement("container");
|
|
3232
3427
|
setDialogue({
|
|
3233
3428
|
character: juliette,
|
|
3234
|
-
text: `Here's what's going to happen: I'm going to create some
|
|
3429
|
+
text: `Here's what's going to happen: I'm going to create some CanvasText with different styles and put them on the stage.
|
|
3235
3430
|
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)).`
|
|
3236
3431
|
});
|
|
3237
|
-
const
|
|
3432
|
+
const basicStyle = new pixi_js.TextStyle({
|
|
3433
|
+
fill: "#ffffff"
|
|
3434
|
+
});
|
|
3435
|
+
const basicText = new CanvasText({
|
|
3436
|
+
text: "Basic text in pixi",
|
|
3437
|
+
style: basicStyle
|
|
3438
|
+
});
|
|
3238
3439
|
basicText.x = 50;
|
|
3239
3440
|
basicText.y = 100;
|
|
3240
3441
|
GameWindowManager.addCanvasElement("basicText", basicText);
|
|
@@ -3252,7 +3453,7 @@ But it will generate a warn message, because the FillGradient or FillPattern has
|
|
|
3252
3453
|
fill: { fill },
|
|
3253
3454
|
stroke: { color: "#4a1850", width: 5, join: "round" },
|
|
3254
3455
|
dropShadow: {
|
|
3255
|
-
color: "#
|
|
3456
|
+
color: "#ff5f74",
|
|
3256
3457
|
blur: 4,
|
|
3257
3458
|
angle: Math.PI / 6,
|
|
3258
3459
|
distance: 6
|
|
@@ -3305,36 +3506,30 @@ EventTest1 = __decorateClass([
|
|
|
3305
3506
|
eventDecorator("___pixi_vn_canvas_events_test_event1___")
|
|
3306
3507
|
], EventTest1);
|
|
3307
3508
|
var EventTest2 = class extends CanvasEvent {
|
|
3308
|
-
constructor() {
|
|
3309
|
-
super(...arguments);
|
|
3310
|
-
this.textureButtonDown = pixi_js.Texture.from("https://pixijs.com/assets/button_down.png");
|
|
3311
|
-
this.textureButtonOver = pixi_js.Texture.from("https://pixijs.com/assets/button_over.png");
|
|
3312
|
-
this.textureButton = pixi_js.Texture.from("https://pixijs.com/assets/button.png");
|
|
3313
|
-
}
|
|
3314
3509
|
fn(event, sprite) {
|
|
3315
3510
|
if (event === "pointerdown") {
|
|
3316
3511
|
sprite.isdown = true;
|
|
3317
|
-
sprite.texture =
|
|
3512
|
+
sprite.texture = pixi_js.Texture.from("https://pixijs.com/assets/button_down.png");
|
|
3318
3513
|
sprite.alpha = 1;
|
|
3319
3514
|
} else if (event === "pointerup" || event === "pointerupoutside") {
|
|
3320
3515
|
sprite.isdown = false;
|
|
3321
3516
|
if (sprite.isOver) {
|
|
3322
|
-
sprite.texture =
|
|
3517
|
+
sprite.texture = pixi_js.Texture.from("https://pixijs.com/assets/button_over.png");
|
|
3323
3518
|
} else {
|
|
3324
|
-
sprite.texture =
|
|
3519
|
+
sprite.texture = pixi_js.Texture.from("https://pixijs.com/assets/button.png");
|
|
3325
3520
|
}
|
|
3326
3521
|
} else if (event === "pointerover") {
|
|
3327
3522
|
sprite.isOver = true;
|
|
3328
3523
|
if (sprite.isdown) {
|
|
3329
3524
|
return;
|
|
3330
3525
|
}
|
|
3331
|
-
sprite.texture =
|
|
3526
|
+
sprite.texture = pixi_js.Texture.from("https://pixijs.com/assets/button_over.png");
|
|
3332
3527
|
} else if (event === "pointerout") {
|
|
3333
3528
|
sprite.isOver = false;
|
|
3334
3529
|
if (sprite.isdown) {
|
|
3335
3530
|
return;
|
|
3336
3531
|
}
|
|
3337
|
-
sprite.texture =
|
|
3532
|
+
sprite.texture = pixi_js.Texture.from("https://pixijs.com/assets/button.png");
|
|
3338
3533
|
}
|
|
3339
3534
|
}
|
|
3340
3535
|
};
|
|
@@ -3356,6 +3551,7 @@ var canvasEventsTestLabel = newLabel(
|
|
|
3356
3551
|
});
|
|
3357
3552
|
const texture = yield pixi_js.Assets.load(bunnyImage);
|
|
3358
3553
|
const sprite = CanvasSprite.from(texture);
|
|
3554
|
+
sprite.scale.set(3);
|
|
3359
3555
|
sprite.anchor.set(0.5);
|
|
3360
3556
|
sprite.x = GameWindowManager.screen.width / 2;
|
|
3361
3557
|
sprite.y = GameWindowManager.screen.height / 2;
|
|
@@ -3371,12 +3567,11 @@ var canvasEventsTestLabel = newLabel(
|
|
|
3371
3567
|
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).)`
|
|
3372
3568
|
});
|
|
3373
3569
|
const backgroundT = yield pixi_js.Assets.load("https://pixijs.com/assets/bg_button.jpg");
|
|
3374
|
-
const background = CanvasSprite
|
|
3570
|
+
const background = new CanvasSprite(backgroundT);
|
|
3375
3571
|
background.width = GameWindowManager.screen.width;
|
|
3376
3572
|
background.height = GameWindowManager.screen.height;
|
|
3377
3573
|
GameWindowManager.addCanvasElement("bg", background);
|
|
3378
|
-
const
|
|
3379
|
-
const textureButton = CanvasSprite.from(textureButtonT);
|
|
3574
|
+
const textureButton = yield pixi_js.Assets.load("https://pixijs.com/assets/button.png");
|
|
3380
3575
|
const buttons = [];
|
|
3381
3576
|
const buttonPositions = [175, 75, 655, 75, 410, 325, 150, 465, 685, 445];
|
|
3382
3577
|
for (let i = 0; i < 5; i++) {
|
|
@@ -3396,7 +3591,17 @@ var canvasEventsTestLabel = newLabel(
|
|
|
3396
3591
|
buttons[4].scale.set(0.8, 1.2);
|
|
3397
3592
|
buttons[4].rotation = Math.PI;
|
|
3398
3593
|
})
|
|
3399
|
-
]
|
|
3594
|
+
],
|
|
3595
|
+
{
|
|
3596
|
+
onLoadStep: () => __async(void 0, null, function* () {
|
|
3597
|
+
yield pixi_js.Assets.load([
|
|
3598
|
+
"https://pixijs.com/assets/bg_button.jpg",
|
|
3599
|
+
"https://pixijs.com/assets/button.png",
|
|
3600
|
+
"https://pixijs.com/assets/button_down.png",
|
|
3601
|
+
"https://pixijs.com/assets/button_over.png"
|
|
3602
|
+
]);
|
|
3603
|
+
})
|
|
3604
|
+
}
|
|
3400
3605
|
);
|
|
3401
3606
|
var AlienTintingTest = class extends CanvasSprite {
|
|
3402
3607
|
constructor() {
|
|
@@ -3516,13 +3721,13 @@ var imagesAnimationsTest = newLabel(IMAGE_ANIMAIONS_TEST_LABEL, [
|
|
|
3516
3721
|
() => __async(void 0, null, function* () {
|
|
3517
3722
|
setDialogue({ character: juliette, text: "Here's what they can do." });
|
|
3518
3723
|
setChoiceMenuOptions([
|
|
3519
|
-
new ChoiceMenuOption("Dissolve effect", imagesDissolveTest),
|
|
3520
|
-
new ChoiceMenuOption("Fade effect", imagesFadeTest),
|
|
3521
|
-
new ChoiceMenuOption("Rotate", imagesRotateTest),
|
|
3522
|
-
new ChoiceMenuOption("Move", imagesMoveTest),
|
|
3523
|
-
new ChoiceMenuOption("Zoom", imagesZoomTest),
|
|
3524
|
-
new ChoiceMenuOption("Move in/out", imagesMoveInOutTest),
|
|
3525
|
-
new ChoiceMenuOption("Zoom in/out", imagesZoomInOutTest),
|
|
3724
|
+
new ChoiceMenuOption("Dissolve effect", imagesDissolveTest, {}),
|
|
3725
|
+
new ChoiceMenuOption("Fade effect", imagesFadeTest, {}),
|
|
3726
|
+
new ChoiceMenuOption("Rotate", imagesRotateTest, {}),
|
|
3727
|
+
new ChoiceMenuOption("Move", imagesMoveTest, {}),
|
|
3728
|
+
new ChoiceMenuOption("Zoom", imagesZoomTest, {}),
|
|
3729
|
+
new ChoiceMenuOption("Move in/out", imagesMoveInOutTest, {}),
|
|
3730
|
+
new ChoiceMenuOption("Zoom in/out", imagesZoomInOutTest, {}),
|
|
3526
3731
|
new ChoiceMenuOptionClose("Cancel", true)
|
|
3527
3732
|
]);
|
|
3528
3733
|
}),
|
|
@@ -3632,8 +3837,8 @@ var imagesRotateTest = newLabel("___pixi_vn_images_rotate_test___", [
|
|
|
3632
3837
|
text: `Here's what's going to happen:
|
|
3633
3838
|
- ${eggHeadName} will rotate with a anchor set to 0.
|
|
3634
3839
|
- ${flowerTopName} will rotate with a anchor set to 0.5 and a exponential speed progression.
|
|
3635
|
-
- ${helmlokName} will rotate with a anchor set to 0.5, rotate 2
|
|
3636
|
-
- ${skullyName} will rotate with a anchor set to 1, rotate 3
|
|
3840
|
+
- ${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.
|
|
3841
|
+
- ${skullyName} will rotate with a anchor set to 1, rotate 3 seconds clockwise, wait for 0.5 seconds, and rotate 7 seconds counterclockwise.`
|
|
3637
3842
|
});
|
|
3638
3843
|
let eggHead = GameWindowManager.getCanvasElement("eggHead");
|
|
3639
3844
|
if (eggHead)
|
|
@@ -3686,10 +3891,10 @@ var imagesMoveTest = newLabel("___pixi_vn_images_move_test___", [
|
|
|
3686
3891
|
setDialogue({
|
|
3687
3892
|
character: juliette,
|
|
3688
3893
|
text: `Here's what's going to happen:
|
|
3689
|
-
- ${eggHeadName} will move to { x: 500, y: 100 } with a speed of
|
|
3690
|
-
- ${flowerTopName} will move to { x: 500, y: 300 } with a speed of
|
|
3691
|
-
- ${helmlokName} will move to
|
|
3692
|
-
- ${skullyName} will move to { x: 500, y: 500 } with a speed of
|
|
3894
|
+
- ${eggHeadName} will move to { x: 500, y: 100 } with a speed of 24.
|
|
3895
|
+
- ${flowerTopName} will move to { x: 500, y: 300 } with a speed of 18.
|
|
3896
|
+
- ${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.
|
|
3897
|
+
- ${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.`
|
|
3693
3898
|
});
|
|
3694
3899
|
GameWindowManager.addTicker("eggHead", new exports.MoveTicker({
|
|
3695
3900
|
destination: { x: 500, y: 100 },
|
|
@@ -3702,25 +3907,25 @@ var imagesMoveTest = newLabel("___pixi_vn_images_move_test___", [
|
|
|
3702
3907
|
GameWindowManager.addTickersSteps("helmlok", [
|
|
3703
3908
|
new exports.MoveTicker({
|
|
3704
3909
|
destination: { x: 100, y: 500 },
|
|
3705
|
-
speed:
|
|
3706
|
-
speedProgression: { type: "linear", amt: -
|
|
3910
|
+
speed: 150,
|
|
3911
|
+
speedProgression: { type: "linear", amt: -2, limit: 10 }
|
|
3707
3912
|
}),
|
|
3708
3913
|
new exports.MoveTicker({
|
|
3709
3914
|
destination: { x: 1700, y: 500 },
|
|
3710
|
-
speed:
|
|
3711
|
-
speedProgression: { type: "linear", amt:
|
|
3915
|
+
speed: 10,
|
|
3916
|
+
speedProgression: { type: "linear", amt: 2, limit: 150 }
|
|
3712
3917
|
}),
|
|
3713
3918
|
Repeat
|
|
3714
3919
|
]);
|
|
3715
3920
|
GameWindowManager.addTickersSteps("skully", [
|
|
3716
3921
|
new exports.MoveTicker({
|
|
3717
3922
|
destination: { x: 500, y: 500 },
|
|
3718
|
-
speed:
|
|
3923
|
+
speed: 40
|
|
3719
3924
|
}),
|
|
3720
3925
|
Pause(0.5),
|
|
3721
3926
|
new exports.MoveTicker({
|
|
3722
3927
|
destination: { x: 100, y: 100 },
|
|
3723
|
-
speed:
|
|
3928
|
+
speed: 40
|
|
3724
3929
|
})
|
|
3725
3930
|
]);
|
|
3726
3931
|
}
|
|
@@ -3782,37 +3987,45 @@ var imagesMoveInOutTest = newLabel("___pixi_vn_images_move_in_out_test___", [
|
|
|
3782
3987
|
setDialogue({
|
|
3783
3988
|
character: juliette,
|
|
3784
3989
|
text: `Here's what's going to happen:
|
|
3785
|
-
- ${eggHeadName} will move in from the top with a speed of
|
|
3786
|
-
- ${flowerTopName} will move in from the right with a speed of
|
|
3787
|
-
- ${helmlokName} will move in from the left with a speed of
|
|
3788
|
-
- ${skullyName} will move in from the bottom with a speed of
|
|
3990
|
+
- ${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.
|
|
3991
|
+
- ${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.
|
|
3992
|
+
- ${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.
|
|
3993
|
+
- ${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.`
|
|
3789
3994
|
});
|
|
3790
3995
|
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3791
3996
|
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
3792
3997
|
let helmlok = new CanvasImage({ x: 100, y: 300 }, helmlokImage);
|
|
3793
3998
|
let skully = new CanvasImage({ x: 300, y: 300 }, skullyImage);
|
|
3794
|
-
moveIn("eggHead", eggHead, { speed:
|
|
3999
|
+
moveIn("eggHead", eggHead, { speed: 80, direction: "down" });
|
|
3795
4000
|
moveIn("flowerTop", flowerTop, {
|
|
3796
|
-
speed:
|
|
4001
|
+
speed: 80,
|
|
3797
4002
|
direction: "left",
|
|
3798
4003
|
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3799
4004
|
});
|
|
3800
|
-
moveIn("helmlok", helmlok, { speed:
|
|
4005
|
+
moveIn("helmlok", helmlok, { speed: 80, direction: "right" });
|
|
3801
4006
|
moveIn("skully", skully, {
|
|
3802
|
-
speed:
|
|
4007
|
+
speed: 80,
|
|
3803
4008
|
direction: "up",
|
|
3804
4009
|
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3805
4010
|
});
|
|
3806
4011
|
}),
|
|
3807
4012
|
() => {
|
|
3808
|
-
moveOut("eggHead", { speed:
|
|
3809
|
-
moveOut("flowerTop", { speed:
|
|
3810
|
-
moveOut("helmlok", { speed:
|
|
3811
|
-
moveOut("skully", { speed:
|
|
4013
|
+
moveOut("eggHead", { speed: 80, direction: "down" });
|
|
4014
|
+
moveOut("flowerTop", { speed: 80, direction: "left" });
|
|
4015
|
+
moveOut("helmlok", { speed: 80, direction: "right" });
|
|
4016
|
+
moveOut("skully", { speed: 80, direction: "up" });
|
|
3812
4017
|
}
|
|
3813
4018
|
]);
|
|
3814
4019
|
var imagesZoomInOutTest = newLabel("___pixi_vn_images_zoom_in_out_test___", [
|
|
3815
4020
|
() => __async(void 0, null, function* () {
|
|
4021
|
+
setDialogue({
|
|
4022
|
+
character: juliette,
|
|
4023
|
+
text: `Here's what's going to happen:
|
|
4024
|
+
- ${eggHeadName} will zoom in with a speed of 3. If you go next, ${eggHeadName} will zoom out with a speed of 3.
|
|
4025
|
+
- ${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.
|
|
4026
|
+
- ${helmlokName} will zoom in with a speed of 3. If you go next, ${helmlokName} will zoom out with a speed of 1.
|
|
4027
|
+
- ${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.`
|
|
4028
|
+
});
|
|
3816
4029
|
GameWindowManager.removeCanvasElements();
|
|
3817
4030
|
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3818
4031
|
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
@@ -3838,7 +4051,7 @@ var imagesZoomInOutTest = newLabel("___pixi_vn_images_zoom_in_out_test___", [
|
|
|
3838
4051
|
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3839
4052
|
});
|
|
3840
4053
|
zoomOut("flowerTop", { speed: 3, direction: "left" });
|
|
3841
|
-
zoomOut("helmlok", { speed:
|
|
4054
|
+
zoomOut("helmlok", { speed: 1, direction: "right" });
|
|
3842
4055
|
zoomOut("skully", {
|
|
3843
4056
|
speed: 3,
|
|
3844
4057
|
direction: "up",
|
|
@@ -3920,6 +4133,23 @@ Footer
|
|
|
3920
4133
|
})
|
|
3921
4134
|
]);
|
|
3922
4135
|
|
|
4136
|
+
// src/labels/StepLabelTest.ts
|
|
4137
|
+
var STEP_LABEL_TEST_LABEL = "___pixi_vn_step_label_test___";
|
|
4138
|
+
var stepLabelTestLAbel = newLabel(STEP_LABEL_TEST_LABEL, [
|
|
4139
|
+
() => __async(void 0, null, function* () {
|
|
4140
|
+
setDialogue({ character: juliette, text: `Pixi'VN manages the succession of "screens" with steps. Each step is a function that can be asynchronous.` });
|
|
4141
|
+
}),
|
|
4142
|
+
() => __async(void 0, null, function* () {
|
|
4143
|
+
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." });
|
|
4144
|
+
}),
|
|
4145
|
+
() => __async(void 0, null, function* () {
|
|
4146
|
+
setDialogue({ character: juliette, text: "It is also possible to ask the player to make a choice." });
|
|
4147
|
+
}),
|
|
4148
|
+
() => __async(void 0, null, function* () {
|
|
4149
|
+
setDialogue({ character: juliette, text: "Browsing through available tests is one way to test the steps/labels system." });
|
|
4150
|
+
})
|
|
4151
|
+
]);
|
|
4152
|
+
|
|
3923
4153
|
// src/labels/StartLabel.ts
|
|
3924
4154
|
var pixivnTestStartLabel = newLabel(
|
|
3925
4155
|
"___pixi_vn_example_start_label___",
|
|
@@ -3928,25 +4158,25 @@ var pixivnTestStartLabel = newLabel(
|
|
|
3928
4158
|
let currentTimeName = "";
|
|
3929
4159
|
const hour = (/* @__PURE__ */ new Date()).getHours();
|
|
3930
4160
|
if (hour >= 5 && hour < 12) {
|
|
3931
|
-
currentTimeName = "morning";
|
|
4161
|
+
currentTimeName = "morning\u{1F505}";
|
|
3932
4162
|
} else if (hour >= 12 && hour < 18) {
|
|
3933
|
-
currentTimeName = "afternoon";
|
|
4163
|
+
currentTimeName = "afternoon\u{1F506}";
|
|
3934
4164
|
} else if (hour >= 18 && hour < 22) {
|
|
3935
|
-
currentTimeName = "evening";
|
|
4165
|
+
currentTimeName = "evening\u26C5";
|
|
3936
4166
|
} else {
|
|
3937
|
-
currentTimeName = "night";
|
|
4167
|
+
currentTimeName = "night\u{1F319}";
|
|
3938
4168
|
}
|
|
3939
4169
|
setDialogue({ character: juliette, text: `Good ${currentTimeName}! I'm ${juliette.name}, your virtual assistant. I'm here to help you with your tests.` });
|
|
3940
4170
|
},
|
|
3941
|
-
() => setDialogue({ character: juliette, text: `You are running the Pixi\u2019VN test. This test will guide you through the different features of the library.` }),
|
|
4171
|
+
() => 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.` }),
|
|
3942
4172
|
(props) => GameStepManager.jumpLabel(pixivnTestStartLabel2, props)
|
|
3943
4173
|
]
|
|
3944
4174
|
);
|
|
3945
|
-
var
|
|
3946
|
-
"
|
|
4175
|
+
var openLink = newLabel(
|
|
4176
|
+
"___pixi_vn_open_link___",
|
|
3947
4177
|
[
|
|
3948
4178
|
(props) => {
|
|
3949
|
-
window.open(
|
|
4179
|
+
window.open(props.link);
|
|
3950
4180
|
GameStepManager.goNext(props);
|
|
3951
4181
|
}
|
|
3952
4182
|
]
|
|
@@ -3959,12 +4189,14 @@ var pixivnTestStartLabel2 = newLabel(
|
|
|
3959
4189
|
GameWindowManager.clear();
|
|
3960
4190
|
setDialogue({ character: juliette, text: "Which test would you like to start with?" });
|
|
3961
4191
|
setChoiceMenuOptions([
|
|
3962
|
-
new ChoiceMenuOption("Open Pixi\u2019VN Wiki",
|
|
3963
|
-
new ChoiceMenuOption("Images, Transitions and Animations Test", imagesAnimationsTest),
|
|
3964
|
-
new ChoiceMenuOption("Canvas Events Test
|
|
3965
|
-
new ChoiceMenuOption("Base Canvas Element Test", baseCanvasElementTestLabel),
|
|
3966
|
-
new ChoiceMenuOption("Custom Ticker Canvas Element Test", customTickerCanvasElementTestLabel),
|
|
3967
|
-
new ChoiceMenuOption("
|
|
4192
|
+
new ChoiceMenuOption("Open Pixi\u2019VN Wiki", openLink, { link: "https://pixi-vn.web.app/" }),
|
|
4193
|
+
new ChoiceMenuOption("Images, Transitions and Animations Test", imagesAnimationsTest, {}),
|
|
4194
|
+
new ChoiceMenuOption("Canvas Events Test", canvasEventsTestLabel, {}),
|
|
4195
|
+
new ChoiceMenuOption("Base Canvas Element Test", baseCanvasElementTestLabel, {}),
|
|
4196
|
+
new ChoiceMenuOption("Custom Ticker Canvas Element Test", customTickerCanvasElementTestLabel, {}),
|
|
4197
|
+
new ChoiceMenuOption("Steps and Labels Test", stepLabelTestLAbel, {}),
|
|
4198
|
+
new ChoiceMenuOption("Markdown Test", markdownTest, {}),
|
|
4199
|
+
new ChoiceMenuOption("Open Pixi\u2019VN Github Issues", openLink, { link: "https://github.com/DRincs-Productions/pixi-vn/issues" })
|
|
3968
4200
|
]);
|
|
3969
4201
|
},
|
|
3970
4202
|
(props) => GameStepManager.jumpLabel(RESTART_TEST_LABEL, props)
|
|
@@ -3990,6 +4222,7 @@ exports.GameStepManager = GameStepManager;
|
|
|
3990
4222
|
exports.GameStorageManager = GameStorageManager;
|
|
3991
4223
|
exports.GameWindowManager = GameWindowManager;
|
|
3992
4224
|
exports.Label = Label;
|
|
4225
|
+
exports.LabelJson = LabelJson2;
|
|
3993
4226
|
exports.Pause = Pause;
|
|
3994
4227
|
exports.Repeat = Repeat;
|
|
3995
4228
|
exports.StoredClassModel = StoredClassModel;
|
|
@@ -4010,6 +4243,7 @@ exports.getLabelById = getLabelById;
|
|
|
4010
4243
|
exports.getSaveData = getSaveData;
|
|
4011
4244
|
exports.getSaveJson = getSaveJson;
|
|
4012
4245
|
exports.getTexture = getTexture;
|
|
4246
|
+
exports.importPixiVNJson = importPixiVNJson;
|
|
4013
4247
|
exports.juliette = juliette;
|
|
4014
4248
|
exports.loadImage = loadImage;
|
|
4015
4249
|
exports.loadSaveData = loadSaveData;
|