@drincs/pixi-vn 0.3.6 → 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 +1 -84
- package/dist/index.d.mts +106 -32
- package/dist/index.d.ts +106 -32
- 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.mjs
CHANGED
|
@@ -48,6 +48,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
48
48
|
});
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
+
// src/index.ts
|
|
52
|
+
import { Assets as Assets2 } from "pixi.js";
|
|
53
|
+
|
|
51
54
|
// src/classes/CanvasEvent.ts
|
|
52
55
|
var CanvasEvent = class {
|
|
53
56
|
fn(_event, _element) {
|
|
@@ -584,9 +587,12 @@ function setMemorySprite(element, memory) {
|
|
|
584
587
|
|
|
585
588
|
// src/classes/canvas/CanvasImage.ts
|
|
586
589
|
var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
587
|
-
constructor() {
|
|
588
|
-
super(
|
|
590
|
+
constructor(options) {
|
|
591
|
+
super(options);
|
|
589
592
|
this.imageLink = "";
|
|
593
|
+
if (options && typeof options === "object" && "textureImage" in options && options.textureImage) {
|
|
594
|
+
this.imageLink = options.textureImage;
|
|
595
|
+
}
|
|
590
596
|
}
|
|
591
597
|
get memory() {
|
|
592
598
|
return __spreadProps(__spreadValues({}, getMemorySprite(this)), {
|
|
@@ -856,7 +862,7 @@ TickerFadeAlpha = __decorateClass([
|
|
|
856
862
|
tickerDecorator()
|
|
857
863
|
], TickerFadeAlpha);
|
|
858
864
|
|
|
859
|
-
// src/classes/ticker/
|
|
865
|
+
// src/classes/ticker/TickerMove.ts
|
|
860
866
|
import { Container as Container4, Sprite as Sprite4 } from "pixi.js";
|
|
861
867
|
|
|
862
868
|
// src/functions/TickerUtility.ts
|
|
@@ -887,7 +893,57 @@ function updateTickerProgression(args, propertyName, progression) {
|
|
|
887
893
|
}
|
|
888
894
|
}
|
|
889
895
|
|
|
896
|
+
// src/classes/ticker/TickerMove.ts
|
|
897
|
+
var TickerMove = class extends TickerBase {
|
|
898
|
+
/**
|
|
899
|
+
* The method that will be called every frame to move the canvas element of the canvas.
|
|
900
|
+
* @param t The ticker that is calling this method
|
|
901
|
+
* @param args The arguments that are passed to the ticker
|
|
902
|
+
* @param tags The tags of the canvas element that are connected to this ticker
|
|
903
|
+
*/
|
|
904
|
+
fn(t, args, tags) {
|
|
905
|
+
let speed = args.speed === void 0 ? 0.1 : args.speed;
|
|
906
|
+
let destination = args.destination;
|
|
907
|
+
tags.filter((tag) => {
|
|
908
|
+
var _a;
|
|
909
|
+
let element = GameWindowManager.getCanvasElement(tag);
|
|
910
|
+
if (args.startOnlyIfHaveTexture) {
|
|
911
|
+
if (element && element instanceof Sprite4 && ((_a = element.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
912
|
+
return false;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
return true;
|
|
916
|
+
}).forEach((tag) => {
|
|
917
|
+
let element = GameWindowManager.getCanvasElement(tag);
|
|
918
|
+
if (element && element instanceof Container4) {
|
|
919
|
+
let xDistance = destination.x - element.x;
|
|
920
|
+
if (xDistance != 0) {
|
|
921
|
+
element.x += xDistance / speed * t.deltaTime;
|
|
922
|
+
let newDistance = destination.x - element.x;
|
|
923
|
+
if (xDistance < 0 && newDistance > 0 || xDistance > 0 && newDistance < 0) {
|
|
924
|
+
element.x = destination.x;
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
let yDistance = destination.y - element.y;
|
|
928
|
+
if (yDistance != 0) {
|
|
929
|
+
element.y += yDistance / speed * t.deltaTime;
|
|
930
|
+
let newDistance = destination.y - element.y;
|
|
931
|
+
if (yDistance < 0 && newDistance > 0 || yDistance > 0 && newDistance < 0) {
|
|
932
|
+
element.y = destination.y;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
});
|
|
937
|
+
if (args.speedProgression)
|
|
938
|
+
updateTickerProgression(args, "speed", args.speedProgression);
|
|
939
|
+
}
|
|
940
|
+
};
|
|
941
|
+
TickerMove = __decorateClass([
|
|
942
|
+
tickerDecorator()
|
|
943
|
+
], TickerMove);
|
|
944
|
+
|
|
890
945
|
// src/classes/ticker/TickerRotate.ts
|
|
946
|
+
import { Container as Container5, Sprite as Sprite5 } from "pixi.js";
|
|
891
947
|
var TickerRotate = class extends TickerBase {
|
|
892
948
|
/**
|
|
893
949
|
* The method that will be called every frame to rotate the canvas element of the canvas.
|
|
@@ -902,14 +958,14 @@ var TickerRotate = class extends TickerBase {
|
|
|
902
958
|
var _a;
|
|
903
959
|
let element = GameWindowManager.getCanvasElement(tag);
|
|
904
960
|
if (args.startOnlyIfHaveTexture) {
|
|
905
|
-
if (element && element instanceof
|
|
961
|
+
if (element && element instanceof Sprite5 && ((_a = element.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
906
962
|
return false;
|
|
907
963
|
}
|
|
908
964
|
}
|
|
909
965
|
return true;
|
|
910
966
|
}).forEach((tag) => {
|
|
911
967
|
let element = GameWindowManager.getCanvasElement(tag);
|
|
912
|
-
if (element && element instanceof
|
|
968
|
+
if (element && element instanceof Container5) {
|
|
913
969
|
if (clockwise)
|
|
914
970
|
element.rotation += speed * t.deltaTime;
|
|
915
971
|
else
|
|
@@ -931,7 +987,7 @@ function addImage(tag, imageUrl) {
|
|
|
931
987
|
GameWindowManager.addCanvasElement(tag, image);
|
|
932
988
|
return image;
|
|
933
989
|
}
|
|
934
|
-
function
|
|
990
|
+
function loadImages(canvasImages) {
|
|
935
991
|
return __async(this, null, function* () {
|
|
936
992
|
if (!Array.isArray(canvasImages)) {
|
|
937
993
|
return [canvasImages];
|
|
@@ -984,7 +1040,7 @@ function showImageWithDissolveTransition(tag, imageUrl, speed, priority) {
|
|
|
984
1040
|
}
|
|
985
1041
|
|
|
986
1042
|
// src/constants.ts
|
|
987
|
-
var PIXIVN_VERSION = "0.
|
|
1043
|
+
var PIXIVN_VERSION = "0.4.0";
|
|
988
1044
|
|
|
989
1045
|
// src/functions/SavesUtility.ts
|
|
990
1046
|
function getSaveData() {
|
|
@@ -2424,13 +2480,33 @@ var DialogueBaseModel = class {
|
|
|
2424
2480
|
* Other parameters that can be stored in the dialogue.
|
|
2425
2481
|
*/
|
|
2426
2482
|
this.oltherParams = {};
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2483
|
+
if (typeof text === "string") {
|
|
2484
|
+
this.text = text;
|
|
2485
|
+
if (typeof character === "string") {
|
|
2486
|
+
this.characterId = character;
|
|
2487
|
+
} else {
|
|
2488
|
+
this.characterId = character == null ? void 0 : character.id;
|
|
2489
|
+
}
|
|
2490
|
+
this.oltherParams = oltherParams;
|
|
2430
2491
|
} else {
|
|
2431
|
-
this.
|
|
2492
|
+
this.text = text.text;
|
|
2493
|
+
if (text.characterId) {
|
|
2494
|
+
this.characterId = text.characterId;
|
|
2495
|
+
}
|
|
2496
|
+
this.oltherParams = text.oltherParams || {};
|
|
2432
2497
|
}
|
|
2433
|
-
|
|
2498
|
+
}
|
|
2499
|
+
/**
|
|
2500
|
+
* Export the dialogue to a DialogueBaseData object.
|
|
2501
|
+
*
|
|
2502
|
+
* @returns The data of the dialogue.
|
|
2503
|
+
*/
|
|
2504
|
+
export() {
|
|
2505
|
+
return {
|
|
2506
|
+
text: this.text,
|
|
2507
|
+
characterId: this.characterId,
|
|
2508
|
+
oltherParams: this.oltherParams
|
|
2509
|
+
};
|
|
2434
2510
|
}
|
|
2435
2511
|
};
|
|
2436
2512
|
|
|
@@ -2463,6 +2539,7 @@ var Label = class {
|
|
|
2463
2539
|
}
|
|
2464
2540
|
};
|
|
2465
2541
|
export {
|
|
2542
|
+
Assets2 as Assets,
|
|
2466
2543
|
CanvasBase,
|
|
2467
2544
|
CanvasContainer,
|
|
2468
2545
|
CanvasEvent,
|
|
@@ -2483,6 +2560,7 @@ export {
|
|
|
2483
2560
|
StoredClassModel,
|
|
2484
2561
|
TickerBase,
|
|
2485
2562
|
TickerFadeAlpha,
|
|
2563
|
+
TickerMove,
|
|
2486
2564
|
TickerRotate,
|
|
2487
2565
|
addImage,
|
|
2488
2566
|
canvasElementDecorator,
|
|
@@ -2500,6 +2578,7 @@ export {
|
|
|
2500
2578
|
getSaveJson,
|
|
2501
2579
|
getTexture,
|
|
2502
2580
|
labelDecorator,
|
|
2581
|
+
loadImages,
|
|
2503
2582
|
loadSaveData,
|
|
2504
2583
|
loadSaveJson,
|
|
2505
2584
|
removeCanvasElement,
|
|
@@ -2507,7 +2586,6 @@ export {
|
|
|
2507
2586
|
setChoiceMenuOptions,
|
|
2508
2587
|
setDialogue,
|
|
2509
2588
|
setFlag,
|
|
2510
|
-
showCanvasImages,
|
|
2511
2589
|
showImageWithDissolveTransition,
|
|
2512
2590
|
tickerDecorator
|
|
2513
2591
|
};
|