@drincs/pixi-vn 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{TickerBase-BAUiHet_.d.ts → TickerBase-3rLpDpmb.d.ts} +9 -0
- package/dist/{TickerBase-BctFf13y.d.mts → TickerBase-DKYzbzro.d.mts} +9 -0
- package/dist/classes/CanvasEvent.d.mts +6 -0
- package/dist/classes/CanvasEvent.d.ts +6 -0
- package/dist/classes/CanvasEvent.js +7 -0
- package/dist/classes/CanvasEvent.js.map +1 -1
- package/dist/classes/CanvasEvent.mjs +7 -0
- package/dist/classes/CanvasEvent.mjs.map +1 -1
- package/dist/classes/CharacterBaseModel.js +93 -65
- package/dist/classes/CharacterBaseModel.js.map +1 -1
- package/dist/classes/CharacterBaseModel.mjs +93 -65
- package/dist/classes/CharacterBaseModel.mjs.map +1 -1
- package/dist/classes/ChoiceMenuOption.js +94 -66
- package/dist/classes/ChoiceMenuOption.js.map +1 -1
- package/dist/classes/ChoiceMenuOption.mjs +94 -66
- package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
- package/dist/classes/CloseLabel.js +1 -1
- package/dist/classes/CloseLabel.js.map +1 -1
- package/dist/classes/CloseLabel.mjs +1 -1
- package/dist/classes/CloseLabel.mjs.map +1 -1
- package/dist/classes/DialogueBaseModel.d.mts +2 -2
- package/dist/classes/DialogueBaseModel.d.ts +2 -2
- package/dist/classes/DialogueBaseModel.js +5 -5
- package/dist/classes/DialogueBaseModel.js.map +1 -1
- package/dist/classes/DialogueBaseModel.mjs +5 -5
- package/dist/classes/DialogueBaseModel.mjs.map +1 -1
- package/dist/classes/Label.d.mts +1 -1
- package/dist/classes/Label.d.ts +1 -1
- package/dist/classes/Label.js +1 -1
- package/dist/classes/Label.js.map +1 -1
- package/dist/classes/Label.mjs +1 -1
- package/dist/classes/Label.mjs.map +1 -1
- package/dist/classes/StoredClassModel.js +93 -65
- package/dist/classes/StoredClassModel.js.map +1 -1
- package/dist/classes/StoredClassModel.mjs +93 -65
- package/dist/classes/StoredClassModel.mjs.map +1 -1
- package/dist/classes/canvas/CanvasBase.d.mts +5 -1
- package/dist/classes/canvas/CanvasBase.d.ts +5 -1
- package/dist/classes/canvas/CanvasBase.js +7 -0
- package/dist/classes/canvas/CanvasBase.js.map +1 -1
- package/dist/classes/canvas/CanvasBase.mjs +7 -0
- package/dist/classes/canvas/CanvasBase.mjs.map +1 -1
- package/dist/classes/canvas/CanvasContainer.d.mts +4 -1
- package/dist/classes/canvas/CanvasContainer.d.ts +4 -1
- package/dist/classes/canvas/CanvasContainer.js +57 -37
- package/dist/classes/canvas/CanvasContainer.js.map +1 -1
- package/dist/classes/canvas/CanvasContainer.mjs +57 -38
- package/dist/classes/canvas/CanvasContainer.mjs.map +1 -1
- package/dist/classes/canvas/CanvasImage.d.mts +4 -2
- package/dist/classes/canvas/CanvasImage.d.ts +4 -2
- package/dist/classes/canvas/CanvasImage.js +33 -20
- package/dist/classes/canvas/CanvasImage.js.map +1 -1
- package/dist/classes/canvas/CanvasImage.mjs +30 -20
- package/dist/classes/canvas/CanvasImage.mjs.map +1 -1
- package/dist/classes/canvas/CanvasSprite.d.mts +5 -2
- package/dist/classes/canvas/CanvasSprite.d.ts +5 -2
- package/dist/classes/canvas/CanvasSprite.js +25 -17
- package/dist/classes/canvas/CanvasSprite.js.map +1 -1
- package/dist/classes/canvas/CanvasSprite.mjs +25 -18
- package/dist/classes/canvas/CanvasSprite.mjs.map +1 -1
- package/dist/classes/canvas/CanvasText.d.mts +6 -3
- package/dist/classes/canvas/CanvasText.d.ts +6 -3
- package/dist/classes/canvas/CanvasText.js +25 -17
- package/dist/classes/canvas/CanvasText.js.map +1 -1
- package/dist/classes/canvas/CanvasText.mjs +25 -18
- package/dist/classes/canvas/CanvasText.mjs.map +1 -1
- package/dist/classes/canvas/index.js +184 -158
- package/dist/classes/canvas/index.js.map +1 -1
- package/dist/classes/canvas/index.mjs +184 -158
- package/dist/classes/canvas/index.mjs.map +1 -1
- package/dist/classes/index.d.mts +1 -0
- package/dist/classes/index.d.ts +1 -0
- package/dist/classes/index.js +106 -71
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +106 -71
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/ticker/FadeAlphaTicker.d.mts +2 -1
- package/dist/classes/ticker/FadeAlphaTicker.d.ts +2 -1
- package/dist/classes/ticker/FadeAlphaTicker.js +93 -65
- package/dist/classes/ticker/FadeAlphaTicker.js.map +1 -1
- package/dist/classes/ticker/FadeAlphaTicker.mjs +93 -65
- package/dist/classes/ticker/FadeAlphaTicker.mjs.map +1 -1
- package/dist/classes/ticker/MoveTicker.d.mts +2 -1
- package/dist/classes/ticker/MoveTicker.d.ts +2 -1
- package/dist/classes/ticker/MoveTicker.js +93 -65
- package/dist/classes/ticker/MoveTicker.js.map +1 -1
- package/dist/classes/ticker/MoveTicker.mjs +93 -65
- package/dist/classes/ticker/MoveTicker.mjs.map +1 -1
- package/dist/classes/ticker/RotateTicker.d.mts +2 -1
- package/dist/classes/ticker/RotateTicker.d.ts +2 -1
- package/dist/classes/ticker/RotateTicker.js +93 -65
- package/dist/classes/ticker/RotateTicker.js.map +1 -1
- package/dist/classes/ticker/RotateTicker.mjs +93 -65
- package/dist/classes/ticker/RotateTicker.mjs.map +1 -1
- package/dist/classes/ticker/TickerBase.d.mts +2 -1
- package/dist/classes/ticker/TickerBase.d.ts +2 -1
- package/dist/classes/ticker/TickerBase.js +5 -0
- package/dist/classes/ticker/TickerBase.js.map +1 -1
- package/dist/classes/ticker/TickerBase.mjs +5 -0
- package/dist/classes/ticker/TickerBase.mjs.map +1 -1
- package/dist/classes/ticker/ZoomTicker.d.mts +9 -3
- package/dist/classes/ticker/ZoomTicker.d.ts +9 -3
- package/dist/classes/ticker/ZoomTicker.js +108 -66
- package/dist/classes/ticker/ZoomTicker.js.map +1 -1
- package/dist/classes/ticker/ZoomTicker.mjs +106 -66
- package/dist/classes/ticker/ZoomTicker.mjs.map +1 -1
- package/dist/classes/ticker/index.d.mts +2 -1
- package/dist/classes/ticker/index.d.ts +2 -1
- package/dist/classes/ticker/index.js +230 -202
- package/dist/classes/ticker/index.js.map +1 -1
- package/dist/classes/ticker/index.mjs +230 -202
- package/dist/classes/ticker/index.mjs.map +1 -1
- package/dist/constants.d.mts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/constants.mjs.map +1 -1
- package/dist/decorators/CanvasElementDecorator.d.mts +3 -3
- package/dist/decorators/CanvasElementDecorator.d.ts +3 -3
- package/dist/decorators/CanvasElementDecorator.js +63 -43
- package/dist/decorators/CanvasElementDecorator.js.map +1 -1
- package/dist/decorators/CanvasElementDecorator.mjs +62 -42
- package/dist/decorators/CanvasElementDecorator.mjs.map +1 -1
- package/dist/decorators/EventDecorator.d.mts +7 -7
- package/dist/decorators/EventDecorator.d.ts +7 -7
- package/dist/decorators/EventDecorator.js +11 -10
- package/dist/decorators/EventDecorator.js.map +1 -1
- package/dist/decorators/EventDecorator.mjs +10 -9
- package/dist/decorators/EventDecorator.mjs.map +1 -1
- package/dist/decorators/LabelDecorator.js +94 -66
- package/dist/decorators/LabelDecorator.js.map +1 -1
- package/dist/decorators/LabelDecorator.mjs +94 -66
- package/dist/decorators/LabelDecorator.mjs.map +1 -1
- package/dist/decorators/TickerDecorator.d.mts +5 -5
- package/dist/decorators/TickerDecorator.d.ts +5 -5
- package/dist/decorators/TickerDecorator.js +6 -5
- package/dist/decorators/TickerDecorator.js.map +1 -1
- package/dist/decorators/TickerDecorator.mjs +6 -5
- package/dist/decorators/TickerDecorator.mjs.map +1 -1
- package/dist/decorators/index.d.mts +1 -1
- package/dist/decorators/index.d.ts +1 -1
- package/dist/decorators/index.js +96 -66
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +96 -66
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/CanvasUtility.js +56 -37
- package/dist/functions/CanvasUtility.js.map +1 -1
- package/dist/functions/CanvasUtility.mjs +56 -37
- package/dist/functions/CanvasUtility.mjs.map +1 -1
- package/dist/functions/DialogueUtility.d.mts +1 -1
- package/dist/functions/DialogueUtility.d.ts +1 -1
- package/dist/functions/DialogueUtility.js +240 -201
- package/dist/functions/DialogueUtility.js.map +1 -1
- package/dist/functions/DialogueUtility.mjs +240 -201
- package/dist/functions/DialogueUtility.mjs.map +1 -1
- package/dist/functions/FlagsUtility.js +93 -65
- package/dist/functions/FlagsUtility.js.map +1 -1
- package/dist/functions/FlagsUtility.mjs +93 -65
- package/dist/functions/FlagsUtility.mjs.map +1 -1
- package/dist/functions/GameUtility.js +93 -65
- package/dist/functions/GameUtility.js.map +1 -1
- package/dist/functions/GameUtility.mjs +93 -65
- package/dist/functions/GameUtility.mjs.map +1 -1
- package/dist/functions/ImageUtility.d.mts +35 -2
- package/dist/functions/ImageUtility.d.ts +35 -2
- package/dist/functions/ImageUtility.js +371 -186
- package/dist/functions/ImageUtility.js.map +1 -1
- package/dist/functions/ImageUtility.mjs +368 -187
- package/dist/functions/ImageUtility.mjs.map +1 -1
- package/dist/functions/SavesUtility.d.mts +2 -2
- package/dist/functions/SavesUtility.d.ts +2 -2
- package/dist/functions/SavesUtility.js +141 -71
- package/dist/functions/SavesUtility.js.map +1 -1
- package/dist/functions/SavesUtility.mjs +141 -71
- package/dist/functions/SavesUtility.mjs.map +1 -1
- package/dist/functions/index.d.mts +6 -3
- package/dist/functions/index.d.ts +6 -3
- package/dist/functions/index.js +277 -81
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +275 -83
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +644 -153
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +642 -155
- package/dist/index.mjs.map +1 -1
- package/dist/interface/IHistoryStep.d.mts +2 -2
- package/dist/interface/IHistoryStep.d.ts +2 -2
- package/dist/interface/ISaveData.d.mts +2 -2
- package/dist/interface/ISaveData.d.ts +2 -2
- package/dist/interface/ITicker.d.mts +2 -1
- package/dist/interface/ITicker.d.ts +2 -1
- package/dist/interface/ITickersSteps.d.mts +12 -3
- package/dist/interface/ITickersSteps.d.ts +12 -3
- package/dist/interface/TickerHistory.d.mts +3 -3
- package/dist/interface/TickerHistory.d.ts +3 -3
- package/dist/interface/canvas/ICanvasBaseMemory.d.mts +1 -1
- package/dist/interface/canvas/ICanvasBaseMemory.d.ts +1 -1
- package/dist/interface/canvas/ICanvasImageMemory.d.mts +2 -2
- package/dist/interface/canvas/ICanvasImageMemory.d.ts +2 -2
- package/dist/interface/canvas/ICanvasSpriteMemory.d.mts +1 -2
- package/dist/interface/canvas/ICanvasSpriteMemory.d.ts +1 -2
- package/dist/interface/canvas/ICanvasTextTextMemory.d.mts +1 -2
- package/dist/interface/canvas/ICanvasTextTextMemory.d.ts +1 -2
- package/dist/interface/export/ExportedCanvas.d.mts +2 -2
- package/dist/interface/export/ExportedCanvas.d.ts +2 -2
- package/dist/interface/export/ExportedStep.d.mts +2 -2
- package/dist/interface/export/ExportedStep.d.ts +2 -2
- package/dist/interface/export/index.d.mts +2 -2
- package/dist/interface/export/index.d.ts +2 -2
- package/dist/interface/index.d.mts +2 -2
- package/dist/interface/index.d.ts +2 -2
- package/dist/labels/BaseCanvasElementTestLabel.js +400 -372
- package/dist/labels/BaseCanvasElementTestLabel.js.map +1 -1
- package/dist/labels/BaseCanvasElementTestLabel.mjs +401 -373
- package/dist/labels/BaseCanvasElementTestLabel.mjs.map +1 -1
- package/dist/labels/{EventsTestLabel.d.mts → CanvasEventsTestLabel.d.mts} +4 -7
- package/dist/labels/{EventsTestLabel.d.ts → CanvasEventsTestLabel.d.ts} +4 -7
- package/dist/labels/{EventsTestLabel.js → CanvasEventsTestLabel.js} +320 -98
- package/dist/labels/CanvasEventsTestLabel.js.map +1 -0
- package/dist/labels/{EventsTestLabel.mjs → CanvasEventsTestLabel.mjs} +320 -98
- package/dist/labels/CanvasEventsTestLabel.mjs.map +1 -0
- package/dist/labels/{TintingTestLabel.d.mts → CustomTickerCanvasElementTestLabel.d.mts} +5 -4
- package/dist/labels/{TintingTestLabel.d.ts → CustomTickerCanvasElementTestLabel.d.ts} +5 -4
- package/dist/labels/CustomTickerCanvasElementTestLabel.js +2792 -0
- package/dist/labels/CustomTickerCanvasElementTestLabel.js.map +1 -0
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs +2786 -0
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs.map +1 -0
- package/dist/labels/{ShowImageTest.js → ImagesAnimationsTestLabel.js} +373 -82
- package/dist/labels/ImagesAnimationsTestLabel.js.map +1 -0
- package/dist/labels/{ShowImageTest.mjs → ImagesAnimationsTestLabel.mjs} +373 -82
- package/dist/labels/ImagesAnimationsTestLabel.mjs.map +1 -0
- package/dist/labels/MarkdownTest.js +150 -80
- package/dist/labels/MarkdownTest.js.map +1 -1
- package/dist/labels/MarkdownTest.mjs +150 -80
- package/dist/labels/MarkdownTest.mjs.map +1 -1
- package/dist/labels/StartLabel.js +689 -152
- package/dist/labels/StartLabel.js.map +1 -1
- package/dist/labels/StartLabel.mjs +690 -153
- package/dist/labels/StartLabel.mjs.map +1 -1
- package/dist/labels/TestConstant.d.mts +3 -1
- package/dist/labels/TestConstant.d.ts +3 -1
- package/dist/labels/TestConstant.js +97 -65
- package/dist/labels/TestConstant.js.map +1 -1
- package/dist/labels/TestConstant.mjs +96 -66
- package/dist/labels/TestConstant.mjs.map +1 -1
- package/dist/labels/TickerTestLabel.js +472 -402
- package/dist/labels/TickerTestLabel.js.map +1 -1
- package/dist/labels/TickerTestLabel.mjs +473 -403
- package/dist/labels/TickerTestLabel.mjs.map +1 -1
- package/dist/labels/index.js +689 -152
- package/dist/labels/index.js.map +1 -1
- package/dist/labels/index.mjs +690 -153
- package/dist/labels/index.mjs.map +1 -1
- package/dist/managers/StepManager.d.mts +5 -4
- package/dist/managers/StepManager.d.ts +5 -4
- package/dist/managers/StepManager.js +140 -70
- package/dist/managers/StepManager.js.map +1 -1
- package/dist/managers/StepManager.mjs +140 -70
- package/dist/managers/StepManager.mjs.map +1 -1
- package/dist/managers/WindowManager.d.mts +1 -1
- package/dist/managers/WindowManager.d.ts +1 -1
- package/dist/managers/WindowManager.js +84 -60
- package/dist/managers/WindowManager.js.map +1 -1
- package/dist/managers/WindowManager.mjs +84 -60
- package/dist/managers/WindowManager.mjs.map +1 -1
- package/dist/managers/index.d.mts +2 -2
- package/dist/managers/index.d.ts +2 -2
- package/dist/managers/index.js +140 -70
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +140 -70
- package/dist/managers/index.mjs.map +1 -1
- package/dist/types/ticker/MoveTickerProps.d.mts +1 -1
- package/dist/types/ticker/MoveTickerProps.d.ts +1 -1
- package/dist/types/ticker/RotateTickerProps.d.mts +1 -1
- package/dist/types/ticker/RotateTickerProps.d.ts +1 -1
- package/package.json +1 -1
- package/dist/labels/EventsTestLabel.js.map +0 -1
- package/dist/labels/EventsTestLabel.mjs.map +0 -1
- package/dist/labels/ShowImageTest.js.map +0 -1
- package/dist/labels/ShowImageTest.mjs.map +0 -1
- package/dist/labels/TintingTestLabel.js +0 -1786
- package/dist/labels/TintingTestLabel.js.map +0 -1
- package/dist/labels/TintingTestLabel.mjs +0 -1780
- package/dist/labels/TintingTestLabel.mjs.map +0 -1
- /package/dist/labels/{ShowImageTest.d.mts → ImagesAnimationsTestLabel.d.mts} +0 -0
- /package/dist/labels/{ShowImageTest.d.ts → ImagesAnimationsTestLabel.d.ts} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Container, Sprite, Text, Assets, Texture, Application } from 'pixi.js';
|
|
1
|
+
import { Container, Sprite, Text, Assets, Texture, Application, Rectangle } from 'pixi.js';
|
|
2
2
|
export { Assets } from 'pixi.js';
|
|
3
3
|
import { diff } from 'deep-diff';
|
|
4
4
|
import sha1 from 'crypto-js/sha1';
|
|
@@ -54,6 +54,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
54
54
|
|
|
55
55
|
// src/classes/CanvasEvent.ts
|
|
56
56
|
var CanvasEvent = class {
|
|
57
|
+
constructor() {
|
|
58
|
+
/**
|
|
59
|
+
* Get the id of the event. This variable is used in the system to get the event by id, {@link getEventInstanceById}
|
|
60
|
+
*/
|
|
61
|
+
this.id = "event_id_not_set";
|
|
62
|
+
this.id = this.constructor.prototype.id;
|
|
63
|
+
}
|
|
57
64
|
fn(_event, _element) {
|
|
58
65
|
throw new Error("[Pixi'VN] The method CanvasEvent.fn() must be overridden");
|
|
59
66
|
}
|
|
@@ -81,7 +88,7 @@ var Label = class {
|
|
|
81
88
|
this._choiseIndex = choiseIndex;
|
|
82
89
|
}
|
|
83
90
|
/**
|
|
84
|
-
* Get the id of the label
|
|
91
|
+
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
85
92
|
*/
|
|
86
93
|
get id() {
|
|
87
94
|
return this._id;
|
|
@@ -158,6 +165,13 @@ function getLabelById(id) {
|
|
|
158
165
|
return label;
|
|
159
166
|
}
|
|
160
167
|
var CanvasBase = class extends Container {
|
|
168
|
+
constructor() {
|
|
169
|
+
super(...arguments);
|
|
170
|
+
/**
|
|
171
|
+
* Get the id of the canvas element. This variable is used in the system to get the canvas element by id, {@link getCanvasElementInstanceById}
|
|
172
|
+
*/
|
|
173
|
+
this.pixivnId = "canvas_element_id_not_set";
|
|
174
|
+
}
|
|
161
175
|
/**
|
|
162
176
|
* This method return the memory of the canvas element.
|
|
163
177
|
*/
|
|
@@ -184,17 +198,23 @@ function exportCanvasElement(element) {
|
|
|
184
198
|
return element.memory;
|
|
185
199
|
}
|
|
186
200
|
function importCanvasElement(memory) {
|
|
187
|
-
let element =
|
|
201
|
+
let element = getCanvasElementInstanceById(memory.pixivnId);
|
|
188
202
|
if (element) {
|
|
189
203
|
element.memory = memory;
|
|
190
204
|
} else {
|
|
191
|
-
throw new Error("[Pixi'VN] The element " + memory.
|
|
205
|
+
throw new Error("[Pixi'VN] The element " + memory.pixivnId + " could not be created");
|
|
192
206
|
}
|
|
193
207
|
return element;
|
|
194
208
|
}
|
|
195
209
|
|
|
196
210
|
// src/classes/canvas/CanvasContainer.ts
|
|
211
|
+
var CANVAS_CONTAINER_ID = "CanvasContainer";
|
|
197
212
|
var CanvasContainer = class extends Container {
|
|
213
|
+
constructor(options) {
|
|
214
|
+
super(options);
|
|
215
|
+
this.pixivnId = CANVAS_CONTAINER_ID;
|
|
216
|
+
this.pixivnId = this.constructor.prototype.pixivnId;
|
|
217
|
+
}
|
|
198
218
|
get memory() {
|
|
199
219
|
let memory = getMemoryContainer(this);
|
|
200
220
|
this.children.forEach((child) => {
|
|
@@ -210,8 +230,12 @@ var CanvasContainer = class extends Container {
|
|
|
210
230
|
}
|
|
211
231
|
};
|
|
212
232
|
function getMemoryContainer(element) {
|
|
233
|
+
let className = "CanvasContainer";
|
|
234
|
+
if (element.hasOwnProperty("pixivnId")) {
|
|
235
|
+
className = element.pixivnId;
|
|
236
|
+
}
|
|
213
237
|
return {
|
|
214
|
-
|
|
238
|
+
pixivnId: className,
|
|
215
239
|
elements: [],
|
|
216
240
|
width: element.width,
|
|
217
241
|
height: element.height,
|
|
@@ -335,43 +359,47 @@ function eventDecorator(name) {
|
|
|
335
359
|
if (registeredEvents[name]) {
|
|
336
360
|
console.info(`[Pixi'VN] Event ${name} already exists, it will be overwritten`);
|
|
337
361
|
}
|
|
362
|
+
target.prototype.id = name;
|
|
338
363
|
registeredEvents[name] = target;
|
|
339
364
|
};
|
|
340
365
|
}
|
|
341
|
-
function
|
|
366
|
+
function getEventTypeById(eventId) {
|
|
342
367
|
try {
|
|
343
|
-
let eventType = registeredEvents[
|
|
368
|
+
let eventType = registeredEvents[eventId];
|
|
344
369
|
if (!eventType) {
|
|
345
|
-
console.error(`[Pixi'VN] Event ${
|
|
370
|
+
console.error(`[Pixi'VN] Event ${eventId} not found`);
|
|
346
371
|
return;
|
|
347
372
|
}
|
|
348
373
|
new eventType();
|
|
349
374
|
return eventType;
|
|
350
375
|
} catch (e) {
|
|
351
|
-
console.error(`[Pixi'VN] Error while getting Event ${
|
|
376
|
+
console.error(`[Pixi'VN] Error while getting Event ${eventId}`, e);
|
|
352
377
|
return;
|
|
353
378
|
}
|
|
354
379
|
}
|
|
355
|
-
function
|
|
380
|
+
function getEventInstanceById(eventId) {
|
|
356
381
|
try {
|
|
357
|
-
let eventType = registeredEvents[
|
|
382
|
+
let eventType = registeredEvents[eventId];
|
|
358
383
|
if (!eventType) {
|
|
359
|
-
console.error(`[Pixi'VN] Event ${
|
|
384
|
+
console.error(`[Pixi'VN] Event ${eventId} not found`);
|
|
360
385
|
return;
|
|
361
386
|
}
|
|
362
387
|
let event = new eventType();
|
|
363
388
|
return event;
|
|
364
389
|
} catch (e) {
|
|
365
|
-
console.error(`[Pixi'VN] Error while getting Event ${
|
|
390
|
+
console.error(`[Pixi'VN] Error while getting Event ${eventId}`, e);
|
|
366
391
|
return;
|
|
367
392
|
}
|
|
368
393
|
}
|
|
369
394
|
|
|
370
395
|
// src/classes/canvas/CanvasSprite.ts
|
|
396
|
+
var CANVAS_SPRITE_ID = "CanvasSprite";
|
|
371
397
|
var CanvasSprite = class _CanvasSprite extends Sprite {
|
|
372
|
-
constructor() {
|
|
373
|
-
super(
|
|
398
|
+
constructor(options) {
|
|
399
|
+
super(options);
|
|
400
|
+
this.pixivnId = CANVAS_SPRITE_ID;
|
|
374
401
|
this._onEvents = {};
|
|
402
|
+
this.pixivnId = this.constructor.prototype.pixivnId;
|
|
375
403
|
}
|
|
376
404
|
get memory() {
|
|
377
405
|
return getMemorySprite(this);
|
|
@@ -412,9 +440,9 @@ var CanvasSprite = class _CanvasSprite extends Sprite {
|
|
|
412
440
|
* ```
|
|
413
441
|
*/
|
|
414
442
|
onEvent(event, eventClass) {
|
|
415
|
-
let
|
|
416
|
-
let instance =
|
|
417
|
-
this._onEvents[event] =
|
|
443
|
+
let id = eventClass.prototype.id;
|
|
444
|
+
let instance = getEventInstanceById(id);
|
|
445
|
+
this._onEvents[event] = id;
|
|
418
446
|
if (instance) {
|
|
419
447
|
super.on(event, () => {
|
|
420
448
|
instance.fn(event, this);
|
|
@@ -443,7 +471,7 @@ var CanvasSprite = class _CanvasSprite extends Sprite {
|
|
|
443
471
|
function getMemorySprite(element) {
|
|
444
472
|
let temp = getMemoryContainer(element);
|
|
445
473
|
return __spreadProps(__spreadValues({}, temp), {
|
|
446
|
-
|
|
474
|
+
pixivnId: element.pixivnId,
|
|
447
475
|
textureImage: getTextureMemory(element.texture),
|
|
448
476
|
anchor: { x: element.anchor.x, y: element.anchor.y },
|
|
449
477
|
roundPixels: element.roundPixels,
|
|
@@ -466,8 +494,8 @@ function setMemorySprite(element, memory) {
|
|
|
466
494
|
}
|
|
467
495
|
memory.roundPixels && (element.roundPixels = memory.roundPixels);
|
|
468
496
|
for (let event in memory.onEvents) {
|
|
469
|
-
let
|
|
470
|
-
let instance =
|
|
497
|
+
let id = memory.onEvents[event];
|
|
498
|
+
let instance = getEventTypeById(id);
|
|
471
499
|
if (instance) {
|
|
472
500
|
element.onEvent(event, instance);
|
|
473
501
|
}
|
|
@@ -475,9 +503,11 @@ function setMemorySprite(element, memory) {
|
|
|
475
503
|
}
|
|
476
504
|
|
|
477
505
|
// src/classes/canvas/CanvasImage.ts
|
|
506
|
+
var CANVAS_IMAGE_ID = "CanvasImage";
|
|
478
507
|
var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
479
508
|
constructor(options, imageLink) {
|
|
480
509
|
super(options);
|
|
510
|
+
this.pixivnId = CANVAS_IMAGE_ID;
|
|
481
511
|
this.imageLink = "";
|
|
482
512
|
if (imageLink) {
|
|
483
513
|
this.imageLink = imageLink;
|
|
@@ -485,12 +515,13 @@ var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
|
485
515
|
}
|
|
486
516
|
get memory() {
|
|
487
517
|
return __spreadProps(__spreadValues({}, getMemorySprite(this)), {
|
|
488
|
-
|
|
489
|
-
|
|
518
|
+
pixivnId: this.pixivnId,
|
|
519
|
+
imageLink: this.imageLink
|
|
490
520
|
});
|
|
491
521
|
}
|
|
492
522
|
set memory(memory) {
|
|
493
523
|
setMemorySprite(this, memory);
|
|
524
|
+
this.imageLink = memory.imageLink;
|
|
494
525
|
}
|
|
495
526
|
static from(source, skipCache) {
|
|
496
527
|
let sprite = Sprite.from(source, skipCache);
|
|
@@ -518,10 +549,13 @@ var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
|
518
549
|
});
|
|
519
550
|
}
|
|
520
551
|
};
|
|
552
|
+
var CANVAS_TEXT_ID = "CanvasText";
|
|
521
553
|
var CanvasText = class extends Text {
|
|
522
|
-
constructor() {
|
|
523
|
-
super(
|
|
554
|
+
constructor(options) {
|
|
555
|
+
super(options);
|
|
556
|
+
this.pixivnId = CANVAS_TEXT_ID;
|
|
524
557
|
this._onEvents = {};
|
|
558
|
+
this.pixivnId = this.constructor.prototype.pixivnId;
|
|
525
559
|
}
|
|
526
560
|
get memory() {
|
|
527
561
|
return getMemoryText(this);
|
|
@@ -562,9 +596,9 @@ var CanvasText = class extends Text {
|
|
|
562
596
|
* ```
|
|
563
597
|
*/
|
|
564
598
|
onEvent(event, eventClass) {
|
|
565
|
-
let
|
|
566
|
-
let instance =
|
|
567
|
-
this._onEvents[event] =
|
|
599
|
+
let id = eventClass.prototype.id;
|
|
600
|
+
let instance = getEventInstanceById(id);
|
|
601
|
+
this._onEvents[event] = id;
|
|
568
602
|
if (instance) {
|
|
569
603
|
super.on(event, () => {
|
|
570
604
|
instance.fn(event, this);
|
|
@@ -587,7 +621,7 @@ var CanvasText = class extends Text {
|
|
|
587
621
|
function getMemoryText(element) {
|
|
588
622
|
let temp = getMemoryContainer(element);
|
|
589
623
|
return __spreadProps(__spreadValues({}, temp), {
|
|
590
|
-
|
|
624
|
+
pixivnId: element.pixivnId,
|
|
591
625
|
anchor: { x: element.anchor.x, y: element.anchor.y },
|
|
592
626
|
text: element.text,
|
|
593
627
|
resolution: element.resolution,
|
|
@@ -610,8 +644,8 @@ function setMemoryText(element, memory) {
|
|
|
610
644
|
memory.style && (element.style = memory.style);
|
|
611
645
|
memory.roundPixels && (element.roundPixels = memory.roundPixels);
|
|
612
646
|
for (let event in memory.onEvents) {
|
|
613
|
-
let
|
|
614
|
-
let instance =
|
|
647
|
+
let id = memory.onEvents[event];
|
|
648
|
+
let instance = getEventTypeById(id);
|
|
615
649
|
if (instance) {
|
|
616
650
|
element.onEvent(event, instance);
|
|
617
651
|
}
|
|
@@ -628,31 +662,32 @@ function canvasElementDecorator(name) {
|
|
|
628
662
|
if (registeredCanvasElement[name]) {
|
|
629
663
|
console.warn(`[Pixi'VN] CanvasElement ${name} already registered`);
|
|
630
664
|
}
|
|
665
|
+
target.prototype.pixivnId = name;
|
|
631
666
|
registeredCanvasElement[name] = target;
|
|
632
667
|
};
|
|
633
668
|
}
|
|
634
|
-
function
|
|
669
|
+
function getCanvasElementInstanceById(canvasId) {
|
|
635
670
|
try {
|
|
636
|
-
let eventType = registeredCanvasElement[
|
|
671
|
+
let eventType = registeredCanvasElement[canvasId];
|
|
637
672
|
if (!eventType) {
|
|
638
|
-
if (
|
|
673
|
+
if (canvasId === CANVAS_CONTAINER_ID) {
|
|
639
674
|
eventType = CanvasContainer;
|
|
640
|
-
} else if (
|
|
675
|
+
} else if (canvasId === CANVAS_IMAGE_ID) {
|
|
641
676
|
eventType = CanvasImage;
|
|
642
|
-
} else if (
|
|
677
|
+
} else if (canvasId === CANVAS_SPRITE_ID) {
|
|
643
678
|
eventType = CanvasSprite;
|
|
644
|
-
} else if (
|
|
679
|
+
} else if (canvasId === CANVAS_TEXT_ID) {
|
|
645
680
|
eventType = CanvasText;
|
|
646
681
|
}
|
|
647
682
|
}
|
|
648
683
|
if (!eventType) {
|
|
649
|
-
console.error(`[Pixi'VN] CanvasElement ${
|
|
684
|
+
console.error(`[Pixi'VN] CanvasElement ${canvasId} not found`);
|
|
650
685
|
return;
|
|
651
686
|
}
|
|
652
687
|
let canvasElement = new eventType();
|
|
653
688
|
return canvasElement;
|
|
654
689
|
} catch (e) {
|
|
655
|
-
console.error(`[Pixi'VN] Error while getting CanvasElement ${
|
|
690
|
+
console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasId}`, e);
|
|
656
691
|
return;
|
|
657
692
|
}
|
|
658
693
|
}
|
|
@@ -696,19 +731,20 @@ function tickerDecorator(name) {
|
|
|
696
731
|
if (registeredTickers[name]) {
|
|
697
732
|
console.info(`[Pixi'VN] Ticker ${name} already exists, it will be overwritten`);
|
|
698
733
|
}
|
|
734
|
+
target.prototype.id = name;
|
|
699
735
|
registeredTickers[name] = target;
|
|
700
736
|
};
|
|
701
737
|
}
|
|
702
|
-
function
|
|
738
|
+
function geTickerInstanceById(tickerId, args, duration, priority) {
|
|
703
739
|
try {
|
|
704
|
-
let ticker = registeredTickers[
|
|
740
|
+
let ticker = registeredTickers[tickerId];
|
|
705
741
|
if (!ticker) {
|
|
706
|
-
console.error(`[Pixi'VN] Ticker ${
|
|
742
|
+
console.error(`[Pixi'VN] Ticker ${tickerId} not found`);
|
|
707
743
|
return;
|
|
708
744
|
}
|
|
709
745
|
return new ticker(args, duration, priority);
|
|
710
746
|
} catch (e) {
|
|
711
|
-
console.error(`[Pixi'VN] Error while getting Ticker ${
|
|
747
|
+
console.error(`[Pixi'VN] Error while getting Ticker ${tickerId}`, e);
|
|
712
748
|
return;
|
|
713
749
|
}
|
|
714
750
|
}
|
|
@@ -771,21 +807,21 @@ var ChoiceMenuOptionClose = class {
|
|
|
771
807
|
// src/functions/DialogueUtility.ts
|
|
772
808
|
function setDialogue(props) {
|
|
773
809
|
let text = "";
|
|
774
|
-
let
|
|
810
|
+
let character = void 0;
|
|
775
811
|
let dialogue;
|
|
776
812
|
if (typeof props === "string") {
|
|
777
813
|
text = props;
|
|
778
|
-
dialogue = new DialogueBaseModel(text,
|
|
814
|
+
dialogue = new DialogueBaseModel(text, character);
|
|
779
815
|
} else if (!(props instanceof DialogueBaseModel)) {
|
|
780
816
|
text = props.text;
|
|
781
817
|
if (props.character) {
|
|
782
818
|
if (typeof props.character === "string") {
|
|
783
|
-
|
|
819
|
+
character = props.character;
|
|
784
820
|
} else {
|
|
785
|
-
|
|
821
|
+
character = props.character.id;
|
|
786
822
|
}
|
|
787
823
|
}
|
|
788
|
-
dialogue = new DialogueBaseModel(text,
|
|
824
|
+
dialogue = new DialogueBaseModel(text, character);
|
|
789
825
|
} else {
|
|
790
826
|
dialogue = props;
|
|
791
827
|
}
|
|
@@ -916,9 +952,14 @@ var TickerBase = class {
|
|
|
916
952
|
* @param priority The priority of the ticker. @default UPDATE_PRIORITY.NORMAL
|
|
917
953
|
*/
|
|
918
954
|
constructor(args, duration, priority) {
|
|
955
|
+
/**
|
|
956
|
+
* Get the id of the ticker. This variable is used in the system to get the ticker by id, {@link geTickerInstanceById}
|
|
957
|
+
*/
|
|
958
|
+
this.id = "ticker_id_not_set";
|
|
919
959
|
this.args = args;
|
|
920
960
|
this.duration = duration;
|
|
921
961
|
this.priority = priority;
|
|
962
|
+
this.id = this.constructor.prototype.id;
|
|
922
963
|
}
|
|
923
964
|
/**
|
|
924
965
|
* The method that will be called every frame.
|
|
@@ -1141,8 +1182,8 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1141
1182
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
1142
1183
|
}
|
|
1143
1184
|
let type = args.type || "zoom";
|
|
1144
|
-
let xLimit = Infinity;
|
|
1145
|
-
let yLimit = Infinity;
|
|
1185
|
+
let xLimit = type === "zoom" ? Infinity : 0;
|
|
1186
|
+
let yLimit = type === "zoom" ? Infinity : 0;
|
|
1146
1187
|
if (args.limit) {
|
|
1147
1188
|
if (typeof args.limit === "number") {
|
|
1148
1189
|
xLimit = args.limit;
|
|
@@ -1181,7 +1222,7 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1181
1222
|
if (element.scale.x >= xLimit && element.scale.y >= yLimit) {
|
|
1182
1223
|
element.scale.x = xLimit;
|
|
1183
1224
|
element.scale.y = yLimit;
|
|
1184
|
-
|
|
1225
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1185
1226
|
}
|
|
1186
1227
|
} else if (type === "unzoom") {
|
|
1187
1228
|
if (element.scale.x < xLimit) {
|
|
@@ -1193,24 +1234,39 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1193
1234
|
if (element.scale.x <= xLimit && element.scale.y <= yLimit) {
|
|
1194
1235
|
element.scale.x = xLimit;
|
|
1195
1236
|
element.scale.y = yLimit;
|
|
1196
|
-
|
|
1237
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1197
1238
|
}
|
|
1198
1239
|
}
|
|
1199
1240
|
if (xSpeed < 1e-5 && ySpeed < 1e-5 && !(args.speedProgression && args.speedProgression.type == "linear" && args.speedProgression.amt != 0)) {
|
|
1200
|
-
|
|
1241
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1201
1242
|
}
|
|
1202
1243
|
}
|
|
1203
1244
|
});
|
|
1204
1245
|
if (args.speedProgression)
|
|
1205
1246
|
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1206
1247
|
}
|
|
1248
|
+
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
1249
|
+
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
1250
|
+
}
|
|
1207
1251
|
};
|
|
1208
1252
|
ZoomTicker = __decorateClass([
|
|
1209
1253
|
tickerDecorator()
|
|
1210
1254
|
], ZoomTicker);
|
|
1255
|
+
var ZoomInOutTicker = class extends ZoomTicker {
|
|
1256
|
+
constructor(props, duration, priority) {
|
|
1257
|
+
super(props, duration, priority);
|
|
1258
|
+
}
|
|
1259
|
+
onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2) {
|
|
1260
|
+
if (element.children.length > 0) {
|
|
1261
|
+
let elementChild = element.children[0];
|
|
1262
|
+
GameWindowManager.addCanvasElement(tag, elementChild);
|
|
1263
|
+
}
|
|
1264
|
+
super.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1265
|
+
}
|
|
1266
|
+
};
|
|
1211
1267
|
|
|
1212
1268
|
// src/constants.ts
|
|
1213
|
-
var PIXIVN_VERSION = "0.6.
|
|
1269
|
+
var PIXIVN_VERSION = "0.6.2";
|
|
1214
1270
|
var Repeat = "repeat";
|
|
1215
1271
|
function Pause(duration) {
|
|
1216
1272
|
return {
|
|
@@ -1333,6 +1389,147 @@ function showWithFadeTransition(_0, _1) {
|
|
|
1333
1389
|
function removeWithFadeTransition(tag, props = {}, priority) {
|
|
1334
1390
|
return removeWithDissolveTransition(tag, props, priority);
|
|
1335
1391
|
}
|
|
1392
|
+
function moveIn(_0, _1) {
|
|
1393
|
+
return __async(this, arguments, function* (tag, image, props = { direction: "right" }, priority) {
|
|
1394
|
+
var _a;
|
|
1395
|
+
let canvasElement;
|
|
1396
|
+
if (typeof image === "string") {
|
|
1397
|
+
canvasElement = addImage(tag, image);
|
|
1398
|
+
} else {
|
|
1399
|
+
canvasElement = image;
|
|
1400
|
+
GameWindowManager.addCanvasElement(tag, canvasElement);
|
|
1401
|
+
}
|
|
1402
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1403
|
+
yield canvasElement.load();
|
|
1404
|
+
}
|
|
1405
|
+
let destination = { x: canvasElement.x, y: canvasElement.y };
|
|
1406
|
+
if (props.direction == "up") {
|
|
1407
|
+
canvasElement.y = GameWindowManager.canvasHeight + canvasElement.height;
|
|
1408
|
+
} else if (props.direction == "down") {
|
|
1409
|
+
canvasElement.y = -canvasElement.height;
|
|
1410
|
+
} else if (props.direction == "left") {
|
|
1411
|
+
canvasElement.x = GameWindowManager.canvasWidth + canvasElement.width;
|
|
1412
|
+
} else if (props.direction == "right") {
|
|
1413
|
+
canvasElement.x = -canvasElement.width;
|
|
1414
|
+
}
|
|
1415
|
+
let effect = new MoveTicker(__spreadProps(__spreadValues({}, props), {
|
|
1416
|
+
destination,
|
|
1417
|
+
startOnlyIfHaveTexture: true
|
|
1418
|
+
}), priority);
|
|
1419
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
function moveOut(tag, props = { direction: "right" }, priority) {
|
|
1423
|
+
let canvasElement = GameWindowManager.getCanvasElement(tag);
|
|
1424
|
+
if (!canvasElement) {
|
|
1425
|
+
console.warn("[Pixi'VN] The canvas element is not found.");
|
|
1426
|
+
return;
|
|
1427
|
+
}
|
|
1428
|
+
let destination = { x: canvasElement.x, y: canvasElement.y };
|
|
1429
|
+
if (props.direction == "up") {
|
|
1430
|
+
destination.y = -canvasElement.height;
|
|
1431
|
+
} else if (props.direction == "down") {
|
|
1432
|
+
destination.y = GameWindowManager.canvasHeight + canvasElement.height;
|
|
1433
|
+
} else if (props.direction == "left") {
|
|
1434
|
+
destination.x = -canvasElement.width;
|
|
1435
|
+
} else if (props.direction == "right") {
|
|
1436
|
+
destination.x = GameWindowManager.canvasWidth + canvasElement.width;
|
|
1437
|
+
}
|
|
1438
|
+
let effect = new MoveTicker(__spreadProps(__spreadValues({}, props), {
|
|
1439
|
+
destination,
|
|
1440
|
+
startOnlyIfHaveTexture: true,
|
|
1441
|
+
tagToRemoveAfter: tag
|
|
1442
|
+
}), priority);
|
|
1443
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1444
|
+
}
|
|
1445
|
+
function zoomIn(_0, _1) {
|
|
1446
|
+
return __async(this, arguments, function* (tag, image, props = { direction: "right" }, priority) {
|
|
1447
|
+
var _a;
|
|
1448
|
+
let canvasElement;
|
|
1449
|
+
if (typeof image === "string") {
|
|
1450
|
+
canvasElement = new CanvasImage({}, image);
|
|
1451
|
+
} else {
|
|
1452
|
+
canvasElement = image;
|
|
1453
|
+
}
|
|
1454
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1455
|
+
yield canvasElement.load();
|
|
1456
|
+
}
|
|
1457
|
+
let container = new CanvasContainer();
|
|
1458
|
+
container.addChild(canvasElement);
|
|
1459
|
+
container.height = GameWindowManager.canvasHeight;
|
|
1460
|
+
container.width = GameWindowManager.canvasWidth;
|
|
1461
|
+
GameWindowManager.addCanvasElement(tag, container);
|
|
1462
|
+
if (props.direction == "up") {
|
|
1463
|
+
container.pivot.y = GameWindowManager.canvasHeight;
|
|
1464
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1465
|
+
container.y = GameWindowManager.canvasHeight;
|
|
1466
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1467
|
+
} else if (props.direction == "down") {
|
|
1468
|
+
container.pivot.y = 0;
|
|
1469
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1470
|
+
container.y = 0;
|
|
1471
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1472
|
+
} else if (props.direction == "left") {
|
|
1473
|
+
container.pivot.x = GameWindowManager.canvasWidth;
|
|
1474
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1475
|
+
container.x = GameWindowManager.canvasWidth;
|
|
1476
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1477
|
+
} else if (props.direction == "right") {
|
|
1478
|
+
container.pivot.x = 0;
|
|
1479
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1480
|
+
container.x = 0;
|
|
1481
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1482
|
+
}
|
|
1483
|
+
container.scale.set(0);
|
|
1484
|
+
let effect = new ZoomInOutTicker(__spreadProps(__spreadValues({}, props), {
|
|
1485
|
+
startOnlyIfHaveTexture: true,
|
|
1486
|
+
type: "zoom",
|
|
1487
|
+
limit: 1
|
|
1488
|
+
}), priority);
|
|
1489
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1490
|
+
});
|
|
1491
|
+
}
|
|
1492
|
+
function zoomOut(tag, props = { direction: "right" }, priority) {
|
|
1493
|
+
let canvasElement = GameWindowManager.getCanvasElement(tag);
|
|
1494
|
+
if (!canvasElement) {
|
|
1495
|
+
console.warn("[Pixi'VN] The canvas element is not found.");
|
|
1496
|
+
return;
|
|
1497
|
+
}
|
|
1498
|
+
let container = new CanvasContainer();
|
|
1499
|
+
container.addChild(canvasElement);
|
|
1500
|
+
container.height = GameWindowManager.canvasHeight;
|
|
1501
|
+
container.width = GameWindowManager.canvasWidth;
|
|
1502
|
+
GameWindowManager.addCanvasElement(tag, container);
|
|
1503
|
+
if (props.direction == "up") {
|
|
1504
|
+
container.pivot.y = GameWindowManager.canvasHeight;
|
|
1505
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1506
|
+
container.y = GameWindowManager.canvasHeight;
|
|
1507
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1508
|
+
} else if (props.direction == "down") {
|
|
1509
|
+
container.pivot.y = 0;
|
|
1510
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1511
|
+
container.y = 0;
|
|
1512
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1513
|
+
} else if (props.direction == "left") {
|
|
1514
|
+
container.pivot.x = GameWindowManager.canvasWidth;
|
|
1515
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1516
|
+
container.x = GameWindowManager.canvasWidth;
|
|
1517
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1518
|
+
} else if (props.direction == "right") {
|
|
1519
|
+
container.pivot.x = 0;
|
|
1520
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1521
|
+
container.x = 0;
|
|
1522
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1523
|
+
}
|
|
1524
|
+
container.scale.set(1);
|
|
1525
|
+
let effect = new ZoomInOutTicker(__spreadProps(__spreadValues({}, props), {
|
|
1526
|
+
startOnlyIfHaveTexture: true,
|
|
1527
|
+
type: "unzoom",
|
|
1528
|
+
limit: 0,
|
|
1529
|
+
tagToRemoveAfter: tag
|
|
1530
|
+
}), priority);
|
|
1531
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1532
|
+
}
|
|
1336
1533
|
|
|
1337
1534
|
// src/functions/SavesUtility.ts
|
|
1338
1535
|
function getSaveData() {
|
|
@@ -1822,18 +2019,18 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1822
2019
|
* ```
|
|
1823
2020
|
*/
|
|
1824
2021
|
static addTicker(canvasElementTag, ticker) {
|
|
1825
|
-
let
|
|
2022
|
+
let tickerId = ticker.id;
|
|
1826
2023
|
if (typeof canvasElementTag === "string") {
|
|
1827
2024
|
canvasElementTag = [canvasElementTag];
|
|
1828
2025
|
}
|
|
1829
|
-
if (!
|
|
1830
|
-
console.error(`[Pixi'VN] Ticker ${
|
|
2026
|
+
if (!geTickerInstanceById(tickerId, ticker.args, ticker.duration, ticker.priority)) {
|
|
2027
|
+
console.error(`[Pixi'VN] Ticker ${tickerId} not found`);
|
|
1831
2028
|
return;
|
|
1832
2029
|
}
|
|
1833
2030
|
let tickerHistory = {
|
|
1834
2031
|
fn: () => {
|
|
1835
2032
|
},
|
|
1836
|
-
|
|
2033
|
+
id: tickerId,
|
|
1837
2034
|
args: createExportableElement(ticker.args),
|
|
1838
2035
|
canvasElementTags: canvasElementTag,
|
|
1839
2036
|
priority: ticker.priority,
|
|
@@ -1849,11 +2046,11 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1849
2046
|
_GameWindowManager.removeTicker(id);
|
|
1850
2047
|
}
|
|
1851
2048
|
}, ticker.duration * 1e3);
|
|
1852
|
-
_GameWindowManager.addTickerTimeoutInfo(canvasElementTag,
|
|
2049
|
+
_GameWindowManager.addTickerTimeoutInfo(canvasElementTag, tickerId, timeout.toString(), true);
|
|
1853
2050
|
}
|
|
1854
2051
|
}
|
|
1855
2052
|
static pushTicker(id, tickerData, ticker) {
|
|
1856
|
-
_GameWindowManager.removeAssociationBetweenTickerCanvasElement(tickerData.canvasElementTags,
|
|
2053
|
+
_GameWindowManager.removeAssociationBetweenTickerCanvasElement(tickerData.canvasElementTags, ticker);
|
|
1857
2054
|
_GameWindowManager._currentTickers[id] = tickerData;
|
|
1858
2055
|
tickerData.fn = (t) => {
|
|
1859
2056
|
let data = _GameWindowManager._currentTickers[id];
|
|
@@ -1894,9 +2091,9 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1894
2091
|
if (step.hasOwnProperty("type") && step.type === "pause") {
|
|
1895
2092
|
return step;
|
|
1896
2093
|
}
|
|
1897
|
-
let
|
|
2094
|
+
let tickerId = step.id;
|
|
1898
2095
|
return {
|
|
1899
|
-
ticker:
|
|
2096
|
+
ticker: tickerId,
|
|
1900
2097
|
args: createExportableElement(step.args),
|
|
1901
2098
|
duration: step.duration
|
|
1902
2099
|
};
|
|
@@ -1934,16 +2131,16 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1934
2131
|
_GameWindowManager.addTickerTimeoutInfo(tag, "steps", timeout.toString(), false);
|
|
1935
2132
|
return;
|
|
1936
2133
|
}
|
|
1937
|
-
let ticker =
|
|
2134
|
+
let ticker = geTickerInstanceById(step.ticker, step.args, step.duration, step.priority);
|
|
1938
2135
|
if (!ticker) {
|
|
1939
2136
|
console.error(`[Pixi'VN] Ticker ${step.ticker} not found`);
|
|
1940
2137
|
return;
|
|
1941
2138
|
}
|
|
1942
|
-
let tickerName = ticker.
|
|
2139
|
+
let tickerName = ticker.id;
|
|
1943
2140
|
let tickerHistory = {
|
|
1944
2141
|
fn: () => {
|
|
1945
2142
|
},
|
|
1946
|
-
|
|
2143
|
+
id: tickerName,
|
|
1947
2144
|
args: createExportableElement(ticker.args),
|
|
1948
2145
|
canvasElementTags: [tag],
|
|
1949
2146
|
priority: ticker.priority,
|
|
@@ -2000,26 +2197,26 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
2000
2197
|
* ```
|
|
2001
2198
|
*/
|
|
2002
2199
|
static removeAssociationBetweenTickerCanvasElement(tags, ticker) {
|
|
2003
|
-
let
|
|
2200
|
+
let tickerId;
|
|
2004
2201
|
if (typeof ticker === "string") {
|
|
2005
|
-
|
|
2202
|
+
tickerId = ticker;
|
|
2006
2203
|
} else if (ticker instanceof TickerBase) {
|
|
2007
|
-
|
|
2204
|
+
tickerId = ticker.id;
|
|
2008
2205
|
} else {
|
|
2009
|
-
|
|
2206
|
+
tickerId = ticker.prototype.id;
|
|
2010
2207
|
}
|
|
2011
2208
|
if (typeof tags === "string") {
|
|
2012
2209
|
tags = [tags];
|
|
2013
2210
|
}
|
|
2014
2211
|
for (let id in _GameWindowManager._currentTickers) {
|
|
2015
2212
|
let ticker2 = _GameWindowManager._currentTickers[id];
|
|
2016
|
-
if (ticker2.
|
|
2213
|
+
if (ticker2.id === tickerId) {
|
|
2017
2214
|
_GameWindowManager._currentTickers[id].canvasElementTags = ticker2.canvasElementTags.filter((e) => !tags.includes(e));
|
|
2018
2215
|
}
|
|
2019
2216
|
}
|
|
2020
2217
|
for (let timeout in _GameWindowManager._currentTickersTimeouts) {
|
|
2021
2218
|
let TickerTimeout = _GameWindowManager._currentTickersTimeouts[timeout];
|
|
2022
|
-
if (TickerTimeout.ticker ===
|
|
2219
|
+
if (TickerTimeout.ticker === tickerId && TickerTimeout.canBeDeletedBeforeEnd) {
|
|
2023
2220
|
_GameWindowManager._currentTickersTimeouts[timeout].tags = TickerTimeout.tags.filter((t) => !tags.includes(t));
|
|
2024
2221
|
}
|
|
2025
2222
|
}
|
|
@@ -2205,11 +2402,11 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
2205
2402
|
for (let id in currentTickers) {
|
|
2206
2403
|
let t = currentTickers[id];
|
|
2207
2404
|
let tags = t.canvasElementTags;
|
|
2208
|
-
let ticker =
|
|
2405
|
+
let ticker = geTickerInstanceById(t.id, t.args, t.duration, t.priority);
|
|
2209
2406
|
if (ticker) {
|
|
2210
2407
|
_GameWindowManager.addTicker(tags, ticker);
|
|
2211
2408
|
} else {
|
|
2212
|
-
console.error(`[Pixi'VN] Ticker ${t.
|
|
2409
|
+
console.error(`[Pixi'VN] Ticker ${t.id} not found`);
|
|
2213
2410
|
}
|
|
2214
2411
|
}
|
|
2215
2412
|
}
|
|
@@ -2410,6 +2607,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2410
2607
|
_GameStepManager._openedLabels = _GameStepManager.originalStepData.openedLabels;
|
|
2411
2608
|
}
|
|
2412
2609
|
/* Run Methods */
|
|
2610
|
+
static get canGoNext() {
|
|
2611
|
+
let options = getChoiceMenuOptions();
|
|
2612
|
+
if (options && options.length > 0) {
|
|
2613
|
+
return false;
|
|
2614
|
+
}
|
|
2615
|
+
return true;
|
|
2616
|
+
}
|
|
2413
2617
|
/**
|
|
2414
2618
|
* Execute the next step and add it to the history.
|
|
2415
2619
|
* @param props The props to pass to the step.
|
|
@@ -2419,7 +2623,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2419
2623
|
* ```typescript
|
|
2420
2624
|
* function nextOnClick() {
|
|
2421
2625
|
* setLoading(true)
|
|
2422
|
-
* GameStepManager.
|
|
2626
|
+
* GameStepManager.goNext(yourParams)
|
|
2423
2627
|
* .then((result) => {
|
|
2424
2628
|
* setUpdate((p) => p + 1)
|
|
2425
2629
|
* setLoading(false)
|
|
@@ -2434,8 +2638,12 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2434
2638
|
* }
|
|
2435
2639
|
* ```
|
|
2436
2640
|
*/
|
|
2437
|
-
static
|
|
2641
|
+
static goNext(props, choiseMade) {
|
|
2438
2642
|
return __async(this, null, function* () {
|
|
2643
|
+
if (!_GameStepManager.canGoNext) {
|
|
2644
|
+
console.warn("[Pixi'VN] The player must make a choice");
|
|
2645
|
+
return;
|
|
2646
|
+
}
|
|
2439
2647
|
_GameStepManager.increaseCurrentStepIndex();
|
|
2440
2648
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2441
2649
|
});
|
|
@@ -2466,7 +2674,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2466
2674
|
return result;
|
|
2467
2675
|
} else if (_GameStepManager.openedLabels.length > 1) {
|
|
2468
2676
|
_GameStepManager.closeCurrentLabel();
|
|
2469
|
-
return yield _GameStepManager.
|
|
2677
|
+
return yield _GameStepManager.goNext(props, choiseMade);
|
|
2470
2678
|
} else {
|
|
2471
2679
|
_GameStepManager.restorLastLabelList();
|
|
2472
2680
|
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");
|
|
@@ -2614,7 +2822,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2614
2822
|
if (choice.closeCurrentLabel) {
|
|
2615
2823
|
_GameStepManager.closeCurrentLabel();
|
|
2616
2824
|
}
|
|
2617
|
-
return _GameStepManager.
|
|
2825
|
+
return _GameStepManager.goNext(props, choiseMade);
|
|
2618
2826
|
});
|
|
2619
2827
|
}
|
|
2620
2828
|
/* After Update Methods */
|
|
@@ -2942,15 +3150,15 @@ var DialogueBaseModel = class {
|
|
|
2942
3150
|
if (typeof text === "string") {
|
|
2943
3151
|
this.text = text;
|
|
2944
3152
|
if (typeof character === "string") {
|
|
2945
|
-
this.
|
|
3153
|
+
this.character = character;
|
|
2946
3154
|
} else {
|
|
2947
|
-
this.
|
|
3155
|
+
this.character = character == null ? void 0 : character.id;
|
|
2948
3156
|
}
|
|
2949
3157
|
this.oltherParams = oltherParams;
|
|
2950
3158
|
} else {
|
|
2951
3159
|
this.text = text.text;
|
|
2952
|
-
if (text.
|
|
2953
|
-
this.
|
|
3160
|
+
if (text.character) {
|
|
3161
|
+
this.character = text.character;
|
|
2954
3162
|
}
|
|
2955
3163
|
this.oltherParams = text.oltherParams || {};
|
|
2956
3164
|
}
|
|
@@ -2963,7 +3171,7 @@ var DialogueBaseModel = class {
|
|
|
2963
3171
|
export() {
|
|
2964
3172
|
return {
|
|
2965
3173
|
text: this.text,
|
|
2966
|
-
|
|
3174
|
+
character: this.character,
|
|
2967
3175
|
oltherParams: this.oltherParams
|
|
2968
3176
|
};
|
|
2969
3177
|
}
|
|
@@ -2985,81 +3193,214 @@ var helmlokImage = "https://pixijs.com/assets/helmlok.png";
|
|
|
2985
3193
|
var helmlokName = `<span style="color:blue">Helmlok</span>`;
|
|
2986
3194
|
var skullyImage = "https://pixijs.com/assets/skully.png";
|
|
2987
3195
|
var skullyName = `<span style="color:red">Skully</span>`;
|
|
3196
|
+
var bunnyImage = "https://pixijs.com/assets/bunny.png";
|
|
3197
|
+
var bunnyName = `Bunny`;
|
|
2988
3198
|
|
|
2989
|
-
// src/labels/
|
|
2990
|
-
var
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
3199
|
+
// src/labels/CanvasEventsTestLabel.ts
|
|
3200
|
+
var EventTest1 = class extends CanvasEvent {
|
|
3201
|
+
fn(event, sprite) {
|
|
3202
|
+
if (event === "pointerdown") {
|
|
3203
|
+
sprite.scale.x *= 1.25;
|
|
3204
|
+
sprite.scale.y *= 1.25;
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
};
|
|
3208
|
+
EventTest1 = __decorateClass([
|
|
3209
|
+
eventDecorator("___pixi_vn_canvas_events_test_event1___")
|
|
3210
|
+
], EventTest1);
|
|
3211
|
+
var EventTest2 = class extends CanvasEvent {
|
|
3212
|
+
constructor() {
|
|
3213
|
+
super(...arguments);
|
|
3214
|
+
this.textureButtonDown = Texture.from("https://pixijs.com/assets/button_down.png");
|
|
3215
|
+
this.textureButtonOver = Texture.from("https://pixijs.com/assets/button_over.png");
|
|
3216
|
+
this.textureButton = Texture.from("https://pixijs.com/assets/button.png");
|
|
3217
|
+
}
|
|
3218
|
+
fn(event, sprite) {
|
|
3219
|
+
if (event === "pointerdown") {
|
|
3220
|
+
sprite.isdown = true;
|
|
3221
|
+
sprite.texture = this.textureButtonDown;
|
|
3222
|
+
sprite.alpha = 1;
|
|
3223
|
+
} else if (event === "pointerup" || event === "pointerupoutside") {
|
|
3224
|
+
sprite.isdown = false;
|
|
3225
|
+
if (sprite.isOver) {
|
|
3226
|
+
sprite.texture = this.textureButtonOver;
|
|
3227
|
+
} else {
|
|
3228
|
+
sprite.texture = this.textureButton;
|
|
3229
|
+
}
|
|
3230
|
+
} else if (event === "pointerover") {
|
|
3231
|
+
sprite.isOver = true;
|
|
3232
|
+
if (sprite.isdown) {
|
|
3233
|
+
return;
|
|
3234
|
+
}
|
|
3235
|
+
sprite.texture = this.textureButtonOver;
|
|
3236
|
+
} else if (event === "pointerout") {
|
|
3237
|
+
sprite.isOver = false;
|
|
3238
|
+
if (sprite.isdown) {
|
|
3239
|
+
return;
|
|
3240
|
+
}
|
|
3241
|
+
sprite.texture = this.textureButton;
|
|
3242
|
+
}
|
|
3243
|
+
}
|
|
3244
|
+
};
|
|
3245
|
+
EventTest2 = __decorateClass([
|
|
3246
|
+
eventDecorator("___pixi_vn_canvas_events_test_event2___")
|
|
3247
|
+
], EventTest2);
|
|
3248
|
+
var CANVAS_EVENTS_TEST_LABEL = "___pixi_vn_canvas_events_test___";
|
|
3249
|
+
var canvasEventsTestLabel = newLabel(
|
|
3250
|
+
CANVAS_EVENTS_TEST_LABEL,
|
|
3251
|
+
[
|
|
3252
|
+
() => setDialogue({
|
|
2994
3253
|
character: juliette,
|
|
2995
|
-
text:
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3254
|
+
text: "This is the test of clickable elements in a canvas."
|
|
3255
|
+
}),
|
|
3256
|
+
() => __async(void 0, null, function* () {
|
|
3257
|
+
setDialogue({
|
|
3258
|
+
character: juliette,
|
|
3259
|
+
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).)`
|
|
3260
|
+
});
|
|
3261
|
+
const texture = yield Assets.load(bunnyImage);
|
|
3262
|
+
const sprite = CanvasSprite.from(texture);
|
|
3263
|
+
sprite.anchor.set(0.5);
|
|
3264
|
+
sprite.x = GameWindowManager.screen.width / 2;
|
|
3265
|
+
sprite.y = GameWindowManager.screen.height / 2;
|
|
3266
|
+
sprite.eventMode = "static";
|
|
3267
|
+
sprite.cursor = "pointer";
|
|
3268
|
+
sprite.onEvent("pointerdown", EventTest1);
|
|
3269
|
+
GameWindowManager.addCanvasElement("bunny", sprite);
|
|
3270
|
+
}),
|
|
3271
|
+
() => __async(void 0, null, function* () {
|
|
3272
|
+
GameWindowManager.clear();
|
|
3273
|
+
setDialogue({
|
|
3274
|
+
character: juliette,
|
|
3275
|
+
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).)`
|
|
3276
|
+
});
|
|
3277
|
+
yield Assets.load([
|
|
3278
|
+
"https://pixijs.com/assets/bg_button.jpg",
|
|
3279
|
+
"https://pixijs.com/assets/button.png",
|
|
3280
|
+
"https://pixijs.com/assets/button_down.png",
|
|
3281
|
+
"https://pixijs.com/assets/button_over.png"
|
|
3282
|
+
]);
|
|
3283
|
+
const background = CanvasSprite.from("https://pixijs.com/assets/bg_button.jpg");
|
|
3284
|
+
background.width = GameWindowManager.screen.width;
|
|
3285
|
+
background.height = GameWindowManager.screen.height;
|
|
3286
|
+
GameWindowManager.addCanvasElement("bg", background);
|
|
3287
|
+
const textureButton = Texture.from("https://pixijs.com/assets/button.png");
|
|
3288
|
+
const buttons = [];
|
|
3289
|
+
const buttonPositions = [175, 75, 655, 75, 410, 325, 150, 465, 685, 445];
|
|
3290
|
+
for (let i = 0; i < 5; i++) {
|
|
3291
|
+
const button = new CanvasSprite(textureButton);
|
|
3292
|
+
button.anchor.set(0.5);
|
|
3293
|
+
button.x = buttonPositions[i * 2];
|
|
3294
|
+
button.y = buttonPositions[i * 2 + 1];
|
|
3295
|
+
button.eventMode = "static";
|
|
3296
|
+
button.cursor = "pointer";
|
|
3297
|
+
button.onEvent("pointerdown", EventTest2).onEvent("pointerup", EventTest2).onEvent("pointerupoutside", EventTest2).onEvent("pointerover", EventTest2).onEvent("pointerout", EventTest2);
|
|
3298
|
+
GameWindowManager.addCanvasElement("button" + i, button);
|
|
3299
|
+
buttons.push(button);
|
|
3300
|
+
}
|
|
3301
|
+
buttons[0].scale.set(1.2);
|
|
3302
|
+
buttons[2].rotation = Math.PI / 10;
|
|
3303
|
+
buttons[3].scale.set(0.8);
|
|
3304
|
+
buttons[4].scale.set(0.8, 1.2);
|
|
3305
|
+
buttons[4].rotation = Math.PI;
|
|
3306
|
+
})
|
|
3307
|
+
]
|
|
3308
|
+
);
|
|
3309
|
+
var AlienTintingTest = class extends CanvasSprite {
|
|
3310
|
+
constructor() {
|
|
3311
|
+
super(...arguments);
|
|
3312
|
+
this.direction = 0;
|
|
3313
|
+
this.turningSpeed = 0;
|
|
3314
|
+
this.speed = 0;
|
|
3315
|
+
}
|
|
3316
|
+
get memory() {
|
|
3317
|
+
return __spreadProps(__spreadValues({}, super.memory), {
|
|
3318
|
+
direction: this.direction,
|
|
3319
|
+
turningSpeed: this.turningSpeed,
|
|
3320
|
+
speed: this.speed
|
|
3058
3321
|
});
|
|
3059
|
-
}
|
|
3060
|
-
|
|
3322
|
+
}
|
|
3323
|
+
set memory(memory) {
|
|
3324
|
+
super.memory = memory;
|
|
3325
|
+
this.direction = memory.direction;
|
|
3326
|
+
this.turningSpeed = memory.turningSpeed;
|
|
3327
|
+
this.speed = memory.speed;
|
|
3328
|
+
}
|
|
3329
|
+
static from(source, skipCache) {
|
|
3330
|
+
let sprite = Sprite.from(source, skipCache);
|
|
3331
|
+
let mySprite = new AlienTintingTest();
|
|
3332
|
+
mySprite.texture = sprite.texture;
|
|
3333
|
+
return mySprite;
|
|
3334
|
+
}
|
|
3335
|
+
};
|
|
3336
|
+
AlienTintingTest = __decorateClass([
|
|
3337
|
+
canvasElementDecorator("___pixi_vn_custom_canvas_element___")
|
|
3338
|
+
], AlienTintingTest);
|
|
3339
|
+
var TintingTestTicker = class extends TickerBase {
|
|
3340
|
+
constructor() {
|
|
3341
|
+
super({});
|
|
3342
|
+
}
|
|
3343
|
+
fn(_t, _args, tags) {
|
|
3344
|
+
tags.forEach((tag) => {
|
|
3345
|
+
const dudeBoundsPadding = 100;
|
|
3346
|
+
const dudeBounds = new Rectangle(
|
|
3347
|
+
-dudeBoundsPadding,
|
|
3348
|
+
-dudeBoundsPadding,
|
|
3349
|
+
GameWindowManager.screen.width + dudeBoundsPadding * 2,
|
|
3350
|
+
GameWindowManager.screen.height + dudeBoundsPadding * 2
|
|
3351
|
+
);
|
|
3352
|
+
let dude = GameWindowManager.getCanvasElement(tag);
|
|
3353
|
+
if (dude && dude instanceof AlienTintingTest) {
|
|
3354
|
+
dude.direction += dude.turningSpeed * 0.01;
|
|
3355
|
+
dude.x += Math.sin(dude.direction) * dude.speed;
|
|
3356
|
+
dude.y += Math.cos(dude.direction) * dude.speed;
|
|
3357
|
+
dude.rotation = -dude.direction - Math.PI / 2;
|
|
3358
|
+
if (dude.x < dudeBounds.x) {
|
|
3359
|
+
dude.x += dudeBounds.width;
|
|
3360
|
+
} else if (dude.x > dudeBounds.x + dudeBounds.width) {
|
|
3361
|
+
dude.x -= dudeBounds.width;
|
|
3362
|
+
}
|
|
3363
|
+
if (dude.y < dudeBounds.y) {
|
|
3364
|
+
dude.y += dudeBounds.height;
|
|
3365
|
+
} else if (dude.y > dudeBounds.y + dudeBounds.height) {
|
|
3366
|
+
dude.y -= dudeBounds.height;
|
|
3367
|
+
}
|
|
3368
|
+
}
|
|
3369
|
+
});
|
|
3370
|
+
}
|
|
3371
|
+
};
|
|
3372
|
+
TintingTestTicker = __decorateClass([
|
|
3373
|
+
tickerDecorator("___pixi_vn_custom_ticker___")
|
|
3374
|
+
], TintingTestTicker);
|
|
3375
|
+
var CUSTOM_TICKER_CANVAS_ELEMENT_TEST_LABEL = "___pixi_vn_custom_ticker_canvas_element_test___";
|
|
3376
|
+
var customTickerCanvasElementTestLabel = newLabel(
|
|
3377
|
+
CUSTOM_TICKER_CANVAS_ELEMENT_TEST_LABEL,
|
|
3378
|
+
[
|
|
3379
|
+
() => __async(void 0, null, function* () {
|
|
3380
|
+
const totalDudes = 100;
|
|
3381
|
+
for (let i = 0; i < totalDudes; i++) {
|
|
3382
|
+
const texture = yield Assets.load(eggHeadImage);
|
|
3383
|
+
const dude = AlienTintingTest.from(texture);
|
|
3384
|
+
dude.anchor.set(0.5);
|
|
3385
|
+
dude.scale.set(0.8 + Math.random() * 0.3);
|
|
3386
|
+
dude.x = Math.random() * GameWindowManager.screen.width;
|
|
3387
|
+
dude.y = Math.random() * GameWindowManager.screen.height;
|
|
3388
|
+
dude.tint = Math.random() * 16777215;
|
|
3389
|
+
dude.direction = Math.random() * Math.PI * 2;
|
|
3390
|
+
dude.turningSpeed = Math.random() - 0.8;
|
|
3391
|
+
dude.speed = 2 + Math.random() * 2;
|
|
3392
|
+
GameWindowManager.addCanvasElement("alien" + i, dude);
|
|
3393
|
+
GameWindowManager.addTicker("alien" + i, new TintingTestTicker());
|
|
3394
|
+
}
|
|
3395
|
+
setDialogue({
|
|
3396
|
+
character: juliette,
|
|
3397
|
+
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).)`
|
|
3398
|
+
});
|
|
3399
|
+
})
|
|
3400
|
+
]
|
|
3401
|
+
);
|
|
3061
3402
|
|
|
3062
|
-
// src/labels/
|
|
3403
|
+
// src/labels/ImagesAnimationsTestLabel.ts
|
|
3063
3404
|
var IMAGE_ANIMAIONS_TEST_LABEL = "___pixi_vn_images_animations_test___";
|
|
3064
3405
|
var imagesAnimationsTest = newLabel(IMAGE_ANIMAIONS_TEST_LABEL, [
|
|
3065
3406
|
() => __async(void 0, null, function* () {
|
|
@@ -3088,6 +3429,8 @@ var imagesAnimationsTest = newLabel(IMAGE_ANIMAIONS_TEST_LABEL, [
|
|
|
3088
3429
|
new ChoiceMenuOption("Rotate", imagesRotateTest),
|
|
3089
3430
|
new ChoiceMenuOption("Move", imagesMoveTest),
|
|
3090
3431
|
new ChoiceMenuOption("Zoom", imagesZoomTest),
|
|
3432
|
+
new ChoiceMenuOption("Move in/out", imagesMoveInOutTest),
|
|
3433
|
+
new ChoiceMenuOption("Zoom in/out", imagesZoomInOutTest),
|
|
3091
3434
|
new ChoiceMenuOptionClose("Cancel", true)
|
|
3092
3435
|
]);
|
|
3093
3436
|
}),
|
|
@@ -3342,6 +3685,148 @@ var imagesZoomTest = newLabel("___pixi_vn_images_zoom_test___", [
|
|
|
3342
3685
|
]);
|
|
3343
3686
|
}
|
|
3344
3687
|
]);
|
|
3688
|
+
var imagesMoveInOutTest = newLabel("___pixi_vn_images_move_in_out_test___", [
|
|
3689
|
+
() => __async(void 0, null, function* () {
|
|
3690
|
+
setDialogue({
|
|
3691
|
+
character: juliette,
|
|
3692
|
+
text: `Here's what's going to happen:
|
|
3693
|
+
- ${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.
|
|
3694
|
+
- ${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.
|
|
3695
|
+
- ${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.
|
|
3696
|
+
- ${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.`
|
|
3697
|
+
});
|
|
3698
|
+
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3699
|
+
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
3700
|
+
let helmlok = new CanvasImage({ x: 100, y: 300 }, helmlokImage);
|
|
3701
|
+
let skully = new CanvasImage({ x: 300, y: 300 }, skullyImage);
|
|
3702
|
+
moveIn("eggHead", eggHead, { speed: 800, direction: "down" });
|
|
3703
|
+
moveIn("flowerTop", flowerTop, {
|
|
3704
|
+
speed: 800,
|
|
3705
|
+
direction: "left",
|
|
3706
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3707
|
+
});
|
|
3708
|
+
moveIn("helmlok", helmlok, { speed: 800, direction: "right" });
|
|
3709
|
+
moveIn("skully", skully, {
|
|
3710
|
+
speed: 800,
|
|
3711
|
+
direction: "up",
|
|
3712
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3713
|
+
});
|
|
3714
|
+
}),
|
|
3715
|
+
() => {
|
|
3716
|
+
moveOut("eggHead", { speed: 800, direction: "down" });
|
|
3717
|
+
moveOut("flowerTop", { speed: 800, direction: "left" });
|
|
3718
|
+
moveOut("helmlok", { speed: 800, direction: "right" });
|
|
3719
|
+
moveOut("skully", { speed: 800, direction: "up" });
|
|
3720
|
+
}
|
|
3721
|
+
]);
|
|
3722
|
+
var imagesZoomInOutTest = newLabel("___pixi_vn_images_zoom_in_out_test___", [
|
|
3723
|
+
() => __async(void 0, null, function* () {
|
|
3724
|
+
GameWindowManager.removeCanvasElements();
|
|
3725
|
+
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3726
|
+
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
3727
|
+
let helmlok = new CanvasImage({ x: 100, y: 300 }, helmlokImage);
|
|
3728
|
+
let skully = new CanvasImage({ x: 300, y: 300 }, skullyImage);
|
|
3729
|
+
zoomIn("eggHead", eggHead, { speed: 3, direction: "down" });
|
|
3730
|
+
zoomIn("flowerTop", flowerTop, {
|
|
3731
|
+
speed: 3,
|
|
3732
|
+
direction: "left",
|
|
3733
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3734
|
+
});
|
|
3735
|
+
zoomIn("helmlok", helmlok, { speed: 3, direction: "right" });
|
|
3736
|
+
zoomIn("skully", skully, {
|
|
3737
|
+
speed: 3,
|
|
3738
|
+
direction: "up",
|
|
3739
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3740
|
+
});
|
|
3741
|
+
}),
|
|
3742
|
+
() => __async(void 0, null, function* () {
|
|
3743
|
+
zoomOut("eggHead", {
|
|
3744
|
+
speed: 3,
|
|
3745
|
+
direction: "down",
|
|
3746
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3747
|
+
});
|
|
3748
|
+
zoomOut("flowerTop", { speed: 3, direction: "left" });
|
|
3749
|
+
zoomOut("helmlok", { speed: 3, direction: "right" });
|
|
3750
|
+
zoomOut("skully", {
|
|
3751
|
+
speed: 3,
|
|
3752
|
+
direction: "up",
|
|
3753
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3754
|
+
});
|
|
3755
|
+
})
|
|
3756
|
+
]);
|
|
3757
|
+
|
|
3758
|
+
// src/labels/MarkdownTest.ts
|
|
3759
|
+
var MARKDOWN_TEST_LABEL = "___pixi_vn_markdown_test___";
|
|
3760
|
+
var markdownTest = newLabel(MARKDOWN_TEST_LABEL, [
|
|
3761
|
+
() => __async(void 0, null, function* () {
|
|
3762
|
+
setDialogue({
|
|
3763
|
+
character: juliette,
|
|
3764
|
+
text: `
|
|
3765
|
+
# Markdown Test
|
|
3766
|
+
|
|
3767
|
+
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.
|
|
3768
|
+
|
|
3769
|
+
For example in React, you can use the library [react-markdown](https://www.npmjs.com/package/react-markdown).
|
|
3770
|
+
|
|
3771
|
+
## Colored Text
|
|
3772
|
+
|
|
3773
|
+
<span style="color:blue">some *blue* text</span>.
|
|
3774
|
+
|
|
3775
|
+
<span style="color:red">some *red* text</span>.
|
|
3776
|
+
|
|
3777
|
+
<span style="color:green">some *green* text</span>.
|
|
3778
|
+
|
|
3779
|
+
## Bold Text
|
|
3780
|
+
|
|
3781
|
+
**This is bold text.**
|
|
3782
|
+
|
|
3783
|
+
## Italic Text
|
|
3784
|
+
|
|
3785
|
+
*This is italic text.*
|
|
3786
|
+
|
|
3787
|
+
## Delete Text
|
|
3788
|
+
|
|
3789
|
+
~~This is deleted text.~~
|
|
3790
|
+
|
|
3791
|
+
## Link Test
|
|
3792
|
+
|
|
3793
|
+
[Link to Google](https://www.google.com)
|
|
3794
|
+
|
|
3795
|
+
## H2 Test
|
|
3796
|
+
|
|
3797
|
+
### H3 Test
|
|
3798
|
+
|
|
3799
|
+
#### H4 Test
|
|
3800
|
+
|
|
3801
|
+
## Code Test
|
|
3802
|
+
|
|
3803
|
+
\`Hello World\`
|
|
3804
|
+
|
|
3805
|
+
\`\`\`js
|
|
3806
|
+
console.log("Hello World")
|
|
3807
|
+
\`\`\`
|
|
3808
|
+
|
|
3809
|
+
## List Test
|
|
3810
|
+
|
|
3811
|
+
- Item 1
|
|
3812
|
+
* Item 2
|
|
3813
|
+
- [x] Item 3
|
|
3814
|
+
|
|
3815
|
+
## Table Test
|
|
3816
|
+
|
|
3817
|
+
| Header 1 | Header 2 |
|
|
3818
|
+
| -------- | -------- |
|
|
3819
|
+
| Cell 1 | Cell 2 |
|
|
3820
|
+
|
|
3821
|
+
## Separator Test
|
|
3822
|
+
|
|
3823
|
+
***
|
|
3824
|
+
Footer
|
|
3825
|
+
|
|
3826
|
+
`
|
|
3827
|
+
});
|
|
3828
|
+
})
|
|
3829
|
+
]);
|
|
3345
3830
|
|
|
3346
3831
|
// src/labels/StartLabel.ts
|
|
3347
3832
|
var pixivnTestStartLabel = newLabel(
|
|
@@ -3373,7 +3858,9 @@ var pixivnTestStartLabel2 = newLabel(
|
|
|
3373
3858
|
GameWindowManager.clear();
|
|
3374
3859
|
setDialogue({ character: juliette, text: "Which test would you like to start with?" });
|
|
3375
3860
|
setChoiceMenuOptions([
|
|
3376
|
-
new ChoiceMenuOption("Images and Animations", imagesAnimationsTest),
|
|
3861
|
+
new ChoiceMenuOption("Images, Transitions and Animations Test", imagesAnimationsTest),
|
|
3862
|
+
new ChoiceMenuOption("Canvas Events Test Label", canvasEventsTestLabel),
|
|
3863
|
+
new ChoiceMenuOption("Custom Ticker Canvas Element Test", customTickerCanvasElementTestLabel),
|
|
3377
3864
|
new ChoiceMenuOption("Markdown Test", markdownTest)
|
|
3378
3865
|
]);
|
|
3379
3866
|
},
|
|
@@ -3381,6 +3868,6 @@ var pixivnTestStartLabel2 = newLabel(
|
|
|
3381
3868
|
]
|
|
3382
3869
|
);
|
|
3383
3870
|
|
|
3384
|
-
export { CanvasBase, CanvasContainer, CanvasEvent, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel2 as CharacterBaseModel, ChoiceMenuOption, ChoiceMenuOptionClose, Close, DialogueBaseModel, FadeAlphaTicker, GameStepManager, GameStorageManager, GameWindowManager, Label, MoveTicker, Pause, Repeat, RotateTicker, StoredClassModel, TickerBase, ZoomTicker, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getLabelById, getSaveData, getSaveJson, getTexture, juliette, loadImage, loadSaveData, loadSaveJson, newLabel, pixivnTestStartLabel, removeCanvasElement, removeWithDissolveTransition, removeWithFadeTransition, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag, showImage, showWithDissolveTransition, showWithFadeTransition, tickerDecorator };
|
|
3871
|
+
export { CanvasBase, CanvasContainer, CanvasEvent, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel2 as CharacterBaseModel, ChoiceMenuOption, ChoiceMenuOptionClose, Close, DialogueBaseModel, FadeAlphaTicker, GameStepManager, GameStorageManager, GameWindowManager, Label, MoveTicker, Pause, Repeat, RotateTicker, StoredClassModel, TickerBase, ZoomTicker, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getLabelById, getSaveData, getSaveJson, getTexture, juliette, loadImage, loadSaveData, loadSaveJson, moveIn, moveOut, newLabel, pixivnTestStartLabel, removeCanvasElement, removeWithDissolveTransition, removeWithFadeTransition, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag, showImage, showWithDissolveTransition, showWithFadeTransition, tickerDecorator, zoomIn, zoomOut };
|
|
3385
3872
|
//# sourceMappingURL=out.js.map
|
|
3386
3873
|
//# sourceMappingURL=index.mjs.map
|