@drincs/pixi-vn 0.3.5 → 0.4.0
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/README.md +2 -81
- package/dist/index.d.mts +245 -149
- package/dist/index.d.ts +245 -149
- package/dist/index.js +94 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +91 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -76,6 +76,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
76
76
|
// src/index.ts
|
|
77
77
|
var src_exports = {};
|
|
78
78
|
__export(src_exports, {
|
|
79
|
+
Assets: () => import_pixi11.Assets,
|
|
79
80
|
CanvasBase: () => CanvasBase,
|
|
80
81
|
CanvasContainer: () => CanvasContainer,
|
|
81
82
|
CanvasEvent: () => CanvasEvent,
|
|
@@ -96,6 +97,7 @@ __export(src_exports, {
|
|
|
96
97
|
StoredClassModel: () => StoredClassModel,
|
|
97
98
|
TickerBase: () => TickerBase,
|
|
98
99
|
TickerFadeAlpha: () => TickerFadeAlpha,
|
|
100
|
+
TickerMove: () => TickerMove,
|
|
99
101
|
TickerRotate: () => TickerRotate,
|
|
100
102
|
addImage: () => addImage,
|
|
101
103
|
canvasElementDecorator: () => canvasElementDecorator,
|
|
@@ -113,6 +115,7 @@ __export(src_exports, {
|
|
|
113
115
|
getSaveJson: () => getSaveJson,
|
|
114
116
|
getTexture: () => getTexture,
|
|
115
117
|
labelDecorator: () => labelDecorator,
|
|
118
|
+
loadImages: () => loadImages,
|
|
116
119
|
loadSaveData: () => loadSaveData,
|
|
117
120
|
loadSaveJson: () => loadSaveJson,
|
|
118
121
|
removeCanvasElement: () => removeCanvasElement,
|
|
@@ -120,11 +123,11 @@ __export(src_exports, {
|
|
|
120
123
|
setChoiceMenuOptions: () => setChoiceMenuOptions,
|
|
121
124
|
setDialogue: () => setDialogue,
|
|
122
125
|
setFlag: () => setFlag,
|
|
123
|
-
showCanvasImages: () => showCanvasImages,
|
|
124
126
|
showImageWithDissolveTransition: () => showImageWithDissolveTransition,
|
|
125
127
|
tickerDecorator: () => tickerDecorator
|
|
126
128
|
});
|
|
127
129
|
module.exports = __toCommonJS(src_exports);
|
|
130
|
+
var import_pixi11 = require("pixi.js");
|
|
128
131
|
|
|
129
132
|
// src/classes/CanvasEvent.ts
|
|
130
133
|
var CanvasEvent = class {
|
|
@@ -662,9 +665,12 @@ function setMemorySprite(element, memory) {
|
|
|
662
665
|
|
|
663
666
|
// src/classes/canvas/CanvasImage.ts
|
|
664
667
|
var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
665
|
-
constructor() {
|
|
666
|
-
super(
|
|
668
|
+
constructor(options) {
|
|
669
|
+
super(options);
|
|
667
670
|
this.imageLink = "";
|
|
671
|
+
if (options && typeof options === "object" && "textureImage" in options && options.textureImage) {
|
|
672
|
+
this.imageLink = options.textureImage;
|
|
673
|
+
}
|
|
668
674
|
}
|
|
669
675
|
get memory() {
|
|
670
676
|
return __spreadProps(__spreadValues({}, getMemorySprite(this)), {
|
|
@@ -934,7 +940,7 @@ TickerFadeAlpha = __decorateClass([
|
|
|
934
940
|
tickerDecorator()
|
|
935
941
|
], TickerFadeAlpha);
|
|
936
942
|
|
|
937
|
-
// src/classes/ticker/
|
|
943
|
+
// src/classes/ticker/TickerMove.ts
|
|
938
944
|
var import_pixi8 = require("pixi.js");
|
|
939
945
|
|
|
940
946
|
// src/functions/TickerUtility.ts
|
|
@@ -965,7 +971,57 @@ function updateTickerProgression(args, propertyName, progression) {
|
|
|
965
971
|
}
|
|
966
972
|
}
|
|
967
973
|
|
|
974
|
+
// src/classes/ticker/TickerMove.ts
|
|
975
|
+
var TickerMove = class extends TickerBase {
|
|
976
|
+
/**
|
|
977
|
+
* The method that will be called every frame to move the canvas element of the canvas.
|
|
978
|
+
* @param t The ticker that is calling this method
|
|
979
|
+
* @param args The arguments that are passed to the ticker
|
|
980
|
+
* @param tags The tags of the canvas element that are connected to this ticker
|
|
981
|
+
*/
|
|
982
|
+
fn(t, args, tags) {
|
|
983
|
+
let speed = args.speed === void 0 ? 0.1 : args.speed;
|
|
984
|
+
let destination = args.destination;
|
|
985
|
+
tags.filter((tag) => {
|
|
986
|
+
var _a;
|
|
987
|
+
let element = GameWindowManager.getCanvasElement(tag);
|
|
988
|
+
if (args.startOnlyIfHaveTexture) {
|
|
989
|
+
if (element && element instanceof import_pixi8.Sprite && ((_a = element.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
990
|
+
return false;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
return true;
|
|
994
|
+
}).forEach((tag) => {
|
|
995
|
+
let element = GameWindowManager.getCanvasElement(tag);
|
|
996
|
+
if (element && element instanceof import_pixi8.Container) {
|
|
997
|
+
let xDistance = destination.x - element.x;
|
|
998
|
+
if (xDistance != 0) {
|
|
999
|
+
element.x += xDistance / speed * t.deltaTime;
|
|
1000
|
+
let newDistance = destination.x - element.x;
|
|
1001
|
+
if (xDistance < 0 && newDistance > 0 || xDistance > 0 && newDistance < 0) {
|
|
1002
|
+
element.x = destination.x;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
let yDistance = destination.y - element.y;
|
|
1006
|
+
if (yDistance != 0) {
|
|
1007
|
+
element.y += yDistance / speed * t.deltaTime;
|
|
1008
|
+
let newDistance = destination.y - element.y;
|
|
1009
|
+
if (yDistance < 0 && newDistance > 0 || yDistance > 0 && newDistance < 0) {
|
|
1010
|
+
element.y = destination.y;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
1015
|
+
if (args.speedProgression)
|
|
1016
|
+
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
TickerMove = __decorateClass([
|
|
1020
|
+
tickerDecorator()
|
|
1021
|
+
], TickerMove);
|
|
1022
|
+
|
|
968
1023
|
// src/classes/ticker/TickerRotate.ts
|
|
1024
|
+
var import_pixi9 = require("pixi.js");
|
|
969
1025
|
var TickerRotate = class extends TickerBase {
|
|
970
1026
|
/**
|
|
971
1027
|
* The method that will be called every frame to rotate the canvas element of the canvas.
|
|
@@ -980,14 +1036,14 @@ var TickerRotate = class extends TickerBase {
|
|
|
980
1036
|
var _a;
|
|
981
1037
|
let element = GameWindowManager.getCanvasElement(tag);
|
|
982
1038
|
if (args.startOnlyIfHaveTexture) {
|
|
983
|
-
if (element && element instanceof
|
|
1039
|
+
if (element && element instanceof import_pixi9.Sprite && ((_a = element.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
984
1040
|
return false;
|
|
985
1041
|
}
|
|
986
1042
|
}
|
|
987
1043
|
return true;
|
|
988
1044
|
}).forEach((tag) => {
|
|
989
1045
|
let element = GameWindowManager.getCanvasElement(tag);
|
|
990
|
-
if (element && element instanceof
|
|
1046
|
+
if (element && element instanceof import_pixi9.Container) {
|
|
991
1047
|
if (clockwise)
|
|
992
1048
|
element.rotation += speed * t.deltaTime;
|
|
993
1049
|
else
|
|
@@ -1009,7 +1065,7 @@ function addImage(tag, imageUrl) {
|
|
|
1009
1065
|
GameWindowManager.addCanvasElement(tag, image);
|
|
1010
1066
|
return image;
|
|
1011
1067
|
}
|
|
1012
|
-
function
|
|
1068
|
+
function loadImages(canvasImages) {
|
|
1013
1069
|
return __async(this, null, function* () {
|
|
1014
1070
|
if (!Array.isArray(canvasImages)) {
|
|
1015
1071
|
return [canvasImages];
|
|
@@ -1062,7 +1118,7 @@ function showImageWithDissolveTransition(tag, imageUrl, speed, priority) {
|
|
|
1062
1118
|
}
|
|
1063
1119
|
|
|
1064
1120
|
// src/constants.ts
|
|
1065
|
-
var PIXIVN_VERSION = "0.
|
|
1121
|
+
var PIXIVN_VERSION = "0.4.0";
|
|
1066
1122
|
|
|
1067
1123
|
// src/functions/SavesUtility.ts
|
|
1068
1124
|
function getSaveData() {
|
|
@@ -1239,7 +1295,7 @@ _GameStorageManager.storage = {};
|
|
|
1239
1295
|
var GameStorageManager = _GameStorageManager;
|
|
1240
1296
|
|
|
1241
1297
|
// src/managers/WindowManager.ts
|
|
1242
|
-
var
|
|
1298
|
+
var import_pixi10 = require("pixi.js");
|
|
1243
1299
|
|
|
1244
1300
|
// src/functions/EasterEgg.ts
|
|
1245
1301
|
function asciiArtLog() {
|
|
@@ -1309,7 +1365,7 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1309
1365
|
return __async(this, null, function* () {
|
|
1310
1366
|
_GameWindowManager.canvasWidth = width;
|
|
1311
1367
|
_GameWindowManager.canvasHeight = height;
|
|
1312
|
-
_GameWindowManager._app = new
|
|
1368
|
+
_GameWindowManager._app = new import_pixi10.Application();
|
|
1313
1369
|
return _GameWindowManager.app.init(__spreadValues({
|
|
1314
1370
|
resolution: window.devicePixelRatio || 1,
|
|
1315
1371
|
autoDensity: true,
|
|
@@ -2502,13 +2558,33 @@ var DialogueBaseModel = class {
|
|
|
2502
2558
|
* Other parameters that can be stored in the dialogue.
|
|
2503
2559
|
*/
|
|
2504
2560
|
this.oltherParams = {};
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2561
|
+
if (typeof text === "string") {
|
|
2562
|
+
this.text = text;
|
|
2563
|
+
if (typeof character === "string") {
|
|
2564
|
+
this.characterId = character;
|
|
2565
|
+
} else {
|
|
2566
|
+
this.characterId = character == null ? void 0 : character.id;
|
|
2567
|
+
}
|
|
2568
|
+
this.oltherParams = oltherParams;
|
|
2508
2569
|
} else {
|
|
2509
|
-
this.
|
|
2570
|
+
this.text = text.text;
|
|
2571
|
+
if (text.characterId) {
|
|
2572
|
+
this.characterId = text.characterId;
|
|
2573
|
+
}
|
|
2574
|
+
this.oltherParams = text.oltherParams || {};
|
|
2510
2575
|
}
|
|
2511
|
-
|
|
2576
|
+
}
|
|
2577
|
+
/**
|
|
2578
|
+
* Export the dialogue to a DialogueBaseData object.
|
|
2579
|
+
*
|
|
2580
|
+
* @returns The data of the dialogue.
|
|
2581
|
+
*/
|
|
2582
|
+
export() {
|
|
2583
|
+
return {
|
|
2584
|
+
text: this.text,
|
|
2585
|
+
characterId: this.characterId,
|
|
2586
|
+
oltherParams: this.oltherParams
|
|
2587
|
+
};
|
|
2512
2588
|
}
|
|
2513
2589
|
};
|
|
2514
2590
|
|
|
@@ -2542,6 +2618,7 @@ var Label = class {
|
|
|
2542
2618
|
};
|
|
2543
2619
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2544
2620
|
0 && (module.exports = {
|
|
2621
|
+
Assets,
|
|
2545
2622
|
CanvasBase,
|
|
2546
2623
|
CanvasContainer,
|
|
2547
2624
|
CanvasEvent,
|
|
@@ -2562,6 +2639,7 @@ var Label = class {
|
|
|
2562
2639
|
StoredClassModel,
|
|
2563
2640
|
TickerBase,
|
|
2564
2641
|
TickerFadeAlpha,
|
|
2642
|
+
TickerMove,
|
|
2565
2643
|
TickerRotate,
|
|
2566
2644
|
addImage,
|
|
2567
2645
|
canvasElementDecorator,
|
|
@@ -2579,6 +2657,7 @@ var Label = class {
|
|
|
2579
2657
|
getSaveJson,
|
|
2580
2658
|
getTexture,
|
|
2581
2659
|
labelDecorator,
|
|
2660
|
+
loadImages,
|
|
2582
2661
|
loadSaveData,
|
|
2583
2662
|
loadSaveJson,
|
|
2584
2663
|
removeCanvasElement,
|
|
@@ -2586,7 +2665,6 @@ var Label = class {
|
|
|
2586
2665
|
setChoiceMenuOptions,
|
|
2587
2666
|
setDialogue,
|
|
2588
2667
|
setFlag,
|
|
2589
|
-
showCanvasImages,
|
|
2590
2668
|
showImageWithDissolveTransition,
|
|
2591
2669
|
tickerDecorator
|
|
2592
2670
|
});
|