@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
|
@@ -53,6 +53,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
53
53
|
|
|
54
54
|
// src/classes/CanvasEvent.ts
|
|
55
55
|
var CanvasEvent = class {
|
|
56
|
+
constructor() {
|
|
57
|
+
/**
|
|
58
|
+
* Get the id of the event. This variable is used in the system to get the event by id, {@link getEventInstanceById}
|
|
59
|
+
*/
|
|
60
|
+
this.id = "event_id_not_set";
|
|
61
|
+
this.id = this.constructor.prototype.id;
|
|
62
|
+
}
|
|
56
63
|
fn(_event, _element) {
|
|
57
64
|
throw new Error("[Pixi'VN] The method CanvasEvent.fn() must be overridden");
|
|
58
65
|
}
|
|
@@ -80,7 +87,7 @@ var Label = class {
|
|
|
80
87
|
this._choiseIndex = choiseIndex;
|
|
81
88
|
}
|
|
82
89
|
/**
|
|
83
|
-
* Get the id of the label
|
|
90
|
+
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
84
91
|
*/
|
|
85
92
|
get id() {
|
|
86
93
|
return this._id;
|
|
@@ -169,17 +176,23 @@ function exportCanvasElement(element) {
|
|
|
169
176
|
return element.memory;
|
|
170
177
|
}
|
|
171
178
|
function importCanvasElement(memory) {
|
|
172
|
-
let element =
|
|
179
|
+
let element = getCanvasElementInstanceById(memory.pixivnId);
|
|
173
180
|
if (element) {
|
|
174
181
|
element.memory = memory;
|
|
175
182
|
} else {
|
|
176
|
-
throw new Error("[Pixi'VN] The element " + memory.
|
|
183
|
+
throw new Error("[Pixi'VN] The element " + memory.pixivnId + " could not be created");
|
|
177
184
|
}
|
|
178
185
|
return element;
|
|
179
186
|
}
|
|
180
187
|
|
|
181
188
|
// src/classes/canvas/CanvasContainer.ts
|
|
189
|
+
var CANVAS_CONTAINER_ID = "CanvasContainer";
|
|
182
190
|
var CanvasContainer = class extends Container {
|
|
191
|
+
constructor(options) {
|
|
192
|
+
super(options);
|
|
193
|
+
this.pixivnId = CANVAS_CONTAINER_ID;
|
|
194
|
+
this.pixivnId = this.constructor.prototype.pixivnId;
|
|
195
|
+
}
|
|
183
196
|
get memory() {
|
|
184
197
|
let memory = getMemoryContainer(this);
|
|
185
198
|
this.children.forEach((child) => {
|
|
@@ -195,8 +208,12 @@ var CanvasContainer = class extends Container {
|
|
|
195
208
|
}
|
|
196
209
|
};
|
|
197
210
|
function getMemoryContainer(element) {
|
|
211
|
+
let className = "CanvasContainer";
|
|
212
|
+
if (element.hasOwnProperty("pixivnId")) {
|
|
213
|
+
className = element.pixivnId;
|
|
214
|
+
}
|
|
198
215
|
return {
|
|
199
|
-
|
|
216
|
+
pixivnId: className,
|
|
200
217
|
elements: [],
|
|
201
218
|
width: element.width,
|
|
202
219
|
height: element.height,
|
|
@@ -320,43 +337,47 @@ function eventDecorator(name) {
|
|
|
320
337
|
if (registeredEvents[name]) {
|
|
321
338
|
console.info(`[Pixi'VN] Event ${name} already exists, it will be overwritten`);
|
|
322
339
|
}
|
|
340
|
+
target.prototype.id = name;
|
|
323
341
|
registeredEvents[name] = target;
|
|
324
342
|
};
|
|
325
343
|
}
|
|
326
|
-
function
|
|
344
|
+
function getEventTypeById(eventId) {
|
|
327
345
|
try {
|
|
328
|
-
let eventType = registeredEvents[
|
|
346
|
+
let eventType = registeredEvents[eventId];
|
|
329
347
|
if (!eventType) {
|
|
330
|
-
console.error(`[Pixi'VN] Event ${
|
|
348
|
+
console.error(`[Pixi'VN] Event ${eventId} not found`);
|
|
331
349
|
return;
|
|
332
350
|
}
|
|
333
351
|
new eventType();
|
|
334
352
|
return eventType;
|
|
335
353
|
} catch (e) {
|
|
336
|
-
console.error(`[Pixi'VN] Error while getting Event ${
|
|
354
|
+
console.error(`[Pixi'VN] Error while getting Event ${eventId}`, e);
|
|
337
355
|
return;
|
|
338
356
|
}
|
|
339
357
|
}
|
|
340
|
-
function
|
|
358
|
+
function getEventInstanceById(eventId) {
|
|
341
359
|
try {
|
|
342
|
-
let eventType = registeredEvents[
|
|
360
|
+
let eventType = registeredEvents[eventId];
|
|
343
361
|
if (!eventType) {
|
|
344
|
-
console.error(`[Pixi'VN] Event ${
|
|
362
|
+
console.error(`[Pixi'VN] Event ${eventId} not found`);
|
|
345
363
|
return;
|
|
346
364
|
}
|
|
347
365
|
let event = new eventType();
|
|
348
366
|
return event;
|
|
349
367
|
} catch (e) {
|
|
350
|
-
console.error(`[Pixi'VN] Error while getting Event ${
|
|
368
|
+
console.error(`[Pixi'VN] Error while getting Event ${eventId}`, e);
|
|
351
369
|
return;
|
|
352
370
|
}
|
|
353
371
|
}
|
|
354
372
|
|
|
355
373
|
// src/classes/canvas/CanvasSprite.ts
|
|
374
|
+
var CANVAS_SPRITE_ID = "CanvasSprite";
|
|
356
375
|
var CanvasSprite = class _CanvasSprite extends Sprite {
|
|
357
|
-
constructor() {
|
|
358
|
-
super(
|
|
376
|
+
constructor(options) {
|
|
377
|
+
super(options);
|
|
378
|
+
this.pixivnId = CANVAS_SPRITE_ID;
|
|
359
379
|
this._onEvents = {};
|
|
380
|
+
this.pixivnId = this.constructor.prototype.pixivnId;
|
|
360
381
|
}
|
|
361
382
|
get memory() {
|
|
362
383
|
return getMemorySprite(this);
|
|
@@ -397,9 +418,9 @@ var CanvasSprite = class _CanvasSprite extends Sprite {
|
|
|
397
418
|
* ```
|
|
398
419
|
*/
|
|
399
420
|
onEvent(event, eventClass) {
|
|
400
|
-
let
|
|
401
|
-
let instance =
|
|
402
|
-
this._onEvents[event] =
|
|
421
|
+
let id = eventClass.prototype.id;
|
|
422
|
+
let instance = getEventInstanceById(id);
|
|
423
|
+
this._onEvents[event] = id;
|
|
403
424
|
if (instance) {
|
|
404
425
|
super.on(event, () => {
|
|
405
426
|
instance.fn(event, this);
|
|
@@ -428,7 +449,7 @@ var CanvasSprite = class _CanvasSprite extends Sprite {
|
|
|
428
449
|
function getMemorySprite(element) {
|
|
429
450
|
let temp = getMemoryContainer(element);
|
|
430
451
|
return __spreadProps(__spreadValues({}, temp), {
|
|
431
|
-
|
|
452
|
+
pixivnId: element.pixivnId,
|
|
432
453
|
textureImage: getTextureMemory(element.texture),
|
|
433
454
|
anchor: { x: element.anchor.x, y: element.anchor.y },
|
|
434
455
|
roundPixels: element.roundPixels,
|
|
@@ -451,8 +472,8 @@ function setMemorySprite(element, memory) {
|
|
|
451
472
|
}
|
|
452
473
|
memory.roundPixels && (element.roundPixels = memory.roundPixels);
|
|
453
474
|
for (let event in memory.onEvents) {
|
|
454
|
-
let
|
|
455
|
-
let instance =
|
|
475
|
+
let id = memory.onEvents[event];
|
|
476
|
+
let instance = getEventTypeById(id);
|
|
456
477
|
if (instance) {
|
|
457
478
|
element.onEvent(event, instance);
|
|
458
479
|
}
|
|
@@ -460,9 +481,11 @@ function setMemorySprite(element, memory) {
|
|
|
460
481
|
}
|
|
461
482
|
|
|
462
483
|
// src/classes/canvas/CanvasImage.ts
|
|
484
|
+
var CANVAS_IMAGE_ID = "CanvasImage";
|
|
463
485
|
var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
464
486
|
constructor(options, imageLink) {
|
|
465
487
|
super(options);
|
|
488
|
+
this.pixivnId = CANVAS_IMAGE_ID;
|
|
466
489
|
this.imageLink = "";
|
|
467
490
|
if (imageLink) {
|
|
468
491
|
this.imageLink = imageLink;
|
|
@@ -470,12 +493,13 @@ var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
|
470
493
|
}
|
|
471
494
|
get memory() {
|
|
472
495
|
return __spreadProps(__spreadValues({}, getMemorySprite(this)), {
|
|
473
|
-
|
|
474
|
-
|
|
496
|
+
pixivnId: this.pixivnId,
|
|
497
|
+
imageLink: this.imageLink
|
|
475
498
|
});
|
|
476
499
|
}
|
|
477
500
|
set memory(memory) {
|
|
478
501
|
setMemorySprite(this, memory);
|
|
502
|
+
this.imageLink = memory.imageLink;
|
|
479
503
|
}
|
|
480
504
|
static from(source, skipCache) {
|
|
481
505
|
let sprite = Sprite.from(source, skipCache);
|
|
@@ -503,10 +527,13 @@ var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
|
503
527
|
});
|
|
504
528
|
}
|
|
505
529
|
};
|
|
530
|
+
var CANVAS_TEXT_ID = "CanvasText";
|
|
506
531
|
var CanvasText = class extends Text {
|
|
507
|
-
constructor() {
|
|
508
|
-
super(
|
|
532
|
+
constructor(options) {
|
|
533
|
+
super(options);
|
|
534
|
+
this.pixivnId = CANVAS_TEXT_ID;
|
|
509
535
|
this._onEvents = {};
|
|
536
|
+
this.pixivnId = this.constructor.prototype.pixivnId;
|
|
510
537
|
}
|
|
511
538
|
get memory() {
|
|
512
539
|
return getMemoryText(this);
|
|
@@ -547,9 +574,9 @@ var CanvasText = class extends Text {
|
|
|
547
574
|
* ```
|
|
548
575
|
*/
|
|
549
576
|
onEvent(event, eventClass) {
|
|
550
|
-
let
|
|
551
|
-
let instance =
|
|
552
|
-
this._onEvents[event] =
|
|
577
|
+
let id = eventClass.prototype.id;
|
|
578
|
+
let instance = getEventInstanceById(id);
|
|
579
|
+
this._onEvents[event] = id;
|
|
553
580
|
if (instance) {
|
|
554
581
|
super.on(event, () => {
|
|
555
582
|
instance.fn(event, this);
|
|
@@ -572,7 +599,7 @@ var CanvasText = class extends Text {
|
|
|
572
599
|
function getMemoryText(element) {
|
|
573
600
|
let temp = getMemoryContainer(element);
|
|
574
601
|
return __spreadProps(__spreadValues({}, temp), {
|
|
575
|
-
|
|
602
|
+
pixivnId: element.pixivnId,
|
|
576
603
|
anchor: { x: element.anchor.x, y: element.anchor.y },
|
|
577
604
|
text: element.text,
|
|
578
605
|
resolution: element.resolution,
|
|
@@ -595,8 +622,8 @@ function setMemoryText(element, memory) {
|
|
|
595
622
|
memory.style && (element.style = memory.style);
|
|
596
623
|
memory.roundPixels && (element.roundPixels = memory.roundPixels);
|
|
597
624
|
for (let event in memory.onEvents) {
|
|
598
|
-
let
|
|
599
|
-
let instance =
|
|
625
|
+
let id = memory.onEvents[event];
|
|
626
|
+
let instance = getEventTypeById(id);
|
|
600
627
|
if (instance) {
|
|
601
628
|
element.onEvent(event, instance);
|
|
602
629
|
}
|
|
@@ -605,32 +632,45 @@ function setMemoryText(element, memory) {
|
|
|
605
632
|
|
|
606
633
|
// src/decorators/CanvasElementDecorator.ts
|
|
607
634
|
var registeredCanvasElement = {};
|
|
608
|
-
function
|
|
635
|
+
function getCanvasElementInstanceById(canvasId) {
|
|
609
636
|
try {
|
|
610
|
-
let eventType = registeredCanvasElement[
|
|
637
|
+
let eventType = registeredCanvasElement[canvasId];
|
|
611
638
|
if (!eventType) {
|
|
612
|
-
if (
|
|
639
|
+
if (canvasId === CANVAS_CONTAINER_ID) {
|
|
613
640
|
eventType = CanvasContainer;
|
|
614
|
-
} else if (
|
|
641
|
+
} else if (canvasId === CANVAS_IMAGE_ID) {
|
|
615
642
|
eventType = CanvasImage;
|
|
616
|
-
} else if (
|
|
643
|
+
} else if (canvasId === CANVAS_SPRITE_ID) {
|
|
617
644
|
eventType = CanvasSprite;
|
|
618
|
-
} else if (
|
|
645
|
+
} else if (canvasId === CANVAS_TEXT_ID) {
|
|
619
646
|
eventType = CanvasText;
|
|
620
647
|
}
|
|
621
648
|
}
|
|
622
649
|
if (!eventType) {
|
|
623
|
-
console.error(`[Pixi'VN] CanvasElement ${
|
|
650
|
+
console.error(`[Pixi'VN] CanvasElement ${canvasId} not found`);
|
|
624
651
|
return;
|
|
625
652
|
}
|
|
626
653
|
let canvasElement = new eventType();
|
|
627
654
|
return canvasElement;
|
|
628
655
|
} catch (e) {
|
|
629
|
-
console.error(`[Pixi'VN] Error while getting CanvasElement ${
|
|
656
|
+
console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasId}`, e);
|
|
630
657
|
return;
|
|
631
658
|
}
|
|
632
659
|
}
|
|
633
660
|
|
|
661
|
+
// src/decorators/CharacterDecorator.ts
|
|
662
|
+
var registeredCharacters = {};
|
|
663
|
+
function saveCharacter(character) {
|
|
664
|
+
if (Array.isArray(character)) {
|
|
665
|
+
character.forEach((c) => saveCharacter(c));
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
if (registeredCharacters[character.id]) {
|
|
669
|
+
console.info(`[Pixi'VN] Character id ${character.id} already exists, it will be overwritten`);
|
|
670
|
+
}
|
|
671
|
+
registeredCharacters[character.id] = character;
|
|
672
|
+
}
|
|
673
|
+
|
|
634
674
|
// src/decorators/TickerDecorator.ts
|
|
635
675
|
var registeredTickers = {};
|
|
636
676
|
function tickerDecorator(name) {
|
|
@@ -641,41 +681,45 @@ function tickerDecorator(name) {
|
|
|
641
681
|
if (registeredTickers[name]) {
|
|
642
682
|
console.info(`[Pixi'VN] Ticker ${name} already exists, it will be overwritten`);
|
|
643
683
|
}
|
|
684
|
+
target.prototype.id = name;
|
|
644
685
|
registeredTickers[name] = target;
|
|
645
686
|
};
|
|
646
687
|
}
|
|
647
|
-
function
|
|
688
|
+
function geTickerInstanceById(tickerId, args, duration, priority) {
|
|
648
689
|
try {
|
|
649
|
-
let ticker = registeredTickers[
|
|
690
|
+
let ticker = registeredTickers[tickerId];
|
|
650
691
|
if (!ticker) {
|
|
651
|
-
console.error(`[Pixi'VN] Ticker ${
|
|
692
|
+
console.error(`[Pixi'VN] Ticker ${tickerId} not found`);
|
|
652
693
|
return;
|
|
653
694
|
}
|
|
654
695
|
return new ticker(args, duration, priority);
|
|
655
696
|
} catch (e) {
|
|
656
|
-
console.error(`[Pixi'VN] Error while getting Ticker ${
|
|
697
|
+
console.error(`[Pixi'VN] Error while getting Ticker ${tickerId}`, e);
|
|
657
698
|
return;
|
|
658
699
|
}
|
|
659
700
|
}
|
|
660
701
|
|
|
702
|
+
// src/types/CloseType.ts
|
|
703
|
+
var Close = "close";
|
|
704
|
+
|
|
661
705
|
// src/functions/DialogueUtility.ts
|
|
662
706
|
function setDialogue(props) {
|
|
663
707
|
let text = "";
|
|
664
|
-
let
|
|
708
|
+
let character = void 0;
|
|
665
709
|
let dialogue;
|
|
666
710
|
if (typeof props === "string") {
|
|
667
711
|
text = props;
|
|
668
|
-
dialogue = new DialogueBaseModel(text,
|
|
712
|
+
dialogue = new DialogueBaseModel(text, character);
|
|
669
713
|
} else if (!(props instanceof DialogueBaseModel)) {
|
|
670
714
|
text = props.text;
|
|
671
715
|
if (props.character) {
|
|
672
716
|
if (typeof props.character === "string") {
|
|
673
|
-
|
|
717
|
+
character = props.character;
|
|
674
718
|
} else {
|
|
675
|
-
|
|
719
|
+
character = props.character.id;
|
|
676
720
|
}
|
|
677
721
|
}
|
|
678
|
-
dialogue = new DialogueBaseModel(text,
|
|
722
|
+
dialogue = new DialogueBaseModel(text, character);
|
|
679
723
|
} else {
|
|
680
724
|
dialogue = props;
|
|
681
725
|
}
|
|
@@ -685,8 +729,33 @@ function setDialogue(props) {
|
|
|
685
729
|
function getDialogue() {
|
|
686
730
|
return GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY);
|
|
687
731
|
}
|
|
688
|
-
function
|
|
689
|
-
GameStorageManager.
|
|
732
|
+
function getChoiceMenuOptions() {
|
|
733
|
+
let d = GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY);
|
|
734
|
+
if (d) {
|
|
735
|
+
let options = [];
|
|
736
|
+
d.forEach((option, index) => {
|
|
737
|
+
if (option.type === Close) {
|
|
738
|
+
let itemLabel = newCloseLabel(index);
|
|
739
|
+
options.push({
|
|
740
|
+
text: option.text,
|
|
741
|
+
label: itemLabel,
|
|
742
|
+
type: Close,
|
|
743
|
+
closeCurrentLabel: option.closeCurrentLabel,
|
|
744
|
+
props: {}
|
|
745
|
+
});
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
let label = getLabelById(option.label);
|
|
749
|
+
if (label) {
|
|
750
|
+
let itemLabel = new Label(label.id, label.steps, label.onStepRun, index);
|
|
751
|
+
options.push(__spreadProps(__spreadValues({}, option), {
|
|
752
|
+
label: itemLabel
|
|
753
|
+
}));
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
return options;
|
|
757
|
+
}
|
|
758
|
+
return void 0;
|
|
690
759
|
}
|
|
691
760
|
|
|
692
761
|
// src/classes/ticker/TickerBase.ts
|
|
@@ -697,9 +766,14 @@ var TickerBase = class {
|
|
|
697
766
|
* @param priority The priority of the ticker. @default UPDATE_PRIORITY.NORMAL
|
|
698
767
|
*/
|
|
699
768
|
constructor(args, duration, priority) {
|
|
769
|
+
/**
|
|
770
|
+
* Get the id of the ticker. This variable is used in the system to get the ticker by id, {@link geTickerInstanceById}
|
|
771
|
+
*/
|
|
772
|
+
this.id = "ticker_id_not_set";
|
|
700
773
|
this.args = args;
|
|
701
774
|
this.duration = duration;
|
|
702
775
|
this.priority = priority;
|
|
776
|
+
this.id = this.constructor.prototype.id;
|
|
703
777
|
}
|
|
704
778
|
/**
|
|
705
779
|
* The method that will be called every frame.
|
|
@@ -922,8 +996,8 @@ var ZoomTicker = class extends TickerBase {
|
|
|
922
996
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
923
997
|
}
|
|
924
998
|
let type = args.type || "zoom";
|
|
925
|
-
let xLimit = Infinity;
|
|
926
|
-
let yLimit = Infinity;
|
|
999
|
+
let xLimit = type === "zoom" ? Infinity : 0;
|
|
1000
|
+
let yLimit = type === "zoom" ? Infinity : 0;
|
|
927
1001
|
if (args.limit) {
|
|
928
1002
|
if (typeof args.limit === "number") {
|
|
929
1003
|
xLimit = args.limit;
|
|
@@ -962,7 +1036,7 @@ var ZoomTicker = class extends TickerBase {
|
|
|
962
1036
|
if (element.scale.x >= xLimit && element.scale.y >= yLimit) {
|
|
963
1037
|
element.scale.x = xLimit;
|
|
964
1038
|
element.scale.y = yLimit;
|
|
965
|
-
|
|
1039
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
966
1040
|
}
|
|
967
1041
|
} else if (type === "unzoom") {
|
|
968
1042
|
if (element.scale.x < xLimit) {
|
|
@@ -974,17 +1048,20 @@ var ZoomTicker = class extends TickerBase {
|
|
|
974
1048
|
if (element.scale.x <= xLimit && element.scale.y <= yLimit) {
|
|
975
1049
|
element.scale.x = xLimit;
|
|
976
1050
|
element.scale.y = yLimit;
|
|
977
|
-
|
|
1051
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
978
1052
|
}
|
|
979
1053
|
}
|
|
980
1054
|
if (xSpeed < 1e-5 && ySpeed < 1e-5 && !(args.speedProgression && args.speedProgression.type == "linear" && args.speedProgression.amt != 0)) {
|
|
981
|
-
|
|
1055
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
982
1056
|
}
|
|
983
1057
|
}
|
|
984
1058
|
});
|
|
985
1059
|
if (args.speedProgression)
|
|
986
1060
|
updateTickerProgression(args, "speed", args.speedProgression);
|
|
987
1061
|
}
|
|
1062
|
+
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
1063
|
+
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
1064
|
+
}
|
|
988
1065
|
};
|
|
989
1066
|
ZoomTicker = __decorateClass([
|
|
990
1067
|
tickerDecorator()
|
|
@@ -1454,18 +1531,18 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1454
1531
|
* ```
|
|
1455
1532
|
*/
|
|
1456
1533
|
static addTicker(canvasElementTag, ticker) {
|
|
1457
|
-
let
|
|
1534
|
+
let tickerId = ticker.id;
|
|
1458
1535
|
if (typeof canvasElementTag === "string") {
|
|
1459
1536
|
canvasElementTag = [canvasElementTag];
|
|
1460
1537
|
}
|
|
1461
|
-
if (!
|
|
1462
|
-
console.error(`[Pixi'VN] Ticker ${
|
|
1538
|
+
if (!geTickerInstanceById(tickerId, ticker.args, ticker.duration, ticker.priority)) {
|
|
1539
|
+
console.error(`[Pixi'VN] Ticker ${tickerId} not found`);
|
|
1463
1540
|
return;
|
|
1464
1541
|
}
|
|
1465
1542
|
let tickerHistory = {
|
|
1466
1543
|
fn: () => {
|
|
1467
1544
|
},
|
|
1468
|
-
|
|
1545
|
+
id: tickerId,
|
|
1469
1546
|
args: createExportableElement(ticker.args),
|
|
1470
1547
|
canvasElementTags: canvasElementTag,
|
|
1471
1548
|
priority: ticker.priority,
|
|
@@ -1481,11 +1558,11 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1481
1558
|
_GameWindowManager.removeTicker(id);
|
|
1482
1559
|
}
|
|
1483
1560
|
}, ticker.duration * 1e3);
|
|
1484
|
-
_GameWindowManager.addTickerTimeoutInfo(canvasElementTag,
|
|
1561
|
+
_GameWindowManager.addTickerTimeoutInfo(canvasElementTag, tickerId, timeout.toString(), true);
|
|
1485
1562
|
}
|
|
1486
1563
|
}
|
|
1487
1564
|
static pushTicker(id, tickerData, ticker) {
|
|
1488
|
-
_GameWindowManager.removeAssociationBetweenTickerCanvasElement(tickerData.canvasElementTags,
|
|
1565
|
+
_GameWindowManager.removeAssociationBetweenTickerCanvasElement(tickerData.canvasElementTags, ticker);
|
|
1489
1566
|
_GameWindowManager._currentTickers[id] = tickerData;
|
|
1490
1567
|
tickerData.fn = (t) => {
|
|
1491
1568
|
let data = _GameWindowManager._currentTickers[id];
|
|
@@ -1526,9 +1603,9 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1526
1603
|
if (step.hasOwnProperty("type") && step.type === "pause") {
|
|
1527
1604
|
return step;
|
|
1528
1605
|
}
|
|
1529
|
-
let
|
|
1606
|
+
let tickerId = step.id;
|
|
1530
1607
|
return {
|
|
1531
|
-
ticker:
|
|
1608
|
+
ticker: tickerId,
|
|
1532
1609
|
args: createExportableElement(step.args),
|
|
1533
1610
|
duration: step.duration
|
|
1534
1611
|
};
|
|
@@ -1566,16 +1643,16 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1566
1643
|
_GameWindowManager.addTickerTimeoutInfo(tag, "steps", timeout.toString(), false);
|
|
1567
1644
|
return;
|
|
1568
1645
|
}
|
|
1569
|
-
let ticker =
|
|
1646
|
+
let ticker = geTickerInstanceById(step.ticker, step.args, step.duration, step.priority);
|
|
1570
1647
|
if (!ticker) {
|
|
1571
1648
|
console.error(`[Pixi'VN] Ticker ${step.ticker} not found`);
|
|
1572
1649
|
return;
|
|
1573
1650
|
}
|
|
1574
|
-
let tickerName = ticker.
|
|
1651
|
+
let tickerName = ticker.id;
|
|
1575
1652
|
let tickerHistory = {
|
|
1576
1653
|
fn: () => {
|
|
1577
1654
|
},
|
|
1578
|
-
|
|
1655
|
+
id: tickerName,
|
|
1579
1656
|
args: createExportableElement(ticker.args),
|
|
1580
1657
|
canvasElementTags: [tag],
|
|
1581
1658
|
priority: ticker.priority,
|
|
@@ -1632,26 +1709,26 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1632
1709
|
* ```
|
|
1633
1710
|
*/
|
|
1634
1711
|
static removeAssociationBetweenTickerCanvasElement(tags, ticker) {
|
|
1635
|
-
let
|
|
1712
|
+
let tickerId;
|
|
1636
1713
|
if (typeof ticker === "string") {
|
|
1637
|
-
|
|
1714
|
+
tickerId = ticker;
|
|
1638
1715
|
} else if (ticker instanceof TickerBase) {
|
|
1639
|
-
|
|
1716
|
+
tickerId = ticker.id;
|
|
1640
1717
|
} else {
|
|
1641
|
-
|
|
1718
|
+
tickerId = ticker.prototype.id;
|
|
1642
1719
|
}
|
|
1643
1720
|
if (typeof tags === "string") {
|
|
1644
1721
|
tags = [tags];
|
|
1645
1722
|
}
|
|
1646
1723
|
for (let id in _GameWindowManager._currentTickers) {
|
|
1647
1724
|
let ticker2 = _GameWindowManager._currentTickers[id];
|
|
1648
|
-
if (ticker2.
|
|
1725
|
+
if (ticker2.id === tickerId) {
|
|
1649
1726
|
_GameWindowManager._currentTickers[id].canvasElementTags = ticker2.canvasElementTags.filter((e) => !tags.includes(e));
|
|
1650
1727
|
}
|
|
1651
1728
|
}
|
|
1652
1729
|
for (let timeout in _GameWindowManager._currentTickersTimeouts) {
|
|
1653
1730
|
let TickerTimeout = _GameWindowManager._currentTickersTimeouts[timeout];
|
|
1654
|
-
if (TickerTimeout.ticker ===
|
|
1731
|
+
if (TickerTimeout.ticker === tickerId && TickerTimeout.canBeDeletedBeforeEnd) {
|
|
1655
1732
|
_GameWindowManager._currentTickersTimeouts[timeout].tags = TickerTimeout.tags.filter((t) => !tags.includes(t));
|
|
1656
1733
|
}
|
|
1657
1734
|
}
|
|
@@ -1837,11 +1914,11 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1837
1914
|
for (let id in currentTickers) {
|
|
1838
1915
|
let t = currentTickers[id];
|
|
1839
1916
|
let tags = t.canvasElementTags;
|
|
1840
|
-
let ticker =
|
|
1917
|
+
let ticker = geTickerInstanceById(t.id, t.args, t.duration, t.priority);
|
|
1841
1918
|
if (ticker) {
|
|
1842
1919
|
_GameWindowManager.addTicker(tags, ticker);
|
|
1843
1920
|
} else {
|
|
1844
|
-
console.error(`[Pixi'VN] Ticker ${t.
|
|
1921
|
+
console.error(`[Pixi'VN] Ticker ${t.id} not found`);
|
|
1845
1922
|
}
|
|
1846
1923
|
}
|
|
1847
1924
|
}
|
|
@@ -2042,6 +2119,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2042
2119
|
_GameStepManager._openedLabels = _GameStepManager.originalStepData.openedLabels;
|
|
2043
2120
|
}
|
|
2044
2121
|
/* Run Methods */
|
|
2122
|
+
static get canGoNext() {
|
|
2123
|
+
let options = getChoiceMenuOptions();
|
|
2124
|
+
if (options && options.length > 0) {
|
|
2125
|
+
return false;
|
|
2126
|
+
}
|
|
2127
|
+
return true;
|
|
2128
|
+
}
|
|
2045
2129
|
/**
|
|
2046
2130
|
* Execute the next step and add it to the history.
|
|
2047
2131
|
* @param props The props to pass to the step.
|
|
@@ -2051,7 +2135,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2051
2135
|
* ```typescript
|
|
2052
2136
|
* function nextOnClick() {
|
|
2053
2137
|
* setLoading(true)
|
|
2054
|
-
* GameStepManager.
|
|
2138
|
+
* GameStepManager.goNext(yourParams)
|
|
2055
2139
|
* .then((result) => {
|
|
2056
2140
|
* setUpdate((p) => p + 1)
|
|
2057
2141
|
* setLoading(false)
|
|
@@ -2066,8 +2150,12 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2066
2150
|
* }
|
|
2067
2151
|
* ```
|
|
2068
2152
|
*/
|
|
2069
|
-
static
|
|
2153
|
+
static goNext(props, choiseMade) {
|
|
2070
2154
|
return __async(this, null, function* () {
|
|
2155
|
+
if (!_GameStepManager.canGoNext) {
|
|
2156
|
+
console.warn("[Pixi'VN] The player must make a choice");
|
|
2157
|
+
return;
|
|
2158
|
+
}
|
|
2071
2159
|
_GameStepManager.increaseCurrentStepIndex();
|
|
2072
2160
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2073
2161
|
});
|
|
@@ -2098,7 +2186,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2098
2186
|
return result;
|
|
2099
2187
|
} else if (_GameStepManager.openedLabels.length > 1) {
|
|
2100
2188
|
_GameStepManager.closeCurrentLabel();
|
|
2101
|
-
return yield _GameStepManager.
|
|
2189
|
+
return yield _GameStepManager.goNext(props, choiseMade);
|
|
2102
2190
|
} else {
|
|
2103
2191
|
_GameStepManager.restorLastLabelList();
|
|
2104
2192
|
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");
|
|
@@ -2246,7 +2334,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2246
2334
|
if (choice.closeCurrentLabel) {
|
|
2247
2335
|
_GameStepManager.closeCurrentLabel();
|
|
2248
2336
|
}
|
|
2249
|
-
return _GameStepManager.
|
|
2337
|
+
return _GameStepManager.goNext(props, choiseMade);
|
|
2250
2338
|
});
|
|
2251
2339
|
}
|
|
2252
2340
|
/* After Update Methods */
|
|
@@ -2441,6 +2529,120 @@ _GameStepManager._openedLabels = [];
|
|
|
2441
2529
|
_GameStepManager._originalStepData = void 0;
|
|
2442
2530
|
var GameStepManager = _GameStepManager;
|
|
2443
2531
|
|
|
2532
|
+
// src/classes/StoredClassModel.ts
|
|
2533
|
+
var StoredClassModel = class {
|
|
2534
|
+
/**
|
|
2535
|
+
* @param categoryId The id of the category. For example if you are storing a character class, you can use "characters" as categoryId. so all instances of the character class will be stored in the "characters" category.
|
|
2536
|
+
* @param id The id of instance of the class. This id must be unique for the category.
|
|
2537
|
+
*/
|
|
2538
|
+
constructor(categoryId, id) {
|
|
2539
|
+
this.categoryId = categoryId;
|
|
2540
|
+
this._id = id;
|
|
2541
|
+
}
|
|
2542
|
+
/**
|
|
2543
|
+
* Is id of the stored class. is unique for this class.
|
|
2544
|
+
*/
|
|
2545
|
+
get id() {
|
|
2546
|
+
return this._id;
|
|
2547
|
+
}
|
|
2548
|
+
/**
|
|
2549
|
+
* Update a property in the storage.
|
|
2550
|
+
* @param propertyName The name of the property to set.
|
|
2551
|
+
* @param value The value to set. If is undefined, the property will be removed from the storage.
|
|
2552
|
+
*/
|
|
2553
|
+
setStorageProperty(propertyName, value) {
|
|
2554
|
+
let storage = GameStorageManager.getVariable(this.categoryId);
|
|
2555
|
+
if (!storage) {
|
|
2556
|
+
storage = {};
|
|
2557
|
+
}
|
|
2558
|
+
if (!storage.hasOwnProperty(this.id)) {
|
|
2559
|
+
storage[this.id] = {};
|
|
2560
|
+
}
|
|
2561
|
+
if (value === void 0 || value === null) {
|
|
2562
|
+
if (storage[this.id].hasOwnProperty(propertyName)) {
|
|
2563
|
+
delete storage[this.id][propertyName];
|
|
2564
|
+
}
|
|
2565
|
+
} else {
|
|
2566
|
+
storage[this.id] = __spreadProps(__spreadValues({}, storage[this.id]), { [propertyName]: value });
|
|
2567
|
+
}
|
|
2568
|
+
if (Object.keys(storage[this.id]).length === 0) {
|
|
2569
|
+
delete storage[this.id];
|
|
2570
|
+
}
|
|
2571
|
+
GameStorageManager.setVariable(this.categoryId, storage);
|
|
2572
|
+
}
|
|
2573
|
+
/**
|
|
2574
|
+
* Get a property from the storage.
|
|
2575
|
+
* @param propertyName The name of the property to get.
|
|
2576
|
+
* @returns The value of the property. If the property is not found, returns undefined.
|
|
2577
|
+
*/
|
|
2578
|
+
getStorageProperty(propertyName) {
|
|
2579
|
+
let storage = GameStorageManager.getVariable(this.categoryId);
|
|
2580
|
+
if (storage && storage.hasOwnProperty(this.id) && storage[this.id].hasOwnProperty(propertyName)) {
|
|
2581
|
+
return storage[this.id][propertyName];
|
|
2582
|
+
}
|
|
2583
|
+
return void 0;
|
|
2584
|
+
}
|
|
2585
|
+
};
|
|
2586
|
+
|
|
2587
|
+
// src/classes/CharacterBaseModel.ts
|
|
2588
|
+
var CharacterBaseModel2 = class extends StoredClassModel {
|
|
2589
|
+
/**
|
|
2590
|
+
* @param id The id of the character.
|
|
2591
|
+
* @param props The properties of the character.
|
|
2592
|
+
*/
|
|
2593
|
+
constructor(id, props) {
|
|
2594
|
+
super(GameStorageManager.keysSystem.CHARACTER_CATEGORY_KEY, id);
|
|
2595
|
+
this.defaultName = "";
|
|
2596
|
+
this.defaultName = props.name;
|
|
2597
|
+
this.defaultSurname = props.surname;
|
|
2598
|
+
this.defaultAge = props.age;
|
|
2599
|
+
this._icon = props.icon;
|
|
2600
|
+
this._color = props.color;
|
|
2601
|
+
}
|
|
2602
|
+
/***
|
|
2603
|
+
* The name of the character.
|
|
2604
|
+
* If you set undefined, it will return the default name.
|
|
2605
|
+
*/
|
|
2606
|
+
get name() {
|
|
2607
|
+
return this.getStorageProperty("name") || this.defaultName;
|
|
2608
|
+
}
|
|
2609
|
+
set name(value) {
|
|
2610
|
+
this.setStorageProperty("name", value);
|
|
2611
|
+
}
|
|
2612
|
+
/**
|
|
2613
|
+
* The surname of the character.
|
|
2614
|
+
* If you set undefined, it will return the default surname.
|
|
2615
|
+
*/
|
|
2616
|
+
get surname() {
|
|
2617
|
+
return this.getStorageProperty("surname") || this.defaultSurname;
|
|
2618
|
+
}
|
|
2619
|
+
set surname(value) {
|
|
2620
|
+
this.setStorageProperty("surname", value);
|
|
2621
|
+
}
|
|
2622
|
+
/**
|
|
2623
|
+
* The age of the character.
|
|
2624
|
+
* If you set undefined, it will return the default age.
|
|
2625
|
+
*/
|
|
2626
|
+
get age() {
|
|
2627
|
+
return this.getStorageProperty("age") || this.defaultAge;
|
|
2628
|
+
}
|
|
2629
|
+
set age(value) {
|
|
2630
|
+
this.setStorageProperty("age", value);
|
|
2631
|
+
}
|
|
2632
|
+
/**
|
|
2633
|
+
* The icon of the character.
|
|
2634
|
+
*/
|
|
2635
|
+
get icon() {
|
|
2636
|
+
return this._icon;
|
|
2637
|
+
}
|
|
2638
|
+
/**
|
|
2639
|
+
* The color of the character.
|
|
2640
|
+
*/
|
|
2641
|
+
get color() {
|
|
2642
|
+
return this._color;
|
|
2643
|
+
}
|
|
2644
|
+
};
|
|
2645
|
+
|
|
2444
2646
|
// src/classes/DialogueBaseModel.ts
|
|
2445
2647
|
var DialogueBaseModel = class {
|
|
2446
2648
|
/**
|
|
@@ -2460,15 +2662,15 @@ var DialogueBaseModel = class {
|
|
|
2460
2662
|
if (typeof text === "string") {
|
|
2461
2663
|
this.text = text;
|
|
2462
2664
|
if (typeof character === "string") {
|
|
2463
|
-
this.
|
|
2665
|
+
this.character = character;
|
|
2464
2666
|
} else {
|
|
2465
|
-
this.
|
|
2667
|
+
this.character = character == null ? void 0 : character.id;
|
|
2466
2668
|
}
|
|
2467
2669
|
this.oltherParams = oltherParams;
|
|
2468
2670
|
} else {
|
|
2469
2671
|
this.text = text.text;
|
|
2470
|
-
if (text.
|
|
2471
|
-
this.
|
|
2672
|
+
if (text.character) {
|
|
2673
|
+
this.character = text.character;
|
|
2472
2674
|
}
|
|
2473
2675
|
this.oltherParams = text.oltherParams || {};
|
|
2474
2676
|
}
|
|
@@ -2481,14 +2683,25 @@ var DialogueBaseModel = class {
|
|
|
2481
2683
|
export() {
|
|
2482
2684
|
return {
|
|
2483
2685
|
text: this.text,
|
|
2484
|
-
|
|
2686
|
+
character: this.character,
|
|
2485
2687
|
oltherParams: this.oltherParams
|
|
2486
2688
|
};
|
|
2487
2689
|
}
|
|
2488
2690
|
};
|
|
2489
2691
|
|
|
2490
|
-
// src/labels/
|
|
2491
|
-
var
|
|
2692
|
+
// src/labels/TestConstant.ts
|
|
2693
|
+
var juliette = new CharacterBaseModel2("___pixivn_juliette___", {
|
|
2694
|
+
name: "Juliette",
|
|
2695
|
+
age: 25,
|
|
2696
|
+
icon: "https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-square.webp?alt=media&token=5856ae7b-d99e-4563-86ec-cbc48cc9c6b4",
|
|
2697
|
+
color: "#ac0086"
|
|
2698
|
+
});
|
|
2699
|
+
saveCharacter(juliette);
|
|
2700
|
+
var bunnyImage = "https://pixijs.com/assets/bunny.png";
|
|
2701
|
+
var bunnyName = `Bunny`;
|
|
2702
|
+
|
|
2703
|
+
// src/labels/CanvasEventsTestLabel.ts
|
|
2704
|
+
var EventTest1 = class extends CanvasEvent {
|
|
2492
2705
|
fn(event, sprite) {
|
|
2493
2706
|
if (event === "pointerdown") {
|
|
2494
2707
|
sprite.scale.x *= 1.25;
|
|
@@ -2496,9 +2709,9 @@ var EventTest = class extends CanvasEvent {
|
|
|
2496
2709
|
}
|
|
2497
2710
|
}
|
|
2498
2711
|
};
|
|
2499
|
-
|
|
2500
|
-
eventDecorator()
|
|
2501
|
-
],
|
|
2712
|
+
EventTest1 = __decorateClass([
|
|
2713
|
+
eventDecorator("___pixi_vn_canvas_events_test_event1___")
|
|
2714
|
+
], EventTest1);
|
|
2502
2715
|
var EventTest2 = class extends CanvasEvent {
|
|
2503
2716
|
constructor() {
|
|
2504
2717
|
super(...arguments);
|
|
@@ -2534,28 +2747,37 @@ var EventTest2 = class extends CanvasEvent {
|
|
|
2534
2747
|
}
|
|
2535
2748
|
};
|
|
2536
2749
|
EventTest2 = __decorateClass([
|
|
2537
|
-
eventDecorator()
|
|
2750
|
+
eventDecorator("___pixi_vn_canvas_events_test_event2___")
|
|
2538
2751
|
], EventTest2);
|
|
2539
|
-
var
|
|
2540
|
-
|
|
2752
|
+
var CANVAS_EVENTS_TEST_LABEL = "___pixi_vn_canvas_events_test___";
|
|
2753
|
+
var canvasEventsTestLabel = newLabel(
|
|
2754
|
+
CANVAS_EVENTS_TEST_LABEL,
|
|
2541
2755
|
[
|
|
2756
|
+
() => setDialogue({
|
|
2757
|
+
character: juliette,
|
|
2758
|
+
text: "This is the test of clickable elements in a canvas."
|
|
2759
|
+
}),
|
|
2542
2760
|
() => __async(void 0, null, function* () {
|
|
2543
|
-
|
|
2761
|
+
setDialogue({
|
|
2762
|
+
character: juliette,
|
|
2763
|
+
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).)`
|
|
2764
|
+
});
|
|
2765
|
+
const texture = yield Assets.load(bunnyImage);
|
|
2544
2766
|
const sprite = CanvasSprite.from(texture);
|
|
2545
2767
|
sprite.anchor.set(0.5);
|
|
2546
2768
|
sprite.x = GameWindowManager.screen.width / 2;
|
|
2547
2769
|
sprite.y = GameWindowManager.screen.height / 2;
|
|
2548
2770
|
sprite.eventMode = "static";
|
|
2549
2771
|
sprite.cursor = "pointer";
|
|
2550
|
-
sprite.onEvent("pointerdown",
|
|
2772
|
+
sprite.onEvent("pointerdown", EventTest1);
|
|
2551
2773
|
GameWindowManager.addCanvasElement("bunny", sprite);
|
|
2552
|
-
setDialogue("This is the test of clickable elements in a canvas. To make it possible to save the added events in a canvas element, use CanvasEvents.");
|
|
2553
2774
|
}),
|
|
2554
|
-
() => setDialogue("To make the events in the canvas work. by default all elements in the gliaphic html interface are: pointerEvents = 'none'. to enable clicking on html elements, you will need to add the css pointerEvents = 'auto'"),
|
|
2555
|
-
() => setDialogue("For performance reasons it is better to add the buttons in the html interface and not in the canvas."),
|
|
2556
2775
|
() => __async(void 0, null, function* () {
|
|
2557
|
-
clearDialogue();
|
|
2558
2776
|
GameWindowManager.clear();
|
|
2777
|
+
setDialogue({
|
|
2778
|
+
character: juliette,
|
|
2779
|
+
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).)`
|
|
2780
|
+
});
|
|
2559
2781
|
yield Assets.load([
|
|
2560
2782
|
"https://pixijs.com/assets/bg_button.jpg",
|
|
2561
2783
|
"https://pixijs.com/assets/button.png",
|
|
@@ -2589,6 +2811,6 @@ var eventsTestLabel = newLabel(
|
|
|
2589
2811
|
]
|
|
2590
2812
|
);
|
|
2591
2813
|
|
|
2592
|
-
export {
|
|
2814
|
+
export { EventTest1, EventTest2, canvasEventsTestLabel };
|
|
2593
2815
|
//# sourceMappingURL=out.js.map
|
|
2594
|
-
//# sourceMappingURL=
|
|
2816
|
+
//# sourceMappingURL=CanvasEventsTestLabel.mjs.map
|