@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
|
@@ -56,6 +56,20 @@ var __async = (__this, __arguments, generator) => {
|
|
|
56
56
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
57
57
|
});
|
|
58
58
|
};
|
|
59
|
+
|
|
60
|
+
// src/classes/CanvasEvent.ts
|
|
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
|
+
}
|
|
69
|
+
fn(_event, _element) {
|
|
70
|
+
throw new Error("[Pixi'VN] The method CanvasEvent.fn() must be overridden");
|
|
71
|
+
}
|
|
72
|
+
};
|
|
59
73
|
function getStepSha1(step) {
|
|
60
74
|
let sha1String = sha1__default.default(step.toString().toLocaleLowerCase());
|
|
61
75
|
return sha1String.toString();
|
|
@@ -79,7 +93,7 @@ var Label = class {
|
|
|
79
93
|
this._choiseIndex = choiseIndex;
|
|
80
94
|
}
|
|
81
95
|
/**
|
|
82
|
-
* 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}
|
|
83
97
|
*/
|
|
84
98
|
get id() {
|
|
85
99
|
return this._id;
|
|
@@ -168,17 +182,23 @@ function exportCanvasElement(element) {
|
|
|
168
182
|
return element.memory;
|
|
169
183
|
}
|
|
170
184
|
function importCanvasElement(memory) {
|
|
171
|
-
let element =
|
|
185
|
+
let element = getCanvasElementInstanceById(memory.pixivnId);
|
|
172
186
|
if (element) {
|
|
173
187
|
element.memory = memory;
|
|
174
188
|
} else {
|
|
175
|
-
throw new Error("[Pixi'VN] The element " + memory.
|
|
189
|
+
throw new Error("[Pixi'VN] The element " + memory.pixivnId + " could not be created");
|
|
176
190
|
}
|
|
177
191
|
return element;
|
|
178
192
|
}
|
|
179
193
|
|
|
180
194
|
// src/classes/canvas/CanvasContainer.ts
|
|
195
|
+
var CANVAS_CONTAINER_ID = "CanvasContainer";
|
|
181
196
|
var CanvasContainer = class extends pixi_js.Container {
|
|
197
|
+
constructor(options) {
|
|
198
|
+
super(options);
|
|
199
|
+
this.pixivnId = CANVAS_CONTAINER_ID;
|
|
200
|
+
this.pixivnId = this.constructor.prototype.pixivnId;
|
|
201
|
+
}
|
|
182
202
|
get memory() {
|
|
183
203
|
let memory = getMemoryContainer(this);
|
|
184
204
|
this.children.forEach((child) => {
|
|
@@ -194,8 +214,12 @@ var CanvasContainer = class extends pixi_js.Container {
|
|
|
194
214
|
}
|
|
195
215
|
};
|
|
196
216
|
function getMemoryContainer(element) {
|
|
217
|
+
let className = "CanvasContainer";
|
|
218
|
+
if (element.hasOwnProperty("pixivnId")) {
|
|
219
|
+
className = element.pixivnId;
|
|
220
|
+
}
|
|
197
221
|
return {
|
|
198
|
-
|
|
222
|
+
pixivnId: className,
|
|
199
223
|
elements: [],
|
|
200
224
|
width: element.width,
|
|
201
225
|
height: element.height,
|
|
@@ -311,40 +335,55 @@ function getTextStyle(style) {
|
|
|
311
335
|
|
|
312
336
|
// src/decorators/EventDecorator.ts
|
|
313
337
|
var registeredEvents = {};
|
|
314
|
-
function
|
|
338
|
+
function eventDecorator(name) {
|
|
339
|
+
return function(target) {
|
|
340
|
+
if (!name) {
|
|
341
|
+
name = target.name;
|
|
342
|
+
}
|
|
343
|
+
if (registeredEvents[name]) {
|
|
344
|
+
console.info(`[Pixi'VN] Event ${name} already exists, it will be overwritten`);
|
|
345
|
+
}
|
|
346
|
+
target.prototype.id = name;
|
|
347
|
+
registeredEvents[name] = target;
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
function getEventTypeById(eventId) {
|
|
315
351
|
try {
|
|
316
|
-
let eventType = registeredEvents[
|
|
352
|
+
let eventType = registeredEvents[eventId];
|
|
317
353
|
if (!eventType) {
|
|
318
|
-
console.error(`[Pixi'VN] Event ${
|
|
354
|
+
console.error(`[Pixi'VN] Event ${eventId} not found`);
|
|
319
355
|
return;
|
|
320
356
|
}
|
|
321
357
|
new eventType();
|
|
322
358
|
return eventType;
|
|
323
359
|
} catch (e) {
|
|
324
|
-
console.error(`[Pixi'VN] Error while getting Event ${
|
|
360
|
+
console.error(`[Pixi'VN] Error while getting Event ${eventId}`, e);
|
|
325
361
|
return;
|
|
326
362
|
}
|
|
327
363
|
}
|
|
328
|
-
function
|
|
364
|
+
function getEventInstanceById(eventId) {
|
|
329
365
|
try {
|
|
330
|
-
let eventType = registeredEvents[
|
|
366
|
+
let eventType = registeredEvents[eventId];
|
|
331
367
|
if (!eventType) {
|
|
332
|
-
console.error(`[Pixi'VN] Event ${
|
|
368
|
+
console.error(`[Pixi'VN] Event ${eventId} not found`);
|
|
333
369
|
return;
|
|
334
370
|
}
|
|
335
371
|
let event = new eventType();
|
|
336
372
|
return event;
|
|
337
373
|
} catch (e) {
|
|
338
|
-
console.error(`[Pixi'VN] Error while getting Event ${
|
|
374
|
+
console.error(`[Pixi'VN] Error while getting Event ${eventId}`, e);
|
|
339
375
|
return;
|
|
340
376
|
}
|
|
341
377
|
}
|
|
342
378
|
|
|
343
379
|
// src/classes/canvas/CanvasSprite.ts
|
|
380
|
+
var CANVAS_SPRITE_ID = "CanvasSprite";
|
|
344
381
|
var CanvasSprite = class _CanvasSprite extends pixi_js.Sprite {
|
|
345
|
-
constructor() {
|
|
346
|
-
super(
|
|
382
|
+
constructor(options) {
|
|
383
|
+
super(options);
|
|
384
|
+
this.pixivnId = CANVAS_SPRITE_ID;
|
|
347
385
|
this._onEvents = {};
|
|
386
|
+
this.pixivnId = this.constructor.prototype.pixivnId;
|
|
348
387
|
}
|
|
349
388
|
get memory() {
|
|
350
389
|
return getMemorySprite(this);
|
|
@@ -385,9 +424,9 @@ var CanvasSprite = class _CanvasSprite extends pixi_js.Sprite {
|
|
|
385
424
|
* ```
|
|
386
425
|
*/
|
|
387
426
|
onEvent(event, eventClass) {
|
|
388
|
-
let
|
|
389
|
-
let instance =
|
|
390
|
-
this._onEvents[event] =
|
|
427
|
+
let id = eventClass.prototype.id;
|
|
428
|
+
let instance = getEventInstanceById(id);
|
|
429
|
+
this._onEvents[event] = id;
|
|
391
430
|
if (instance) {
|
|
392
431
|
super.on(event, () => {
|
|
393
432
|
instance.fn(event, this);
|
|
@@ -416,7 +455,7 @@ var CanvasSprite = class _CanvasSprite extends pixi_js.Sprite {
|
|
|
416
455
|
function getMemorySprite(element) {
|
|
417
456
|
let temp = getMemoryContainer(element);
|
|
418
457
|
return __spreadProps(__spreadValues({}, temp), {
|
|
419
|
-
|
|
458
|
+
pixivnId: element.pixivnId,
|
|
420
459
|
textureImage: getTextureMemory(element.texture),
|
|
421
460
|
anchor: { x: element.anchor.x, y: element.anchor.y },
|
|
422
461
|
roundPixels: element.roundPixels,
|
|
@@ -439,8 +478,8 @@ function setMemorySprite(element, memory) {
|
|
|
439
478
|
}
|
|
440
479
|
memory.roundPixels && (element.roundPixels = memory.roundPixels);
|
|
441
480
|
for (let event in memory.onEvents) {
|
|
442
|
-
let
|
|
443
|
-
let instance =
|
|
481
|
+
let id = memory.onEvents[event];
|
|
482
|
+
let instance = getEventTypeById(id);
|
|
444
483
|
if (instance) {
|
|
445
484
|
element.onEvent(event, instance);
|
|
446
485
|
}
|
|
@@ -448,9 +487,11 @@ function setMemorySprite(element, memory) {
|
|
|
448
487
|
}
|
|
449
488
|
|
|
450
489
|
// src/classes/canvas/CanvasImage.ts
|
|
490
|
+
var CANVAS_IMAGE_ID = "CanvasImage";
|
|
451
491
|
var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
452
492
|
constructor(options, imageLink) {
|
|
453
493
|
super(options);
|
|
494
|
+
this.pixivnId = CANVAS_IMAGE_ID;
|
|
454
495
|
this.imageLink = "";
|
|
455
496
|
if (imageLink) {
|
|
456
497
|
this.imageLink = imageLink;
|
|
@@ -458,12 +499,13 @@ var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
|
458
499
|
}
|
|
459
500
|
get memory() {
|
|
460
501
|
return __spreadProps(__spreadValues({}, getMemorySprite(this)), {
|
|
461
|
-
|
|
462
|
-
|
|
502
|
+
pixivnId: this.pixivnId,
|
|
503
|
+
imageLink: this.imageLink
|
|
463
504
|
});
|
|
464
505
|
}
|
|
465
506
|
set memory(memory) {
|
|
466
507
|
setMemorySprite(this, memory);
|
|
508
|
+
this.imageLink = memory.imageLink;
|
|
467
509
|
}
|
|
468
510
|
static from(source, skipCache) {
|
|
469
511
|
let sprite = pixi_js.Sprite.from(source, skipCache);
|
|
@@ -491,10 +533,13 @@ var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
|
491
533
|
});
|
|
492
534
|
}
|
|
493
535
|
};
|
|
536
|
+
var CANVAS_TEXT_ID = "CanvasText";
|
|
494
537
|
var CanvasText = class extends pixi_js.Text {
|
|
495
|
-
constructor() {
|
|
496
|
-
super(
|
|
538
|
+
constructor(options) {
|
|
539
|
+
super(options);
|
|
540
|
+
this.pixivnId = CANVAS_TEXT_ID;
|
|
497
541
|
this._onEvents = {};
|
|
542
|
+
this.pixivnId = this.constructor.prototype.pixivnId;
|
|
498
543
|
}
|
|
499
544
|
get memory() {
|
|
500
545
|
return getMemoryText(this);
|
|
@@ -535,9 +580,9 @@ var CanvasText = class extends pixi_js.Text {
|
|
|
535
580
|
* ```
|
|
536
581
|
*/
|
|
537
582
|
onEvent(event, eventClass) {
|
|
538
|
-
let
|
|
539
|
-
let instance =
|
|
540
|
-
this._onEvents[event] =
|
|
583
|
+
let id = eventClass.prototype.id;
|
|
584
|
+
let instance = getEventInstanceById(id);
|
|
585
|
+
this._onEvents[event] = id;
|
|
541
586
|
if (instance) {
|
|
542
587
|
super.on(event, () => {
|
|
543
588
|
instance.fn(event, this);
|
|
@@ -560,7 +605,7 @@ var CanvasText = class extends pixi_js.Text {
|
|
|
560
605
|
function getMemoryText(element) {
|
|
561
606
|
let temp = getMemoryContainer(element);
|
|
562
607
|
return __spreadProps(__spreadValues({}, temp), {
|
|
563
|
-
|
|
608
|
+
pixivnId: element.pixivnId,
|
|
564
609
|
anchor: { x: element.anchor.x, y: element.anchor.y },
|
|
565
610
|
text: element.text,
|
|
566
611
|
resolution: element.resolution,
|
|
@@ -583,8 +628,8 @@ function setMemoryText(element, memory) {
|
|
|
583
628
|
memory.style && (element.style = memory.style);
|
|
584
629
|
memory.roundPixels && (element.roundPixels = memory.roundPixels);
|
|
585
630
|
for (let event in memory.onEvents) {
|
|
586
|
-
let
|
|
587
|
-
let instance =
|
|
631
|
+
let id = memory.onEvents[event];
|
|
632
|
+
let instance = getEventTypeById(id);
|
|
588
633
|
if (instance) {
|
|
589
634
|
element.onEvent(event, instance);
|
|
590
635
|
}
|
|
@@ -593,28 +638,40 @@ function setMemoryText(element, memory) {
|
|
|
593
638
|
|
|
594
639
|
// src/decorators/CanvasElementDecorator.ts
|
|
595
640
|
var registeredCanvasElement = {};
|
|
596
|
-
function
|
|
641
|
+
function canvasElementDecorator(name) {
|
|
642
|
+
return function(target) {
|
|
643
|
+
if (!name) {
|
|
644
|
+
name = target.name;
|
|
645
|
+
}
|
|
646
|
+
if (registeredCanvasElement[name]) {
|
|
647
|
+
console.warn(`[Pixi'VN] CanvasElement ${name} already registered`);
|
|
648
|
+
}
|
|
649
|
+
target.prototype.pixivnId = name;
|
|
650
|
+
registeredCanvasElement[name] = target;
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
function getCanvasElementInstanceById(canvasId) {
|
|
597
654
|
try {
|
|
598
|
-
let eventType = registeredCanvasElement[
|
|
655
|
+
let eventType = registeredCanvasElement[canvasId];
|
|
599
656
|
if (!eventType) {
|
|
600
|
-
if (
|
|
657
|
+
if (canvasId === CANVAS_CONTAINER_ID) {
|
|
601
658
|
eventType = CanvasContainer;
|
|
602
|
-
} else if (
|
|
659
|
+
} else if (canvasId === CANVAS_IMAGE_ID) {
|
|
603
660
|
eventType = CanvasImage;
|
|
604
|
-
} else if (
|
|
661
|
+
} else if (canvasId === CANVAS_SPRITE_ID) {
|
|
605
662
|
eventType = CanvasSprite;
|
|
606
|
-
} else if (
|
|
663
|
+
} else if (canvasId === CANVAS_TEXT_ID) {
|
|
607
664
|
eventType = CanvasText;
|
|
608
665
|
}
|
|
609
666
|
}
|
|
610
667
|
if (!eventType) {
|
|
611
|
-
console.error(`[Pixi'VN] CanvasElement ${
|
|
668
|
+
console.error(`[Pixi'VN] CanvasElement ${canvasId} not found`);
|
|
612
669
|
return;
|
|
613
670
|
}
|
|
614
671
|
let canvasElement = new eventType();
|
|
615
672
|
return canvasElement;
|
|
616
673
|
} catch (e) {
|
|
617
|
-
console.error(`[Pixi'VN] Error while getting CanvasElement ${
|
|
674
|
+
console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasId}`, e);
|
|
618
675
|
return;
|
|
619
676
|
}
|
|
620
677
|
}
|
|
@@ -642,19 +699,20 @@ function tickerDecorator(name) {
|
|
|
642
699
|
if (registeredTickers[name]) {
|
|
643
700
|
console.info(`[Pixi'VN] Ticker ${name} already exists, it will be overwritten`);
|
|
644
701
|
}
|
|
702
|
+
target.prototype.id = name;
|
|
645
703
|
registeredTickers[name] = target;
|
|
646
704
|
};
|
|
647
705
|
}
|
|
648
|
-
function
|
|
706
|
+
function geTickerInstanceById(tickerId, args, duration, priority) {
|
|
649
707
|
try {
|
|
650
|
-
let ticker = registeredTickers[
|
|
708
|
+
let ticker = registeredTickers[tickerId];
|
|
651
709
|
if (!ticker) {
|
|
652
|
-
console.error(`[Pixi'VN] Ticker ${
|
|
710
|
+
console.error(`[Pixi'VN] Ticker ${tickerId} not found`);
|
|
653
711
|
return;
|
|
654
712
|
}
|
|
655
713
|
return new ticker(args, duration, priority);
|
|
656
714
|
} catch (e) {
|
|
657
|
-
console.error(`[Pixi'VN] Error while getting Ticker ${
|
|
715
|
+
console.error(`[Pixi'VN] Error while getting Ticker ${tickerId}`, e);
|
|
658
716
|
return;
|
|
659
717
|
}
|
|
660
718
|
}
|
|
@@ -717,21 +775,21 @@ var ChoiceMenuOptionClose = class {
|
|
|
717
775
|
// src/functions/DialogueUtility.ts
|
|
718
776
|
function setDialogue(props) {
|
|
719
777
|
let text = "";
|
|
720
|
-
let
|
|
778
|
+
let character = void 0;
|
|
721
779
|
let dialogue;
|
|
722
780
|
if (typeof props === "string") {
|
|
723
781
|
text = props;
|
|
724
|
-
dialogue = new DialogueBaseModel(text,
|
|
782
|
+
dialogue = new DialogueBaseModel(text, character);
|
|
725
783
|
} else if (!(props instanceof DialogueBaseModel)) {
|
|
726
784
|
text = props.text;
|
|
727
785
|
if (props.character) {
|
|
728
786
|
if (typeof props.character === "string") {
|
|
729
|
-
|
|
787
|
+
character = props.character;
|
|
730
788
|
} else {
|
|
731
|
-
|
|
789
|
+
character = props.character.id;
|
|
732
790
|
}
|
|
733
791
|
}
|
|
734
|
-
dialogue = new DialogueBaseModel(text,
|
|
792
|
+
dialogue = new DialogueBaseModel(text, character);
|
|
735
793
|
} else {
|
|
736
794
|
dialogue = props;
|
|
737
795
|
}
|
|
@@ -757,6 +815,34 @@ function setChoiceMenuOptions(options) {
|
|
|
757
815
|
GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY, value);
|
|
758
816
|
GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex);
|
|
759
817
|
}
|
|
818
|
+
function getChoiceMenuOptions() {
|
|
819
|
+
let d = GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY);
|
|
820
|
+
if (d) {
|
|
821
|
+
let options = [];
|
|
822
|
+
d.forEach((option, index) => {
|
|
823
|
+
if (option.type === Close) {
|
|
824
|
+
let itemLabel = newCloseLabel(index);
|
|
825
|
+
options.push({
|
|
826
|
+
text: option.text,
|
|
827
|
+
label: itemLabel,
|
|
828
|
+
type: Close,
|
|
829
|
+
closeCurrentLabel: option.closeCurrentLabel,
|
|
830
|
+
props: {}
|
|
831
|
+
});
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
let label = getLabelById(option.label);
|
|
835
|
+
if (label) {
|
|
836
|
+
let itemLabel = new Label(label.id, label.steps, label.onStepRun, index);
|
|
837
|
+
options.push(__spreadProps(__spreadValues({}, option), {
|
|
838
|
+
label: itemLabel
|
|
839
|
+
}));
|
|
840
|
+
}
|
|
841
|
+
});
|
|
842
|
+
return options;
|
|
843
|
+
}
|
|
844
|
+
return void 0;
|
|
845
|
+
}
|
|
760
846
|
|
|
761
847
|
// src/classes/ticker/TickerBase.ts
|
|
762
848
|
var TickerBase = class {
|
|
@@ -766,9 +852,14 @@ var TickerBase = class {
|
|
|
766
852
|
* @param priority The priority of the ticker. @default UPDATE_PRIORITY.NORMAL
|
|
767
853
|
*/
|
|
768
854
|
constructor(args, duration, priority) {
|
|
855
|
+
/**
|
|
856
|
+
* Get the id of the ticker. This variable is used in the system to get the ticker by id, {@link geTickerInstanceById}
|
|
857
|
+
*/
|
|
858
|
+
this.id = "ticker_id_not_set";
|
|
769
859
|
this.args = args;
|
|
770
860
|
this.duration = duration;
|
|
771
861
|
this.priority = priority;
|
|
862
|
+
this.id = this.constructor.prototype.id;
|
|
772
863
|
}
|
|
773
864
|
/**
|
|
774
865
|
* The method that will be called every frame.
|
|
@@ -991,8 +1082,8 @@ var ZoomTicker = class extends TickerBase {
|
|
|
991
1082
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
992
1083
|
}
|
|
993
1084
|
let type = args.type || "zoom";
|
|
994
|
-
let xLimit = Infinity;
|
|
995
|
-
let yLimit = Infinity;
|
|
1085
|
+
let xLimit = type === "zoom" ? Infinity : 0;
|
|
1086
|
+
let yLimit = type === "zoom" ? Infinity : 0;
|
|
996
1087
|
if (args.limit) {
|
|
997
1088
|
if (typeof args.limit === "number") {
|
|
998
1089
|
xLimit = args.limit;
|
|
@@ -1031,7 +1122,7 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1031
1122
|
if (element.scale.x >= xLimit && element.scale.y >= yLimit) {
|
|
1032
1123
|
element.scale.x = xLimit;
|
|
1033
1124
|
element.scale.y = yLimit;
|
|
1034
|
-
|
|
1125
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1035
1126
|
}
|
|
1036
1127
|
} else if (type === "unzoom") {
|
|
1037
1128
|
if (element.scale.x < xLimit) {
|
|
@@ -1043,21 +1134,36 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1043
1134
|
if (element.scale.x <= xLimit && element.scale.y <= yLimit) {
|
|
1044
1135
|
element.scale.x = xLimit;
|
|
1045
1136
|
element.scale.y = yLimit;
|
|
1046
|
-
|
|
1137
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1047
1138
|
}
|
|
1048
1139
|
}
|
|
1049
1140
|
if (xSpeed < 1e-5 && ySpeed < 1e-5 && !(args.speedProgression && args.speedProgression.type == "linear" && args.speedProgression.amt != 0)) {
|
|
1050
|
-
|
|
1141
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1051
1142
|
}
|
|
1052
1143
|
}
|
|
1053
1144
|
});
|
|
1054
1145
|
if (args.speedProgression)
|
|
1055
1146
|
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1056
1147
|
}
|
|
1148
|
+
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
1149
|
+
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
1150
|
+
}
|
|
1057
1151
|
};
|
|
1058
1152
|
ZoomTicker = __decorateClass([
|
|
1059
1153
|
tickerDecorator()
|
|
1060
1154
|
], ZoomTicker);
|
|
1155
|
+
var ZoomInOutTicker = class extends ZoomTicker {
|
|
1156
|
+
constructor(props, duration, priority) {
|
|
1157
|
+
super(props, duration, priority);
|
|
1158
|
+
}
|
|
1159
|
+
onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2) {
|
|
1160
|
+
if (element.children.length > 0) {
|
|
1161
|
+
let elementChild = element.children[0];
|
|
1162
|
+
GameWindowManager.addCanvasElement(tag, elementChild);
|
|
1163
|
+
}
|
|
1164
|
+
super.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1165
|
+
}
|
|
1166
|
+
};
|
|
1061
1167
|
|
|
1062
1168
|
// src/constants.ts
|
|
1063
1169
|
var Repeat = "repeat";
|
|
@@ -1172,6 +1278,147 @@ function showWithFadeTransition(_0, _1) {
|
|
|
1172
1278
|
function removeWithFadeTransition(tag, props = {}, priority) {
|
|
1173
1279
|
return removeWithDissolveTransition(tag, props, priority);
|
|
1174
1280
|
}
|
|
1281
|
+
function moveIn(_0, _1) {
|
|
1282
|
+
return __async(this, arguments, function* (tag, image, props = { direction: "right" }, priority) {
|
|
1283
|
+
var _a;
|
|
1284
|
+
let canvasElement;
|
|
1285
|
+
if (typeof image === "string") {
|
|
1286
|
+
canvasElement = addImage(tag, image);
|
|
1287
|
+
} else {
|
|
1288
|
+
canvasElement = image;
|
|
1289
|
+
GameWindowManager.addCanvasElement(tag, canvasElement);
|
|
1290
|
+
}
|
|
1291
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1292
|
+
yield canvasElement.load();
|
|
1293
|
+
}
|
|
1294
|
+
let destination = { x: canvasElement.x, y: canvasElement.y };
|
|
1295
|
+
if (props.direction == "up") {
|
|
1296
|
+
canvasElement.y = GameWindowManager.canvasHeight + canvasElement.height;
|
|
1297
|
+
} else if (props.direction == "down") {
|
|
1298
|
+
canvasElement.y = -canvasElement.height;
|
|
1299
|
+
} else if (props.direction == "left") {
|
|
1300
|
+
canvasElement.x = GameWindowManager.canvasWidth + canvasElement.width;
|
|
1301
|
+
} else if (props.direction == "right") {
|
|
1302
|
+
canvasElement.x = -canvasElement.width;
|
|
1303
|
+
}
|
|
1304
|
+
let effect = new MoveTicker(__spreadProps(__spreadValues({}, props), {
|
|
1305
|
+
destination,
|
|
1306
|
+
startOnlyIfHaveTexture: true
|
|
1307
|
+
}), priority);
|
|
1308
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1309
|
+
});
|
|
1310
|
+
}
|
|
1311
|
+
function moveOut(tag, props = { direction: "right" }, priority) {
|
|
1312
|
+
let canvasElement = GameWindowManager.getCanvasElement(tag);
|
|
1313
|
+
if (!canvasElement) {
|
|
1314
|
+
console.warn("[Pixi'VN] The canvas element is not found.");
|
|
1315
|
+
return;
|
|
1316
|
+
}
|
|
1317
|
+
let destination = { x: canvasElement.x, y: canvasElement.y };
|
|
1318
|
+
if (props.direction == "up") {
|
|
1319
|
+
destination.y = -canvasElement.height;
|
|
1320
|
+
} else if (props.direction == "down") {
|
|
1321
|
+
destination.y = GameWindowManager.canvasHeight + canvasElement.height;
|
|
1322
|
+
} else if (props.direction == "left") {
|
|
1323
|
+
destination.x = -canvasElement.width;
|
|
1324
|
+
} else if (props.direction == "right") {
|
|
1325
|
+
destination.x = GameWindowManager.canvasWidth + canvasElement.width;
|
|
1326
|
+
}
|
|
1327
|
+
let effect = new MoveTicker(__spreadProps(__spreadValues({}, props), {
|
|
1328
|
+
destination,
|
|
1329
|
+
startOnlyIfHaveTexture: true,
|
|
1330
|
+
tagToRemoveAfter: tag
|
|
1331
|
+
}), priority);
|
|
1332
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1333
|
+
}
|
|
1334
|
+
function zoomIn(_0, _1) {
|
|
1335
|
+
return __async(this, arguments, function* (tag, image, props = { direction: "right" }, priority) {
|
|
1336
|
+
var _a;
|
|
1337
|
+
let canvasElement;
|
|
1338
|
+
if (typeof image === "string") {
|
|
1339
|
+
canvasElement = new CanvasImage({}, image);
|
|
1340
|
+
} else {
|
|
1341
|
+
canvasElement = image;
|
|
1342
|
+
}
|
|
1343
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1344
|
+
yield canvasElement.load();
|
|
1345
|
+
}
|
|
1346
|
+
let container = new CanvasContainer();
|
|
1347
|
+
container.addChild(canvasElement);
|
|
1348
|
+
container.height = GameWindowManager.canvasHeight;
|
|
1349
|
+
container.width = GameWindowManager.canvasWidth;
|
|
1350
|
+
GameWindowManager.addCanvasElement(tag, container);
|
|
1351
|
+
if (props.direction == "up") {
|
|
1352
|
+
container.pivot.y = GameWindowManager.canvasHeight;
|
|
1353
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1354
|
+
container.y = GameWindowManager.canvasHeight;
|
|
1355
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1356
|
+
} else if (props.direction == "down") {
|
|
1357
|
+
container.pivot.y = 0;
|
|
1358
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1359
|
+
container.y = 0;
|
|
1360
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1361
|
+
} else if (props.direction == "left") {
|
|
1362
|
+
container.pivot.x = GameWindowManager.canvasWidth;
|
|
1363
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1364
|
+
container.x = GameWindowManager.canvasWidth;
|
|
1365
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1366
|
+
} else if (props.direction == "right") {
|
|
1367
|
+
container.pivot.x = 0;
|
|
1368
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1369
|
+
container.x = 0;
|
|
1370
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1371
|
+
}
|
|
1372
|
+
container.scale.set(0);
|
|
1373
|
+
let effect = new ZoomInOutTicker(__spreadProps(__spreadValues({}, props), {
|
|
1374
|
+
startOnlyIfHaveTexture: true,
|
|
1375
|
+
type: "zoom",
|
|
1376
|
+
limit: 1
|
|
1377
|
+
}), priority);
|
|
1378
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
function zoomOut(tag, props = { direction: "right" }, priority) {
|
|
1382
|
+
let canvasElement = GameWindowManager.getCanvasElement(tag);
|
|
1383
|
+
if (!canvasElement) {
|
|
1384
|
+
console.warn("[Pixi'VN] The canvas element is not found.");
|
|
1385
|
+
return;
|
|
1386
|
+
}
|
|
1387
|
+
let container = new CanvasContainer();
|
|
1388
|
+
container.addChild(canvasElement);
|
|
1389
|
+
container.height = GameWindowManager.canvasHeight;
|
|
1390
|
+
container.width = GameWindowManager.canvasWidth;
|
|
1391
|
+
GameWindowManager.addCanvasElement(tag, container);
|
|
1392
|
+
if (props.direction == "up") {
|
|
1393
|
+
container.pivot.y = GameWindowManager.canvasHeight;
|
|
1394
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1395
|
+
container.y = GameWindowManager.canvasHeight;
|
|
1396
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1397
|
+
} else if (props.direction == "down") {
|
|
1398
|
+
container.pivot.y = 0;
|
|
1399
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1400
|
+
container.y = 0;
|
|
1401
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1402
|
+
} else if (props.direction == "left") {
|
|
1403
|
+
container.pivot.x = GameWindowManager.canvasWidth;
|
|
1404
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1405
|
+
container.x = GameWindowManager.canvasWidth;
|
|
1406
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1407
|
+
} else if (props.direction == "right") {
|
|
1408
|
+
container.pivot.x = 0;
|
|
1409
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1410
|
+
container.x = 0;
|
|
1411
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1412
|
+
}
|
|
1413
|
+
container.scale.set(1);
|
|
1414
|
+
let effect = new ZoomInOutTicker(__spreadProps(__spreadValues({}, props), {
|
|
1415
|
+
startOnlyIfHaveTexture: true,
|
|
1416
|
+
type: "unzoom",
|
|
1417
|
+
limit: 0,
|
|
1418
|
+
tagToRemoveAfter: tag
|
|
1419
|
+
}), priority);
|
|
1420
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1421
|
+
}
|
|
1175
1422
|
|
|
1176
1423
|
// src/functions/ExportUtility.ts
|
|
1177
1424
|
function createExportableElement(element) {
|
|
@@ -1634,18 +1881,18 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1634
1881
|
* ```
|
|
1635
1882
|
*/
|
|
1636
1883
|
static addTicker(canvasElementTag, ticker) {
|
|
1637
|
-
let
|
|
1884
|
+
let tickerId = ticker.id;
|
|
1638
1885
|
if (typeof canvasElementTag === "string") {
|
|
1639
1886
|
canvasElementTag = [canvasElementTag];
|
|
1640
1887
|
}
|
|
1641
|
-
if (!
|
|
1642
|
-
console.error(`[Pixi'VN] Ticker ${
|
|
1888
|
+
if (!geTickerInstanceById(tickerId, ticker.args, ticker.duration, ticker.priority)) {
|
|
1889
|
+
console.error(`[Pixi'VN] Ticker ${tickerId} not found`);
|
|
1643
1890
|
return;
|
|
1644
1891
|
}
|
|
1645
1892
|
let tickerHistory = {
|
|
1646
1893
|
fn: () => {
|
|
1647
1894
|
},
|
|
1648
|
-
|
|
1895
|
+
id: tickerId,
|
|
1649
1896
|
args: createExportableElement(ticker.args),
|
|
1650
1897
|
canvasElementTags: canvasElementTag,
|
|
1651
1898
|
priority: ticker.priority,
|
|
@@ -1661,11 +1908,11 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1661
1908
|
_GameWindowManager.removeTicker(id);
|
|
1662
1909
|
}
|
|
1663
1910
|
}, ticker.duration * 1e3);
|
|
1664
|
-
_GameWindowManager.addTickerTimeoutInfo(canvasElementTag,
|
|
1911
|
+
_GameWindowManager.addTickerTimeoutInfo(canvasElementTag, tickerId, timeout.toString(), true);
|
|
1665
1912
|
}
|
|
1666
1913
|
}
|
|
1667
1914
|
static pushTicker(id, tickerData, ticker) {
|
|
1668
|
-
_GameWindowManager.removeAssociationBetweenTickerCanvasElement(tickerData.canvasElementTags,
|
|
1915
|
+
_GameWindowManager.removeAssociationBetweenTickerCanvasElement(tickerData.canvasElementTags, ticker);
|
|
1669
1916
|
_GameWindowManager._currentTickers[id] = tickerData;
|
|
1670
1917
|
tickerData.fn = (t) => {
|
|
1671
1918
|
let data = _GameWindowManager._currentTickers[id];
|
|
@@ -1706,9 +1953,9 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1706
1953
|
if (step.hasOwnProperty("type") && step.type === "pause") {
|
|
1707
1954
|
return step;
|
|
1708
1955
|
}
|
|
1709
|
-
let
|
|
1956
|
+
let tickerId = step.id;
|
|
1710
1957
|
return {
|
|
1711
|
-
ticker:
|
|
1958
|
+
ticker: tickerId,
|
|
1712
1959
|
args: createExportableElement(step.args),
|
|
1713
1960
|
duration: step.duration
|
|
1714
1961
|
};
|
|
@@ -1746,16 +1993,16 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1746
1993
|
_GameWindowManager.addTickerTimeoutInfo(tag, "steps", timeout.toString(), false);
|
|
1747
1994
|
return;
|
|
1748
1995
|
}
|
|
1749
|
-
let ticker =
|
|
1996
|
+
let ticker = geTickerInstanceById(step.ticker, step.args, step.duration, step.priority);
|
|
1750
1997
|
if (!ticker) {
|
|
1751
1998
|
console.error(`[Pixi'VN] Ticker ${step.ticker} not found`);
|
|
1752
1999
|
return;
|
|
1753
2000
|
}
|
|
1754
|
-
let tickerName = ticker.
|
|
2001
|
+
let tickerName = ticker.id;
|
|
1755
2002
|
let tickerHistory = {
|
|
1756
2003
|
fn: () => {
|
|
1757
2004
|
},
|
|
1758
|
-
|
|
2005
|
+
id: tickerName,
|
|
1759
2006
|
args: createExportableElement(ticker.args),
|
|
1760
2007
|
canvasElementTags: [tag],
|
|
1761
2008
|
priority: ticker.priority,
|
|
@@ -1812,26 +2059,26 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1812
2059
|
* ```
|
|
1813
2060
|
*/
|
|
1814
2061
|
static removeAssociationBetweenTickerCanvasElement(tags, ticker) {
|
|
1815
|
-
let
|
|
2062
|
+
let tickerId;
|
|
1816
2063
|
if (typeof ticker === "string") {
|
|
1817
|
-
|
|
2064
|
+
tickerId = ticker;
|
|
1818
2065
|
} else if (ticker instanceof TickerBase) {
|
|
1819
|
-
|
|
2066
|
+
tickerId = ticker.id;
|
|
1820
2067
|
} else {
|
|
1821
|
-
|
|
2068
|
+
tickerId = ticker.prototype.id;
|
|
1822
2069
|
}
|
|
1823
2070
|
if (typeof tags === "string") {
|
|
1824
2071
|
tags = [tags];
|
|
1825
2072
|
}
|
|
1826
2073
|
for (let id in _GameWindowManager._currentTickers) {
|
|
1827
2074
|
let ticker2 = _GameWindowManager._currentTickers[id];
|
|
1828
|
-
if (ticker2.
|
|
2075
|
+
if (ticker2.id === tickerId) {
|
|
1829
2076
|
_GameWindowManager._currentTickers[id].canvasElementTags = ticker2.canvasElementTags.filter((e) => !tags.includes(e));
|
|
1830
2077
|
}
|
|
1831
2078
|
}
|
|
1832
2079
|
for (let timeout in _GameWindowManager._currentTickersTimeouts) {
|
|
1833
2080
|
let TickerTimeout = _GameWindowManager._currentTickersTimeouts[timeout];
|
|
1834
|
-
if (TickerTimeout.ticker ===
|
|
2081
|
+
if (TickerTimeout.ticker === tickerId && TickerTimeout.canBeDeletedBeforeEnd) {
|
|
1835
2082
|
_GameWindowManager._currentTickersTimeouts[timeout].tags = TickerTimeout.tags.filter((t) => !tags.includes(t));
|
|
1836
2083
|
}
|
|
1837
2084
|
}
|
|
@@ -2017,11 +2264,11 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
2017
2264
|
for (let id in currentTickers) {
|
|
2018
2265
|
let t = currentTickers[id];
|
|
2019
2266
|
let tags = t.canvasElementTags;
|
|
2020
|
-
let ticker =
|
|
2267
|
+
let ticker = geTickerInstanceById(t.id, t.args, t.duration, t.priority);
|
|
2021
2268
|
if (ticker) {
|
|
2022
2269
|
_GameWindowManager.addTicker(tags, ticker);
|
|
2023
2270
|
} else {
|
|
2024
|
-
console.error(`[Pixi'VN] Ticker ${t.
|
|
2271
|
+
console.error(`[Pixi'VN] Ticker ${t.id} not found`);
|
|
2025
2272
|
}
|
|
2026
2273
|
}
|
|
2027
2274
|
}
|
|
@@ -2222,6 +2469,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2222
2469
|
_GameStepManager._openedLabels = _GameStepManager.originalStepData.openedLabels;
|
|
2223
2470
|
}
|
|
2224
2471
|
/* Run Methods */
|
|
2472
|
+
static get canGoNext() {
|
|
2473
|
+
let options = getChoiceMenuOptions();
|
|
2474
|
+
if (options && options.length > 0) {
|
|
2475
|
+
return false;
|
|
2476
|
+
}
|
|
2477
|
+
return true;
|
|
2478
|
+
}
|
|
2225
2479
|
/**
|
|
2226
2480
|
* Execute the next step and add it to the history.
|
|
2227
2481
|
* @param props The props to pass to the step.
|
|
@@ -2231,7 +2485,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2231
2485
|
* ```typescript
|
|
2232
2486
|
* function nextOnClick() {
|
|
2233
2487
|
* setLoading(true)
|
|
2234
|
-
* GameStepManager.
|
|
2488
|
+
* GameStepManager.goNext(yourParams)
|
|
2235
2489
|
* .then((result) => {
|
|
2236
2490
|
* setUpdate((p) => p + 1)
|
|
2237
2491
|
* setLoading(false)
|
|
@@ -2246,8 +2500,12 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2246
2500
|
* }
|
|
2247
2501
|
* ```
|
|
2248
2502
|
*/
|
|
2249
|
-
static
|
|
2503
|
+
static goNext(props, choiseMade) {
|
|
2250
2504
|
return __async(this, null, function* () {
|
|
2505
|
+
if (!_GameStepManager.canGoNext) {
|
|
2506
|
+
console.warn("[Pixi'VN] The player must make a choice");
|
|
2507
|
+
return;
|
|
2508
|
+
}
|
|
2251
2509
|
_GameStepManager.increaseCurrentStepIndex();
|
|
2252
2510
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2253
2511
|
});
|
|
@@ -2278,7 +2536,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2278
2536
|
return result;
|
|
2279
2537
|
} else if (_GameStepManager.openedLabels.length > 1) {
|
|
2280
2538
|
_GameStepManager.closeCurrentLabel();
|
|
2281
|
-
return yield _GameStepManager.
|
|
2539
|
+
return yield _GameStepManager.goNext(props, choiseMade);
|
|
2282
2540
|
} else {
|
|
2283
2541
|
_GameStepManager.restorLastLabelList();
|
|
2284
2542
|
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");
|
|
@@ -2426,7 +2684,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2426
2684
|
if (choice.closeCurrentLabel) {
|
|
2427
2685
|
_GameStepManager.closeCurrentLabel();
|
|
2428
2686
|
}
|
|
2429
|
-
return _GameStepManager.
|
|
2687
|
+
return _GameStepManager.goNext(props, choiseMade);
|
|
2430
2688
|
});
|
|
2431
2689
|
}
|
|
2432
2690
|
/* After Update Methods */
|
|
@@ -2754,15 +3012,15 @@ var DialogueBaseModel = class {
|
|
|
2754
3012
|
if (typeof text === "string") {
|
|
2755
3013
|
this.text = text;
|
|
2756
3014
|
if (typeof character === "string") {
|
|
2757
|
-
this.
|
|
3015
|
+
this.character = character;
|
|
2758
3016
|
} else {
|
|
2759
|
-
this.
|
|
3017
|
+
this.character = character == null ? void 0 : character.id;
|
|
2760
3018
|
}
|
|
2761
3019
|
this.oltherParams = oltherParams;
|
|
2762
3020
|
} else {
|
|
2763
3021
|
this.text = text.text;
|
|
2764
|
-
if (text.
|
|
2765
|
-
this.
|
|
3022
|
+
if (text.character) {
|
|
3023
|
+
this.character = text.character;
|
|
2766
3024
|
}
|
|
2767
3025
|
this.oltherParams = text.oltherParams || {};
|
|
2768
3026
|
}
|
|
@@ -2775,7 +3033,7 @@ var DialogueBaseModel = class {
|
|
|
2775
3033
|
export() {
|
|
2776
3034
|
return {
|
|
2777
3035
|
text: this.text,
|
|
2778
|
-
|
|
3036
|
+
character: this.character,
|
|
2779
3037
|
oltherParams: this.oltherParams
|
|
2780
3038
|
};
|
|
2781
3039
|
}
|
|
@@ -2797,81 +3055,214 @@ var helmlokImage = "https://pixijs.com/assets/helmlok.png";
|
|
|
2797
3055
|
var helmlokName = `<span style="color:blue">Helmlok</span>`;
|
|
2798
3056
|
var skullyImage = "https://pixijs.com/assets/skully.png";
|
|
2799
3057
|
var skullyName = `<span style="color:red">Skully</span>`;
|
|
3058
|
+
var bunnyImage = "https://pixijs.com/assets/bunny.png";
|
|
3059
|
+
var bunnyName = `Bunny`;
|
|
2800
3060
|
|
|
2801
|
-
// src/labels/
|
|
2802
|
-
var
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
3061
|
+
// src/labels/CanvasEventsTestLabel.ts
|
|
3062
|
+
var EventTest1 = class extends CanvasEvent {
|
|
3063
|
+
fn(event, sprite) {
|
|
3064
|
+
if (event === "pointerdown") {
|
|
3065
|
+
sprite.scale.x *= 1.25;
|
|
3066
|
+
sprite.scale.y *= 1.25;
|
|
3067
|
+
}
|
|
3068
|
+
}
|
|
3069
|
+
};
|
|
3070
|
+
EventTest1 = __decorateClass([
|
|
3071
|
+
eventDecorator("___pixi_vn_canvas_events_test_event1___")
|
|
3072
|
+
], EventTest1);
|
|
3073
|
+
var EventTest2 = class extends CanvasEvent {
|
|
3074
|
+
constructor() {
|
|
3075
|
+
super(...arguments);
|
|
3076
|
+
this.textureButtonDown = pixi_js.Texture.from("https://pixijs.com/assets/button_down.png");
|
|
3077
|
+
this.textureButtonOver = pixi_js.Texture.from("https://pixijs.com/assets/button_over.png");
|
|
3078
|
+
this.textureButton = pixi_js.Texture.from("https://pixijs.com/assets/button.png");
|
|
3079
|
+
}
|
|
3080
|
+
fn(event, sprite) {
|
|
3081
|
+
if (event === "pointerdown") {
|
|
3082
|
+
sprite.isdown = true;
|
|
3083
|
+
sprite.texture = this.textureButtonDown;
|
|
3084
|
+
sprite.alpha = 1;
|
|
3085
|
+
} else if (event === "pointerup" || event === "pointerupoutside") {
|
|
3086
|
+
sprite.isdown = false;
|
|
3087
|
+
if (sprite.isOver) {
|
|
3088
|
+
sprite.texture = this.textureButtonOver;
|
|
3089
|
+
} else {
|
|
3090
|
+
sprite.texture = this.textureButton;
|
|
3091
|
+
}
|
|
3092
|
+
} else if (event === "pointerover") {
|
|
3093
|
+
sprite.isOver = true;
|
|
3094
|
+
if (sprite.isdown) {
|
|
3095
|
+
return;
|
|
3096
|
+
}
|
|
3097
|
+
sprite.texture = this.textureButtonOver;
|
|
3098
|
+
} else if (event === "pointerout") {
|
|
3099
|
+
sprite.isOver = false;
|
|
3100
|
+
if (sprite.isdown) {
|
|
3101
|
+
return;
|
|
3102
|
+
}
|
|
3103
|
+
sprite.texture = this.textureButton;
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
};
|
|
3107
|
+
EventTest2 = __decorateClass([
|
|
3108
|
+
eventDecorator("___pixi_vn_canvas_events_test_event2___")
|
|
3109
|
+
], EventTest2);
|
|
3110
|
+
var CANVAS_EVENTS_TEST_LABEL = "___pixi_vn_canvas_events_test___";
|
|
3111
|
+
var canvasEventsTestLabel = newLabel(
|
|
3112
|
+
CANVAS_EVENTS_TEST_LABEL,
|
|
3113
|
+
[
|
|
3114
|
+
() => setDialogue({
|
|
2806
3115
|
character: juliette,
|
|
2807
|
-
text:
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
3116
|
+
text: "This is the test of clickable elements in a canvas."
|
|
3117
|
+
}),
|
|
3118
|
+
() => __async(void 0, null, function* () {
|
|
3119
|
+
setDialogue({
|
|
3120
|
+
character: juliette,
|
|
3121
|
+
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).)`
|
|
3122
|
+
});
|
|
3123
|
+
const texture = yield pixi_js.Assets.load(bunnyImage);
|
|
3124
|
+
const sprite = CanvasSprite.from(texture);
|
|
3125
|
+
sprite.anchor.set(0.5);
|
|
3126
|
+
sprite.x = GameWindowManager.screen.width / 2;
|
|
3127
|
+
sprite.y = GameWindowManager.screen.height / 2;
|
|
3128
|
+
sprite.eventMode = "static";
|
|
3129
|
+
sprite.cursor = "pointer";
|
|
3130
|
+
sprite.onEvent("pointerdown", EventTest1);
|
|
3131
|
+
GameWindowManager.addCanvasElement("bunny", sprite);
|
|
3132
|
+
}),
|
|
3133
|
+
() => __async(void 0, null, function* () {
|
|
3134
|
+
GameWindowManager.clear();
|
|
3135
|
+
setDialogue({
|
|
3136
|
+
character: juliette,
|
|
3137
|
+
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).)`
|
|
3138
|
+
});
|
|
3139
|
+
yield pixi_js.Assets.load([
|
|
3140
|
+
"https://pixijs.com/assets/bg_button.jpg",
|
|
3141
|
+
"https://pixijs.com/assets/button.png",
|
|
3142
|
+
"https://pixijs.com/assets/button_down.png",
|
|
3143
|
+
"https://pixijs.com/assets/button_over.png"
|
|
3144
|
+
]);
|
|
3145
|
+
const background = CanvasSprite.from("https://pixijs.com/assets/bg_button.jpg");
|
|
3146
|
+
background.width = GameWindowManager.screen.width;
|
|
3147
|
+
background.height = GameWindowManager.screen.height;
|
|
3148
|
+
GameWindowManager.addCanvasElement("bg", background);
|
|
3149
|
+
const textureButton = pixi_js.Texture.from("https://pixijs.com/assets/button.png");
|
|
3150
|
+
const buttons = [];
|
|
3151
|
+
const buttonPositions = [175, 75, 655, 75, 410, 325, 150, 465, 685, 445];
|
|
3152
|
+
for (let i = 0; i < 5; i++) {
|
|
3153
|
+
const button = new CanvasSprite(textureButton);
|
|
3154
|
+
button.anchor.set(0.5);
|
|
3155
|
+
button.x = buttonPositions[i * 2];
|
|
3156
|
+
button.y = buttonPositions[i * 2 + 1];
|
|
3157
|
+
button.eventMode = "static";
|
|
3158
|
+
button.cursor = "pointer";
|
|
3159
|
+
button.onEvent("pointerdown", EventTest2).onEvent("pointerup", EventTest2).onEvent("pointerupoutside", EventTest2).onEvent("pointerover", EventTest2).onEvent("pointerout", EventTest2);
|
|
3160
|
+
GameWindowManager.addCanvasElement("button" + i, button);
|
|
3161
|
+
buttons.push(button);
|
|
3162
|
+
}
|
|
3163
|
+
buttons[0].scale.set(1.2);
|
|
3164
|
+
buttons[2].rotation = Math.PI / 10;
|
|
3165
|
+
buttons[3].scale.set(0.8);
|
|
3166
|
+
buttons[4].scale.set(0.8, 1.2);
|
|
3167
|
+
buttons[4].rotation = Math.PI;
|
|
3168
|
+
})
|
|
3169
|
+
]
|
|
3170
|
+
);
|
|
3171
|
+
var AlienTintingTest = class extends CanvasSprite {
|
|
3172
|
+
constructor() {
|
|
3173
|
+
super(...arguments);
|
|
3174
|
+
this.direction = 0;
|
|
3175
|
+
this.turningSpeed = 0;
|
|
3176
|
+
this.speed = 0;
|
|
3177
|
+
}
|
|
3178
|
+
get memory() {
|
|
3179
|
+
return __spreadProps(__spreadValues({}, super.memory), {
|
|
3180
|
+
direction: this.direction,
|
|
3181
|
+
turningSpeed: this.turningSpeed,
|
|
3182
|
+
speed: this.speed
|
|
2870
3183
|
});
|
|
2871
|
-
}
|
|
2872
|
-
|
|
3184
|
+
}
|
|
3185
|
+
set memory(memory) {
|
|
3186
|
+
super.memory = memory;
|
|
3187
|
+
this.direction = memory.direction;
|
|
3188
|
+
this.turningSpeed = memory.turningSpeed;
|
|
3189
|
+
this.speed = memory.speed;
|
|
3190
|
+
}
|
|
3191
|
+
static from(source, skipCache) {
|
|
3192
|
+
let sprite = pixi_js.Sprite.from(source, skipCache);
|
|
3193
|
+
let mySprite = new AlienTintingTest();
|
|
3194
|
+
mySprite.texture = sprite.texture;
|
|
3195
|
+
return mySprite;
|
|
3196
|
+
}
|
|
3197
|
+
};
|
|
3198
|
+
AlienTintingTest = __decorateClass([
|
|
3199
|
+
canvasElementDecorator("___pixi_vn_custom_canvas_element___")
|
|
3200
|
+
], AlienTintingTest);
|
|
3201
|
+
var TintingTestTicker = class extends TickerBase {
|
|
3202
|
+
constructor() {
|
|
3203
|
+
super({});
|
|
3204
|
+
}
|
|
3205
|
+
fn(_t, _args, tags) {
|
|
3206
|
+
tags.forEach((tag) => {
|
|
3207
|
+
const dudeBoundsPadding = 100;
|
|
3208
|
+
const dudeBounds = new pixi_js.Rectangle(
|
|
3209
|
+
-dudeBoundsPadding,
|
|
3210
|
+
-dudeBoundsPadding,
|
|
3211
|
+
GameWindowManager.screen.width + dudeBoundsPadding * 2,
|
|
3212
|
+
GameWindowManager.screen.height + dudeBoundsPadding * 2
|
|
3213
|
+
);
|
|
3214
|
+
let dude = GameWindowManager.getCanvasElement(tag);
|
|
3215
|
+
if (dude && dude instanceof AlienTintingTest) {
|
|
3216
|
+
dude.direction += dude.turningSpeed * 0.01;
|
|
3217
|
+
dude.x += Math.sin(dude.direction) * dude.speed;
|
|
3218
|
+
dude.y += Math.cos(dude.direction) * dude.speed;
|
|
3219
|
+
dude.rotation = -dude.direction - Math.PI / 2;
|
|
3220
|
+
if (dude.x < dudeBounds.x) {
|
|
3221
|
+
dude.x += dudeBounds.width;
|
|
3222
|
+
} else if (dude.x > dudeBounds.x + dudeBounds.width) {
|
|
3223
|
+
dude.x -= dudeBounds.width;
|
|
3224
|
+
}
|
|
3225
|
+
if (dude.y < dudeBounds.y) {
|
|
3226
|
+
dude.y += dudeBounds.height;
|
|
3227
|
+
} else if (dude.y > dudeBounds.y + dudeBounds.height) {
|
|
3228
|
+
dude.y -= dudeBounds.height;
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
});
|
|
3232
|
+
}
|
|
3233
|
+
};
|
|
3234
|
+
TintingTestTicker = __decorateClass([
|
|
3235
|
+
tickerDecorator("___pixi_vn_custom_ticker___")
|
|
3236
|
+
], TintingTestTicker);
|
|
3237
|
+
var CUSTOM_TICKER_CANVAS_ELEMENT_TEST_LABEL = "___pixi_vn_custom_ticker_canvas_element_test___";
|
|
3238
|
+
var customTickerCanvasElementTestLabel = newLabel(
|
|
3239
|
+
CUSTOM_TICKER_CANVAS_ELEMENT_TEST_LABEL,
|
|
3240
|
+
[
|
|
3241
|
+
() => __async(void 0, null, function* () {
|
|
3242
|
+
const totalDudes = 100;
|
|
3243
|
+
for (let i = 0; i < totalDudes; i++) {
|
|
3244
|
+
const texture = yield pixi_js.Assets.load(eggHeadImage);
|
|
3245
|
+
const dude = AlienTintingTest.from(texture);
|
|
3246
|
+
dude.anchor.set(0.5);
|
|
3247
|
+
dude.scale.set(0.8 + Math.random() * 0.3);
|
|
3248
|
+
dude.x = Math.random() * GameWindowManager.screen.width;
|
|
3249
|
+
dude.y = Math.random() * GameWindowManager.screen.height;
|
|
3250
|
+
dude.tint = Math.random() * 16777215;
|
|
3251
|
+
dude.direction = Math.random() * Math.PI * 2;
|
|
3252
|
+
dude.turningSpeed = Math.random() - 0.8;
|
|
3253
|
+
dude.speed = 2 + Math.random() * 2;
|
|
3254
|
+
GameWindowManager.addCanvasElement("alien" + i, dude);
|
|
3255
|
+
GameWindowManager.addTicker("alien" + i, new TintingTestTicker());
|
|
3256
|
+
}
|
|
3257
|
+
setDialogue({
|
|
3258
|
+
character: juliette,
|
|
3259
|
+
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).)`
|
|
3260
|
+
});
|
|
3261
|
+
})
|
|
3262
|
+
]
|
|
3263
|
+
);
|
|
2873
3264
|
|
|
2874
|
-
// src/labels/
|
|
3265
|
+
// src/labels/ImagesAnimationsTestLabel.ts
|
|
2875
3266
|
var IMAGE_ANIMAIONS_TEST_LABEL = "___pixi_vn_images_animations_test___";
|
|
2876
3267
|
var imagesAnimationsTest = newLabel(IMAGE_ANIMAIONS_TEST_LABEL, [
|
|
2877
3268
|
() => __async(void 0, null, function* () {
|
|
@@ -2900,6 +3291,8 @@ var imagesAnimationsTest = newLabel(IMAGE_ANIMAIONS_TEST_LABEL, [
|
|
|
2900
3291
|
new ChoiceMenuOption("Rotate", imagesRotateTest),
|
|
2901
3292
|
new ChoiceMenuOption("Move", imagesMoveTest),
|
|
2902
3293
|
new ChoiceMenuOption("Zoom", imagesZoomTest),
|
|
3294
|
+
new ChoiceMenuOption("Move in/out", imagesMoveInOutTest),
|
|
3295
|
+
new ChoiceMenuOption("Zoom in/out", imagesZoomInOutTest),
|
|
2903
3296
|
new ChoiceMenuOptionClose("Cancel", true)
|
|
2904
3297
|
]);
|
|
2905
3298
|
}),
|
|
@@ -3154,6 +3547,148 @@ var imagesZoomTest = newLabel("___pixi_vn_images_zoom_test___", [
|
|
|
3154
3547
|
]);
|
|
3155
3548
|
}
|
|
3156
3549
|
]);
|
|
3550
|
+
var imagesMoveInOutTest = newLabel("___pixi_vn_images_move_in_out_test___", [
|
|
3551
|
+
() => __async(void 0, null, function* () {
|
|
3552
|
+
setDialogue({
|
|
3553
|
+
character: juliette,
|
|
3554
|
+
text: `Here's what's going to happen:
|
|
3555
|
+
- ${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.
|
|
3556
|
+
- ${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.
|
|
3557
|
+
- ${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.
|
|
3558
|
+
- ${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.`
|
|
3559
|
+
});
|
|
3560
|
+
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3561
|
+
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
3562
|
+
let helmlok = new CanvasImage({ x: 100, y: 300 }, helmlokImage);
|
|
3563
|
+
let skully = new CanvasImage({ x: 300, y: 300 }, skullyImage);
|
|
3564
|
+
moveIn("eggHead", eggHead, { speed: 800, direction: "down" });
|
|
3565
|
+
moveIn("flowerTop", flowerTop, {
|
|
3566
|
+
speed: 800,
|
|
3567
|
+
direction: "left",
|
|
3568
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3569
|
+
});
|
|
3570
|
+
moveIn("helmlok", helmlok, { speed: 800, direction: "right" });
|
|
3571
|
+
moveIn("skully", skully, {
|
|
3572
|
+
speed: 800,
|
|
3573
|
+
direction: "up",
|
|
3574
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3575
|
+
});
|
|
3576
|
+
}),
|
|
3577
|
+
() => {
|
|
3578
|
+
moveOut("eggHead", { speed: 800, direction: "down" });
|
|
3579
|
+
moveOut("flowerTop", { speed: 800, direction: "left" });
|
|
3580
|
+
moveOut("helmlok", { speed: 800, direction: "right" });
|
|
3581
|
+
moveOut("skully", { speed: 800, direction: "up" });
|
|
3582
|
+
}
|
|
3583
|
+
]);
|
|
3584
|
+
var imagesZoomInOutTest = newLabel("___pixi_vn_images_zoom_in_out_test___", [
|
|
3585
|
+
() => __async(void 0, null, function* () {
|
|
3586
|
+
GameWindowManager.removeCanvasElements();
|
|
3587
|
+
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3588
|
+
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
3589
|
+
let helmlok = new CanvasImage({ x: 100, y: 300 }, helmlokImage);
|
|
3590
|
+
let skully = new CanvasImage({ x: 300, y: 300 }, skullyImage);
|
|
3591
|
+
zoomIn("eggHead", eggHead, { speed: 3, direction: "down" });
|
|
3592
|
+
zoomIn("flowerTop", flowerTop, {
|
|
3593
|
+
speed: 3,
|
|
3594
|
+
direction: "left",
|
|
3595
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3596
|
+
});
|
|
3597
|
+
zoomIn("helmlok", helmlok, { speed: 3, direction: "right" });
|
|
3598
|
+
zoomIn("skully", skully, {
|
|
3599
|
+
speed: 3,
|
|
3600
|
+
direction: "up",
|
|
3601
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3602
|
+
});
|
|
3603
|
+
}),
|
|
3604
|
+
() => __async(void 0, null, function* () {
|
|
3605
|
+
zoomOut("eggHead", {
|
|
3606
|
+
speed: 3,
|
|
3607
|
+
direction: "down",
|
|
3608
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3609
|
+
});
|
|
3610
|
+
zoomOut("flowerTop", { speed: 3, direction: "left" });
|
|
3611
|
+
zoomOut("helmlok", { speed: 3, direction: "right" });
|
|
3612
|
+
zoomOut("skully", {
|
|
3613
|
+
speed: 3,
|
|
3614
|
+
direction: "up",
|
|
3615
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3616
|
+
});
|
|
3617
|
+
})
|
|
3618
|
+
]);
|
|
3619
|
+
|
|
3620
|
+
// src/labels/MarkdownTest.ts
|
|
3621
|
+
var MARKDOWN_TEST_LABEL = "___pixi_vn_markdown_test___";
|
|
3622
|
+
var markdownTest = newLabel(MARKDOWN_TEST_LABEL, [
|
|
3623
|
+
() => __async(void 0, null, function* () {
|
|
3624
|
+
setDialogue({
|
|
3625
|
+
character: juliette,
|
|
3626
|
+
text: `
|
|
3627
|
+
# Markdown Test
|
|
3628
|
+
|
|
3629
|
+
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.
|
|
3630
|
+
|
|
3631
|
+
For example in React, you can use the library [react-markdown](https://www.npmjs.com/package/react-markdown).
|
|
3632
|
+
|
|
3633
|
+
## Colored Text
|
|
3634
|
+
|
|
3635
|
+
<span style="color:blue">some *blue* text</span>.
|
|
3636
|
+
|
|
3637
|
+
<span style="color:red">some *red* text</span>.
|
|
3638
|
+
|
|
3639
|
+
<span style="color:green">some *green* text</span>.
|
|
3640
|
+
|
|
3641
|
+
## Bold Text
|
|
3642
|
+
|
|
3643
|
+
**This is bold text.**
|
|
3644
|
+
|
|
3645
|
+
## Italic Text
|
|
3646
|
+
|
|
3647
|
+
*This is italic text.*
|
|
3648
|
+
|
|
3649
|
+
## Delete Text
|
|
3650
|
+
|
|
3651
|
+
~~This is deleted text.~~
|
|
3652
|
+
|
|
3653
|
+
## Link Test
|
|
3654
|
+
|
|
3655
|
+
[Link to Google](https://www.google.com)
|
|
3656
|
+
|
|
3657
|
+
## H2 Test
|
|
3658
|
+
|
|
3659
|
+
### H3 Test
|
|
3660
|
+
|
|
3661
|
+
#### H4 Test
|
|
3662
|
+
|
|
3663
|
+
## Code Test
|
|
3664
|
+
|
|
3665
|
+
\`Hello World\`
|
|
3666
|
+
|
|
3667
|
+
\`\`\`js
|
|
3668
|
+
console.log("Hello World")
|
|
3669
|
+
\`\`\`
|
|
3670
|
+
|
|
3671
|
+
## List Test
|
|
3672
|
+
|
|
3673
|
+
- Item 1
|
|
3674
|
+
* Item 2
|
|
3675
|
+
- [x] Item 3
|
|
3676
|
+
|
|
3677
|
+
## Table Test
|
|
3678
|
+
|
|
3679
|
+
| Header 1 | Header 2 |
|
|
3680
|
+
| -------- | -------- |
|
|
3681
|
+
| Cell 1 | Cell 2 |
|
|
3682
|
+
|
|
3683
|
+
## Separator Test
|
|
3684
|
+
|
|
3685
|
+
***
|
|
3686
|
+
Footer
|
|
3687
|
+
|
|
3688
|
+
`
|
|
3689
|
+
});
|
|
3690
|
+
})
|
|
3691
|
+
]);
|
|
3157
3692
|
|
|
3158
3693
|
// src/labels/StartLabel.ts
|
|
3159
3694
|
var pixivnTestStartLabel = newLabel(
|
|
@@ -3185,7 +3720,9 @@ var pixivnTestStartLabel2 = newLabel(
|
|
|
3185
3720
|
GameWindowManager.clear();
|
|
3186
3721
|
setDialogue({ character: juliette, text: "Which test would you like to start with?" });
|
|
3187
3722
|
setChoiceMenuOptions([
|
|
3188
|
-
new ChoiceMenuOption("Images and Animations", imagesAnimationsTest),
|
|
3723
|
+
new ChoiceMenuOption("Images, Transitions and Animations Test", imagesAnimationsTest),
|
|
3724
|
+
new ChoiceMenuOption("Canvas Events Test Label", canvasEventsTestLabel),
|
|
3725
|
+
new ChoiceMenuOption("Custom Ticker Canvas Element Test", customTickerCanvasElementTestLabel),
|
|
3189
3726
|
new ChoiceMenuOption("Markdown Test", markdownTest)
|
|
3190
3727
|
]);
|
|
3191
3728
|
},
|