@drincs/pixi-vn 0.4.5 → 0.4.7
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/index.d.mts +47 -23
- package/dist/index.d.ts +47 -23
- package/dist/index.js +42 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -34
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -587,9 +587,12 @@ function setMemorySprite(element, memory) {
|
|
|
587
587
|
|
|
588
588
|
// src/classes/canvas/CanvasImage.ts
|
|
589
589
|
var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
590
|
-
constructor() {
|
|
591
|
-
super(
|
|
590
|
+
constructor(options, imageLink) {
|
|
591
|
+
super(options);
|
|
592
592
|
this.imageLink = "";
|
|
593
|
+
if (imageLink) {
|
|
594
|
+
this.imageLink = imageLink;
|
|
595
|
+
}
|
|
593
596
|
}
|
|
594
597
|
get memory() {
|
|
595
598
|
return __spreadProps(__spreadValues({}, getMemorySprite(this)), {
|
|
@@ -606,7 +609,7 @@ var CanvasImage = class _CanvasImage extends CanvasSprite {
|
|
|
606
609
|
mySprite.texture = sprite.texture;
|
|
607
610
|
return mySprite;
|
|
608
611
|
}
|
|
609
|
-
/**
|
|
612
|
+
/**
|
|
610
613
|
* Load the image from the link and set the texture of the sprite.
|
|
611
614
|
* @param image The link of the image. If it is not set, it will use the imageLink property.
|
|
612
615
|
* @returns A promise that resolves when the image is loaded.
|
|
@@ -1012,36 +1015,36 @@ function loadImages(canvasImages) {
|
|
|
1012
1015
|
function removeCanvasElement(tag) {
|
|
1013
1016
|
GameWindowManager.removeCanvasElement(tag);
|
|
1014
1017
|
}
|
|
1015
|
-
function
|
|
1018
|
+
function showWithDissolveTransition(tag, image, speed, priority) {
|
|
1016
1019
|
return __async(this, null, function* () {
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1020
|
+
let specialTag = void 0;
|
|
1021
|
+
if (GameWindowManager.getCanvasElement(tag)) {
|
|
1022
|
+
specialTag = tag + "_temp_disolve";
|
|
1023
|
+
GameWindowManager.editTagCanvasElement(tag, specialTag);
|
|
1024
|
+
}
|
|
1025
|
+
let canvasElement;
|
|
1026
|
+
if (typeof image === "string") {
|
|
1027
|
+
canvasElement = addImage(tag, image);
|
|
1028
|
+
} else {
|
|
1029
|
+
canvasElement = image;
|
|
1030
|
+
}
|
|
1031
|
+
image.alpha = 0;
|
|
1029
1032
|
let effect = new TickerFadeAlpha({
|
|
1030
1033
|
speed,
|
|
1031
1034
|
type: "show",
|
|
1032
1035
|
tagToRemoveAfter: specialTag,
|
|
1033
1036
|
startOnlyIfHaveTexture: true
|
|
1034
1037
|
}, 1e4, priority);
|
|
1035
|
-
GameWindowManager.editTagCanvasElement(tag, specialTag);
|
|
1036
|
-
let image = addImage(tag, imageUrl);
|
|
1037
|
-
image.alpha = 0;
|
|
1038
1038
|
GameWindowManager.addTicker(tag, effect);
|
|
1039
|
-
|
|
1039
|
+
if (canvasElement instanceof CanvasImage) {
|
|
1040
|
+
return canvasElement.load();
|
|
1041
|
+
}
|
|
1042
|
+
return;
|
|
1040
1043
|
});
|
|
1041
1044
|
}
|
|
1042
1045
|
|
|
1043
1046
|
// src/constants.ts
|
|
1044
|
-
var PIXIVN_VERSION = "0.4.
|
|
1047
|
+
var PIXIVN_VERSION = "0.4.6";
|
|
1045
1048
|
|
|
1046
1049
|
// src/functions/SavesUtility.ts
|
|
1047
1050
|
function getSaveData() {
|
|
@@ -2003,12 +2006,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2003
2006
|
/* Run Methods */
|
|
2004
2007
|
/**
|
|
2005
2008
|
* Execute the next step and add it to the history.
|
|
2009
|
+
* @param props The props to pass to the step.
|
|
2006
2010
|
* @returns StepLabelResultType or undefined.
|
|
2007
2011
|
* @example
|
|
2008
2012
|
* ```typescript
|
|
2009
2013
|
* function nextOnClick() {
|
|
2010
2014
|
* setLoading(true)
|
|
2011
|
-
* GameStepManager.runNextStep()
|
|
2015
|
+
* GameStepManager.runNextStep(yourParams)
|
|
2012
2016
|
* .then((result) => {
|
|
2013
2017
|
* setUpdate((p) => p + 1)
|
|
2014
2018
|
* setLoading(false)
|
|
@@ -2023,21 +2027,22 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2023
2027
|
* }
|
|
2024
2028
|
* ```
|
|
2025
2029
|
*/
|
|
2026
|
-
static runNextStep() {
|
|
2030
|
+
static runNextStep(props) {
|
|
2027
2031
|
return __async(this, null, function* () {
|
|
2028
2032
|
if (_GameStepManager._openedLabels.length === 0) {
|
|
2029
2033
|
console.warn("[Pixi'VN] There are no labels to run");
|
|
2030
2034
|
return;
|
|
2031
2035
|
}
|
|
2032
2036
|
_GameStepManager.increaseCurrentStepIndex();
|
|
2033
|
-
return yield _GameStepManager.runCurrentStep();
|
|
2037
|
+
return yield _GameStepManager.runCurrentStep(props);
|
|
2034
2038
|
});
|
|
2035
2039
|
}
|
|
2036
2040
|
/**
|
|
2037
2041
|
* Execute the current step and add it to the history.
|
|
2042
|
+
* @param props The props to pass to the step.
|
|
2038
2043
|
* @returns StepLabelResultType or undefined.
|
|
2039
2044
|
*/
|
|
2040
|
-
static runCurrentStep() {
|
|
2045
|
+
static runCurrentStep(props) {
|
|
2041
2046
|
return __async(this, null, function* () {
|
|
2042
2047
|
if (_GameStepManager.currentLabelId) {
|
|
2043
2048
|
let lasteStepsLength = _GameStepManager.currentLabelStepIndex;
|
|
@@ -2053,12 +2058,12 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2053
2058
|
let n = currentLabel.steps.length;
|
|
2054
2059
|
if (n > lasteStepsLength) {
|
|
2055
2060
|
let nextStep = currentLabel.steps[lasteStepsLength];
|
|
2056
|
-
let result = yield nextStep();
|
|
2061
|
+
let result = yield nextStep(props);
|
|
2057
2062
|
_GameStepManager.addStepHistory(nextStep);
|
|
2058
2063
|
return result;
|
|
2059
2064
|
} else if (n === lasteStepsLength) {
|
|
2060
2065
|
_GameStepManager.closeCurrentLabel();
|
|
2061
|
-
return yield _GameStepManager.runNextStep();
|
|
2066
|
+
return yield _GameStepManager.runNextStep(props);
|
|
2062
2067
|
} else {
|
|
2063
2068
|
console.warn("[Pixi'VN] There are no steps to run");
|
|
2064
2069
|
}
|
|
@@ -2069,10 +2074,11 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2069
2074
|
* Execute the label and add it to the history.
|
|
2070
2075
|
* Is a call function in Ren'Py.
|
|
2071
2076
|
* @param label The label to execute.
|
|
2077
|
+
* @param props The props to pass to the label.
|
|
2072
2078
|
* @returns StepLabelResultType or undefined.
|
|
2073
2079
|
* @example
|
|
2074
2080
|
* ```typescript
|
|
2075
|
-
* GameStepManager.callLabel(StartLabel).then((result) => {
|
|
2081
|
+
* GameStepManager.callLabel(StartLabel, yourParams).then((result) => {
|
|
2076
2082
|
* if (result) {
|
|
2077
2083
|
* // your code
|
|
2078
2084
|
* }
|
|
@@ -2086,7 +2092,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2086
2092
|
* })
|
|
2087
2093
|
* ```
|
|
2088
2094
|
*/
|
|
2089
|
-
static callLabel(label) {
|
|
2095
|
+
static callLabel(label, props) {
|
|
2090
2096
|
return __async(this, null, function* () {
|
|
2091
2097
|
try {
|
|
2092
2098
|
if (label instanceof Label) {
|
|
@@ -2098,17 +2104,18 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2098
2104
|
console.error("[Pixi'VN] Error calling label", e);
|
|
2099
2105
|
return;
|
|
2100
2106
|
}
|
|
2101
|
-
return yield _GameStepManager.runCurrentStep();
|
|
2107
|
+
return yield _GameStepManager.runCurrentStep(props);
|
|
2102
2108
|
});
|
|
2103
2109
|
}
|
|
2104
2110
|
/**
|
|
2105
2111
|
* Execute the label, close all labels and add them to the history.
|
|
2106
2112
|
* Is a jump function in Ren'Py.
|
|
2107
2113
|
* @param label The label to execute.
|
|
2114
|
+
* @param props The props to pass to the label.
|
|
2108
2115
|
* @returns StepLabelResultType or undefined.
|
|
2109
2116
|
* @example
|
|
2110
2117
|
* ```typescript
|
|
2111
|
-
* GameStepManager.jumpLabel(StartLabel).then((result) => {
|
|
2118
|
+
* GameStepManager.jumpLabel(StartLabel, yourParams).then((result) => {
|
|
2112
2119
|
* if (result) {
|
|
2113
2120
|
* // your code
|
|
2114
2121
|
* }
|
|
@@ -2122,7 +2129,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2122
2129
|
* })
|
|
2123
2130
|
* ```
|
|
2124
2131
|
*/
|
|
2125
|
-
static jumpLabel(label) {
|
|
2132
|
+
static jumpLabel(label, props) {
|
|
2126
2133
|
return __async(this, null, function* () {
|
|
2127
2134
|
_GameStepManager.closeAllLabels();
|
|
2128
2135
|
try {
|
|
@@ -2135,7 +2142,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2135
2142
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
2136
2143
|
return;
|
|
2137
2144
|
}
|
|
2138
|
-
return yield _GameStepManager.runCurrentStep();
|
|
2145
|
+
return yield _GameStepManager.runCurrentStep(props);
|
|
2139
2146
|
});
|
|
2140
2147
|
}
|
|
2141
2148
|
/* After Update Methods */
|
|
@@ -2587,7 +2594,7 @@ export {
|
|
|
2587
2594
|
setChoiceMenuOptions,
|
|
2588
2595
|
setDialogue,
|
|
2589
2596
|
setFlag,
|
|
2590
|
-
|
|
2597
|
+
showWithDissolveTransition,
|
|
2591
2598
|
tickerDecorator
|
|
2592
2599
|
};
|
|
2593
2600
|
//# sourceMappingURL=index.mjs.map
|