@drincs/pixi-vn 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{TickerBase-BAUiHet_.d.ts → TickerBase-3rLpDpmb.d.ts} +9 -0
- package/dist/{TickerBase-BctFf13y.d.mts → TickerBase-DKYzbzro.d.mts} +9 -0
- package/dist/classes/CanvasEvent.d.mts +6 -0
- package/dist/classes/CanvasEvent.d.ts +6 -0
- package/dist/classes/CanvasEvent.js +7 -0
- package/dist/classes/CanvasEvent.js.map +1 -1
- package/dist/classes/CanvasEvent.mjs +7 -0
- package/dist/classes/CanvasEvent.mjs.map +1 -1
- package/dist/classes/CharacterBaseModel.js +93 -65
- package/dist/classes/CharacterBaseModel.js.map +1 -1
- package/dist/classes/CharacterBaseModel.mjs +93 -65
- package/dist/classes/CharacterBaseModel.mjs.map +1 -1
- package/dist/classes/ChoiceMenuOption.js +94 -66
- package/dist/classes/ChoiceMenuOption.js.map +1 -1
- package/dist/classes/ChoiceMenuOption.mjs +94 -66
- package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
- package/dist/classes/CloseLabel.js +1 -1
- package/dist/classes/CloseLabel.js.map +1 -1
- package/dist/classes/CloseLabel.mjs +1 -1
- package/dist/classes/CloseLabel.mjs.map +1 -1
- package/dist/classes/DialogueBaseModel.d.mts +2 -2
- package/dist/classes/DialogueBaseModel.d.ts +2 -2
- package/dist/classes/DialogueBaseModel.js +5 -5
- package/dist/classes/DialogueBaseModel.js.map +1 -1
- package/dist/classes/DialogueBaseModel.mjs +5 -5
- package/dist/classes/DialogueBaseModel.mjs.map +1 -1
- package/dist/classes/Label.d.mts +1 -1
- package/dist/classes/Label.d.ts +1 -1
- package/dist/classes/Label.js +1 -1
- package/dist/classes/Label.js.map +1 -1
- package/dist/classes/Label.mjs +1 -1
- package/dist/classes/Label.mjs.map +1 -1
- package/dist/classes/StoredClassModel.js +93 -65
- package/dist/classes/StoredClassModel.js.map +1 -1
- package/dist/classes/StoredClassModel.mjs +93 -65
- package/dist/classes/StoredClassModel.mjs.map +1 -1
- package/dist/classes/canvas/CanvasBase.d.mts +5 -1
- package/dist/classes/canvas/CanvasBase.d.ts +5 -1
- package/dist/classes/canvas/CanvasBase.js +7 -0
- package/dist/classes/canvas/CanvasBase.js.map +1 -1
- package/dist/classes/canvas/CanvasBase.mjs +7 -0
- package/dist/classes/canvas/CanvasBase.mjs.map +1 -1
- package/dist/classes/canvas/CanvasContainer.d.mts +4 -1
- package/dist/classes/canvas/CanvasContainer.d.ts +4 -1
- package/dist/classes/canvas/CanvasContainer.js +57 -37
- package/dist/classes/canvas/CanvasContainer.js.map +1 -1
- package/dist/classes/canvas/CanvasContainer.mjs +57 -38
- package/dist/classes/canvas/CanvasContainer.mjs.map +1 -1
- package/dist/classes/canvas/CanvasImage.d.mts +4 -2
- package/dist/classes/canvas/CanvasImage.d.ts +4 -2
- package/dist/classes/canvas/CanvasImage.js +33 -20
- package/dist/classes/canvas/CanvasImage.js.map +1 -1
- package/dist/classes/canvas/CanvasImage.mjs +30 -20
- package/dist/classes/canvas/CanvasImage.mjs.map +1 -1
- package/dist/classes/canvas/CanvasSprite.d.mts +5 -2
- package/dist/classes/canvas/CanvasSprite.d.ts +5 -2
- package/dist/classes/canvas/CanvasSprite.js +25 -17
- package/dist/classes/canvas/CanvasSprite.js.map +1 -1
- package/dist/classes/canvas/CanvasSprite.mjs +25 -18
- package/dist/classes/canvas/CanvasSprite.mjs.map +1 -1
- package/dist/classes/canvas/CanvasText.d.mts +6 -3
- package/dist/classes/canvas/CanvasText.d.ts +6 -3
- package/dist/classes/canvas/CanvasText.js +25 -17
- package/dist/classes/canvas/CanvasText.js.map +1 -1
- package/dist/classes/canvas/CanvasText.mjs +25 -18
- package/dist/classes/canvas/CanvasText.mjs.map +1 -1
- package/dist/classes/canvas/index.js +184 -158
- package/dist/classes/canvas/index.js.map +1 -1
- package/dist/classes/canvas/index.mjs +184 -158
- package/dist/classes/canvas/index.mjs.map +1 -1
- package/dist/classes/index.d.mts +1 -0
- package/dist/classes/index.d.ts +1 -0
- package/dist/classes/index.js +106 -71
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +106 -71
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/ticker/FadeAlphaTicker.d.mts +2 -1
- package/dist/classes/ticker/FadeAlphaTicker.d.ts +2 -1
- package/dist/classes/ticker/FadeAlphaTicker.js +93 -65
- package/dist/classes/ticker/FadeAlphaTicker.js.map +1 -1
- package/dist/classes/ticker/FadeAlphaTicker.mjs +93 -65
- package/dist/classes/ticker/FadeAlphaTicker.mjs.map +1 -1
- package/dist/classes/ticker/MoveTicker.d.mts +2 -1
- package/dist/classes/ticker/MoveTicker.d.ts +2 -1
- package/dist/classes/ticker/MoveTicker.js +93 -65
- package/dist/classes/ticker/MoveTicker.js.map +1 -1
- package/dist/classes/ticker/MoveTicker.mjs +93 -65
- package/dist/classes/ticker/MoveTicker.mjs.map +1 -1
- package/dist/classes/ticker/RotateTicker.d.mts +2 -1
- package/dist/classes/ticker/RotateTicker.d.ts +2 -1
- package/dist/classes/ticker/RotateTicker.js +93 -65
- package/dist/classes/ticker/RotateTicker.js.map +1 -1
- package/dist/classes/ticker/RotateTicker.mjs +93 -65
- package/dist/classes/ticker/RotateTicker.mjs.map +1 -1
- package/dist/classes/ticker/TickerBase.d.mts +2 -1
- package/dist/classes/ticker/TickerBase.d.ts +2 -1
- package/dist/classes/ticker/TickerBase.js +5 -0
- package/dist/classes/ticker/TickerBase.js.map +1 -1
- package/dist/classes/ticker/TickerBase.mjs +5 -0
- package/dist/classes/ticker/TickerBase.mjs.map +1 -1
- package/dist/classes/ticker/ZoomTicker.d.mts +9 -3
- package/dist/classes/ticker/ZoomTicker.d.ts +9 -3
- package/dist/classes/ticker/ZoomTicker.js +108 -66
- package/dist/classes/ticker/ZoomTicker.js.map +1 -1
- package/dist/classes/ticker/ZoomTicker.mjs +106 -66
- package/dist/classes/ticker/ZoomTicker.mjs.map +1 -1
- package/dist/classes/ticker/index.d.mts +2 -1
- package/dist/classes/ticker/index.d.ts +2 -1
- package/dist/classes/ticker/index.js +230 -202
- package/dist/classes/ticker/index.js.map +1 -1
- package/dist/classes/ticker/index.mjs +230 -202
- 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.d.mts +3 -3
- package/dist/decorators/CanvasElementDecorator.d.ts +3 -3
- package/dist/decorators/CanvasElementDecorator.js +63 -43
- package/dist/decorators/CanvasElementDecorator.js.map +1 -1
- package/dist/decorators/CanvasElementDecorator.mjs +62 -42
- package/dist/decorators/CanvasElementDecorator.mjs.map +1 -1
- package/dist/decorators/EventDecorator.d.mts +7 -7
- package/dist/decorators/EventDecorator.d.ts +7 -7
- package/dist/decorators/EventDecorator.js +11 -10
- package/dist/decorators/EventDecorator.js.map +1 -1
- package/dist/decorators/EventDecorator.mjs +10 -9
- package/dist/decorators/EventDecorator.mjs.map +1 -1
- package/dist/decorators/LabelDecorator.js +94 -66
- package/dist/decorators/LabelDecorator.js.map +1 -1
- package/dist/decorators/LabelDecorator.mjs +94 -66
- package/dist/decorators/LabelDecorator.mjs.map +1 -1
- package/dist/decorators/TickerDecorator.d.mts +5 -5
- package/dist/decorators/TickerDecorator.d.ts +5 -5
- package/dist/decorators/TickerDecorator.js +6 -5
- package/dist/decorators/TickerDecorator.js.map +1 -1
- package/dist/decorators/TickerDecorator.mjs +6 -5
- package/dist/decorators/TickerDecorator.mjs.map +1 -1
- package/dist/decorators/index.d.mts +1 -1
- package/dist/decorators/index.d.ts +1 -1
- package/dist/decorators/index.js +96 -66
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +96 -66
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/CanvasUtility.js +56 -37
- package/dist/functions/CanvasUtility.js.map +1 -1
- package/dist/functions/CanvasUtility.mjs +56 -37
- package/dist/functions/CanvasUtility.mjs.map +1 -1
- package/dist/functions/DialogueUtility.d.mts +1 -1
- package/dist/functions/DialogueUtility.d.ts +1 -1
- package/dist/functions/DialogueUtility.js +240 -201
- package/dist/functions/DialogueUtility.js.map +1 -1
- package/dist/functions/DialogueUtility.mjs +240 -201
- package/dist/functions/DialogueUtility.mjs.map +1 -1
- package/dist/functions/FlagsUtility.js +93 -65
- package/dist/functions/FlagsUtility.js.map +1 -1
- package/dist/functions/FlagsUtility.mjs +93 -65
- package/dist/functions/FlagsUtility.mjs.map +1 -1
- package/dist/functions/GameUtility.js +93 -65
- package/dist/functions/GameUtility.js.map +1 -1
- package/dist/functions/GameUtility.mjs +93 -65
- package/dist/functions/GameUtility.mjs.map +1 -1
- package/dist/functions/ImageUtility.d.mts +35 -2
- package/dist/functions/ImageUtility.d.ts +35 -2
- package/dist/functions/ImageUtility.js +371 -186
- package/dist/functions/ImageUtility.js.map +1 -1
- package/dist/functions/ImageUtility.mjs +368 -187
- package/dist/functions/ImageUtility.mjs.map +1 -1
- package/dist/functions/SavesUtility.d.mts +2 -2
- package/dist/functions/SavesUtility.d.ts +2 -2
- package/dist/functions/SavesUtility.js +141 -71
- package/dist/functions/SavesUtility.js.map +1 -1
- package/dist/functions/SavesUtility.mjs +141 -71
- package/dist/functions/SavesUtility.mjs.map +1 -1
- package/dist/functions/index.d.mts +6 -3
- package/dist/functions/index.d.ts +6 -3
- package/dist/functions/index.js +277 -81
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +275 -83
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +644 -153
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +642 -155
- package/dist/index.mjs.map +1 -1
- package/dist/interface/IHistoryStep.d.mts +2 -2
- package/dist/interface/IHistoryStep.d.ts +2 -2
- package/dist/interface/ISaveData.d.mts +2 -2
- package/dist/interface/ISaveData.d.ts +2 -2
- package/dist/interface/ITicker.d.mts +2 -1
- package/dist/interface/ITicker.d.ts +2 -1
- package/dist/interface/ITickersSteps.d.mts +12 -3
- package/dist/interface/ITickersSteps.d.ts +12 -3
- package/dist/interface/TickerHistory.d.mts +3 -3
- package/dist/interface/TickerHistory.d.ts +3 -3
- package/dist/interface/canvas/ICanvasBaseMemory.d.mts +1 -1
- package/dist/interface/canvas/ICanvasBaseMemory.d.ts +1 -1
- package/dist/interface/canvas/ICanvasImageMemory.d.mts +2 -2
- package/dist/interface/canvas/ICanvasImageMemory.d.ts +2 -2
- package/dist/interface/canvas/ICanvasSpriteMemory.d.mts +1 -2
- package/dist/interface/canvas/ICanvasSpriteMemory.d.ts +1 -2
- package/dist/interface/canvas/ICanvasTextTextMemory.d.mts +1 -2
- package/dist/interface/canvas/ICanvasTextTextMemory.d.ts +1 -2
- package/dist/interface/export/ExportedCanvas.d.mts +2 -2
- package/dist/interface/export/ExportedCanvas.d.ts +2 -2
- package/dist/interface/export/ExportedStep.d.mts +2 -2
- package/dist/interface/export/ExportedStep.d.ts +2 -2
- package/dist/interface/export/index.d.mts +2 -2
- package/dist/interface/export/index.d.ts +2 -2
- package/dist/interface/index.d.mts +2 -2
- package/dist/interface/index.d.ts +2 -2
- package/dist/labels/BaseCanvasElementTestLabel.js +400 -372
- package/dist/labels/BaseCanvasElementTestLabel.js.map +1 -1
- package/dist/labels/BaseCanvasElementTestLabel.mjs +401 -373
- package/dist/labels/BaseCanvasElementTestLabel.mjs.map +1 -1
- package/dist/labels/{EventsTestLabel.d.mts → CanvasEventsTestLabel.d.mts} +4 -7
- package/dist/labels/{EventsTestLabel.d.ts → CanvasEventsTestLabel.d.ts} +4 -7
- package/dist/labels/{EventsTestLabel.js → CanvasEventsTestLabel.js} +320 -98
- package/dist/labels/CanvasEventsTestLabel.js.map +1 -0
- package/dist/labels/{EventsTestLabel.mjs → CanvasEventsTestLabel.mjs} +320 -98
- package/dist/labels/CanvasEventsTestLabel.mjs.map +1 -0
- package/dist/labels/{TintingTestLabel.d.mts → CustomTickerCanvasElementTestLabel.d.mts} +5 -4
- package/dist/labels/{TintingTestLabel.d.ts → CustomTickerCanvasElementTestLabel.d.ts} +5 -4
- package/dist/labels/CustomTickerCanvasElementTestLabel.js +2792 -0
- package/dist/labels/CustomTickerCanvasElementTestLabel.js.map +1 -0
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs +2786 -0
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs.map +1 -0
- package/dist/labels/{ShowImageTest.js → ImagesAnimationsTestLabel.js} +373 -82
- package/dist/labels/ImagesAnimationsTestLabel.js.map +1 -0
- package/dist/labels/{ShowImageTest.mjs → ImagesAnimationsTestLabel.mjs} +373 -82
- package/dist/labels/ImagesAnimationsTestLabel.mjs.map +1 -0
- package/dist/labels/MarkdownTest.js +150 -80
- package/dist/labels/MarkdownTest.js.map +1 -1
- package/dist/labels/MarkdownTest.mjs +150 -80
- package/dist/labels/MarkdownTest.mjs.map +1 -1
- package/dist/labels/StartLabel.js +689 -152
- package/dist/labels/StartLabel.js.map +1 -1
- package/dist/labels/StartLabel.mjs +690 -153
- package/dist/labels/StartLabel.mjs.map +1 -1
- package/dist/labels/TestConstant.d.mts +3 -1
- package/dist/labels/TestConstant.d.ts +3 -1
- package/dist/labels/TestConstant.js +97 -65
- package/dist/labels/TestConstant.js.map +1 -1
- package/dist/labels/TestConstant.mjs +96 -66
- package/dist/labels/TestConstant.mjs.map +1 -1
- package/dist/labels/TickerTestLabel.js +472 -402
- package/dist/labels/TickerTestLabel.js.map +1 -1
- package/dist/labels/TickerTestLabel.mjs +473 -403
- package/dist/labels/TickerTestLabel.mjs.map +1 -1
- package/dist/labels/index.js +689 -152
- package/dist/labels/index.js.map +1 -1
- package/dist/labels/index.mjs +690 -153
- package/dist/labels/index.mjs.map +1 -1
- package/dist/managers/StepManager.d.mts +5 -4
- package/dist/managers/StepManager.d.ts +5 -4
- package/dist/managers/StepManager.js +140 -70
- package/dist/managers/StepManager.js.map +1 -1
- package/dist/managers/StepManager.mjs +140 -70
- package/dist/managers/StepManager.mjs.map +1 -1
- package/dist/managers/WindowManager.d.mts +1 -1
- package/dist/managers/WindowManager.d.ts +1 -1
- package/dist/managers/WindowManager.js +84 -60
- package/dist/managers/WindowManager.js.map +1 -1
- package/dist/managers/WindowManager.mjs +84 -60
- package/dist/managers/WindowManager.mjs.map +1 -1
- package/dist/managers/index.d.mts +2 -2
- package/dist/managers/index.d.ts +2 -2
- package/dist/managers/index.js +140 -70
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +140 -70
- package/dist/managers/index.mjs.map +1 -1
- package/dist/types/ticker/MoveTickerProps.d.mts +1 -1
- package/dist/types/ticker/MoveTickerProps.d.ts +1 -1
- package/dist/types/ticker/RotateTickerProps.d.mts +1 -1
- package/dist/types/ticker/RotateTickerProps.d.ts +1 -1
- package/package.json +1 -1
- package/dist/labels/EventsTestLabel.js.map +0 -1
- package/dist/labels/EventsTestLabel.mjs.map +0 -1
- package/dist/labels/ShowImageTest.js.map +0 -1
- package/dist/labels/ShowImageTest.mjs.map +0 -1
- package/dist/labels/TintingTestLabel.js +0 -1786
- package/dist/labels/TintingTestLabel.js.map +0 -1
- package/dist/labels/TintingTestLabel.mjs +0 -1780
- package/dist/labels/TintingTestLabel.mjs.map +0 -1
- /package/dist/labels/{ShowImageTest.d.mts → ImagesAnimationsTestLabel.d.mts} +0 -0
- /package/dist/labels/{ShowImageTest.d.ts → ImagesAnimationsTestLabel.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -59,6 +59,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
59
59
|
|
|
60
60
|
// src/classes/CanvasEvent.ts
|
|
61
61
|
var CanvasEvent = class {
|
|
62
|
+
constructor() {
|
|
63
|
+
/**
|
|
64
|
+
* Get the id of the event. This variable is used in the system to get the event by id, {@link getEventInstanceById}
|
|
65
|
+
*/
|
|
66
|
+
this.id = "event_id_not_set";
|
|
67
|
+
this.id = this.constructor.prototype.id;
|
|
68
|
+
}
|
|
62
69
|
fn(_event, _element) {
|
|
63
70
|
throw new Error("[Pixi'VN] The method CanvasEvent.fn() must be overridden");
|
|
64
71
|
}
|
|
@@ -86,7 +93,7 @@ var Label = class {
|
|
|
86
93
|
this._choiseIndex = choiseIndex;
|
|
87
94
|
}
|
|
88
95
|
/**
|
|
89
|
-
* Get the id of the label
|
|
96
|
+
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
90
97
|
*/
|
|
91
98
|
get id() {
|
|
92
99
|
return this._id;
|
|
@@ -163,6 +170,13 @@ function getLabelById(id) {
|
|
|
163
170
|
return label;
|
|
164
171
|
}
|
|
165
172
|
var CanvasBase = class extends pixi_js.Container {
|
|
173
|
+
constructor() {
|
|
174
|
+
super(...arguments);
|
|
175
|
+
/**
|
|
176
|
+
* Get the id of the canvas element. This variable is used in the system to get the canvas element by id, {@link getCanvasElementInstanceById}
|
|
177
|
+
*/
|
|
178
|
+
this.pixivnId = "canvas_element_id_not_set";
|
|
179
|
+
}
|
|
166
180
|
/**
|
|
167
181
|
* This method return the memory of the canvas element.
|
|
168
182
|
*/
|
|
@@ -189,17 +203,23 @@ function exportCanvasElement(element) {
|
|
|
189
203
|
return element.memory;
|
|
190
204
|
}
|
|
191
205
|
function importCanvasElement(memory) {
|
|
192
|
-
let element =
|
|
206
|
+
let element = getCanvasElementInstanceById(memory.pixivnId);
|
|
193
207
|
if (element) {
|
|
194
208
|
element.memory = memory;
|
|
195
209
|
} else {
|
|
196
|
-
throw new Error("[Pixi'VN] The element " + memory.
|
|
210
|
+
throw new Error("[Pixi'VN] The element " + memory.pixivnId + " could not be created");
|
|
197
211
|
}
|
|
198
212
|
return element;
|
|
199
213
|
}
|
|
200
214
|
|
|
201
215
|
// src/classes/canvas/CanvasContainer.ts
|
|
216
|
+
var CANVAS_CONTAINER_ID = "CanvasContainer";
|
|
202
217
|
var CanvasContainer = class extends pixi_js.Container {
|
|
218
|
+
constructor(options) {
|
|
219
|
+
super(options);
|
|
220
|
+
this.pixivnId = CANVAS_CONTAINER_ID;
|
|
221
|
+
this.pixivnId = this.constructor.prototype.pixivnId;
|
|
222
|
+
}
|
|
203
223
|
get memory() {
|
|
204
224
|
let memory = getMemoryContainer(this);
|
|
205
225
|
this.children.forEach((child) => {
|
|
@@ -215,8 +235,12 @@ var CanvasContainer = class extends pixi_js.Container {
|
|
|
215
235
|
}
|
|
216
236
|
};
|
|
217
237
|
function getMemoryContainer(element) {
|
|
238
|
+
let className = "CanvasContainer";
|
|
239
|
+
if (element.hasOwnProperty("pixivnId")) {
|
|
240
|
+
className = element.pixivnId;
|
|
241
|
+
}
|
|
218
242
|
return {
|
|
219
|
-
|
|
243
|
+
pixivnId: className,
|
|
220
244
|
elements: [],
|
|
221
245
|
width: element.width,
|
|
222
246
|
height: element.height,
|
|
@@ -340,43 +364,47 @@ function eventDecorator(name) {
|
|
|
340
364
|
if (registeredEvents[name]) {
|
|
341
365
|
console.info(`[Pixi'VN] Event ${name} already exists, it will be overwritten`);
|
|
342
366
|
}
|
|
367
|
+
target.prototype.id = name;
|
|
343
368
|
registeredEvents[name] = target;
|
|
344
369
|
};
|
|
345
370
|
}
|
|
346
|
-
function
|
|
371
|
+
function getEventTypeById(eventId) {
|
|
347
372
|
try {
|
|
348
|
-
let eventType = registeredEvents[
|
|
373
|
+
let eventType = registeredEvents[eventId];
|
|
349
374
|
if (!eventType) {
|
|
350
|
-
console.error(`[Pixi'VN] Event ${
|
|
375
|
+
console.error(`[Pixi'VN] Event ${eventId} not found`);
|
|
351
376
|
return;
|
|
352
377
|
}
|
|
353
378
|
new eventType();
|
|
354
379
|
return eventType;
|
|
355
380
|
} catch (e) {
|
|
356
|
-
console.error(`[Pixi'VN] Error while getting Event ${
|
|
381
|
+
console.error(`[Pixi'VN] Error while getting Event ${eventId}`, e);
|
|
357
382
|
return;
|
|
358
383
|
}
|
|
359
384
|
}
|
|
360
|
-
function
|
|
385
|
+
function getEventInstanceById(eventId) {
|
|
361
386
|
try {
|
|
362
|
-
let eventType = registeredEvents[
|
|
387
|
+
let eventType = registeredEvents[eventId];
|
|
363
388
|
if (!eventType) {
|
|
364
|
-
console.error(`[Pixi'VN] Event ${
|
|
389
|
+
console.error(`[Pixi'VN] Event ${eventId} not found`);
|
|
365
390
|
return;
|
|
366
391
|
}
|
|
367
392
|
let event = new eventType();
|
|
368
393
|
return event;
|
|
369
394
|
} catch (e) {
|
|
370
|
-
console.error(`[Pixi'VN] Error while getting Event ${
|
|
395
|
+
console.error(`[Pixi'VN] Error while getting Event ${eventId}`, e);
|
|
371
396
|
return;
|
|
372
397
|
}
|
|
373
398
|
}
|
|
374
399
|
|
|
375
400
|
// src/classes/canvas/CanvasSprite.ts
|
|
401
|
+
var CANVAS_SPRITE_ID = "CanvasSprite";
|
|
376
402
|
var CanvasSprite = class _CanvasSprite extends pixi_js.Sprite {
|
|
377
|
-
constructor() {
|
|
378
|
-
super(
|
|
403
|
+
constructor(options) {
|
|
404
|
+
super(options);
|
|
405
|
+
this.pixivnId = CANVAS_SPRITE_ID;
|
|
379
406
|
this._onEvents = {};
|
|
407
|
+
this.pixivnId = this.constructor.prototype.pixivnId;
|
|
380
408
|
}
|
|
381
409
|
get memory() {
|
|
382
410
|
return getMemorySprite(this);
|
|
@@ -417,9 +445,9 @@ var CanvasSprite = class _CanvasSprite extends pixi_js.Sprite {
|
|
|
417
445
|
* ```
|
|
418
446
|
*/
|
|
419
447
|
onEvent(event, eventClass) {
|
|
420
|
-
let
|
|
421
|
-
let instance =
|
|
422
|
-
this._onEvents[event] =
|
|
448
|
+
let id = eventClass.prototype.id;
|
|
449
|
+
let instance = getEventInstanceById(id);
|
|
450
|
+
this._onEvents[event] = id;
|
|
423
451
|
if (instance) {
|
|
424
452
|
super.on(event, () => {
|
|
425
453
|
instance.fn(event, this);
|
|
@@ -448,7 +476,7 @@ var CanvasSprite = class _CanvasSprite extends pixi_js.Sprite {
|
|
|
448
476
|
function getMemorySprite(element) {
|
|
449
477
|
let temp = getMemoryContainer(element);
|
|
450
478
|
return __spreadProps(__spreadValues({}, temp), {
|
|
451
|
-
|
|
479
|
+
pixivnId: element.pixivnId,
|
|
452
480
|
textureImage: getTextureMemory(element.texture),
|
|
453
481
|
anchor: { x: element.anchor.x, y: element.anchor.y },
|
|
454
482
|
roundPixels: element.roundPixels,
|
|
@@ -471,8 +499,8 @@ function setMemorySprite(element, memory) {
|
|
|
471
499
|
}
|
|
472
500
|
memory.roundPixels && (element.roundPixels = memory.roundPixels);
|
|
473
501
|
for (let event in memory.onEvents) {
|
|
474
|
-
let
|
|
475
|
-
let instance =
|
|
502
|
+
let id = memory.onEvents[event];
|
|
503
|
+
let instance = getEventTypeById(id);
|
|
476
504
|
if (instance) {
|
|
477
505
|
element.onEvent(event, instance);
|
|
478
506
|
}
|
|
@@ -480,9 +508,11 @@ function setMemorySprite(element, memory) {
|
|
|
480
508
|
}
|
|
481
509
|
|
|
482
510
|
// src/classes/canvas/CanvasImage.ts
|
|
511
|
+
var CANVAS_IMAGE_ID = "CanvasImage";
|
|
483
512
|
var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
484
513
|
constructor(options, imageLink) {
|
|
485
514
|
super(options);
|
|
515
|
+
this.pixivnId = CANVAS_IMAGE_ID;
|
|
486
516
|
this.imageLink = "";
|
|
487
517
|
if (imageLink) {
|
|
488
518
|
this.imageLink = imageLink;
|
|
@@ -490,12 +520,13 @@ var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
|
490
520
|
}
|
|
491
521
|
get memory() {
|
|
492
522
|
return __spreadProps(__spreadValues({}, getMemorySprite(this)), {
|
|
493
|
-
|
|
494
|
-
|
|
523
|
+
pixivnId: this.pixivnId,
|
|
524
|
+
imageLink: this.imageLink
|
|
495
525
|
});
|
|
496
526
|
}
|
|
497
527
|
set memory(memory) {
|
|
498
528
|
setMemorySprite(this, memory);
|
|
529
|
+
this.imageLink = memory.imageLink;
|
|
499
530
|
}
|
|
500
531
|
static from(source, skipCache) {
|
|
501
532
|
let sprite = pixi_js.Sprite.from(source, skipCache);
|
|
@@ -523,10 +554,13 @@ var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
|
523
554
|
});
|
|
524
555
|
}
|
|
525
556
|
};
|
|
557
|
+
var CANVAS_TEXT_ID = "CanvasText";
|
|
526
558
|
var CanvasText = class extends pixi_js.Text {
|
|
527
|
-
constructor() {
|
|
528
|
-
super(
|
|
559
|
+
constructor(options) {
|
|
560
|
+
super(options);
|
|
561
|
+
this.pixivnId = CANVAS_TEXT_ID;
|
|
529
562
|
this._onEvents = {};
|
|
563
|
+
this.pixivnId = this.constructor.prototype.pixivnId;
|
|
530
564
|
}
|
|
531
565
|
get memory() {
|
|
532
566
|
return getMemoryText(this);
|
|
@@ -567,9 +601,9 @@ var CanvasText = class extends pixi_js.Text {
|
|
|
567
601
|
* ```
|
|
568
602
|
*/
|
|
569
603
|
onEvent(event, eventClass) {
|
|
570
|
-
let
|
|
571
|
-
let instance =
|
|
572
|
-
this._onEvents[event] =
|
|
604
|
+
let id = eventClass.prototype.id;
|
|
605
|
+
let instance = getEventInstanceById(id);
|
|
606
|
+
this._onEvents[event] = id;
|
|
573
607
|
if (instance) {
|
|
574
608
|
super.on(event, () => {
|
|
575
609
|
instance.fn(event, this);
|
|
@@ -592,7 +626,7 @@ var CanvasText = class extends pixi_js.Text {
|
|
|
592
626
|
function getMemoryText(element) {
|
|
593
627
|
let temp = getMemoryContainer(element);
|
|
594
628
|
return __spreadProps(__spreadValues({}, temp), {
|
|
595
|
-
|
|
629
|
+
pixivnId: element.pixivnId,
|
|
596
630
|
anchor: { x: element.anchor.x, y: element.anchor.y },
|
|
597
631
|
text: element.text,
|
|
598
632
|
resolution: element.resolution,
|
|
@@ -615,8 +649,8 @@ function setMemoryText(element, memory) {
|
|
|
615
649
|
memory.style && (element.style = memory.style);
|
|
616
650
|
memory.roundPixels && (element.roundPixels = memory.roundPixels);
|
|
617
651
|
for (let event in memory.onEvents) {
|
|
618
|
-
let
|
|
619
|
-
let instance =
|
|
652
|
+
let id = memory.onEvents[event];
|
|
653
|
+
let instance = getEventTypeById(id);
|
|
620
654
|
if (instance) {
|
|
621
655
|
element.onEvent(event, instance);
|
|
622
656
|
}
|
|
@@ -633,31 +667,32 @@ function canvasElementDecorator(name) {
|
|
|
633
667
|
if (registeredCanvasElement[name]) {
|
|
634
668
|
console.warn(`[Pixi'VN] CanvasElement ${name} already registered`);
|
|
635
669
|
}
|
|
670
|
+
target.prototype.pixivnId = name;
|
|
636
671
|
registeredCanvasElement[name] = target;
|
|
637
672
|
};
|
|
638
673
|
}
|
|
639
|
-
function
|
|
674
|
+
function getCanvasElementInstanceById(canvasId) {
|
|
640
675
|
try {
|
|
641
|
-
let eventType = registeredCanvasElement[
|
|
676
|
+
let eventType = registeredCanvasElement[canvasId];
|
|
642
677
|
if (!eventType) {
|
|
643
|
-
if (
|
|
678
|
+
if (canvasId === CANVAS_CONTAINER_ID) {
|
|
644
679
|
eventType = CanvasContainer;
|
|
645
|
-
} else if (
|
|
680
|
+
} else if (canvasId === CANVAS_IMAGE_ID) {
|
|
646
681
|
eventType = CanvasImage;
|
|
647
|
-
} else if (
|
|
682
|
+
} else if (canvasId === CANVAS_SPRITE_ID) {
|
|
648
683
|
eventType = CanvasSprite;
|
|
649
|
-
} else if (
|
|
684
|
+
} else if (canvasId === CANVAS_TEXT_ID) {
|
|
650
685
|
eventType = CanvasText;
|
|
651
686
|
}
|
|
652
687
|
}
|
|
653
688
|
if (!eventType) {
|
|
654
|
-
console.error(`[Pixi'VN] CanvasElement ${
|
|
689
|
+
console.error(`[Pixi'VN] CanvasElement ${canvasId} not found`);
|
|
655
690
|
return;
|
|
656
691
|
}
|
|
657
692
|
let canvasElement = new eventType();
|
|
658
693
|
return canvasElement;
|
|
659
694
|
} catch (e) {
|
|
660
|
-
console.error(`[Pixi'VN] Error while getting CanvasElement ${
|
|
695
|
+
console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasId}`, e);
|
|
661
696
|
return;
|
|
662
697
|
}
|
|
663
698
|
}
|
|
@@ -701,19 +736,20 @@ function tickerDecorator(name) {
|
|
|
701
736
|
if (registeredTickers[name]) {
|
|
702
737
|
console.info(`[Pixi'VN] Ticker ${name} already exists, it will be overwritten`);
|
|
703
738
|
}
|
|
739
|
+
target.prototype.id = name;
|
|
704
740
|
registeredTickers[name] = target;
|
|
705
741
|
};
|
|
706
742
|
}
|
|
707
|
-
function
|
|
743
|
+
function geTickerInstanceById(tickerId, args, duration, priority) {
|
|
708
744
|
try {
|
|
709
|
-
let ticker = registeredTickers[
|
|
745
|
+
let ticker = registeredTickers[tickerId];
|
|
710
746
|
if (!ticker) {
|
|
711
|
-
console.error(`[Pixi'VN] Ticker ${
|
|
747
|
+
console.error(`[Pixi'VN] Ticker ${tickerId} not found`);
|
|
712
748
|
return;
|
|
713
749
|
}
|
|
714
750
|
return new ticker(args, duration, priority);
|
|
715
751
|
} catch (e) {
|
|
716
|
-
console.error(`[Pixi'VN] Error while getting Ticker ${
|
|
752
|
+
console.error(`[Pixi'VN] Error while getting Ticker ${tickerId}`, e);
|
|
717
753
|
return;
|
|
718
754
|
}
|
|
719
755
|
}
|
|
@@ -776,21 +812,21 @@ var ChoiceMenuOptionClose = class {
|
|
|
776
812
|
// src/functions/DialogueUtility.ts
|
|
777
813
|
function setDialogue(props) {
|
|
778
814
|
let text = "";
|
|
779
|
-
let
|
|
815
|
+
let character = void 0;
|
|
780
816
|
let dialogue;
|
|
781
817
|
if (typeof props === "string") {
|
|
782
818
|
text = props;
|
|
783
|
-
dialogue = new DialogueBaseModel(text,
|
|
819
|
+
dialogue = new DialogueBaseModel(text, character);
|
|
784
820
|
} else if (!(props instanceof DialogueBaseModel)) {
|
|
785
821
|
text = props.text;
|
|
786
822
|
if (props.character) {
|
|
787
823
|
if (typeof props.character === "string") {
|
|
788
|
-
|
|
824
|
+
character = props.character;
|
|
789
825
|
} else {
|
|
790
|
-
|
|
826
|
+
character = props.character.id;
|
|
791
827
|
}
|
|
792
828
|
}
|
|
793
|
-
dialogue = new DialogueBaseModel(text,
|
|
829
|
+
dialogue = new DialogueBaseModel(text, character);
|
|
794
830
|
} else {
|
|
795
831
|
dialogue = props;
|
|
796
832
|
}
|
|
@@ -921,9 +957,14 @@ var TickerBase = class {
|
|
|
921
957
|
* @param priority The priority of the ticker. @default UPDATE_PRIORITY.NORMAL
|
|
922
958
|
*/
|
|
923
959
|
constructor(args, duration, priority) {
|
|
960
|
+
/**
|
|
961
|
+
* Get the id of the ticker. This variable is used in the system to get the ticker by id, {@link geTickerInstanceById}
|
|
962
|
+
*/
|
|
963
|
+
this.id = "ticker_id_not_set";
|
|
924
964
|
this.args = args;
|
|
925
965
|
this.duration = duration;
|
|
926
966
|
this.priority = priority;
|
|
967
|
+
this.id = this.constructor.prototype.id;
|
|
927
968
|
}
|
|
928
969
|
/**
|
|
929
970
|
* The method that will be called every frame.
|
|
@@ -1146,8 +1187,8 @@ exports.ZoomTicker = class ZoomTicker extends TickerBase {
|
|
|
1146
1187
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
1147
1188
|
}
|
|
1148
1189
|
let type = args.type || "zoom";
|
|
1149
|
-
let xLimit = Infinity;
|
|
1150
|
-
let yLimit = Infinity;
|
|
1190
|
+
let xLimit = type === "zoom" ? Infinity : 0;
|
|
1191
|
+
let yLimit = type === "zoom" ? Infinity : 0;
|
|
1151
1192
|
if (args.limit) {
|
|
1152
1193
|
if (typeof args.limit === "number") {
|
|
1153
1194
|
xLimit = args.limit;
|
|
@@ -1186,7 +1227,7 @@ exports.ZoomTicker = class ZoomTicker extends TickerBase {
|
|
|
1186
1227
|
if (element.scale.x >= xLimit && element.scale.y >= yLimit) {
|
|
1187
1228
|
element.scale.x = xLimit;
|
|
1188
1229
|
element.scale.y = yLimit;
|
|
1189
|
-
|
|
1230
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1190
1231
|
}
|
|
1191
1232
|
} else if (type === "unzoom") {
|
|
1192
1233
|
if (element.scale.x < xLimit) {
|
|
@@ -1198,24 +1239,39 @@ exports.ZoomTicker = class ZoomTicker extends TickerBase {
|
|
|
1198
1239
|
if (element.scale.x <= xLimit && element.scale.y <= yLimit) {
|
|
1199
1240
|
element.scale.x = xLimit;
|
|
1200
1241
|
element.scale.y = yLimit;
|
|
1201
|
-
|
|
1242
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1202
1243
|
}
|
|
1203
1244
|
}
|
|
1204
1245
|
if (xSpeed < 1e-5 && ySpeed < 1e-5 && !(args.speedProgression && args.speedProgression.type == "linear" && args.speedProgression.amt != 0)) {
|
|
1205
|
-
|
|
1246
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1206
1247
|
}
|
|
1207
1248
|
}
|
|
1208
1249
|
});
|
|
1209
1250
|
if (args.speedProgression)
|
|
1210
1251
|
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1211
1252
|
}
|
|
1253
|
+
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
1254
|
+
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
1255
|
+
}
|
|
1212
1256
|
};
|
|
1213
1257
|
exports.ZoomTicker = __decorateClass([
|
|
1214
1258
|
tickerDecorator()
|
|
1215
1259
|
], exports.ZoomTicker);
|
|
1260
|
+
var ZoomInOutTicker = class extends exports.ZoomTicker {
|
|
1261
|
+
constructor(props, duration, priority) {
|
|
1262
|
+
super(props, duration, priority);
|
|
1263
|
+
}
|
|
1264
|
+
onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2) {
|
|
1265
|
+
if (element.children.length > 0) {
|
|
1266
|
+
let elementChild = element.children[0];
|
|
1267
|
+
GameWindowManager.addCanvasElement(tag, elementChild);
|
|
1268
|
+
}
|
|
1269
|
+
super.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1270
|
+
}
|
|
1271
|
+
};
|
|
1216
1272
|
|
|
1217
1273
|
// src/constants.ts
|
|
1218
|
-
var PIXIVN_VERSION = "0.6.
|
|
1274
|
+
var PIXIVN_VERSION = "0.6.2";
|
|
1219
1275
|
var Repeat = "repeat";
|
|
1220
1276
|
function Pause(duration) {
|
|
1221
1277
|
return {
|
|
@@ -1338,6 +1394,147 @@ function showWithFadeTransition(_0, _1) {
|
|
|
1338
1394
|
function removeWithFadeTransition(tag, props = {}, priority) {
|
|
1339
1395
|
return removeWithDissolveTransition(tag, props, priority);
|
|
1340
1396
|
}
|
|
1397
|
+
function moveIn(_0, _1) {
|
|
1398
|
+
return __async(this, arguments, function* (tag, image, props = { direction: "right" }, priority) {
|
|
1399
|
+
var _a;
|
|
1400
|
+
let canvasElement;
|
|
1401
|
+
if (typeof image === "string") {
|
|
1402
|
+
canvasElement = addImage(tag, image);
|
|
1403
|
+
} else {
|
|
1404
|
+
canvasElement = image;
|
|
1405
|
+
GameWindowManager.addCanvasElement(tag, canvasElement);
|
|
1406
|
+
}
|
|
1407
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1408
|
+
yield canvasElement.load();
|
|
1409
|
+
}
|
|
1410
|
+
let destination = { x: canvasElement.x, y: canvasElement.y };
|
|
1411
|
+
if (props.direction == "up") {
|
|
1412
|
+
canvasElement.y = GameWindowManager.canvasHeight + canvasElement.height;
|
|
1413
|
+
} else if (props.direction == "down") {
|
|
1414
|
+
canvasElement.y = -canvasElement.height;
|
|
1415
|
+
} else if (props.direction == "left") {
|
|
1416
|
+
canvasElement.x = GameWindowManager.canvasWidth + canvasElement.width;
|
|
1417
|
+
} else if (props.direction == "right") {
|
|
1418
|
+
canvasElement.x = -canvasElement.width;
|
|
1419
|
+
}
|
|
1420
|
+
let effect = new exports.MoveTicker(__spreadProps(__spreadValues({}, props), {
|
|
1421
|
+
destination,
|
|
1422
|
+
startOnlyIfHaveTexture: true
|
|
1423
|
+
}), priority);
|
|
1424
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1425
|
+
});
|
|
1426
|
+
}
|
|
1427
|
+
function moveOut(tag, props = { direction: "right" }, priority) {
|
|
1428
|
+
let canvasElement = GameWindowManager.getCanvasElement(tag);
|
|
1429
|
+
if (!canvasElement) {
|
|
1430
|
+
console.warn("[Pixi'VN] The canvas element is not found.");
|
|
1431
|
+
return;
|
|
1432
|
+
}
|
|
1433
|
+
let destination = { x: canvasElement.x, y: canvasElement.y };
|
|
1434
|
+
if (props.direction == "up") {
|
|
1435
|
+
destination.y = -canvasElement.height;
|
|
1436
|
+
} else if (props.direction == "down") {
|
|
1437
|
+
destination.y = GameWindowManager.canvasHeight + canvasElement.height;
|
|
1438
|
+
} else if (props.direction == "left") {
|
|
1439
|
+
destination.x = -canvasElement.width;
|
|
1440
|
+
} else if (props.direction == "right") {
|
|
1441
|
+
destination.x = GameWindowManager.canvasWidth + canvasElement.width;
|
|
1442
|
+
}
|
|
1443
|
+
let effect = new exports.MoveTicker(__spreadProps(__spreadValues({}, props), {
|
|
1444
|
+
destination,
|
|
1445
|
+
startOnlyIfHaveTexture: true,
|
|
1446
|
+
tagToRemoveAfter: tag
|
|
1447
|
+
}), priority);
|
|
1448
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1449
|
+
}
|
|
1450
|
+
function zoomIn(_0, _1) {
|
|
1451
|
+
return __async(this, arguments, function* (tag, image, props = { direction: "right" }, priority) {
|
|
1452
|
+
var _a;
|
|
1453
|
+
let canvasElement;
|
|
1454
|
+
if (typeof image === "string") {
|
|
1455
|
+
canvasElement = new CanvasImage({}, image);
|
|
1456
|
+
} else {
|
|
1457
|
+
canvasElement = image;
|
|
1458
|
+
}
|
|
1459
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1460
|
+
yield canvasElement.load();
|
|
1461
|
+
}
|
|
1462
|
+
let container = new CanvasContainer();
|
|
1463
|
+
container.addChild(canvasElement);
|
|
1464
|
+
container.height = GameWindowManager.canvasHeight;
|
|
1465
|
+
container.width = GameWindowManager.canvasWidth;
|
|
1466
|
+
GameWindowManager.addCanvasElement(tag, container);
|
|
1467
|
+
if (props.direction == "up") {
|
|
1468
|
+
container.pivot.y = GameWindowManager.canvasHeight;
|
|
1469
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1470
|
+
container.y = GameWindowManager.canvasHeight;
|
|
1471
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1472
|
+
} else if (props.direction == "down") {
|
|
1473
|
+
container.pivot.y = 0;
|
|
1474
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1475
|
+
container.y = 0;
|
|
1476
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1477
|
+
} else if (props.direction == "left") {
|
|
1478
|
+
container.pivot.x = GameWindowManager.canvasWidth;
|
|
1479
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1480
|
+
container.x = GameWindowManager.canvasWidth;
|
|
1481
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1482
|
+
} else if (props.direction == "right") {
|
|
1483
|
+
container.pivot.x = 0;
|
|
1484
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1485
|
+
container.x = 0;
|
|
1486
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1487
|
+
}
|
|
1488
|
+
container.scale.set(0);
|
|
1489
|
+
let effect = new ZoomInOutTicker(__spreadProps(__spreadValues({}, props), {
|
|
1490
|
+
startOnlyIfHaveTexture: true,
|
|
1491
|
+
type: "zoom",
|
|
1492
|
+
limit: 1
|
|
1493
|
+
}), priority);
|
|
1494
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1495
|
+
});
|
|
1496
|
+
}
|
|
1497
|
+
function zoomOut(tag, props = { direction: "right" }, priority) {
|
|
1498
|
+
let canvasElement = GameWindowManager.getCanvasElement(tag);
|
|
1499
|
+
if (!canvasElement) {
|
|
1500
|
+
console.warn("[Pixi'VN] The canvas element is not found.");
|
|
1501
|
+
return;
|
|
1502
|
+
}
|
|
1503
|
+
let container = new CanvasContainer();
|
|
1504
|
+
container.addChild(canvasElement);
|
|
1505
|
+
container.height = GameWindowManager.canvasHeight;
|
|
1506
|
+
container.width = GameWindowManager.canvasWidth;
|
|
1507
|
+
GameWindowManager.addCanvasElement(tag, container);
|
|
1508
|
+
if (props.direction == "up") {
|
|
1509
|
+
container.pivot.y = GameWindowManager.canvasHeight;
|
|
1510
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1511
|
+
container.y = GameWindowManager.canvasHeight;
|
|
1512
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1513
|
+
} else if (props.direction == "down") {
|
|
1514
|
+
container.pivot.y = 0;
|
|
1515
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1516
|
+
container.y = 0;
|
|
1517
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1518
|
+
} else if (props.direction == "left") {
|
|
1519
|
+
container.pivot.x = GameWindowManager.canvasWidth;
|
|
1520
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1521
|
+
container.x = GameWindowManager.canvasWidth;
|
|
1522
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1523
|
+
} else if (props.direction == "right") {
|
|
1524
|
+
container.pivot.x = 0;
|
|
1525
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1526
|
+
container.x = 0;
|
|
1527
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1528
|
+
}
|
|
1529
|
+
container.scale.set(1);
|
|
1530
|
+
let effect = new ZoomInOutTicker(__spreadProps(__spreadValues({}, props), {
|
|
1531
|
+
startOnlyIfHaveTexture: true,
|
|
1532
|
+
type: "unzoom",
|
|
1533
|
+
limit: 0,
|
|
1534
|
+
tagToRemoveAfter: tag
|
|
1535
|
+
}), priority);
|
|
1536
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1537
|
+
}
|
|
1341
1538
|
|
|
1342
1539
|
// src/functions/SavesUtility.ts
|
|
1343
1540
|
function getSaveData() {
|
|
@@ -1827,18 +2024,18 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1827
2024
|
* ```
|
|
1828
2025
|
*/
|
|
1829
2026
|
static addTicker(canvasElementTag, ticker) {
|
|
1830
|
-
let
|
|
2027
|
+
let tickerId = ticker.id;
|
|
1831
2028
|
if (typeof canvasElementTag === "string") {
|
|
1832
2029
|
canvasElementTag = [canvasElementTag];
|
|
1833
2030
|
}
|
|
1834
|
-
if (!
|
|
1835
|
-
console.error(`[Pixi'VN] Ticker ${
|
|
2031
|
+
if (!geTickerInstanceById(tickerId, ticker.args, ticker.duration, ticker.priority)) {
|
|
2032
|
+
console.error(`[Pixi'VN] Ticker ${tickerId} not found`);
|
|
1836
2033
|
return;
|
|
1837
2034
|
}
|
|
1838
2035
|
let tickerHistory = {
|
|
1839
2036
|
fn: () => {
|
|
1840
2037
|
},
|
|
1841
|
-
|
|
2038
|
+
id: tickerId,
|
|
1842
2039
|
args: createExportableElement(ticker.args),
|
|
1843
2040
|
canvasElementTags: canvasElementTag,
|
|
1844
2041
|
priority: ticker.priority,
|
|
@@ -1854,11 +2051,11 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1854
2051
|
_GameWindowManager.removeTicker(id);
|
|
1855
2052
|
}
|
|
1856
2053
|
}, ticker.duration * 1e3);
|
|
1857
|
-
_GameWindowManager.addTickerTimeoutInfo(canvasElementTag,
|
|
2054
|
+
_GameWindowManager.addTickerTimeoutInfo(canvasElementTag, tickerId, timeout.toString(), true);
|
|
1858
2055
|
}
|
|
1859
2056
|
}
|
|
1860
2057
|
static pushTicker(id, tickerData, ticker) {
|
|
1861
|
-
_GameWindowManager.removeAssociationBetweenTickerCanvasElement(tickerData.canvasElementTags,
|
|
2058
|
+
_GameWindowManager.removeAssociationBetweenTickerCanvasElement(tickerData.canvasElementTags, ticker);
|
|
1862
2059
|
_GameWindowManager._currentTickers[id] = tickerData;
|
|
1863
2060
|
tickerData.fn = (t) => {
|
|
1864
2061
|
let data = _GameWindowManager._currentTickers[id];
|
|
@@ -1899,9 +2096,9 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1899
2096
|
if (step.hasOwnProperty("type") && step.type === "pause") {
|
|
1900
2097
|
return step;
|
|
1901
2098
|
}
|
|
1902
|
-
let
|
|
2099
|
+
let tickerId = step.id;
|
|
1903
2100
|
return {
|
|
1904
|
-
ticker:
|
|
2101
|
+
ticker: tickerId,
|
|
1905
2102
|
args: createExportableElement(step.args),
|
|
1906
2103
|
duration: step.duration
|
|
1907
2104
|
};
|
|
@@ -1939,16 +2136,16 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1939
2136
|
_GameWindowManager.addTickerTimeoutInfo(tag, "steps", timeout.toString(), false);
|
|
1940
2137
|
return;
|
|
1941
2138
|
}
|
|
1942
|
-
let ticker =
|
|
2139
|
+
let ticker = geTickerInstanceById(step.ticker, step.args, step.duration, step.priority);
|
|
1943
2140
|
if (!ticker) {
|
|
1944
2141
|
console.error(`[Pixi'VN] Ticker ${step.ticker} not found`);
|
|
1945
2142
|
return;
|
|
1946
2143
|
}
|
|
1947
|
-
let tickerName = ticker.
|
|
2144
|
+
let tickerName = ticker.id;
|
|
1948
2145
|
let tickerHistory = {
|
|
1949
2146
|
fn: () => {
|
|
1950
2147
|
},
|
|
1951
|
-
|
|
2148
|
+
id: tickerName,
|
|
1952
2149
|
args: createExportableElement(ticker.args),
|
|
1953
2150
|
canvasElementTags: [tag],
|
|
1954
2151
|
priority: ticker.priority,
|
|
@@ -2005,26 +2202,26 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
2005
2202
|
* ```
|
|
2006
2203
|
*/
|
|
2007
2204
|
static removeAssociationBetweenTickerCanvasElement(tags, ticker) {
|
|
2008
|
-
let
|
|
2205
|
+
let tickerId;
|
|
2009
2206
|
if (typeof ticker === "string") {
|
|
2010
|
-
|
|
2207
|
+
tickerId = ticker;
|
|
2011
2208
|
} else if (ticker instanceof TickerBase) {
|
|
2012
|
-
|
|
2209
|
+
tickerId = ticker.id;
|
|
2013
2210
|
} else {
|
|
2014
|
-
|
|
2211
|
+
tickerId = ticker.prototype.id;
|
|
2015
2212
|
}
|
|
2016
2213
|
if (typeof tags === "string") {
|
|
2017
2214
|
tags = [tags];
|
|
2018
2215
|
}
|
|
2019
2216
|
for (let id in _GameWindowManager._currentTickers) {
|
|
2020
2217
|
let ticker2 = _GameWindowManager._currentTickers[id];
|
|
2021
|
-
if (ticker2.
|
|
2218
|
+
if (ticker2.id === tickerId) {
|
|
2022
2219
|
_GameWindowManager._currentTickers[id].canvasElementTags = ticker2.canvasElementTags.filter((e) => !tags.includes(e));
|
|
2023
2220
|
}
|
|
2024
2221
|
}
|
|
2025
2222
|
for (let timeout in _GameWindowManager._currentTickersTimeouts) {
|
|
2026
2223
|
let TickerTimeout = _GameWindowManager._currentTickersTimeouts[timeout];
|
|
2027
|
-
if (TickerTimeout.ticker ===
|
|
2224
|
+
if (TickerTimeout.ticker === tickerId && TickerTimeout.canBeDeletedBeforeEnd) {
|
|
2028
2225
|
_GameWindowManager._currentTickersTimeouts[timeout].tags = TickerTimeout.tags.filter((t) => !tags.includes(t));
|
|
2029
2226
|
}
|
|
2030
2227
|
}
|
|
@@ -2210,11 +2407,11 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
2210
2407
|
for (let id in currentTickers) {
|
|
2211
2408
|
let t = currentTickers[id];
|
|
2212
2409
|
let tags = t.canvasElementTags;
|
|
2213
|
-
let ticker =
|
|
2410
|
+
let ticker = geTickerInstanceById(t.id, t.args, t.duration, t.priority);
|
|
2214
2411
|
if (ticker) {
|
|
2215
2412
|
_GameWindowManager.addTicker(tags, ticker);
|
|
2216
2413
|
} else {
|
|
2217
|
-
console.error(`[Pixi'VN] Ticker ${t.
|
|
2414
|
+
console.error(`[Pixi'VN] Ticker ${t.id} not found`);
|
|
2218
2415
|
}
|
|
2219
2416
|
}
|
|
2220
2417
|
}
|
|
@@ -2415,6 +2612,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2415
2612
|
_GameStepManager._openedLabels = _GameStepManager.originalStepData.openedLabels;
|
|
2416
2613
|
}
|
|
2417
2614
|
/* Run Methods */
|
|
2615
|
+
static get canGoNext() {
|
|
2616
|
+
let options = getChoiceMenuOptions();
|
|
2617
|
+
if (options && options.length > 0) {
|
|
2618
|
+
return false;
|
|
2619
|
+
}
|
|
2620
|
+
return true;
|
|
2621
|
+
}
|
|
2418
2622
|
/**
|
|
2419
2623
|
* Execute the next step and add it to the history.
|
|
2420
2624
|
* @param props The props to pass to the step.
|
|
@@ -2424,7 +2628,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2424
2628
|
* ```typescript
|
|
2425
2629
|
* function nextOnClick() {
|
|
2426
2630
|
* setLoading(true)
|
|
2427
|
-
* GameStepManager.
|
|
2631
|
+
* GameStepManager.goNext(yourParams)
|
|
2428
2632
|
* .then((result) => {
|
|
2429
2633
|
* setUpdate((p) => p + 1)
|
|
2430
2634
|
* setLoading(false)
|
|
@@ -2439,8 +2643,12 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2439
2643
|
* }
|
|
2440
2644
|
* ```
|
|
2441
2645
|
*/
|
|
2442
|
-
static
|
|
2646
|
+
static goNext(props, choiseMade) {
|
|
2443
2647
|
return __async(this, null, function* () {
|
|
2648
|
+
if (!_GameStepManager.canGoNext) {
|
|
2649
|
+
console.warn("[Pixi'VN] The player must make a choice");
|
|
2650
|
+
return;
|
|
2651
|
+
}
|
|
2444
2652
|
_GameStepManager.increaseCurrentStepIndex();
|
|
2445
2653
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2446
2654
|
});
|
|
@@ -2471,7 +2679,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2471
2679
|
return result;
|
|
2472
2680
|
} else if (_GameStepManager.openedLabels.length > 1) {
|
|
2473
2681
|
_GameStepManager.closeCurrentLabel();
|
|
2474
|
-
return yield _GameStepManager.
|
|
2682
|
+
return yield _GameStepManager.goNext(props, choiseMade);
|
|
2475
2683
|
} else {
|
|
2476
2684
|
_GameStepManager.restorLastLabelList();
|
|
2477
2685
|
console.error("[Pixi'VN] The end of the game is not managed, so the game is blocked. Read this documentation to know how to manage the end of the game: https://pixi-vn.web.app/start/labels.html#how-manage-the-end-of-the-game");
|
|
@@ -2619,7 +2827,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2619
2827
|
if (choice.closeCurrentLabel) {
|
|
2620
2828
|
_GameStepManager.closeCurrentLabel();
|
|
2621
2829
|
}
|
|
2622
|
-
return _GameStepManager.
|
|
2830
|
+
return _GameStepManager.goNext(props, choiseMade);
|
|
2623
2831
|
});
|
|
2624
2832
|
}
|
|
2625
2833
|
/* After Update Methods */
|
|
@@ -2947,15 +3155,15 @@ var DialogueBaseModel = class {
|
|
|
2947
3155
|
if (typeof text === "string") {
|
|
2948
3156
|
this.text = text;
|
|
2949
3157
|
if (typeof character === "string") {
|
|
2950
|
-
this.
|
|
3158
|
+
this.character = character;
|
|
2951
3159
|
} else {
|
|
2952
|
-
this.
|
|
3160
|
+
this.character = character == null ? void 0 : character.id;
|
|
2953
3161
|
}
|
|
2954
3162
|
this.oltherParams = oltherParams;
|
|
2955
3163
|
} else {
|
|
2956
3164
|
this.text = text.text;
|
|
2957
|
-
if (text.
|
|
2958
|
-
this.
|
|
3165
|
+
if (text.character) {
|
|
3166
|
+
this.character = text.character;
|
|
2959
3167
|
}
|
|
2960
3168
|
this.oltherParams = text.oltherParams || {};
|
|
2961
3169
|
}
|
|
@@ -2968,7 +3176,7 @@ var DialogueBaseModel = class {
|
|
|
2968
3176
|
export() {
|
|
2969
3177
|
return {
|
|
2970
3178
|
text: this.text,
|
|
2971
|
-
|
|
3179
|
+
character: this.character,
|
|
2972
3180
|
oltherParams: this.oltherParams
|
|
2973
3181
|
};
|
|
2974
3182
|
}
|
|
@@ -2990,81 +3198,214 @@ var helmlokImage = "https://pixijs.com/assets/helmlok.png";
|
|
|
2990
3198
|
var helmlokName = `<span style="color:blue">Helmlok</span>`;
|
|
2991
3199
|
var skullyImage = "https://pixijs.com/assets/skully.png";
|
|
2992
3200
|
var skullyName = `<span style="color:red">Skully</span>`;
|
|
3201
|
+
var bunnyImage = "https://pixijs.com/assets/bunny.png";
|
|
3202
|
+
var bunnyName = `Bunny`;
|
|
2993
3203
|
|
|
2994
|
-
// src/labels/
|
|
2995
|
-
var
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
3204
|
+
// src/labels/CanvasEventsTestLabel.ts
|
|
3205
|
+
var EventTest1 = class extends CanvasEvent {
|
|
3206
|
+
fn(event, sprite) {
|
|
3207
|
+
if (event === "pointerdown") {
|
|
3208
|
+
sprite.scale.x *= 1.25;
|
|
3209
|
+
sprite.scale.y *= 1.25;
|
|
3210
|
+
}
|
|
3211
|
+
}
|
|
3212
|
+
};
|
|
3213
|
+
EventTest1 = __decorateClass([
|
|
3214
|
+
eventDecorator("___pixi_vn_canvas_events_test_event1___")
|
|
3215
|
+
], EventTest1);
|
|
3216
|
+
var EventTest2 = class extends CanvasEvent {
|
|
3217
|
+
constructor() {
|
|
3218
|
+
super(...arguments);
|
|
3219
|
+
this.textureButtonDown = pixi_js.Texture.from("https://pixijs.com/assets/button_down.png");
|
|
3220
|
+
this.textureButtonOver = pixi_js.Texture.from("https://pixijs.com/assets/button_over.png");
|
|
3221
|
+
this.textureButton = pixi_js.Texture.from("https://pixijs.com/assets/button.png");
|
|
3222
|
+
}
|
|
3223
|
+
fn(event, sprite) {
|
|
3224
|
+
if (event === "pointerdown") {
|
|
3225
|
+
sprite.isdown = true;
|
|
3226
|
+
sprite.texture = this.textureButtonDown;
|
|
3227
|
+
sprite.alpha = 1;
|
|
3228
|
+
} else if (event === "pointerup" || event === "pointerupoutside") {
|
|
3229
|
+
sprite.isdown = false;
|
|
3230
|
+
if (sprite.isOver) {
|
|
3231
|
+
sprite.texture = this.textureButtonOver;
|
|
3232
|
+
} else {
|
|
3233
|
+
sprite.texture = this.textureButton;
|
|
3234
|
+
}
|
|
3235
|
+
} else if (event === "pointerover") {
|
|
3236
|
+
sprite.isOver = true;
|
|
3237
|
+
if (sprite.isdown) {
|
|
3238
|
+
return;
|
|
3239
|
+
}
|
|
3240
|
+
sprite.texture = this.textureButtonOver;
|
|
3241
|
+
} else if (event === "pointerout") {
|
|
3242
|
+
sprite.isOver = false;
|
|
3243
|
+
if (sprite.isdown) {
|
|
3244
|
+
return;
|
|
3245
|
+
}
|
|
3246
|
+
sprite.texture = this.textureButton;
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
};
|
|
3250
|
+
EventTest2 = __decorateClass([
|
|
3251
|
+
eventDecorator("___pixi_vn_canvas_events_test_event2___")
|
|
3252
|
+
], EventTest2);
|
|
3253
|
+
var CANVAS_EVENTS_TEST_LABEL = "___pixi_vn_canvas_events_test___";
|
|
3254
|
+
var canvasEventsTestLabel = newLabel(
|
|
3255
|
+
CANVAS_EVENTS_TEST_LABEL,
|
|
3256
|
+
[
|
|
3257
|
+
() => setDialogue({
|
|
2999
3258
|
character: juliette,
|
|
3000
|
-
text:
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3259
|
+
text: "This is the test of clickable elements in a canvas."
|
|
3260
|
+
}),
|
|
3261
|
+
() => __async(void 0, null, function* () {
|
|
3262
|
+
setDialogue({
|
|
3263
|
+
character: juliette,
|
|
3264
|
+
text: `This is my friend, ${bunnyName}. It's small now, but if you try to click on it it will get bigger and bigger. (This example is from the official [PixiJS website](https://pixijs.com/8.x/examples/events/click).)`
|
|
3265
|
+
});
|
|
3266
|
+
const texture = yield pixi_js.Assets.load(bunnyImage);
|
|
3267
|
+
const sprite = CanvasSprite.from(texture);
|
|
3268
|
+
sprite.anchor.set(0.5);
|
|
3269
|
+
sprite.x = GameWindowManager.screen.width / 2;
|
|
3270
|
+
sprite.y = GameWindowManager.screen.height / 2;
|
|
3271
|
+
sprite.eventMode = "static";
|
|
3272
|
+
sprite.cursor = "pointer";
|
|
3273
|
+
sprite.onEvent("pointerdown", EventTest1);
|
|
3274
|
+
GameWindowManager.addCanvasElement("bunny", sprite);
|
|
3275
|
+
}),
|
|
3276
|
+
() => __async(void 0, null, function* () {
|
|
3277
|
+
GameWindowManager.clear();
|
|
3278
|
+
setDialogue({
|
|
3279
|
+
character: juliette,
|
|
3280
|
+
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).)`
|
|
3281
|
+
});
|
|
3282
|
+
yield pixi_js.Assets.load([
|
|
3283
|
+
"https://pixijs.com/assets/bg_button.jpg",
|
|
3284
|
+
"https://pixijs.com/assets/button.png",
|
|
3285
|
+
"https://pixijs.com/assets/button_down.png",
|
|
3286
|
+
"https://pixijs.com/assets/button_over.png"
|
|
3287
|
+
]);
|
|
3288
|
+
const background = CanvasSprite.from("https://pixijs.com/assets/bg_button.jpg");
|
|
3289
|
+
background.width = GameWindowManager.screen.width;
|
|
3290
|
+
background.height = GameWindowManager.screen.height;
|
|
3291
|
+
GameWindowManager.addCanvasElement("bg", background);
|
|
3292
|
+
const textureButton = pixi_js.Texture.from("https://pixijs.com/assets/button.png");
|
|
3293
|
+
const buttons = [];
|
|
3294
|
+
const buttonPositions = [175, 75, 655, 75, 410, 325, 150, 465, 685, 445];
|
|
3295
|
+
for (let i = 0; i < 5; i++) {
|
|
3296
|
+
const button = new CanvasSprite(textureButton);
|
|
3297
|
+
button.anchor.set(0.5);
|
|
3298
|
+
button.x = buttonPositions[i * 2];
|
|
3299
|
+
button.y = buttonPositions[i * 2 + 1];
|
|
3300
|
+
button.eventMode = "static";
|
|
3301
|
+
button.cursor = "pointer";
|
|
3302
|
+
button.onEvent("pointerdown", EventTest2).onEvent("pointerup", EventTest2).onEvent("pointerupoutside", EventTest2).onEvent("pointerover", EventTest2).onEvent("pointerout", EventTest2);
|
|
3303
|
+
GameWindowManager.addCanvasElement("button" + i, button);
|
|
3304
|
+
buttons.push(button);
|
|
3305
|
+
}
|
|
3306
|
+
buttons[0].scale.set(1.2);
|
|
3307
|
+
buttons[2].rotation = Math.PI / 10;
|
|
3308
|
+
buttons[3].scale.set(0.8);
|
|
3309
|
+
buttons[4].scale.set(0.8, 1.2);
|
|
3310
|
+
buttons[4].rotation = Math.PI;
|
|
3311
|
+
})
|
|
3312
|
+
]
|
|
3313
|
+
);
|
|
3314
|
+
var AlienTintingTest = class extends CanvasSprite {
|
|
3315
|
+
constructor() {
|
|
3316
|
+
super(...arguments);
|
|
3317
|
+
this.direction = 0;
|
|
3318
|
+
this.turningSpeed = 0;
|
|
3319
|
+
this.speed = 0;
|
|
3320
|
+
}
|
|
3321
|
+
get memory() {
|
|
3322
|
+
return __spreadProps(__spreadValues({}, super.memory), {
|
|
3323
|
+
direction: this.direction,
|
|
3324
|
+
turningSpeed: this.turningSpeed,
|
|
3325
|
+
speed: this.speed
|
|
3063
3326
|
});
|
|
3064
|
-
}
|
|
3065
|
-
|
|
3327
|
+
}
|
|
3328
|
+
set memory(memory) {
|
|
3329
|
+
super.memory = memory;
|
|
3330
|
+
this.direction = memory.direction;
|
|
3331
|
+
this.turningSpeed = memory.turningSpeed;
|
|
3332
|
+
this.speed = memory.speed;
|
|
3333
|
+
}
|
|
3334
|
+
static from(source, skipCache) {
|
|
3335
|
+
let sprite = pixi_js.Sprite.from(source, skipCache);
|
|
3336
|
+
let mySprite = new AlienTintingTest();
|
|
3337
|
+
mySprite.texture = sprite.texture;
|
|
3338
|
+
return mySprite;
|
|
3339
|
+
}
|
|
3340
|
+
};
|
|
3341
|
+
AlienTintingTest = __decorateClass([
|
|
3342
|
+
canvasElementDecorator("___pixi_vn_custom_canvas_element___")
|
|
3343
|
+
], AlienTintingTest);
|
|
3344
|
+
var TintingTestTicker = class extends TickerBase {
|
|
3345
|
+
constructor() {
|
|
3346
|
+
super({});
|
|
3347
|
+
}
|
|
3348
|
+
fn(_t, _args, tags) {
|
|
3349
|
+
tags.forEach((tag) => {
|
|
3350
|
+
const dudeBoundsPadding = 100;
|
|
3351
|
+
const dudeBounds = new pixi_js.Rectangle(
|
|
3352
|
+
-dudeBoundsPadding,
|
|
3353
|
+
-dudeBoundsPadding,
|
|
3354
|
+
GameWindowManager.screen.width + dudeBoundsPadding * 2,
|
|
3355
|
+
GameWindowManager.screen.height + dudeBoundsPadding * 2
|
|
3356
|
+
);
|
|
3357
|
+
let dude = GameWindowManager.getCanvasElement(tag);
|
|
3358
|
+
if (dude && dude instanceof AlienTintingTest) {
|
|
3359
|
+
dude.direction += dude.turningSpeed * 0.01;
|
|
3360
|
+
dude.x += Math.sin(dude.direction) * dude.speed;
|
|
3361
|
+
dude.y += Math.cos(dude.direction) * dude.speed;
|
|
3362
|
+
dude.rotation = -dude.direction - Math.PI / 2;
|
|
3363
|
+
if (dude.x < dudeBounds.x) {
|
|
3364
|
+
dude.x += dudeBounds.width;
|
|
3365
|
+
} else if (dude.x > dudeBounds.x + dudeBounds.width) {
|
|
3366
|
+
dude.x -= dudeBounds.width;
|
|
3367
|
+
}
|
|
3368
|
+
if (dude.y < dudeBounds.y) {
|
|
3369
|
+
dude.y += dudeBounds.height;
|
|
3370
|
+
} else if (dude.y > dudeBounds.y + dudeBounds.height) {
|
|
3371
|
+
dude.y -= dudeBounds.height;
|
|
3372
|
+
}
|
|
3373
|
+
}
|
|
3374
|
+
});
|
|
3375
|
+
}
|
|
3376
|
+
};
|
|
3377
|
+
TintingTestTicker = __decorateClass([
|
|
3378
|
+
tickerDecorator("___pixi_vn_custom_ticker___")
|
|
3379
|
+
], TintingTestTicker);
|
|
3380
|
+
var CUSTOM_TICKER_CANVAS_ELEMENT_TEST_LABEL = "___pixi_vn_custom_ticker_canvas_element_test___";
|
|
3381
|
+
var customTickerCanvasElementTestLabel = newLabel(
|
|
3382
|
+
CUSTOM_TICKER_CANVAS_ELEMENT_TEST_LABEL,
|
|
3383
|
+
[
|
|
3384
|
+
() => __async(void 0, null, function* () {
|
|
3385
|
+
const totalDudes = 100;
|
|
3386
|
+
for (let i = 0; i < totalDudes; i++) {
|
|
3387
|
+
const texture = yield pixi_js.Assets.load(eggHeadImage);
|
|
3388
|
+
const dude = AlienTintingTest.from(texture);
|
|
3389
|
+
dude.anchor.set(0.5);
|
|
3390
|
+
dude.scale.set(0.8 + Math.random() * 0.3);
|
|
3391
|
+
dude.x = Math.random() * GameWindowManager.screen.width;
|
|
3392
|
+
dude.y = Math.random() * GameWindowManager.screen.height;
|
|
3393
|
+
dude.tint = Math.random() * 16777215;
|
|
3394
|
+
dude.direction = Math.random() * Math.PI * 2;
|
|
3395
|
+
dude.turningSpeed = Math.random() - 0.8;
|
|
3396
|
+
dude.speed = 2 + Math.random() * 2;
|
|
3397
|
+
GameWindowManager.addCanvasElement("alien" + i, dude);
|
|
3398
|
+
GameWindowManager.addTicker("alien" + i, new TintingTestTicker());
|
|
3399
|
+
}
|
|
3400
|
+
setDialogue({
|
|
3401
|
+
character: juliette,
|
|
3402
|
+
text: `This is a test of custom ticker and canvas element. In this test, we have created ${totalDudes} ${eggHeadName} with random tint, scale, position, direction, turning speed, and speed. With the custom ticker, we are moving the custom canvas element in a random direction. (This example is from the official [PixiJS website](https://pixijs.com/8.x/examples/events/interactivity).)`
|
|
3403
|
+
});
|
|
3404
|
+
})
|
|
3405
|
+
]
|
|
3406
|
+
);
|
|
3066
3407
|
|
|
3067
|
-
// src/labels/
|
|
3408
|
+
// src/labels/ImagesAnimationsTestLabel.ts
|
|
3068
3409
|
var IMAGE_ANIMAIONS_TEST_LABEL = "___pixi_vn_images_animations_test___";
|
|
3069
3410
|
var imagesAnimationsTest = newLabel(IMAGE_ANIMAIONS_TEST_LABEL, [
|
|
3070
3411
|
() => __async(void 0, null, function* () {
|
|
@@ -3093,6 +3434,8 @@ var imagesAnimationsTest = newLabel(IMAGE_ANIMAIONS_TEST_LABEL, [
|
|
|
3093
3434
|
new ChoiceMenuOption("Rotate", imagesRotateTest),
|
|
3094
3435
|
new ChoiceMenuOption("Move", imagesMoveTest),
|
|
3095
3436
|
new ChoiceMenuOption("Zoom", imagesZoomTest),
|
|
3437
|
+
new ChoiceMenuOption("Move in/out", imagesMoveInOutTest),
|
|
3438
|
+
new ChoiceMenuOption("Zoom in/out", imagesZoomInOutTest),
|
|
3096
3439
|
new ChoiceMenuOptionClose("Cancel", true)
|
|
3097
3440
|
]);
|
|
3098
3441
|
}),
|
|
@@ -3347,6 +3690,148 @@ var imagesZoomTest = newLabel("___pixi_vn_images_zoom_test___", [
|
|
|
3347
3690
|
]);
|
|
3348
3691
|
}
|
|
3349
3692
|
]);
|
|
3693
|
+
var imagesMoveInOutTest = newLabel("___pixi_vn_images_move_in_out_test___", [
|
|
3694
|
+
() => __async(void 0, null, function* () {
|
|
3695
|
+
setDialogue({
|
|
3696
|
+
character: juliette,
|
|
3697
|
+
text: `Here's what's going to happen:
|
|
3698
|
+
- ${eggHeadName} will move in from the top with a speed of 800. If you go next, ${eggHeadName} will move out from the bottom with a speed of 800.
|
|
3699
|
+
- ${flowerTopName} will move in from the right with a speed of 800 and a speed progression of 0.02. If you go next, ${flowerTopName} will move out from the left with a speed of 800 and a speed progression of 0.02.
|
|
3700
|
+
- ${helmlokName} will move in from the left with a speed of 800. If you go next, ${helmlokName} will move out from the right with a speed of 800.
|
|
3701
|
+
- ${skullyName} will move in from the bottom with a speed of 800 and a speed progression of 0.02. If you go next, ${skullyName} will move out from the top with a speed of 800 and a speed progression of 0.02.`
|
|
3702
|
+
});
|
|
3703
|
+
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3704
|
+
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
3705
|
+
let helmlok = new CanvasImage({ x: 100, y: 300 }, helmlokImage);
|
|
3706
|
+
let skully = new CanvasImage({ x: 300, y: 300 }, skullyImage);
|
|
3707
|
+
moveIn("eggHead", eggHead, { speed: 800, direction: "down" });
|
|
3708
|
+
moveIn("flowerTop", flowerTop, {
|
|
3709
|
+
speed: 800,
|
|
3710
|
+
direction: "left",
|
|
3711
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3712
|
+
});
|
|
3713
|
+
moveIn("helmlok", helmlok, { speed: 800, direction: "right" });
|
|
3714
|
+
moveIn("skully", skully, {
|
|
3715
|
+
speed: 800,
|
|
3716
|
+
direction: "up",
|
|
3717
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3718
|
+
});
|
|
3719
|
+
}),
|
|
3720
|
+
() => {
|
|
3721
|
+
moveOut("eggHead", { speed: 800, direction: "down" });
|
|
3722
|
+
moveOut("flowerTop", { speed: 800, direction: "left" });
|
|
3723
|
+
moveOut("helmlok", { speed: 800, direction: "right" });
|
|
3724
|
+
moveOut("skully", { speed: 800, direction: "up" });
|
|
3725
|
+
}
|
|
3726
|
+
]);
|
|
3727
|
+
var imagesZoomInOutTest = newLabel("___pixi_vn_images_zoom_in_out_test___", [
|
|
3728
|
+
() => __async(void 0, null, function* () {
|
|
3729
|
+
GameWindowManager.removeCanvasElements();
|
|
3730
|
+
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3731
|
+
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
3732
|
+
let helmlok = new CanvasImage({ x: 100, y: 300 }, helmlokImage);
|
|
3733
|
+
let skully = new CanvasImage({ x: 300, y: 300 }, skullyImage);
|
|
3734
|
+
zoomIn("eggHead", eggHead, { speed: 3, direction: "down" });
|
|
3735
|
+
zoomIn("flowerTop", flowerTop, {
|
|
3736
|
+
speed: 3,
|
|
3737
|
+
direction: "left",
|
|
3738
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3739
|
+
});
|
|
3740
|
+
zoomIn("helmlok", helmlok, { speed: 3, direction: "right" });
|
|
3741
|
+
zoomIn("skully", skully, {
|
|
3742
|
+
speed: 3,
|
|
3743
|
+
direction: "up",
|
|
3744
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3745
|
+
});
|
|
3746
|
+
}),
|
|
3747
|
+
() => __async(void 0, null, function* () {
|
|
3748
|
+
zoomOut("eggHead", {
|
|
3749
|
+
speed: 3,
|
|
3750
|
+
direction: "down",
|
|
3751
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3752
|
+
});
|
|
3753
|
+
zoomOut("flowerTop", { speed: 3, direction: "left" });
|
|
3754
|
+
zoomOut("helmlok", { speed: 3, direction: "right" });
|
|
3755
|
+
zoomOut("skully", {
|
|
3756
|
+
speed: 3,
|
|
3757
|
+
direction: "up",
|
|
3758
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3759
|
+
});
|
|
3760
|
+
})
|
|
3761
|
+
]);
|
|
3762
|
+
|
|
3763
|
+
// src/labels/MarkdownTest.ts
|
|
3764
|
+
var MARKDOWN_TEST_LABEL = "___pixi_vn_markdown_test___";
|
|
3765
|
+
var markdownTest = newLabel(MARKDOWN_TEST_LABEL, [
|
|
3766
|
+
() => __async(void 0, null, function* () {
|
|
3767
|
+
setDialogue({
|
|
3768
|
+
character: juliette,
|
|
3769
|
+
text: `
|
|
3770
|
+
# Markdown Test
|
|
3771
|
+
|
|
3772
|
+
Hello, this is a test of the markdown parser. Pixi'VN does not manage markdown, but you can implement a markdown parser to display text with markdown syntax.
|
|
3773
|
+
|
|
3774
|
+
For example in React, you can use the library [react-markdown](https://www.npmjs.com/package/react-markdown).
|
|
3775
|
+
|
|
3776
|
+
## Colored Text
|
|
3777
|
+
|
|
3778
|
+
<span style="color:blue">some *blue* text</span>.
|
|
3779
|
+
|
|
3780
|
+
<span style="color:red">some *red* text</span>.
|
|
3781
|
+
|
|
3782
|
+
<span style="color:green">some *green* text</span>.
|
|
3783
|
+
|
|
3784
|
+
## Bold Text
|
|
3785
|
+
|
|
3786
|
+
**This is bold text.**
|
|
3787
|
+
|
|
3788
|
+
## Italic Text
|
|
3789
|
+
|
|
3790
|
+
*This is italic text.*
|
|
3791
|
+
|
|
3792
|
+
## Delete Text
|
|
3793
|
+
|
|
3794
|
+
~~This is deleted text.~~
|
|
3795
|
+
|
|
3796
|
+
## Link Test
|
|
3797
|
+
|
|
3798
|
+
[Link to Google](https://www.google.com)
|
|
3799
|
+
|
|
3800
|
+
## H2 Test
|
|
3801
|
+
|
|
3802
|
+
### H3 Test
|
|
3803
|
+
|
|
3804
|
+
#### H4 Test
|
|
3805
|
+
|
|
3806
|
+
## Code Test
|
|
3807
|
+
|
|
3808
|
+
\`Hello World\`
|
|
3809
|
+
|
|
3810
|
+
\`\`\`js
|
|
3811
|
+
console.log("Hello World")
|
|
3812
|
+
\`\`\`
|
|
3813
|
+
|
|
3814
|
+
## List Test
|
|
3815
|
+
|
|
3816
|
+
- Item 1
|
|
3817
|
+
* Item 2
|
|
3818
|
+
- [x] Item 3
|
|
3819
|
+
|
|
3820
|
+
## Table Test
|
|
3821
|
+
|
|
3822
|
+
| Header 1 | Header 2 |
|
|
3823
|
+
| -------- | -------- |
|
|
3824
|
+
| Cell 1 | Cell 2 |
|
|
3825
|
+
|
|
3826
|
+
## Separator Test
|
|
3827
|
+
|
|
3828
|
+
***
|
|
3829
|
+
Footer
|
|
3830
|
+
|
|
3831
|
+
`
|
|
3832
|
+
});
|
|
3833
|
+
})
|
|
3834
|
+
]);
|
|
3350
3835
|
|
|
3351
3836
|
// src/labels/StartLabel.ts
|
|
3352
3837
|
var pixivnTestStartLabel = newLabel(
|
|
@@ -3378,7 +3863,9 @@ var pixivnTestStartLabel2 = newLabel(
|
|
|
3378
3863
|
GameWindowManager.clear();
|
|
3379
3864
|
setDialogue({ character: juliette, text: "Which test would you like to start with?" });
|
|
3380
3865
|
setChoiceMenuOptions([
|
|
3381
|
-
new ChoiceMenuOption("Images and Animations", imagesAnimationsTest),
|
|
3866
|
+
new ChoiceMenuOption("Images, Transitions and Animations Test", imagesAnimationsTest),
|
|
3867
|
+
new ChoiceMenuOption("Canvas Events Test Label", canvasEventsTestLabel),
|
|
3868
|
+
new ChoiceMenuOption("Custom Ticker Canvas Element Test", customTickerCanvasElementTestLabel),
|
|
3382
3869
|
new ChoiceMenuOption("Markdown Test", markdownTest)
|
|
3383
3870
|
]);
|
|
3384
3871
|
},
|
|
@@ -3429,6 +3916,8 @@ exports.juliette = juliette;
|
|
|
3429
3916
|
exports.loadImage = loadImage;
|
|
3430
3917
|
exports.loadSaveData = loadSaveData;
|
|
3431
3918
|
exports.loadSaveJson = loadSaveJson;
|
|
3919
|
+
exports.moveIn = moveIn;
|
|
3920
|
+
exports.moveOut = moveOut;
|
|
3432
3921
|
exports.newLabel = newLabel;
|
|
3433
3922
|
exports.pixivnTestStartLabel = pixivnTestStartLabel;
|
|
3434
3923
|
exports.removeCanvasElement = removeCanvasElement;
|
|
@@ -3442,5 +3931,7 @@ exports.showImage = showImage;
|
|
|
3442
3931
|
exports.showWithDissolveTransition = showWithDissolveTransition;
|
|
3443
3932
|
exports.showWithFadeTransition = showWithFadeTransition;
|
|
3444
3933
|
exports.tickerDecorator = tickerDecorator;
|
|
3934
|
+
exports.zoomIn = zoomIn;
|
|
3935
|
+
exports.zoomOut = zoomOut;
|
|
3445
3936
|
//# sourceMappingURL=out.js.map
|
|
3446
3937
|
//# sourceMappingURL=index.js.map
|