@drincs/pixi-vn 0.3.4 → 0.3.5
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 +49 -13
- package/dist/index.d.ts +49 -13
- package/dist/index.js +36 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -193,7 +193,18 @@ type StepHistoryDataType = string;
|
|
|
193
193
|
/**
|
|
194
194
|
* StepLabel is a function that will be executed as the game continues.
|
|
195
195
|
*/
|
|
196
|
-
type StepLabelType = (() =>
|
|
196
|
+
type StepLabelType = (() => StepLabelResultType | Promise<StepLabelResultType>);
|
|
197
|
+
/**
|
|
198
|
+
* StepLabelResultType is the return type of the StepLabel function.
|
|
199
|
+
* It can be useful for returning to the information calling function to perform other operations that cannot be performed within the StepLabel.
|
|
200
|
+
*/
|
|
201
|
+
type StepLabelResultType = {
|
|
202
|
+
/**
|
|
203
|
+
* The new route to navigate to.
|
|
204
|
+
*/
|
|
205
|
+
newRoute?: string;
|
|
206
|
+
[key: string]: any;
|
|
207
|
+
} | void;
|
|
197
208
|
|
|
198
209
|
/**
|
|
199
210
|
* Label is a class that contains a list of steps, which will be performed as the game continues.
|
|
@@ -1239,15 +1250,18 @@ declare class GameStepManager {
|
|
|
1239
1250
|
private static increaseCurrentStepIndex;
|
|
1240
1251
|
/**
|
|
1241
1252
|
* Execute the next step and add it to the history.
|
|
1242
|
-
* @returns
|
|
1253
|
+
* @returns StepLabelResultType or undefined.
|
|
1243
1254
|
* @example
|
|
1244
1255
|
* ```typescript
|
|
1245
1256
|
* function nextOnClick() {
|
|
1246
1257
|
* setLoading(true)
|
|
1247
1258
|
* GameStepManager.runNextStep()
|
|
1248
|
-
* .then(() => {
|
|
1259
|
+
* .then((result) => {
|
|
1249
1260
|
* setUpdate((p) => p + 1)
|
|
1250
1261
|
* setLoading(false)
|
|
1262
|
+
* if (result) {
|
|
1263
|
+
* // your code
|
|
1264
|
+
* }
|
|
1251
1265
|
* })
|
|
1252
1266
|
* .catch((e) => {
|
|
1253
1267
|
* setLoading(false)
|
|
@@ -1256,34 +1270,56 @@ declare class GameStepManager {
|
|
|
1256
1270
|
* }
|
|
1257
1271
|
* ```
|
|
1258
1272
|
*/
|
|
1259
|
-
static runNextStep(): Promise<
|
|
1273
|
+
static runNextStep(): Promise<StepLabelResultType>;
|
|
1260
1274
|
/**
|
|
1261
1275
|
* Execute the current step and add it to the history.
|
|
1262
|
-
* @returns
|
|
1276
|
+
* @returns StepLabelResultType or undefined.
|
|
1263
1277
|
*/
|
|
1264
1278
|
private static runCurrentStep;
|
|
1265
1279
|
/**
|
|
1266
1280
|
* Execute the label and add it to the history.
|
|
1267
1281
|
* Is a call function in Ren'Py.
|
|
1268
1282
|
* @param label The label to execute.
|
|
1269
|
-
* @returns
|
|
1283
|
+
* @returns StepLabelResultType or undefined.
|
|
1270
1284
|
* @example
|
|
1271
1285
|
* ```typescript
|
|
1272
|
-
* GameStepManager.callLabel(StartLabel)
|
|
1286
|
+
* GameStepManager.callLabel(StartLabel).then((result) => {
|
|
1287
|
+
* if (result) {
|
|
1288
|
+
* // your code
|
|
1289
|
+
* }
|
|
1290
|
+
* })
|
|
1291
|
+
* ```
|
|
1292
|
+
* @example
|
|
1293
|
+
* ```typescript
|
|
1294
|
+
* // if you use it in a step label you should return the result.
|
|
1295
|
+
* return GameStepManager.callLabel(StartLabel).then((result) => {
|
|
1296
|
+
* return result
|
|
1297
|
+
* })
|
|
1273
1298
|
* ```
|
|
1274
1299
|
*/
|
|
1275
|
-
static callLabel(label: typeof Label | Label): Promise<
|
|
1300
|
+
static callLabel(label: typeof Label | Label): Promise<StepLabelResultType>;
|
|
1276
1301
|
/**
|
|
1277
1302
|
* Execute the label, close all labels and add them to the history.
|
|
1278
1303
|
* Is a jump function in Ren'Py.
|
|
1279
|
-
* @param label
|
|
1280
|
-
* @returns
|
|
1304
|
+
* @param label The label to execute.
|
|
1305
|
+
* @returns StepLabelResultType or undefined.
|
|
1306
|
+
* @example
|
|
1307
|
+
* ```typescript
|
|
1308
|
+
* GameStepManager.jumpLabel(StartLabel).then((result) => {
|
|
1309
|
+
* if (result) {
|
|
1310
|
+
* // your code
|
|
1311
|
+
* }
|
|
1312
|
+
* })
|
|
1313
|
+
* ```
|
|
1281
1314
|
* @example
|
|
1282
1315
|
* ```typescript
|
|
1283
|
-
*
|
|
1316
|
+
* // if you use it in a step label you should return the result.
|
|
1317
|
+
* return GameStepManager.jumpLabel(StartLabel).then((result) => {
|
|
1318
|
+
* return result
|
|
1319
|
+
* })
|
|
1284
1320
|
* ```
|
|
1285
1321
|
*/
|
|
1286
|
-
static jumpLabel(label: typeof Label | Label): Promise<
|
|
1322
|
+
static jumpLabel(label: typeof Label | Label): Promise<StepLabelResultType>;
|
|
1287
1323
|
/**
|
|
1288
1324
|
* Go back to the last step and add it to the history.
|
|
1289
1325
|
* @param navigate The navigate function.
|
|
@@ -1621,4 +1657,4 @@ declare class GameWindowManager {
|
|
|
1621
1657
|
static import(data: object): void;
|
|
1622
1658
|
}
|
|
1623
1659
|
|
|
1624
|
-
export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel, type CharacterBaseModelProps, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueBaseModel, type ExportedCanvas, type ExportedStep, type ExportedStorage, GameStepManager, GameStorageManager, GameWindowManager, type ICanvasBaseMemory, type ICanvasContainerMemory, type ICanvasImageMemory, type ICanvasSpriteBaseMemory, type ICanvasSpriteMemory, type ICanvasTextMemory as ICanvasTextTextMemory, type IClassWithArgsHistory, type IClassWithArgsHistoryForExport, type IDialogueHistory, type IHistoryStep, type IHistoryStepData, type IOpenedLabel, type ISaveData, type ITextureMemory, type ITicker, type ITickersSteps, Label, LabelRunModeEnum, Pause, type PauseType, PauseValueType, Repeat, type RepeatType, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerProgrationType, TickerRotate, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, labelDecorator, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag, showCanvasImages, showImageWithDissolveTransition, tickerDecorator };
|
|
1660
|
+
export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel, type CharacterBaseModelProps, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueBaseModel, type ExportedCanvas, type ExportedStep, type ExportedStorage, GameStepManager, GameStorageManager, GameWindowManager, type ICanvasBaseMemory, type ICanvasContainerMemory, type ICanvasImageMemory, type ICanvasSpriteBaseMemory, type ICanvasSpriteMemory, type ICanvasTextMemory as ICanvasTextTextMemory, type IClassWithArgsHistory, type IClassWithArgsHistoryForExport, type IDialogueHistory, type IHistoryStep, type IHistoryStepData, type IOpenedLabel, type ISaveData, type ITextureMemory, type ITicker, type ITickersSteps, Label, LabelRunModeEnum, Pause, type PauseType, PauseValueType, Repeat, type RepeatType, type StepLabelResultType, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerProgrationType, TickerRotate, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, labelDecorator, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag, showCanvasImages, showImageWithDissolveTransition, tickerDecorator };
|
package/dist/index.d.ts
CHANGED
|
@@ -193,7 +193,18 @@ type StepHistoryDataType = string;
|
|
|
193
193
|
/**
|
|
194
194
|
* StepLabel is a function that will be executed as the game continues.
|
|
195
195
|
*/
|
|
196
|
-
type StepLabelType = (() =>
|
|
196
|
+
type StepLabelType = (() => StepLabelResultType | Promise<StepLabelResultType>);
|
|
197
|
+
/**
|
|
198
|
+
* StepLabelResultType is the return type of the StepLabel function.
|
|
199
|
+
* It can be useful for returning to the information calling function to perform other operations that cannot be performed within the StepLabel.
|
|
200
|
+
*/
|
|
201
|
+
type StepLabelResultType = {
|
|
202
|
+
/**
|
|
203
|
+
* The new route to navigate to.
|
|
204
|
+
*/
|
|
205
|
+
newRoute?: string;
|
|
206
|
+
[key: string]: any;
|
|
207
|
+
} | void;
|
|
197
208
|
|
|
198
209
|
/**
|
|
199
210
|
* Label is a class that contains a list of steps, which will be performed as the game continues.
|
|
@@ -1239,15 +1250,18 @@ declare class GameStepManager {
|
|
|
1239
1250
|
private static increaseCurrentStepIndex;
|
|
1240
1251
|
/**
|
|
1241
1252
|
* Execute the next step and add it to the history.
|
|
1242
|
-
* @returns
|
|
1253
|
+
* @returns StepLabelResultType or undefined.
|
|
1243
1254
|
* @example
|
|
1244
1255
|
* ```typescript
|
|
1245
1256
|
* function nextOnClick() {
|
|
1246
1257
|
* setLoading(true)
|
|
1247
1258
|
* GameStepManager.runNextStep()
|
|
1248
|
-
* .then(() => {
|
|
1259
|
+
* .then((result) => {
|
|
1249
1260
|
* setUpdate((p) => p + 1)
|
|
1250
1261
|
* setLoading(false)
|
|
1262
|
+
* if (result) {
|
|
1263
|
+
* // your code
|
|
1264
|
+
* }
|
|
1251
1265
|
* })
|
|
1252
1266
|
* .catch((e) => {
|
|
1253
1267
|
* setLoading(false)
|
|
@@ -1256,34 +1270,56 @@ declare class GameStepManager {
|
|
|
1256
1270
|
* }
|
|
1257
1271
|
* ```
|
|
1258
1272
|
*/
|
|
1259
|
-
static runNextStep(): Promise<
|
|
1273
|
+
static runNextStep(): Promise<StepLabelResultType>;
|
|
1260
1274
|
/**
|
|
1261
1275
|
* Execute the current step and add it to the history.
|
|
1262
|
-
* @returns
|
|
1276
|
+
* @returns StepLabelResultType or undefined.
|
|
1263
1277
|
*/
|
|
1264
1278
|
private static runCurrentStep;
|
|
1265
1279
|
/**
|
|
1266
1280
|
* Execute the label and add it to the history.
|
|
1267
1281
|
* Is a call function in Ren'Py.
|
|
1268
1282
|
* @param label The label to execute.
|
|
1269
|
-
* @returns
|
|
1283
|
+
* @returns StepLabelResultType or undefined.
|
|
1270
1284
|
* @example
|
|
1271
1285
|
* ```typescript
|
|
1272
|
-
* GameStepManager.callLabel(StartLabel)
|
|
1286
|
+
* GameStepManager.callLabel(StartLabel).then((result) => {
|
|
1287
|
+
* if (result) {
|
|
1288
|
+
* // your code
|
|
1289
|
+
* }
|
|
1290
|
+
* })
|
|
1291
|
+
* ```
|
|
1292
|
+
* @example
|
|
1293
|
+
* ```typescript
|
|
1294
|
+
* // if you use it in a step label you should return the result.
|
|
1295
|
+
* return GameStepManager.callLabel(StartLabel).then((result) => {
|
|
1296
|
+
* return result
|
|
1297
|
+
* })
|
|
1273
1298
|
* ```
|
|
1274
1299
|
*/
|
|
1275
|
-
static callLabel(label: typeof Label | Label): Promise<
|
|
1300
|
+
static callLabel(label: typeof Label | Label): Promise<StepLabelResultType>;
|
|
1276
1301
|
/**
|
|
1277
1302
|
* Execute the label, close all labels and add them to the history.
|
|
1278
1303
|
* Is a jump function in Ren'Py.
|
|
1279
|
-
* @param label
|
|
1280
|
-
* @returns
|
|
1304
|
+
* @param label The label to execute.
|
|
1305
|
+
* @returns StepLabelResultType or undefined.
|
|
1306
|
+
* @example
|
|
1307
|
+
* ```typescript
|
|
1308
|
+
* GameStepManager.jumpLabel(StartLabel).then((result) => {
|
|
1309
|
+
* if (result) {
|
|
1310
|
+
* // your code
|
|
1311
|
+
* }
|
|
1312
|
+
* })
|
|
1313
|
+
* ```
|
|
1281
1314
|
* @example
|
|
1282
1315
|
* ```typescript
|
|
1283
|
-
*
|
|
1316
|
+
* // if you use it in a step label you should return the result.
|
|
1317
|
+
* return GameStepManager.jumpLabel(StartLabel).then((result) => {
|
|
1318
|
+
* return result
|
|
1319
|
+
* })
|
|
1284
1320
|
* ```
|
|
1285
1321
|
*/
|
|
1286
|
-
static jumpLabel(label: typeof Label | Label): Promise<
|
|
1322
|
+
static jumpLabel(label: typeof Label | Label): Promise<StepLabelResultType>;
|
|
1287
1323
|
/**
|
|
1288
1324
|
* Go back to the last step and add it to the history.
|
|
1289
1325
|
* @param navigate The navigate function.
|
|
@@ -1621,4 +1657,4 @@ declare class GameWindowManager {
|
|
|
1621
1657
|
static import(data: object): void;
|
|
1622
1658
|
}
|
|
1623
1659
|
|
|
1624
|
-
export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel, type CharacterBaseModelProps, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueBaseModel, type ExportedCanvas, type ExportedStep, type ExportedStorage, GameStepManager, GameStorageManager, GameWindowManager, type ICanvasBaseMemory, type ICanvasContainerMemory, type ICanvasImageMemory, type ICanvasSpriteBaseMemory, type ICanvasSpriteMemory, type ICanvasTextMemory as ICanvasTextTextMemory, type IClassWithArgsHistory, type IClassWithArgsHistoryForExport, type IDialogueHistory, type IHistoryStep, type IHistoryStepData, type IOpenedLabel, type ISaveData, type ITextureMemory, type ITicker, type ITickersSteps, Label, LabelRunModeEnum, Pause, type PauseType, PauseValueType, Repeat, type RepeatType, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerProgrationType, TickerRotate, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, labelDecorator, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag, showCanvasImages, showImageWithDissolveTransition, tickerDecorator };
|
|
1660
|
+
export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel, type CharacterBaseModelProps, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueBaseModel, type ExportedCanvas, type ExportedStep, type ExportedStorage, GameStepManager, GameStorageManager, GameWindowManager, type ICanvasBaseMemory, type ICanvasContainerMemory, type ICanvasImageMemory, type ICanvasSpriteBaseMemory, type ICanvasSpriteMemory, type ICanvasTextMemory as ICanvasTextTextMemory, type IClassWithArgsHistory, type IClassWithArgsHistoryForExport, type IDialogueHistory, type IHistoryStep, type IHistoryStepData, type IOpenedLabel, type ISaveData, type ITextureMemory, type ITicker, type ITickersSteps, Label, LabelRunModeEnum, Pause, type PauseType, PauseValueType, Repeat, type RepeatType, type StepLabelResultType, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerProgrationType, TickerRotate, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, labelDecorator, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag, showCanvasImages, showImageWithDissolveTransition, tickerDecorator };
|
package/dist/index.js
CHANGED
|
@@ -2024,15 +2024,18 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2024
2024
|
/* Run Methods */
|
|
2025
2025
|
/**
|
|
2026
2026
|
* Execute the next step and add it to the history.
|
|
2027
|
-
* @returns
|
|
2027
|
+
* @returns StepLabelResultType or undefined.
|
|
2028
2028
|
* @example
|
|
2029
2029
|
* ```typescript
|
|
2030
2030
|
* function nextOnClick() {
|
|
2031
2031
|
* setLoading(true)
|
|
2032
2032
|
* GameStepManager.runNextStep()
|
|
2033
|
-
* .then(() => {
|
|
2033
|
+
* .then((result) => {
|
|
2034
2034
|
* setUpdate((p) => p + 1)
|
|
2035
2035
|
* setLoading(false)
|
|
2036
|
+
* if (result) {
|
|
2037
|
+
* // your code
|
|
2038
|
+
* }
|
|
2036
2039
|
* })
|
|
2037
2040
|
* .catch((e) => {
|
|
2038
2041
|
* setLoading(false)
|
|
@@ -2053,7 +2056,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2053
2056
|
}
|
|
2054
2057
|
/**
|
|
2055
2058
|
* Execute the current step and add it to the history.
|
|
2056
|
-
* @returns
|
|
2059
|
+
* @returns StepLabelResultType or undefined.
|
|
2057
2060
|
*/
|
|
2058
2061
|
static runCurrentStep() {
|
|
2059
2062
|
return __async(this, null, function* () {
|
|
@@ -2071,11 +2074,12 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2071
2074
|
let n = currentLabel.steps.length;
|
|
2072
2075
|
if (n > lasteStepsLength) {
|
|
2073
2076
|
let nextStep = currentLabel.steps[lasteStepsLength];
|
|
2074
|
-
yield nextStep();
|
|
2077
|
+
let result = yield nextStep();
|
|
2075
2078
|
_GameStepManager.addStepHistory(nextStep);
|
|
2079
|
+
return result;
|
|
2076
2080
|
} else if (n === lasteStepsLength) {
|
|
2077
2081
|
_GameStepManager.closeCurrentLabel();
|
|
2078
|
-
yield _GameStepManager.runNextStep();
|
|
2082
|
+
return yield _GameStepManager.runNextStep();
|
|
2079
2083
|
} else {
|
|
2080
2084
|
console.warn("[Pixi'VN] There are no steps to run");
|
|
2081
2085
|
}
|
|
@@ -2086,10 +2090,21 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2086
2090
|
* Execute the label and add it to the history.
|
|
2087
2091
|
* Is a call function in Ren'Py.
|
|
2088
2092
|
* @param label The label to execute.
|
|
2089
|
-
* @returns
|
|
2093
|
+
* @returns StepLabelResultType or undefined.
|
|
2090
2094
|
* @example
|
|
2091
2095
|
* ```typescript
|
|
2092
|
-
* GameStepManager.callLabel(StartLabel)
|
|
2096
|
+
* GameStepManager.callLabel(StartLabel).then((result) => {
|
|
2097
|
+
* if (result) {
|
|
2098
|
+
* // your code
|
|
2099
|
+
* }
|
|
2100
|
+
* })
|
|
2101
|
+
* ```
|
|
2102
|
+
* @example
|
|
2103
|
+
* ```typescript
|
|
2104
|
+
* // if you use it in a step label you should return the result.
|
|
2105
|
+
* return GameStepManager.callLabel(StartLabel).then((result) => {
|
|
2106
|
+
* return result
|
|
2107
|
+
* })
|
|
2093
2108
|
* ```
|
|
2094
2109
|
*/
|
|
2095
2110
|
static callLabel(label) {
|
|
@@ -2110,11 +2125,22 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2110
2125
|
/**
|
|
2111
2126
|
* Execute the label, close all labels and add them to the history.
|
|
2112
2127
|
* Is a jump function in Ren'Py.
|
|
2113
|
-
* @param label
|
|
2114
|
-
* @returns
|
|
2128
|
+
* @param label The label to execute.
|
|
2129
|
+
* @returns StepLabelResultType or undefined.
|
|
2130
|
+
* @example
|
|
2131
|
+
* ```typescript
|
|
2132
|
+
* GameStepManager.jumpLabel(StartLabel).then((result) => {
|
|
2133
|
+
* if (result) {
|
|
2134
|
+
* // your code
|
|
2135
|
+
* }
|
|
2136
|
+
* })
|
|
2137
|
+
* ```
|
|
2115
2138
|
* @example
|
|
2116
2139
|
* ```typescript
|
|
2117
|
-
*
|
|
2140
|
+
* // if you use it in a step label you should return the result.
|
|
2141
|
+
* return GameStepManager.jumpLabel(StartLabel).then((result) => {
|
|
2142
|
+
* return result
|
|
2143
|
+
* })
|
|
2118
2144
|
* ```
|
|
2119
2145
|
*/
|
|
2120
2146
|
static jumpLabel(label) {
|