@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { diff } from 'deep-diff';
|
|
2
2
|
import sha1 from 'crypto-js/sha1';
|
|
3
|
-
import { Sprite, Container, Application, Assets,
|
|
3
|
+
import { Sprite, Container, Texture, Rectangle, Application, Assets, Text } from 'pixi.js';
|
|
4
4
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __defProps = Object.defineProperties;
|
|
@@ -50,6 +50,20 @@ var __async = (__this, __arguments, generator) => {
|
|
|
50
50
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
|
+
|
|
54
|
+
// src/classes/CanvasEvent.ts
|
|
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
|
+
}
|
|
63
|
+
fn(_event, _element) {
|
|
64
|
+
throw new Error("[Pixi'VN] The method CanvasEvent.fn() must be overridden");
|
|
65
|
+
}
|
|
66
|
+
};
|
|
53
67
|
function getStepSha1(step) {
|
|
54
68
|
let sha1String = sha1(step.toString().toLocaleLowerCase());
|
|
55
69
|
return sha1String.toString();
|
|
@@ -73,7 +87,7 @@ var Label = class {
|
|
|
73
87
|
this._choiseIndex = choiseIndex;
|
|
74
88
|
}
|
|
75
89
|
/**
|
|
76
|
-
* 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}
|
|
77
91
|
*/
|
|
78
92
|
get id() {
|
|
79
93
|
return this._id;
|
|
@@ -162,17 +176,23 @@ function exportCanvasElement(element) {
|
|
|
162
176
|
return element.memory;
|
|
163
177
|
}
|
|
164
178
|
function importCanvasElement(memory) {
|
|
165
|
-
let element =
|
|
179
|
+
let element = getCanvasElementInstanceById(memory.pixivnId);
|
|
166
180
|
if (element) {
|
|
167
181
|
element.memory = memory;
|
|
168
182
|
} else {
|
|
169
|
-
throw new Error("[Pixi'VN] The element " + memory.
|
|
183
|
+
throw new Error("[Pixi'VN] The element " + memory.pixivnId + " could not be created");
|
|
170
184
|
}
|
|
171
185
|
return element;
|
|
172
186
|
}
|
|
173
187
|
|
|
174
188
|
// src/classes/canvas/CanvasContainer.ts
|
|
189
|
+
var CANVAS_CONTAINER_ID = "CanvasContainer";
|
|
175
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
|
+
}
|
|
176
196
|
get memory() {
|
|
177
197
|
let memory = getMemoryContainer(this);
|
|
178
198
|
this.children.forEach((child) => {
|
|
@@ -188,8 +208,12 @@ var CanvasContainer = class extends Container {
|
|
|
188
208
|
}
|
|
189
209
|
};
|
|
190
210
|
function getMemoryContainer(element) {
|
|
211
|
+
let className = "CanvasContainer";
|
|
212
|
+
if (element.hasOwnProperty("pixivnId")) {
|
|
213
|
+
className = element.pixivnId;
|
|
214
|
+
}
|
|
191
215
|
return {
|
|
192
|
-
|
|
216
|
+
pixivnId: className,
|
|
193
217
|
elements: [],
|
|
194
218
|
width: element.width,
|
|
195
219
|
height: element.height,
|
|
@@ -305,40 +329,55 @@ function getTextStyle(style) {
|
|
|
305
329
|
|
|
306
330
|
// src/decorators/EventDecorator.ts
|
|
307
331
|
var registeredEvents = {};
|
|
308
|
-
function
|
|
332
|
+
function eventDecorator(name) {
|
|
333
|
+
return function(target) {
|
|
334
|
+
if (!name) {
|
|
335
|
+
name = target.name;
|
|
336
|
+
}
|
|
337
|
+
if (registeredEvents[name]) {
|
|
338
|
+
console.info(`[Pixi'VN] Event ${name} already exists, it will be overwritten`);
|
|
339
|
+
}
|
|
340
|
+
target.prototype.id = name;
|
|
341
|
+
registeredEvents[name] = target;
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
function getEventTypeById(eventId) {
|
|
309
345
|
try {
|
|
310
|
-
let eventType = registeredEvents[
|
|
346
|
+
let eventType = registeredEvents[eventId];
|
|
311
347
|
if (!eventType) {
|
|
312
|
-
console.error(`[Pixi'VN] Event ${
|
|
348
|
+
console.error(`[Pixi'VN] Event ${eventId} not found`);
|
|
313
349
|
return;
|
|
314
350
|
}
|
|
315
351
|
new eventType();
|
|
316
352
|
return eventType;
|
|
317
353
|
} catch (e) {
|
|
318
|
-
console.error(`[Pixi'VN] Error while getting Event ${
|
|
354
|
+
console.error(`[Pixi'VN] Error while getting Event ${eventId}`, e);
|
|
319
355
|
return;
|
|
320
356
|
}
|
|
321
357
|
}
|
|
322
|
-
function
|
|
358
|
+
function getEventInstanceById(eventId) {
|
|
323
359
|
try {
|
|
324
|
-
let eventType = registeredEvents[
|
|
360
|
+
let eventType = registeredEvents[eventId];
|
|
325
361
|
if (!eventType) {
|
|
326
|
-
console.error(`[Pixi'VN] Event ${
|
|
362
|
+
console.error(`[Pixi'VN] Event ${eventId} not found`);
|
|
327
363
|
return;
|
|
328
364
|
}
|
|
329
365
|
let event = new eventType();
|
|
330
366
|
return event;
|
|
331
367
|
} catch (e) {
|
|
332
|
-
console.error(`[Pixi'VN] Error while getting Event ${
|
|
368
|
+
console.error(`[Pixi'VN] Error while getting Event ${eventId}`, e);
|
|
333
369
|
return;
|
|
334
370
|
}
|
|
335
371
|
}
|
|
336
372
|
|
|
337
373
|
// src/classes/canvas/CanvasSprite.ts
|
|
374
|
+
var CANVAS_SPRITE_ID = "CanvasSprite";
|
|
338
375
|
var CanvasSprite = class _CanvasSprite extends Sprite {
|
|
339
|
-
constructor() {
|
|
340
|
-
super(
|
|
376
|
+
constructor(options) {
|
|
377
|
+
super(options);
|
|
378
|
+
this.pixivnId = CANVAS_SPRITE_ID;
|
|
341
379
|
this._onEvents = {};
|
|
380
|
+
this.pixivnId = this.constructor.prototype.pixivnId;
|
|
342
381
|
}
|
|
343
382
|
get memory() {
|
|
344
383
|
return getMemorySprite(this);
|
|
@@ -379,9 +418,9 @@ var CanvasSprite = class _CanvasSprite extends Sprite {
|
|
|
379
418
|
* ```
|
|
380
419
|
*/
|
|
381
420
|
onEvent(event, eventClass) {
|
|
382
|
-
let
|
|
383
|
-
let instance =
|
|
384
|
-
this._onEvents[event] =
|
|
421
|
+
let id = eventClass.prototype.id;
|
|
422
|
+
let instance = getEventInstanceById(id);
|
|
423
|
+
this._onEvents[event] = id;
|
|
385
424
|
if (instance) {
|
|
386
425
|
super.on(event, () => {
|
|
387
426
|
instance.fn(event, this);
|
|
@@ -410,7 +449,7 @@ var CanvasSprite = class _CanvasSprite extends Sprite {
|
|
|
410
449
|
function getMemorySprite(element) {
|
|
411
450
|
let temp = getMemoryContainer(element);
|
|
412
451
|
return __spreadProps(__spreadValues({}, temp), {
|
|
413
|
-
|
|
452
|
+
pixivnId: element.pixivnId,
|
|
414
453
|
textureImage: getTextureMemory(element.texture),
|
|
415
454
|
anchor: { x: element.anchor.x, y: element.anchor.y },
|
|
416
455
|
roundPixels: element.roundPixels,
|
|
@@ -433,8 +472,8 @@ function setMemorySprite(element, memory) {
|
|
|
433
472
|
}
|
|
434
473
|
memory.roundPixels && (element.roundPixels = memory.roundPixels);
|
|
435
474
|
for (let event in memory.onEvents) {
|
|
436
|
-
let
|
|
437
|
-
let instance =
|
|
475
|
+
let id = memory.onEvents[event];
|
|
476
|
+
let instance = getEventTypeById(id);
|
|
438
477
|
if (instance) {
|
|
439
478
|
element.onEvent(event, instance);
|
|
440
479
|
}
|
|
@@ -442,9 +481,11 @@ function setMemorySprite(element, memory) {
|
|
|
442
481
|
}
|
|
443
482
|
|
|
444
483
|
// src/classes/canvas/CanvasImage.ts
|
|
484
|
+
var CANVAS_IMAGE_ID = "CanvasImage";
|
|
445
485
|
var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
446
486
|
constructor(options, imageLink) {
|
|
447
487
|
super(options);
|
|
488
|
+
this.pixivnId = CANVAS_IMAGE_ID;
|
|
448
489
|
this.imageLink = "";
|
|
449
490
|
if (imageLink) {
|
|
450
491
|
this.imageLink = imageLink;
|
|
@@ -452,12 +493,13 @@ var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
|
452
493
|
}
|
|
453
494
|
get memory() {
|
|
454
495
|
return __spreadProps(__spreadValues({}, getMemorySprite(this)), {
|
|
455
|
-
|
|
456
|
-
|
|
496
|
+
pixivnId: this.pixivnId,
|
|
497
|
+
imageLink: this.imageLink
|
|
457
498
|
});
|
|
458
499
|
}
|
|
459
500
|
set memory(memory) {
|
|
460
501
|
setMemorySprite(this, memory);
|
|
502
|
+
this.imageLink = memory.imageLink;
|
|
461
503
|
}
|
|
462
504
|
static from(source, skipCache) {
|
|
463
505
|
let sprite = Sprite.from(source, skipCache);
|
|
@@ -485,10 +527,13 @@ var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
|
485
527
|
});
|
|
486
528
|
}
|
|
487
529
|
};
|
|
530
|
+
var CANVAS_TEXT_ID = "CanvasText";
|
|
488
531
|
var CanvasText = class extends Text {
|
|
489
|
-
constructor() {
|
|
490
|
-
super(
|
|
532
|
+
constructor(options) {
|
|
533
|
+
super(options);
|
|
534
|
+
this.pixivnId = CANVAS_TEXT_ID;
|
|
491
535
|
this._onEvents = {};
|
|
536
|
+
this.pixivnId = this.constructor.prototype.pixivnId;
|
|
492
537
|
}
|
|
493
538
|
get memory() {
|
|
494
539
|
return getMemoryText(this);
|
|
@@ -529,9 +574,9 @@ var CanvasText = class extends Text {
|
|
|
529
574
|
* ```
|
|
530
575
|
*/
|
|
531
576
|
onEvent(event, eventClass) {
|
|
532
|
-
let
|
|
533
|
-
let instance =
|
|
534
|
-
this._onEvents[event] =
|
|
577
|
+
let id = eventClass.prototype.id;
|
|
578
|
+
let instance = getEventInstanceById(id);
|
|
579
|
+
this._onEvents[event] = id;
|
|
535
580
|
if (instance) {
|
|
536
581
|
super.on(event, () => {
|
|
537
582
|
instance.fn(event, this);
|
|
@@ -554,7 +599,7 @@ var CanvasText = class extends Text {
|
|
|
554
599
|
function getMemoryText(element) {
|
|
555
600
|
let temp = getMemoryContainer(element);
|
|
556
601
|
return __spreadProps(__spreadValues({}, temp), {
|
|
557
|
-
|
|
602
|
+
pixivnId: element.pixivnId,
|
|
558
603
|
anchor: { x: element.anchor.x, y: element.anchor.y },
|
|
559
604
|
text: element.text,
|
|
560
605
|
resolution: element.resolution,
|
|
@@ -577,8 +622,8 @@ function setMemoryText(element, memory) {
|
|
|
577
622
|
memory.style && (element.style = memory.style);
|
|
578
623
|
memory.roundPixels && (element.roundPixels = memory.roundPixels);
|
|
579
624
|
for (let event in memory.onEvents) {
|
|
580
|
-
let
|
|
581
|
-
let instance =
|
|
625
|
+
let id = memory.onEvents[event];
|
|
626
|
+
let instance = getEventTypeById(id);
|
|
582
627
|
if (instance) {
|
|
583
628
|
element.onEvent(event, instance);
|
|
584
629
|
}
|
|
@@ -587,28 +632,40 @@ function setMemoryText(element, memory) {
|
|
|
587
632
|
|
|
588
633
|
// src/decorators/CanvasElementDecorator.ts
|
|
589
634
|
var registeredCanvasElement = {};
|
|
590
|
-
function
|
|
635
|
+
function canvasElementDecorator(name) {
|
|
636
|
+
return function(target) {
|
|
637
|
+
if (!name) {
|
|
638
|
+
name = target.name;
|
|
639
|
+
}
|
|
640
|
+
if (registeredCanvasElement[name]) {
|
|
641
|
+
console.warn(`[Pixi'VN] CanvasElement ${name} already registered`);
|
|
642
|
+
}
|
|
643
|
+
target.prototype.pixivnId = name;
|
|
644
|
+
registeredCanvasElement[name] = target;
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
function getCanvasElementInstanceById(canvasId) {
|
|
591
648
|
try {
|
|
592
|
-
let eventType = registeredCanvasElement[
|
|
649
|
+
let eventType = registeredCanvasElement[canvasId];
|
|
593
650
|
if (!eventType) {
|
|
594
|
-
if (
|
|
651
|
+
if (canvasId === CANVAS_CONTAINER_ID) {
|
|
595
652
|
eventType = CanvasContainer;
|
|
596
|
-
} else if (
|
|
653
|
+
} else if (canvasId === CANVAS_IMAGE_ID) {
|
|
597
654
|
eventType = CanvasImage;
|
|
598
|
-
} else if (
|
|
655
|
+
} else if (canvasId === CANVAS_SPRITE_ID) {
|
|
599
656
|
eventType = CanvasSprite;
|
|
600
|
-
} else if (
|
|
657
|
+
} else if (canvasId === CANVAS_TEXT_ID) {
|
|
601
658
|
eventType = CanvasText;
|
|
602
659
|
}
|
|
603
660
|
}
|
|
604
661
|
if (!eventType) {
|
|
605
|
-
console.error(`[Pixi'VN] CanvasElement ${
|
|
662
|
+
console.error(`[Pixi'VN] CanvasElement ${canvasId} not found`);
|
|
606
663
|
return;
|
|
607
664
|
}
|
|
608
665
|
let canvasElement = new eventType();
|
|
609
666
|
return canvasElement;
|
|
610
667
|
} catch (e) {
|
|
611
|
-
console.error(`[Pixi'VN] Error while getting CanvasElement ${
|
|
668
|
+
console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasId}`, e);
|
|
612
669
|
return;
|
|
613
670
|
}
|
|
614
671
|
}
|
|
@@ -636,19 +693,20 @@ function tickerDecorator(name) {
|
|
|
636
693
|
if (registeredTickers[name]) {
|
|
637
694
|
console.info(`[Pixi'VN] Ticker ${name} already exists, it will be overwritten`);
|
|
638
695
|
}
|
|
696
|
+
target.prototype.id = name;
|
|
639
697
|
registeredTickers[name] = target;
|
|
640
698
|
};
|
|
641
699
|
}
|
|
642
|
-
function
|
|
700
|
+
function geTickerInstanceById(tickerId, args, duration, priority) {
|
|
643
701
|
try {
|
|
644
|
-
let ticker = registeredTickers[
|
|
702
|
+
let ticker = registeredTickers[tickerId];
|
|
645
703
|
if (!ticker) {
|
|
646
|
-
console.error(`[Pixi'VN] Ticker ${
|
|
704
|
+
console.error(`[Pixi'VN] Ticker ${tickerId} not found`);
|
|
647
705
|
return;
|
|
648
706
|
}
|
|
649
707
|
return new ticker(args, duration, priority);
|
|
650
708
|
} catch (e) {
|
|
651
|
-
console.error(`[Pixi'VN] Error while getting Ticker ${
|
|
709
|
+
console.error(`[Pixi'VN] Error while getting Ticker ${tickerId}`, e);
|
|
652
710
|
return;
|
|
653
711
|
}
|
|
654
712
|
}
|
|
@@ -711,21 +769,21 @@ var ChoiceMenuOptionClose = class {
|
|
|
711
769
|
// src/functions/DialogueUtility.ts
|
|
712
770
|
function setDialogue(props) {
|
|
713
771
|
let text = "";
|
|
714
|
-
let
|
|
772
|
+
let character = void 0;
|
|
715
773
|
let dialogue;
|
|
716
774
|
if (typeof props === "string") {
|
|
717
775
|
text = props;
|
|
718
|
-
dialogue = new DialogueBaseModel(text,
|
|
776
|
+
dialogue = new DialogueBaseModel(text, character);
|
|
719
777
|
} else if (!(props instanceof DialogueBaseModel)) {
|
|
720
778
|
text = props.text;
|
|
721
779
|
if (props.character) {
|
|
722
780
|
if (typeof props.character === "string") {
|
|
723
|
-
|
|
781
|
+
character = props.character;
|
|
724
782
|
} else {
|
|
725
|
-
|
|
783
|
+
character = props.character.id;
|
|
726
784
|
}
|
|
727
785
|
}
|
|
728
|
-
dialogue = new DialogueBaseModel(text,
|
|
786
|
+
dialogue = new DialogueBaseModel(text, character);
|
|
729
787
|
} else {
|
|
730
788
|
dialogue = props;
|
|
731
789
|
}
|
|
@@ -751,6 +809,34 @@ function setChoiceMenuOptions(options) {
|
|
|
751
809
|
GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY, value);
|
|
752
810
|
GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex);
|
|
753
811
|
}
|
|
812
|
+
function getChoiceMenuOptions() {
|
|
813
|
+
let d = GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY);
|
|
814
|
+
if (d) {
|
|
815
|
+
let options = [];
|
|
816
|
+
d.forEach((option, index) => {
|
|
817
|
+
if (option.type === Close) {
|
|
818
|
+
let itemLabel = newCloseLabel(index);
|
|
819
|
+
options.push({
|
|
820
|
+
text: option.text,
|
|
821
|
+
label: itemLabel,
|
|
822
|
+
type: Close,
|
|
823
|
+
closeCurrentLabel: option.closeCurrentLabel,
|
|
824
|
+
props: {}
|
|
825
|
+
});
|
|
826
|
+
return;
|
|
827
|
+
}
|
|
828
|
+
let label = getLabelById(option.label);
|
|
829
|
+
if (label) {
|
|
830
|
+
let itemLabel = new Label(label.id, label.steps, label.onStepRun, index);
|
|
831
|
+
options.push(__spreadProps(__spreadValues({}, option), {
|
|
832
|
+
label: itemLabel
|
|
833
|
+
}));
|
|
834
|
+
}
|
|
835
|
+
});
|
|
836
|
+
return options;
|
|
837
|
+
}
|
|
838
|
+
return void 0;
|
|
839
|
+
}
|
|
754
840
|
|
|
755
841
|
// src/classes/ticker/TickerBase.ts
|
|
756
842
|
var TickerBase = class {
|
|
@@ -760,9 +846,14 @@ var TickerBase = class {
|
|
|
760
846
|
* @param priority The priority of the ticker. @default UPDATE_PRIORITY.NORMAL
|
|
761
847
|
*/
|
|
762
848
|
constructor(args, duration, priority) {
|
|
849
|
+
/**
|
|
850
|
+
* Get the id of the ticker. This variable is used in the system to get the ticker by id, {@link geTickerInstanceById}
|
|
851
|
+
*/
|
|
852
|
+
this.id = "ticker_id_not_set";
|
|
763
853
|
this.args = args;
|
|
764
854
|
this.duration = duration;
|
|
765
855
|
this.priority = priority;
|
|
856
|
+
this.id = this.constructor.prototype.id;
|
|
766
857
|
}
|
|
767
858
|
/**
|
|
768
859
|
* The method that will be called every frame.
|
|
@@ -985,8 +1076,8 @@ var ZoomTicker = class extends TickerBase {
|
|
|
985
1076
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
986
1077
|
}
|
|
987
1078
|
let type = args.type || "zoom";
|
|
988
|
-
let xLimit = Infinity;
|
|
989
|
-
let yLimit = Infinity;
|
|
1079
|
+
let xLimit = type === "zoom" ? Infinity : 0;
|
|
1080
|
+
let yLimit = type === "zoom" ? Infinity : 0;
|
|
990
1081
|
if (args.limit) {
|
|
991
1082
|
if (typeof args.limit === "number") {
|
|
992
1083
|
xLimit = args.limit;
|
|
@@ -1025,7 +1116,7 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1025
1116
|
if (element.scale.x >= xLimit && element.scale.y >= yLimit) {
|
|
1026
1117
|
element.scale.x = xLimit;
|
|
1027
1118
|
element.scale.y = yLimit;
|
|
1028
|
-
|
|
1119
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1029
1120
|
}
|
|
1030
1121
|
} else if (type === "unzoom") {
|
|
1031
1122
|
if (element.scale.x < xLimit) {
|
|
@@ -1037,21 +1128,36 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1037
1128
|
if (element.scale.x <= xLimit && element.scale.y <= yLimit) {
|
|
1038
1129
|
element.scale.x = xLimit;
|
|
1039
1130
|
element.scale.y = yLimit;
|
|
1040
|
-
|
|
1131
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1041
1132
|
}
|
|
1042
1133
|
}
|
|
1043
1134
|
if (xSpeed < 1e-5 && ySpeed < 1e-5 && !(args.speedProgression && args.speedProgression.type == "linear" && args.speedProgression.amt != 0)) {
|
|
1044
|
-
|
|
1135
|
+
this.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1045
1136
|
}
|
|
1046
1137
|
}
|
|
1047
1138
|
});
|
|
1048
1139
|
if (args.speedProgression)
|
|
1049
1140
|
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1050
1141
|
}
|
|
1142
|
+
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
1143
|
+
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
1144
|
+
}
|
|
1051
1145
|
};
|
|
1052
1146
|
ZoomTicker = __decorateClass([
|
|
1053
1147
|
tickerDecorator()
|
|
1054
1148
|
], ZoomTicker);
|
|
1149
|
+
var ZoomInOutTicker = class extends ZoomTicker {
|
|
1150
|
+
constructor(props, duration, priority) {
|
|
1151
|
+
super(props, duration, priority);
|
|
1152
|
+
}
|
|
1153
|
+
onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2) {
|
|
1154
|
+
if (element.children.length > 0) {
|
|
1155
|
+
let elementChild = element.children[0];
|
|
1156
|
+
GameWindowManager.addCanvasElement(tag, elementChild);
|
|
1157
|
+
}
|
|
1158
|
+
super.onEndOfTicker(tag, tickerId, element, tagToRemoveAfter2);
|
|
1159
|
+
}
|
|
1160
|
+
};
|
|
1055
1161
|
|
|
1056
1162
|
// src/constants.ts
|
|
1057
1163
|
var Repeat = "repeat";
|
|
@@ -1166,6 +1272,147 @@ function showWithFadeTransition(_0, _1) {
|
|
|
1166
1272
|
function removeWithFadeTransition(tag, props = {}, priority) {
|
|
1167
1273
|
return removeWithDissolveTransition(tag, props, priority);
|
|
1168
1274
|
}
|
|
1275
|
+
function moveIn(_0, _1) {
|
|
1276
|
+
return __async(this, arguments, function* (tag, image, props = { direction: "right" }, priority) {
|
|
1277
|
+
var _a;
|
|
1278
|
+
let canvasElement;
|
|
1279
|
+
if (typeof image === "string") {
|
|
1280
|
+
canvasElement = addImage(tag, image);
|
|
1281
|
+
} else {
|
|
1282
|
+
canvasElement = image;
|
|
1283
|
+
GameWindowManager.addCanvasElement(tag, canvasElement);
|
|
1284
|
+
}
|
|
1285
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1286
|
+
yield canvasElement.load();
|
|
1287
|
+
}
|
|
1288
|
+
let destination = { x: canvasElement.x, y: canvasElement.y };
|
|
1289
|
+
if (props.direction == "up") {
|
|
1290
|
+
canvasElement.y = GameWindowManager.canvasHeight + canvasElement.height;
|
|
1291
|
+
} else if (props.direction == "down") {
|
|
1292
|
+
canvasElement.y = -canvasElement.height;
|
|
1293
|
+
} else if (props.direction == "left") {
|
|
1294
|
+
canvasElement.x = GameWindowManager.canvasWidth + canvasElement.width;
|
|
1295
|
+
} else if (props.direction == "right") {
|
|
1296
|
+
canvasElement.x = -canvasElement.width;
|
|
1297
|
+
}
|
|
1298
|
+
let effect = new MoveTicker(__spreadProps(__spreadValues({}, props), {
|
|
1299
|
+
destination,
|
|
1300
|
+
startOnlyIfHaveTexture: true
|
|
1301
|
+
}), priority);
|
|
1302
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
function moveOut(tag, props = { direction: "right" }, priority) {
|
|
1306
|
+
let canvasElement = GameWindowManager.getCanvasElement(tag);
|
|
1307
|
+
if (!canvasElement) {
|
|
1308
|
+
console.warn("[Pixi'VN] The canvas element is not found.");
|
|
1309
|
+
return;
|
|
1310
|
+
}
|
|
1311
|
+
let destination = { x: canvasElement.x, y: canvasElement.y };
|
|
1312
|
+
if (props.direction == "up") {
|
|
1313
|
+
destination.y = -canvasElement.height;
|
|
1314
|
+
} else if (props.direction == "down") {
|
|
1315
|
+
destination.y = GameWindowManager.canvasHeight + canvasElement.height;
|
|
1316
|
+
} else if (props.direction == "left") {
|
|
1317
|
+
destination.x = -canvasElement.width;
|
|
1318
|
+
} else if (props.direction == "right") {
|
|
1319
|
+
destination.x = GameWindowManager.canvasWidth + canvasElement.width;
|
|
1320
|
+
}
|
|
1321
|
+
let effect = new MoveTicker(__spreadProps(__spreadValues({}, props), {
|
|
1322
|
+
destination,
|
|
1323
|
+
startOnlyIfHaveTexture: true,
|
|
1324
|
+
tagToRemoveAfter: tag
|
|
1325
|
+
}), priority);
|
|
1326
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1327
|
+
}
|
|
1328
|
+
function zoomIn(_0, _1) {
|
|
1329
|
+
return __async(this, arguments, function* (tag, image, props = { direction: "right" }, priority) {
|
|
1330
|
+
var _a;
|
|
1331
|
+
let canvasElement;
|
|
1332
|
+
if (typeof image === "string") {
|
|
1333
|
+
canvasElement = new CanvasImage({}, image);
|
|
1334
|
+
} else {
|
|
1335
|
+
canvasElement = image;
|
|
1336
|
+
}
|
|
1337
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1338
|
+
yield canvasElement.load();
|
|
1339
|
+
}
|
|
1340
|
+
let container = new CanvasContainer();
|
|
1341
|
+
container.addChild(canvasElement);
|
|
1342
|
+
container.height = GameWindowManager.canvasHeight;
|
|
1343
|
+
container.width = GameWindowManager.canvasWidth;
|
|
1344
|
+
GameWindowManager.addCanvasElement(tag, container);
|
|
1345
|
+
if (props.direction == "up") {
|
|
1346
|
+
container.pivot.y = GameWindowManager.canvasHeight;
|
|
1347
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1348
|
+
container.y = GameWindowManager.canvasHeight;
|
|
1349
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1350
|
+
} else if (props.direction == "down") {
|
|
1351
|
+
container.pivot.y = 0;
|
|
1352
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1353
|
+
container.y = 0;
|
|
1354
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1355
|
+
} else if (props.direction == "left") {
|
|
1356
|
+
container.pivot.x = GameWindowManager.canvasWidth;
|
|
1357
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1358
|
+
container.x = GameWindowManager.canvasWidth;
|
|
1359
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1360
|
+
} else if (props.direction == "right") {
|
|
1361
|
+
container.pivot.x = 0;
|
|
1362
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1363
|
+
container.x = 0;
|
|
1364
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1365
|
+
}
|
|
1366
|
+
container.scale.set(0);
|
|
1367
|
+
let effect = new ZoomInOutTicker(__spreadProps(__spreadValues({}, props), {
|
|
1368
|
+
startOnlyIfHaveTexture: true,
|
|
1369
|
+
type: "zoom",
|
|
1370
|
+
limit: 1
|
|
1371
|
+
}), priority);
|
|
1372
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
function zoomOut(tag, props = { direction: "right" }, priority) {
|
|
1376
|
+
let canvasElement = GameWindowManager.getCanvasElement(tag);
|
|
1377
|
+
if (!canvasElement) {
|
|
1378
|
+
console.warn("[Pixi'VN] The canvas element is not found.");
|
|
1379
|
+
return;
|
|
1380
|
+
}
|
|
1381
|
+
let container = new CanvasContainer();
|
|
1382
|
+
container.addChild(canvasElement);
|
|
1383
|
+
container.height = GameWindowManager.canvasHeight;
|
|
1384
|
+
container.width = GameWindowManager.canvasWidth;
|
|
1385
|
+
GameWindowManager.addCanvasElement(tag, container);
|
|
1386
|
+
if (props.direction == "up") {
|
|
1387
|
+
container.pivot.y = GameWindowManager.canvasHeight;
|
|
1388
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1389
|
+
container.y = GameWindowManager.canvasHeight;
|
|
1390
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1391
|
+
} else if (props.direction == "down") {
|
|
1392
|
+
container.pivot.y = 0;
|
|
1393
|
+
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
1394
|
+
container.y = 0;
|
|
1395
|
+
container.x = GameWindowManager.canvasWidth / 2;
|
|
1396
|
+
} else if (props.direction == "left") {
|
|
1397
|
+
container.pivot.x = GameWindowManager.canvasWidth;
|
|
1398
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1399
|
+
container.x = GameWindowManager.canvasWidth;
|
|
1400
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1401
|
+
} else if (props.direction == "right") {
|
|
1402
|
+
container.pivot.x = 0;
|
|
1403
|
+
container.pivot.y = GameWindowManager.canvasHeight / 2;
|
|
1404
|
+
container.x = 0;
|
|
1405
|
+
container.y = GameWindowManager.canvasHeight / 2;
|
|
1406
|
+
}
|
|
1407
|
+
container.scale.set(1);
|
|
1408
|
+
let effect = new ZoomInOutTicker(__spreadProps(__spreadValues({}, props), {
|
|
1409
|
+
startOnlyIfHaveTexture: true,
|
|
1410
|
+
type: "unzoom",
|
|
1411
|
+
limit: 0,
|
|
1412
|
+
tagToRemoveAfter: tag
|
|
1413
|
+
}), priority);
|
|
1414
|
+
GameWindowManager.addTicker(tag, effect);
|
|
1415
|
+
}
|
|
1169
1416
|
|
|
1170
1417
|
// src/functions/ExportUtility.ts
|
|
1171
1418
|
function createExportableElement(element) {
|
|
@@ -1628,18 +1875,18 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1628
1875
|
* ```
|
|
1629
1876
|
*/
|
|
1630
1877
|
static addTicker(canvasElementTag, ticker) {
|
|
1631
|
-
let
|
|
1878
|
+
let tickerId = ticker.id;
|
|
1632
1879
|
if (typeof canvasElementTag === "string") {
|
|
1633
1880
|
canvasElementTag = [canvasElementTag];
|
|
1634
1881
|
}
|
|
1635
|
-
if (!
|
|
1636
|
-
console.error(`[Pixi'VN] Ticker ${
|
|
1882
|
+
if (!geTickerInstanceById(tickerId, ticker.args, ticker.duration, ticker.priority)) {
|
|
1883
|
+
console.error(`[Pixi'VN] Ticker ${tickerId} not found`);
|
|
1637
1884
|
return;
|
|
1638
1885
|
}
|
|
1639
1886
|
let tickerHistory = {
|
|
1640
1887
|
fn: () => {
|
|
1641
1888
|
},
|
|
1642
|
-
|
|
1889
|
+
id: tickerId,
|
|
1643
1890
|
args: createExportableElement(ticker.args),
|
|
1644
1891
|
canvasElementTags: canvasElementTag,
|
|
1645
1892
|
priority: ticker.priority,
|
|
@@ -1655,11 +1902,11 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1655
1902
|
_GameWindowManager.removeTicker(id);
|
|
1656
1903
|
}
|
|
1657
1904
|
}, ticker.duration * 1e3);
|
|
1658
|
-
_GameWindowManager.addTickerTimeoutInfo(canvasElementTag,
|
|
1905
|
+
_GameWindowManager.addTickerTimeoutInfo(canvasElementTag, tickerId, timeout.toString(), true);
|
|
1659
1906
|
}
|
|
1660
1907
|
}
|
|
1661
1908
|
static pushTicker(id, tickerData, ticker) {
|
|
1662
|
-
_GameWindowManager.removeAssociationBetweenTickerCanvasElement(tickerData.canvasElementTags,
|
|
1909
|
+
_GameWindowManager.removeAssociationBetweenTickerCanvasElement(tickerData.canvasElementTags, ticker);
|
|
1663
1910
|
_GameWindowManager._currentTickers[id] = tickerData;
|
|
1664
1911
|
tickerData.fn = (t) => {
|
|
1665
1912
|
let data = _GameWindowManager._currentTickers[id];
|
|
@@ -1700,9 +1947,9 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1700
1947
|
if (step.hasOwnProperty("type") && step.type === "pause") {
|
|
1701
1948
|
return step;
|
|
1702
1949
|
}
|
|
1703
|
-
let
|
|
1950
|
+
let tickerId = step.id;
|
|
1704
1951
|
return {
|
|
1705
|
-
ticker:
|
|
1952
|
+
ticker: tickerId,
|
|
1706
1953
|
args: createExportableElement(step.args),
|
|
1707
1954
|
duration: step.duration
|
|
1708
1955
|
};
|
|
@@ -1740,16 +1987,16 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1740
1987
|
_GameWindowManager.addTickerTimeoutInfo(tag, "steps", timeout.toString(), false);
|
|
1741
1988
|
return;
|
|
1742
1989
|
}
|
|
1743
|
-
let ticker =
|
|
1990
|
+
let ticker = geTickerInstanceById(step.ticker, step.args, step.duration, step.priority);
|
|
1744
1991
|
if (!ticker) {
|
|
1745
1992
|
console.error(`[Pixi'VN] Ticker ${step.ticker} not found`);
|
|
1746
1993
|
return;
|
|
1747
1994
|
}
|
|
1748
|
-
let tickerName = ticker.
|
|
1995
|
+
let tickerName = ticker.id;
|
|
1749
1996
|
let tickerHistory = {
|
|
1750
1997
|
fn: () => {
|
|
1751
1998
|
},
|
|
1752
|
-
|
|
1999
|
+
id: tickerName,
|
|
1753
2000
|
args: createExportableElement(ticker.args),
|
|
1754
2001
|
canvasElementTags: [tag],
|
|
1755
2002
|
priority: ticker.priority,
|
|
@@ -1806,26 +2053,26 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1806
2053
|
* ```
|
|
1807
2054
|
*/
|
|
1808
2055
|
static removeAssociationBetweenTickerCanvasElement(tags, ticker) {
|
|
1809
|
-
let
|
|
2056
|
+
let tickerId;
|
|
1810
2057
|
if (typeof ticker === "string") {
|
|
1811
|
-
|
|
2058
|
+
tickerId = ticker;
|
|
1812
2059
|
} else if (ticker instanceof TickerBase) {
|
|
1813
|
-
|
|
2060
|
+
tickerId = ticker.id;
|
|
1814
2061
|
} else {
|
|
1815
|
-
|
|
2062
|
+
tickerId = ticker.prototype.id;
|
|
1816
2063
|
}
|
|
1817
2064
|
if (typeof tags === "string") {
|
|
1818
2065
|
tags = [tags];
|
|
1819
2066
|
}
|
|
1820
2067
|
for (let id in _GameWindowManager._currentTickers) {
|
|
1821
2068
|
let ticker2 = _GameWindowManager._currentTickers[id];
|
|
1822
|
-
if (ticker2.
|
|
2069
|
+
if (ticker2.id === tickerId) {
|
|
1823
2070
|
_GameWindowManager._currentTickers[id].canvasElementTags = ticker2.canvasElementTags.filter((e) => !tags.includes(e));
|
|
1824
2071
|
}
|
|
1825
2072
|
}
|
|
1826
2073
|
for (let timeout in _GameWindowManager._currentTickersTimeouts) {
|
|
1827
2074
|
let TickerTimeout = _GameWindowManager._currentTickersTimeouts[timeout];
|
|
1828
|
-
if (TickerTimeout.ticker ===
|
|
2075
|
+
if (TickerTimeout.ticker === tickerId && TickerTimeout.canBeDeletedBeforeEnd) {
|
|
1829
2076
|
_GameWindowManager._currentTickersTimeouts[timeout].tags = TickerTimeout.tags.filter((t) => !tags.includes(t));
|
|
1830
2077
|
}
|
|
1831
2078
|
}
|
|
@@ -2011,11 +2258,11 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
2011
2258
|
for (let id in currentTickers) {
|
|
2012
2259
|
let t = currentTickers[id];
|
|
2013
2260
|
let tags = t.canvasElementTags;
|
|
2014
|
-
let ticker =
|
|
2261
|
+
let ticker = geTickerInstanceById(t.id, t.args, t.duration, t.priority);
|
|
2015
2262
|
if (ticker) {
|
|
2016
2263
|
_GameWindowManager.addTicker(tags, ticker);
|
|
2017
2264
|
} else {
|
|
2018
|
-
console.error(`[Pixi'VN] Ticker ${t.
|
|
2265
|
+
console.error(`[Pixi'VN] Ticker ${t.id} not found`);
|
|
2019
2266
|
}
|
|
2020
2267
|
}
|
|
2021
2268
|
}
|
|
@@ -2216,6 +2463,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2216
2463
|
_GameStepManager._openedLabels = _GameStepManager.originalStepData.openedLabels;
|
|
2217
2464
|
}
|
|
2218
2465
|
/* Run Methods */
|
|
2466
|
+
static get canGoNext() {
|
|
2467
|
+
let options = getChoiceMenuOptions();
|
|
2468
|
+
if (options && options.length > 0) {
|
|
2469
|
+
return false;
|
|
2470
|
+
}
|
|
2471
|
+
return true;
|
|
2472
|
+
}
|
|
2219
2473
|
/**
|
|
2220
2474
|
* Execute the next step and add it to the history.
|
|
2221
2475
|
* @param props The props to pass to the step.
|
|
@@ -2225,7 +2479,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2225
2479
|
* ```typescript
|
|
2226
2480
|
* function nextOnClick() {
|
|
2227
2481
|
* setLoading(true)
|
|
2228
|
-
* GameStepManager.
|
|
2482
|
+
* GameStepManager.goNext(yourParams)
|
|
2229
2483
|
* .then((result) => {
|
|
2230
2484
|
* setUpdate((p) => p + 1)
|
|
2231
2485
|
* setLoading(false)
|
|
@@ -2240,8 +2494,12 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2240
2494
|
* }
|
|
2241
2495
|
* ```
|
|
2242
2496
|
*/
|
|
2243
|
-
static
|
|
2497
|
+
static goNext(props, choiseMade) {
|
|
2244
2498
|
return __async(this, null, function* () {
|
|
2499
|
+
if (!_GameStepManager.canGoNext) {
|
|
2500
|
+
console.warn("[Pixi'VN] The player must make a choice");
|
|
2501
|
+
return;
|
|
2502
|
+
}
|
|
2245
2503
|
_GameStepManager.increaseCurrentStepIndex();
|
|
2246
2504
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2247
2505
|
});
|
|
@@ -2272,7 +2530,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2272
2530
|
return result;
|
|
2273
2531
|
} else if (_GameStepManager.openedLabels.length > 1) {
|
|
2274
2532
|
_GameStepManager.closeCurrentLabel();
|
|
2275
|
-
return yield _GameStepManager.
|
|
2533
|
+
return yield _GameStepManager.goNext(props, choiseMade);
|
|
2276
2534
|
} else {
|
|
2277
2535
|
_GameStepManager.restorLastLabelList();
|
|
2278
2536
|
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");
|
|
@@ -2420,7 +2678,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2420
2678
|
if (choice.closeCurrentLabel) {
|
|
2421
2679
|
_GameStepManager.closeCurrentLabel();
|
|
2422
2680
|
}
|
|
2423
|
-
return _GameStepManager.
|
|
2681
|
+
return _GameStepManager.goNext(props, choiseMade);
|
|
2424
2682
|
});
|
|
2425
2683
|
}
|
|
2426
2684
|
/* After Update Methods */
|
|
@@ -2748,15 +3006,15 @@ var DialogueBaseModel = class {
|
|
|
2748
3006
|
if (typeof text === "string") {
|
|
2749
3007
|
this.text = text;
|
|
2750
3008
|
if (typeof character === "string") {
|
|
2751
|
-
this.
|
|
3009
|
+
this.character = character;
|
|
2752
3010
|
} else {
|
|
2753
|
-
this.
|
|
3011
|
+
this.character = character == null ? void 0 : character.id;
|
|
2754
3012
|
}
|
|
2755
3013
|
this.oltherParams = oltherParams;
|
|
2756
3014
|
} else {
|
|
2757
3015
|
this.text = text.text;
|
|
2758
|
-
if (text.
|
|
2759
|
-
this.
|
|
3016
|
+
if (text.character) {
|
|
3017
|
+
this.character = text.character;
|
|
2760
3018
|
}
|
|
2761
3019
|
this.oltherParams = text.oltherParams || {};
|
|
2762
3020
|
}
|
|
@@ -2769,7 +3027,7 @@ var DialogueBaseModel = class {
|
|
|
2769
3027
|
export() {
|
|
2770
3028
|
return {
|
|
2771
3029
|
text: this.text,
|
|
2772
|
-
|
|
3030
|
+
character: this.character,
|
|
2773
3031
|
oltherParams: this.oltherParams
|
|
2774
3032
|
};
|
|
2775
3033
|
}
|
|
@@ -2791,81 +3049,214 @@ var helmlokImage = "https://pixijs.com/assets/helmlok.png";
|
|
|
2791
3049
|
var helmlokName = `<span style="color:blue">Helmlok</span>`;
|
|
2792
3050
|
var skullyImage = "https://pixijs.com/assets/skully.png";
|
|
2793
3051
|
var skullyName = `<span style="color:red">Skully</span>`;
|
|
3052
|
+
var bunnyImage = "https://pixijs.com/assets/bunny.png";
|
|
3053
|
+
var bunnyName = `Bunny`;
|
|
2794
3054
|
|
|
2795
|
-
// src/labels/
|
|
2796
|
-
var
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
3055
|
+
// src/labels/CanvasEventsTestLabel.ts
|
|
3056
|
+
var EventTest1 = class extends CanvasEvent {
|
|
3057
|
+
fn(event, sprite) {
|
|
3058
|
+
if (event === "pointerdown") {
|
|
3059
|
+
sprite.scale.x *= 1.25;
|
|
3060
|
+
sprite.scale.y *= 1.25;
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
};
|
|
3064
|
+
EventTest1 = __decorateClass([
|
|
3065
|
+
eventDecorator("___pixi_vn_canvas_events_test_event1___")
|
|
3066
|
+
], EventTest1);
|
|
3067
|
+
var EventTest2 = class extends CanvasEvent {
|
|
3068
|
+
constructor() {
|
|
3069
|
+
super(...arguments);
|
|
3070
|
+
this.textureButtonDown = Texture.from("https://pixijs.com/assets/button_down.png");
|
|
3071
|
+
this.textureButtonOver = Texture.from("https://pixijs.com/assets/button_over.png");
|
|
3072
|
+
this.textureButton = Texture.from("https://pixijs.com/assets/button.png");
|
|
3073
|
+
}
|
|
3074
|
+
fn(event, sprite) {
|
|
3075
|
+
if (event === "pointerdown") {
|
|
3076
|
+
sprite.isdown = true;
|
|
3077
|
+
sprite.texture = this.textureButtonDown;
|
|
3078
|
+
sprite.alpha = 1;
|
|
3079
|
+
} else if (event === "pointerup" || event === "pointerupoutside") {
|
|
3080
|
+
sprite.isdown = false;
|
|
3081
|
+
if (sprite.isOver) {
|
|
3082
|
+
sprite.texture = this.textureButtonOver;
|
|
3083
|
+
} else {
|
|
3084
|
+
sprite.texture = this.textureButton;
|
|
3085
|
+
}
|
|
3086
|
+
} else if (event === "pointerover") {
|
|
3087
|
+
sprite.isOver = true;
|
|
3088
|
+
if (sprite.isdown) {
|
|
3089
|
+
return;
|
|
3090
|
+
}
|
|
3091
|
+
sprite.texture = this.textureButtonOver;
|
|
3092
|
+
} else if (event === "pointerout") {
|
|
3093
|
+
sprite.isOver = false;
|
|
3094
|
+
if (sprite.isdown) {
|
|
3095
|
+
return;
|
|
3096
|
+
}
|
|
3097
|
+
sprite.texture = this.textureButton;
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
};
|
|
3101
|
+
EventTest2 = __decorateClass([
|
|
3102
|
+
eventDecorator("___pixi_vn_canvas_events_test_event2___")
|
|
3103
|
+
], EventTest2);
|
|
3104
|
+
var CANVAS_EVENTS_TEST_LABEL = "___pixi_vn_canvas_events_test___";
|
|
3105
|
+
var canvasEventsTestLabel = newLabel(
|
|
3106
|
+
CANVAS_EVENTS_TEST_LABEL,
|
|
3107
|
+
[
|
|
3108
|
+
() => setDialogue({
|
|
2800
3109
|
character: juliette,
|
|
2801
|
-
text:
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
3110
|
+
text: "This is the test of clickable elements in a canvas."
|
|
3111
|
+
}),
|
|
3112
|
+
() => __async(void 0, null, function* () {
|
|
3113
|
+
setDialogue({
|
|
3114
|
+
character: juliette,
|
|
3115
|
+
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).)`
|
|
3116
|
+
});
|
|
3117
|
+
const texture = yield Assets.load(bunnyImage);
|
|
3118
|
+
const sprite = CanvasSprite.from(texture);
|
|
3119
|
+
sprite.anchor.set(0.5);
|
|
3120
|
+
sprite.x = GameWindowManager.screen.width / 2;
|
|
3121
|
+
sprite.y = GameWindowManager.screen.height / 2;
|
|
3122
|
+
sprite.eventMode = "static";
|
|
3123
|
+
sprite.cursor = "pointer";
|
|
3124
|
+
sprite.onEvent("pointerdown", EventTest1);
|
|
3125
|
+
GameWindowManager.addCanvasElement("bunny", sprite);
|
|
3126
|
+
}),
|
|
3127
|
+
() => __async(void 0, null, function* () {
|
|
3128
|
+
GameWindowManager.clear();
|
|
3129
|
+
setDialogue({
|
|
3130
|
+
character: juliette,
|
|
3131
|
+
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).)`
|
|
3132
|
+
});
|
|
3133
|
+
yield Assets.load([
|
|
3134
|
+
"https://pixijs.com/assets/bg_button.jpg",
|
|
3135
|
+
"https://pixijs.com/assets/button.png",
|
|
3136
|
+
"https://pixijs.com/assets/button_down.png",
|
|
3137
|
+
"https://pixijs.com/assets/button_over.png"
|
|
3138
|
+
]);
|
|
3139
|
+
const background = CanvasSprite.from("https://pixijs.com/assets/bg_button.jpg");
|
|
3140
|
+
background.width = GameWindowManager.screen.width;
|
|
3141
|
+
background.height = GameWindowManager.screen.height;
|
|
3142
|
+
GameWindowManager.addCanvasElement("bg", background);
|
|
3143
|
+
const textureButton = Texture.from("https://pixijs.com/assets/button.png");
|
|
3144
|
+
const buttons = [];
|
|
3145
|
+
const buttonPositions = [175, 75, 655, 75, 410, 325, 150, 465, 685, 445];
|
|
3146
|
+
for (let i = 0; i < 5; i++) {
|
|
3147
|
+
const button = new CanvasSprite(textureButton);
|
|
3148
|
+
button.anchor.set(0.5);
|
|
3149
|
+
button.x = buttonPositions[i * 2];
|
|
3150
|
+
button.y = buttonPositions[i * 2 + 1];
|
|
3151
|
+
button.eventMode = "static";
|
|
3152
|
+
button.cursor = "pointer";
|
|
3153
|
+
button.onEvent("pointerdown", EventTest2).onEvent("pointerup", EventTest2).onEvent("pointerupoutside", EventTest2).onEvent("pointerover", EventTest2).onEvent("pointerout", EventTest2);
|
|
3154
|
+
GameWindowManager.addCanvasElement("button" + i, button);
|
|
3155
|
+
buttons.push(button);
|
|
3156
|
+
}
|
|
3157
|
+
buttons[0].scale.set(1.2);
|
|
3158
|
+
buttons[2].rotation = Math.PI / 10;
|
|
3159
|
+
buttons[3].scale.set(0.8);
|
|
3160
|
+
buttons[4].scale.set(0.8, 1.2);
|
|
3161
|
+
buttons[4].rotation = Math.PI;
|
|
3162
|
+
})
|
|
3163
|
+
]
|
|
3164
|
+
);
|
|
3165
|
+
var AlienTintingTest = class extends CanvasSprite {
|
|
3166
|
+
constructor() {
|
|
3167
|
+
super(...arguments);
|
|
3168
|
+
this.direction = 0;
|
|
3169
|
+
this.turningSpeed = 0;
|
|
3170
|
+
this.speed = 0;
|
|
3171
|
+
}
|
|
3172
|
+
get memory() {
|
|
3173
|
+
return __spreadProps(__spreadValues({}, super.memory), {
|
|
3174
|
+
direction: this.direction,
|
|
3175
|
+
turningSpeed: this.turningSpeed,
|
|
3176
|
+
speed: this.speed
|
|
2864
3177
|
});
|
|
2865
|
-
}
|
|
2866
|
-
|
|
3178
|
+
}
|
|
3179
|
+
set memory(memory) {
|
|
3180
|
+
super.memory = memory;
|
|
3181
|
+
this.direction = memory.direction;
|
|
3182
|
+
this.turningSpeed = memory.turningSpeed;
|
|
3183
|
+
this.speed = memory.speed;
|
|
3184
|
+
}
|
|
3185
|
+
static from(source, skipCache) {
|
|
3186
|
+
let sprite = Sprite.from(source, skipCache);
|
|
3187
|
+
let mySprite = new AlienTintingTest();
|
|
3188
|
+
mySprite.texture = sprite.texture;
|
|
3189
|
+
return mySprite;
|
|
3190
|
+
}
|
|
3191
|
+
};
|
|
3192
|
+
AlienTintingTest = __decorateClass([
|
|
3193
|
+
canvasElementDecorator("___pixi_vn_custom_canvas_element___")
|
|
3194
|
+
], AlienTintingTest);
|
|
3195
|
+
var TintingTestTicker = class extends TickerBase {
|
|
3196
|
+
constructor() {
|
|
3197
|
+
super({});
|
|
3198
|
+
}
|
|
3199
|
+
fn(_t, _args, tags) {
|
|
3200
|
+
tags.forEach((tag) => {
|
|
3201
|
+
const dudeBoundsPadding = 100;
|
|
3202
|
+
const dudeBounds = new Rectangle(
|
|
3203
|
+
-dudeBoundsPadding,
|
|
3204
|
+
-dudeBoundsPadding,
|
|
3205
|
+
GameWindowManager.screen.width + dudeBoundsPadding * 2,
|
|
3206
|
+
GameWindowManager.screen.height + dudeBoundsPadding * 2
|
|
3207
|
+
);
|
|
3208
|
+
let dude = GameWindowManager.getCanvasElement(tag);
|
|
3209
|
+
if (dude && dude instanceof AlienTintingTest) {
|
|
3210
|
+
dude.direction += dude.turningSpeed * 0.01;
|
|
3211
|
+
dude.x += Math.sin(dude.direction) * dude.speed;
|
|
3212
|
+
dude.y += Math.cos(dude.direction) * dude.speed;
|
|
3213
|
+
dude.rotation = -dude.direction - Math.PI / 2;
|
|
3214
|
+
if (dude.x < dudeBounds.x) {
|
|
3215
|
+
dude.x += dudeBounds.width;
|
|
3216
|
+
} else if (dude.x > dudeBounds.x + dudeBounds.width) {
|
|
3217
|
+
dude.x -= dudeBounds.width;
|
|
3218
|
+
}
|
|
3219
|
+
if (dude.y < dudeBounds.y) {
|
|
3220
|
+
dude.y += dudeBounds.height;
|
|
3221
|
+
} else if (dude.y > dudeBounds.y + dudeBounds.height) {
|
|
3222
|
+
dude.y -= dudeBounds.height;
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
});
|
|
3226
|
+
}
|
|
3227
|
+
};
|
|
3228
|
+
TintingTestTicker = __decorateClass([
|
|
3229
|
+
tickerDecorator("___pixi_vn_custom_ticker___")
|
|
3230
|
+
], TintingTestTicker);
|
|
3231
|
+
var CUSTOM_TICKER_CANVAS_ELEMENT_TEST_LABEL = "___pixi_vn_custom_ticker_canvas_element_test___";
|
|
3232
|
+
var customTickerCanvasElementTestLabel = newLabel(
|
|
3233
|
+
CUSTOM_TICKER_CANVAS_ELEMENT_TEST_LABEL,
|
|
3234
|
+
[
|
|
3235
|
+
() => __async(void 0, null, function* () {
|
|
3236
|
+
const totalDudes = 100;
|
|
3237
|
+
for (let i = 0; i < totalDudes; i++) {
|
|
3238
|
+
const texture = yield Assets.load(eggHeadImage);
|
|
3239
|
+
const dude = AlienTintingTest.from(texture);
|
|
3240
|
+
dude.anchor.set(0.5);
|
|
3241
|
+
dude.scale.set(0.8 + Math.random() * 0.3);
|
|
3242
|
+
dude.x = Math.random() * GameWindowManager.screen.width;
|
|
3243
|
+
dude.y = Math.random() * GameWindowManager.screen.height;
|
|
3244
|
+
dude.tint = Math.random() * 16777215;
|
|
3245
|
+
dude.direction = Math.random() * Math.PI * 2;
|
|
3246
|
+
dude.turningSpeed = Math.random() - 0.8;
|
|
3247
|
+
dude.speed = 2 + Math.random() * 2;
|
|
3248
|
+
GameWindowManager.addCanvasElement("alien" + i, dude);
|
|
3249
|
+
GameWindowManager.addTicker("alien" + i, new TintingTestTicker());
|
|
3250
|
+
}
|
|
3251
|
+
setDialogue({
|
|
3252
|
+
character: juliette,
|
|
3253
|
+
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).)`
|
|
3254
|
+
});
|
|
3255
|
+
})
|
|
3256
|
+
]
|
|
3257
|
+
);
|
|
2867
3258
|
|
|
2868
|
-
// src/labels/
|
|
3259
|
+
// src/labels/ImagesAnimationsTestLabel.ts
|
|
2869
3260
|
var IMAGE_ANIMAIONS_TEST_LABEL = "___pixi_vn_images_animations_test___";
|
|
2870
3261
|
var imagesAnimationsTest = newLabel(IMAGE_ANIMAIONS_TEST_LABEL, [
|
|
2871
3262
|
() => __async(void 0, null, function* () {
|
|
@@ -2894,6 +3285,8 @@ var imagesAnimationsTest = newLabel(IMAGE_ANIMAIONS_TEST_LABEL, [
|
|
|
2894
3285
|
new ChoiceMenuOption("Rotate", imagesRotateTest),
|
|
2895
3286
|
new ChoiceMenuOption("Move", imagesMoveTest),
|
|
2896
3287
|
new ChoiceMenuOption("Zoom", imagesZoomTest),
|
|
3288
|
+
new ChoiceMenuOption("Move in/out", imagesMoveInOutTest),
|
|
3289
|
+
new ChoiceMenuOption("Zoom in/out", imagesZoomInOutTest),
|
|
2897
3290
|
new ChoiceMenuOptionClose("Cancel", true)
|
|
2898
3291
|
]);
|
|
2899
3292
|
}),
|
|
@@ -3148,6 +3541,148 @@ var imagesZoomTest = newLabel("___pixi_vn_images_zoom_test___", [
|
|
|
3148
3541
|
]);
|
|
3149
3542
|
}
|
|
3150
3543
|
]);
|
|
3544
|
+
var imagesMoveInOutTest = newLabel("___pixi_vn_images_move_in_out_test___", [
|
|
3545
|
+
() => __async(void 0, null, function* () {
|
|
3546
|
+
setDialogue({
|
|
3547
|
+
character: juliette,
|
|
3548
|
+
text: `Here's what's going to happen:
|
|
3549
|
+
- ${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.
|
|
3550
|
+
- ${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.
|
|
3551
|
+
- ${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.
|
|
3552
|
+
- ${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.`
|
|
3553
|
+
});
|
|
3554
|
+
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3555
|
+
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
3556
|
+
let helmlok = new CanvasImage({ x: 100, y: 300 }, helmlokImage);
|
|
3557
|
+
let skully = new CanvasImage({ x: 300, y: 300 }, skullyImage);
|
|
3558
|
+
moveIn("eggHead", eggHead, { speed: 800, direction: "down" });
|
|
3559
|
+
moveIn("flowerTop", flowerTop, {
|
|
3560
|
+
speed: 800,
|
|
3561
|
+
direction: "left",
|
|
3562
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3563
|
+
});
|
|
3564
|
+
moveIn("helmlok", helmlok, { speed: 800, direction: "right" });
|
|
3565
|
+
moveIn("skully", skully, {
|
|
3566
|
+
speed: 800,
|
|
3567
|
+
direction: "up",
|
|
3568
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3569
|
+
});
|
|
3570
|
+
}),
|
|
3571
|
+
() => {
|
|
3572
|
+
moveOut("eggHead", { speed: 800, direction: "down" });
|
|
3573
|
+
moveOut("flowerTop", { speed: 800, direction: "left" });
|
|
3574
|
+
moveOut("helmlok", { speed: 800, direction: "right" });
|
|
3575
|
+
moveOut("skully", { speed: 800, direction: "up" });
|
|
3576
|
+
}
|
|
3577
|
+
]);
|
|
3578
|
+
var imagesZoomInOutTest = newLabel("___pixi_vn_images_zoom_in_out_test___", [
|
|
3579
|
+
() => __async(void 0, null, function* () {
|
|
3580
|
+
GameWindowManager.removeCanvasElements();
|
|
3581
|
+
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3582
|
+
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
3583
|
+
let helmlok = new CanvasImage({ x: 100, y: 300 }, helmlokImage);
|
|
3584
|
+
let skully = new CanvasImage({ x: 300, y: 300 }, skullyImage);
|
|
3585
|
+
zoomIn("eggHead", eggHead, { speed: 3, direction: "down" });
|
|
3586
|
+
zoomIn("flowerTop", flowerTop, {
|
|
3587
|
+
speed: 3,
|
|
3588
|
+
direction: "left",
|
|
3589
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3590
|
+
});
|
|
3591
|
+
zoomIn("helmlok", helmlok, { speed: 3, direction: "right" });
|
|
3592
|
+
zoomIn("skully", skully, {
|
|
3593
|
+
speed: 3,
|
|
3594
|
+
direction: "up",
|
|
3595
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3596
|
+
});
|
|
3597
|
+
}),
|
|
3598
|
+
() => __async(void 0, null, function* () {
|
|
3599
|
+
zoomOut("eggHead", {
|
|
3600
|
+
speed: 3,
|
|
3601
|
+
direction: "down",
|
|
3602
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3603
|
+
});
|
|
3604
|
+
zoomOut("flowerTop", { speed: 3, direction: "left" });
|
|
3605
|
+
zoomOut("helmlok", { speed: 3, direction: "right" });
|
|
3606
|
+
zoomOut("skully", {
|
|
3607
|
+
speed: 3,
|
|
3608
|
+
direction: "up",
|
|
3609
|
+
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3610
|
+
});
|
|
3611
|
+
})
|
|
3612
|
+
]);
|
|
3613
|
+
|
|
3614
|
+
// src/labels/MarkdownTest.ts
|
|
3615
|
+
var MARKDOWN_TEST_LABEL = "___pixi_vn_markdown_test___";
|
|
3616
|
+
var markdownTest = newLabel(MARKDOWN_TEST_LABEL, [
|
|
3617
|
+
() => __async(void 0, null, function* () {
|
|
3618
|
+
setDialogue({
|
|
3619
|
+
character: juliette,
|
|
3620
|
+
text: `
|
|
3621
|
+
# Markdown Test
|
|
3622
|
+
|
|
3623
|
+
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.
|
|
3624
|
+
|
|
3625
|
+
For example in React, you can use the library [react-markdown](https://www.npmjs.com/package/react-markdown).
|
|
3626
|
+
|
|
3627
|
+
## Colored Text
|
|
3628
|
+
|
|
3629
|
+
<span style="color:blue">some *blue* text</span>.
|
|
3630
|
+
|
|
3631
|
+
<span style="color:red">some *red* text</span>.
|
|
3632
|
+
|
|
3633
|
+
<span style="color:green">some *green* text</span>.
|
|
3634
|
+
|
|
3635
|
+
## Bold Text
|
|
3636
|
+
|
|
3637
|
+
**This is bold text.**
|
|
3638
|
+
|
|
3639
|
+
## Italic Text
|
|
3640
|
+
|
|
3641
|
+
*This is italic text.*
|
|
3642
|
+
|
|
3643
|
+
## Delete Text
|
|
3644
|
+
|
|
3645
|
+
~~This is deleted text.~~
|
|
3646
|
+
|
|
3647
|
+
## Link Test
|
|
3648
|
+
|
|
3649
|
+
[Link to Google](https://www.google.com)
|
|
3650
|
+
|
|
3651
|
+
## H2 Test
|
|
3652
|
+
|
|
3653
|
+
### H3 Test
|
|
3654
|
+
|
|
3655
|
+
#### H4 Test
|
|
3656
|
+
|
|
3657
|
+
## Code Test
|
|
3658
|
+
|
|
3659
|
+
\`Hello World\`
|
|
3660
|
+
|
|
3661
|
+
\`\`\`js
|
|
3662
|
+
console.log("Hello World")
|
|
3663
|
+
\`\`\`
|
|
3664
|
+
|
|
3665
|
+
## List Test
|
|
3666
|
+
|
|
3667
|
+
- Item 1
|
|
3668
|
+
* Item 2
|
|
3669
|
+
- [x] Item 3
|
|
3670
|
+
|
|
3671
|
+
## Table Test
|
|
3672
|
+
|
|
3673
|
+
| Header 1 | Header 2 |
|
|
3674
|
+
| -------- | -------- |
|
|
3675
|
+
| Cell 1 | Cell 2 |
|
|
3676
|
+
|
|
3677
|
+
## Separator Test
|
|
3678
|
+
|
|
3679
|
+
***
|
|
3680
|
+
Footer
|
|
3681
|
+
|
|
3682
|
+
`
|
|
3683
|
+
});
|
|
3684
|
+
})
|
|
3685
|
+
]);
|
|
3151
3686
|
|
|
3152
3687
|
// src/labels/StartLabel.ts
|
|
3153
3688
|
var pixivnTestStartLabel = newLabel(
|
|
@@ -3179,7 +3714,9 @@ var pixivnTestStartLabel2 = newLabel(
|
|
|
3179
3714
|
GameWindowManager.clear();
|
|
3180
3715
|
setDialogue({ character: juliette, text: "Which test would you like to start with?" });
|
|
3181
3716
|
setChoiceMenuOptions([
|
|
3182
|
-
new ChoiceMenuOption("Images and Animations", imagesAnimationsTest),
|
|
3717
|
+
new ChoiceMenuOption("Images, Transitions and Animations Test", imagesAnimationsTest),
|
|
3718
|
+
new ChoiceMenuOption("Canvas Events Test Label", canvasEventsTestLabel),
|
|
3719
|
+
new ChoiceMenuOption("Custom Ticker Canvas Element Test", customTickerCanvasElementTestLabel),
|
|
3183
3720
|
new ChoiceMenuOption("Markdown Test", markdownTest)
|
|
3184
3721
|
]);
|
|
3185
3722
|
},
|