@drincs/pixi-vn 0.3.3 → 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 +133 -48
- package/dist/index.d.ts +133 -48
- package/dist/index.js +74 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +74 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -82,11 +82,29 @@ declare class StoredClassModel {
|
|
|
82
82
|
getStorageProperty<T>(propertyName: string): T | undefined;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* CharacterBaseModelProps is an interface that is used to create a character model.
|
|
87
|
+
*/
|
|
85
88
|
interface CharacterBaseModelProps {
|
|
89
|
+
/**
|
|
90
|
+
* The name of the character.
|
|
91
|
+
*/
|
|
86
92
|
name: string;
|
|
93
|
+
/**
|
|
94
|
+
* The surname of the character.
|
|
95
|
+
*/
|
|
87
96
|
surname?: string;
|
|
97
|
+
/**
|
|
98
|
+
* The age of the character.
|
|
99
|
+
*/
|
|
88
100
|
age?: number;
|
|
101
|
+
/**
|
|
102
|
+
* The icon of the character.
|
|
103
|
+
*/
|
|
89
104
|
icon?: string;
|
|
105
|
+
/**
|
|
106
|
+
* The color of the character.
|
|
107
|
+
*/
|
|
90
108
|
color?: string;
|
|
91
109
|
}
|
|
92
110
|
/**
|
|
@@ -113,19 +131,41 @@ interface CharacterBaseModelProps {
|
|
|
113
131
|
* ```
|
|
114
132
|
*/
|
|
115
133
|
declare class CharacterBaseModel extends StoredClassModel implements CharacterBaseModelProps {
|
|
134
|
+
/**
|
|
135
|
+
* @param id The id of the character.
|
|
136
|
+
* @param props The properties of the character.
|
|
137
|
+
*/
|
|
116
138
|
constructor(id: string, props: CharacterBaseModelProps);
|
|
117
139
|
private defaultName;
|
|
140
|
+
/***
|
|
141
|
+
* The name of the character.
|
|
142
|
+
* If you set undefined, it will return the default name.
|
|
143
|
+
*/
|
|
118
144
|
get name(): string;
|
|
119
|
-
set name(value: string);
|
|
145
|
+
set name(value: string | undefined);
|
|
120
146
|
private defaultSurname?;
|
|
147
|
+
/**
|
|
148
|
+
* The surname of the character.
|
|
149
|
+
* If you set undefined, it will return the default surname.
|
|
150
|
+
*/
|
|
121
151
|
get surname(): string | undefined;
|
|
122
152
|
set surname(value: string | undefined);
|
|
123
153
|
private defaultAge?;
|
|
154
|
+
/**
|
|
155
|
+
* The age of the character.
|
|
156
|
+
* If you set undefined, it will return the default age.
|
|
157
|
+
*/
|
|
124
158
|
get age(): number | undefined;
|
|
125
159
|
set age(value: number | undefined);
|
|
126
160
|
private _icon?;
|
|
161
|
+
/**
|
|
162
|
+
* The icon of the character.
|
|
163
|
+
*/
|
|
127
164
|
get icon(): string | undefined;
|
|
128
165
|
private _color?;
|
|
166
|
+
/**
|
|
167
|
+
* The color of the character.
|
|
168
|
+
*/
|
|
129
169
|
get color(): string | undefined;
|
|
130
170
|
}
|
|
131
171
|
|
|
@@ -153,7 +193,18 @@ type StepHistoryDataType = string;
|
|
|
153
193
|
/**
|
|
154
194
|
* StepLabel is a function that will be executed as the game continues.
|
|
155
195
|
*/
|
|
156
|
-
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;
|
|
157
208
|
|
|
158
209
|
/**
|
|
159
210
|
* Label is a class that contains a list of steps, which will be performed as the game continues.
|
|
@@ -229,24 +280,43 @@ interface IStoratedChoiceMenuOptionLabel {
|
|
|
229
280
|
}
|
|
230
281
|
|
|
231
282
|
/**
|
|
232
|
-
*
|
|
283
|
+
* Munu is a type that contains a list of Label that a player can choose from.
|
|
284
|
+
* For Ren'py this is the equivalent of a menu.
|
|
285
|
+
*/
|
|
286
|
+
type ChoiceMenuOptionsType = ChoiceMenuOptionLabel[];
|
|
287
|
+
|
|
288
|
+
declare const PauseValueType = "Pause";
|
|
289
|
+
type PauseType = {
|
|
290
|
+
type: typeof PauseValueType;
|
|
291
|
+
duration: number;
|
|
292
|
+
};
|
|
293
|
+
declare function Pause(duration: number): PauseType;
|
|
294
|
+
|
|
295
|
+
type RepeatType = "Repeat";
|
|
296
|
+
declare const Repeat: RepeatType;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* StorageElementType are all the types that can be stored in the storage
|
|
300
|
+
*/
|
|
301
|
+
type StorageElementType = string | number | boolean | object | undefined | null;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Base class for all dialogue models.
|
|
305
|
+
* You can extend this class, but it is not reccomended. You can use the oltherParams property to store any other data you need.
|
|
233
306
|
* @example
|
|
234
307
|
* ```typescript
|
|
235
|
-
*
|
|
236
|
-
* constructor(
|
|
237
|
-
* character: CharacterBaseModel | string,
|
|
238
|
-
* text: string,
|
|
239
|
-
* emotion: string
|
|
240
|
-
* ) {
|
|
241
|
-
* super(character, text);
|
|
242
|
-
* this.emotion = emotion;
|
|
243
|
-
* }
|
|
244
|
-
* emotion = ""
|
|
245
|
-
* }
|
|
308
|
+
* setDialogue(new DialogueBaseModel("Hello World", character))
|
|
246
309
|
* ```
|
|
247
310
|
*/
|
|
248
311
|
declare class DialogueBaseModel<TCharacter extends CharacterBaseModel = CharacterBaseModel> {
|
|
249
|
-
|
|
312
|
+
/**
|
|
313
|
+
* @param text The text of the dialogue.
|
|
314
|
+
* @param character The id of the character that is speaking.
|
|
315
|
+
* @param oltherParams Other parameters that can be stored in the dialogue.
|
|
316
|
+
*/
|
|
317
|
+
constructor(text: string, character: string | TCharacter | undefined, oltherParams?: {
|
|
318
|
+
[key: string]: StorageElementType;
|
|
319
|
+
});
|
|
250
320
|
/**
|
|
251
321
|
* The text of the dialogue.
|
|
252
322
|
*/
|
|
@@ -255,6 +325,12 @@ declare class DialogueBaseModel<TCharacter extends CharacterBaseModel = Characte
|
|
|
255
325
|
* The id of the character that is speaking.
|
|
256
326
|
*/
|
|
257
327
|
characterId?: string;
|
|
328
|
+
/**
|
|
329
|
+
* Other parameters that can be stored in the dialogue.
|
|
330
|
+
*/
|
|
331
|
+
oltherParams: {
|
|
332
|
+
[key: string]: StorageElementType;
|
|
333
|
+
};
|
|
258
334
|
}
|
|
259
335
|
|
|
260
336
|
/**
|
|
@@ -552,11 +628,6 @@ interface ITicker<TArgs extends TickerArgsType> {
|
|
|
552
628
|
priority?: UPDATE_PRIORITY;
|
|
553
629
|
}
|
|
554
630
|
|
|
555
|
-
/**
|
|
556
|
-
* StorageElementType are all the types that can be stored in the storage
|
|
557
|
-
*/
|
|
558
|
-
type StorageElementType = string | number | boolean | object | undefined | null;
|
|
559
|
-
|
|
560
631
|
type TickerArgsType = {
|
|
561
632
|
[id: string]: StorageElementType;
|
|
562
633
|
};
|
|
@@ -592,6 +663,11 @@ type TickerArgsType = {
|
|
|
592
663
|
* ```
|
|
593
664
|
*/
|
|
594
665
|
declare class TickerBase<TArgs extends TickerArgsType> implements ITicker<TArgs> {
|
|
666
|
+
/**
|
|
667
|
+
* @param args The arguments that you want to pass to the ticker.
|
|
668
|
+
* @param duration The duration of the ticker. If is undefined, the ticker will be called every frame.
|
|
669
|
+
* @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL.
|
|
670
|
+
*/
|
|
595
671
|
constructor(args: TArgs, duration?: number, priority?: UPDATE_PRIORITY);
|
|
596
672
|
args: TArgs;
|
|
597
673
|
duration?: number;
|
|
@@ -907,16 +983,6 @@ interface ISaveData {
|
|
|
907
983
|
path: string;
|
|
908
984
|
}
|
|
909
985
|
|
|
910
|
-
declare const PauseValueType = "Pause";
|
|
911
|
-
type PauseType = {
|
|
912
|
-
type: typeof PauseValueType;
|
|
913
|
-
duration: number;
|
|
914
|
-
};
|
|
915
|
-
declare function Pause(duration: number): PauseType;
|
|
916
|
-
|
|
917
|
-
type RepeatType = "Repeat";
|
|
918
|
-
declare const Repeat: RepeatType;
|
|
919
|
-
|
|
920
986
|
interface ITickersStep<TArgs extends TickerArgsType> extends ITicker<TArgs> {
|
|
921
987
|
/**
|
|
922
988
|
* Ticker class name
|
|
@@ -941,12 +1007,6 @@ interface ITickersSteps {
|
|
|
941
1007
|
steps: (ITickersStep<any> | RepeatType | PauseType)[];
|
|
942
1008
|
}
|
|
943
1009
|
|
|
944
|
-
/**
|
|
945
|
-
* Munu is a type that contains a list of Label that a player can choose from.
|
|
946
|
-
* For Ren'py this is the equivalent of a menu.
|
|
947
|
-
*/
|
|
948
|
-
type ChoiceMenuOptionsType = ChoiceMenuOptionLabel[];
|
|
949
|
-
|
|
950
1010
|
/**
|
|
951
1011
|
* Set the dialogue to be shown in the game
|
|
952
1012
|
* @param text Text of the dialogue
|
|
@@ -1190,15 +1250,18 @@ declare class GameStepManager {
|
|
|
1190
1250
|
private static increaseCurrentStepIndex;
|
|
1191
1251
|
/**
|
|
1192
1252
|
* Execute the next step and add it to the history.
|
|
1193
|
-
* @returns
|
|
1253
|
+
* @returns StepLabelResultType or undefined.
|
|
1194
1254
|
* @example
|
|
1195
1255
|
* ```typescript
|
|
1196
1256
|
* function nextOnClick() {
|
|
1197
1257
|
* setLoading(true)
|
|
1198
1258
|
* GameStepManager.runNextStep()
|
|
1199
|
-
* .then(() => {
|
|
1259
|
+
* .then((result) => {
|
|
1200
1260
|
* setUpdate((p) => p + 1)
|
|
1201
1261
|
* setLoading(false)
|
|
1262
|
+
* if (result) {
|
|
1263
|
+
* // your code
|
|
1264
|
+
* }
|
|
1202
1265
|
* })
|
|
1203
1266
|
* .catch((e) => {
|
|
1204
1267
|
* setLoading(false)
|
|
@@ -1207,34 +1270,56 @@ declare class GameStepManager {
|
|
|
1207
1270
|
* }
|
|
1208
1271
|
* ```
|
|
1209
1272
|
*/
|
|
1210
|
-
static runNextStep(): Promise<
|
|
1273
|
+
static runNextStep(): Promise<StepLabelResultType>;
|
|
1211
1274
|
/**
|
|
1212
1275
|
* Execute the current step and add it to the history.
|
|
1213
|
-
* @returns
|
|
1276
|
+
* @returns StepLabelResultType or undefined.
|
|
1214
1277
|
*/
|
|
1215
1278
|
private static runCurrentStep;
|
|
1216
1279
|
/**
|
|
1217
1280
|
* Execute the label and add it to the history.
|
|
1218
1281
|
* Is a call function in Ren'Py.
|
|
1219
1282
|
* @param label The label to execute.
|
|
1220
|
-
* @returns
|
|
1283
|
+
* @returns StepLabelResultType or undefined.
|
|
1284
|
+
* @example
|
|
1285
|
+
* ```typescript
|
|
1286
|
+
* GameStepManager.callLabel(StartLabel).then((result) => {
|
|
1287
|
+
* if (result) {
|
|
1288
|
+
* // your code
|
|
1289
|
+
* }
|
|
1290
|
+
* })
|
|
1291
|
+
* ```
|
|
1221
1292
|
* @example
|
|
1222
1293
|
* ```typescript
|
|
1223
|
-
*
|
|
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
|
+
* })
|
|
1224
1298
|
* ```
|
|
1225
1299
|
*/
|
|
1226
|
-
static callLabel(label: typeof Label | Label): Promise<
|
|
1300
|
+
static callLabel(label: typeof Label | Label): Promise<StepLabelResultType>;
|
|
1227
1301
|
/**
|
|
1228
1302
|
* Execute the label, close all labels and add them to the history.
|
|
1229
1303
|
* Is a jump function in Ren'Py.
|
|
1230
|
-
* @param label
|
|
1231
|
-
* @returns
|
|
1304
|
+
* @param label The label to execute.
|
|
1305
|
+
* @returns StepLabelResultType or undefined.
|
|
1232
1306
|
* @example
|
|
1233
1307
|
* ```typescript
|
|
1234
|
-
* GameStepManager.jumpLabel(StartLabel)
|
|
1308
|
+
* GameStepManager.jumpLabel(StartLabel).then((result) => {
|
|
1309
|
+
* if (result) {
|
|
1310
|
+
* // your code
|
|
1311
|
+
* }
|
|
1312
|
+
* })
|
|
1313
|
+
* ```
|
|
1314
|
+
* @example
|
|
1315
|
+
* ```typescript
|
|
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
|
+
* })
|
|
1235
1320
|
* ```
|
|
1236
1321
|
*/
|
|
1237
|
-
static jumpLabel(label: typeof Label | Label): Promise<
|
|
1322
|
+
static jumpLabel(label: typeof Label | Label): Promise<StepLabelResultType>;
|
|
1238
1323
|
/**
|
|
1239
1324
|
* Go back to the last step and add it to the history.
|
|
1240
1325
|
* @param navigate The navigate function.
|
|
@@ -1572,4 +1657,4 @@ declare class GameWindowManager {
|
|
|
1572
1657
|
static import(data: object): void;
|
|
1573
1658
|
}
|
|
1574
1659
|
|
|
1575
|
-
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
|
@@ -82,11 +82,29 @@ declare class StoredClassModel {
|
|
|
82
82
|
getStorageProperty<T>(propertyName: string): T | undefined;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* CharacterBaseModelProps is an interface that is used to create a character model.
|
|
87
|
+
*/
|
|
85
88
|
interface CharacterBaseModelProps {
|
|
89
|
+
/**
|
|
90
|
+
* The name of the character.
|
|
91
|
+
*/
|
|
86
92
|
name: string;
|
|
93
|
+
/**
|
|
94
|
+
* The surname of the character.
|
|
95
|
+
*/
|
|
87
96
|
surname?: string;
|
|
97
|
+
/**
|
|
98
|
+
* The age of the character.
|
|
99
|
+
*/
|
|
88
100
|
age?: number;
|
|
101
|
+
/**
|
|
102
|
+
* The icon of the character.
|
|
103
|
+
*/
|
|
89
104
|
icon?: string;
|
|
105
|
+
/**
|
|
106
|
+
* The color of the character.
|
|
107
|
+
*/
|
|
90
108
|
color?: string;
|
|
91
109
|
}
|
|
92
110
|
/**
|
|
@@ -113,19 +131,41 @@ interface CharacterBaseModelProps {
|
|
|
113
131
|
* ```
|
|
114
132
|
*/
|
|
115
133
|
declare class CharacterBaseModel extends StoredClassModel implements CharacterBaseModelProps {
|
|
134
|
+
/**
|
|
135
|
+
* @param id The id of the character.
|
|
136
|
+
* @param props The properties of the character.
|
|
137
|
+
*/
|
|
116
138
|
constructor(id: string, props: CharacterBaseModelProps);
|
|
117
139
|
private defaultName;
|
|
140
|
+
/***
|
|
141
|
+
* The name of the character.
|
|
142
|
+
* If you set undefined, it will return the default name.
|
|
143
|
+
*/
|
|
118
144
|
get name(): string;
|
|
119
|
-
set name(value: string);
|
|
145
|
+
set name(value: string | undefined);
|
|
120
146
|
private defaultSurname?;
|
|
147
|
+
/**
|
|
148
|
+
* The surname of the character.
|
|
149
|
+
* If you set undefined, it will return the default surname.
|
|
150
|
+
*/
|
|
121
151
|
get surname(): string | undefined;
|
|
122
152
|
set surname(value: string | undefined);
|
|
123
153
|
private defaultAge?;
|
|
154
|
+
/**
|
|
155
|
+
* The age of the character.
|
|
156
|
+
* If you set undefined, it will return the default age.
|
|
157
|
+
*/
|
|
124
158
|
get age(): number | undefined;
|
|
125
159
|
set age(value: number | undefined);
|
|
126
160
|
private _icon?;
|
|
161
|
+
/**
|
|
162
|
+
* The icon of the character.
|
|
163
|
+
*/
|
|
127
164
|
get icon(): string | undefined;
|
|
128
165
|
private _color?;
|
|
166
|
+
/**
|
|
167
|
+
* The color of the character.
|
|
168
|
+
*/
|
|
129
169
|
get color(): string | undefined;
|
|
130
170
|
}
|
|
131
171
|
|
|
@@ -153,7 +193,18 @@ type StepHistoryDataType = string;
|
|
|
153
193
|
/**
|
|
154
194
|
* StepLabel is a function that will be executed as the game continues.
|
|
155
195
|
*/
|
|
156
|
-
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;
|
|
157
208
|
|
|
158
209
|
/**
|
|
159
210
|
* Label is a class that contains a list of steps, which will be performed as the game continues.
|
|
@@ -229,24 +280,43 @@ interface IStoratedChoiceMenuOptionLabel {
|
|
|
229
280
|
}
|
|
230
281
|
|
|
231
282
|
/**
|
|
232
|
-
*
|
|
283
|
+
* Munu is a type that contains a list of Label that a player can choose from.
|
|
284
|
+
* For Ren'py this is the equivalent of a menu.
|
|
285
|
+
*/
|
|
286
|
+
type ChoiceMenuOptionsType = ChoiceMenuOptionLabel[];
|
|
287
|
+
|
|
288
|
+
declare const PauseValueType = "Pause";
|
|
289
|
+
type PauseType = {
|
|
290
|
+
type: typeof PauseValueType;
|
|
291
|
+
duration: number;
|
|
292
|
+
};
|
|
293
|
+
declare function Pause(duration: number): PauseType;
|
|
294
|
+
|
|
295
|
+
type RepeatType = "Repeat";
|
|
296
|
+
declare const Repeat: RepeatType;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* StorageElementType are all the types that can be stored in the storage
|
|
300
|
+
*/
|
|
301
|
+
type StorageElementType = string | number | boolean | object | undefined | null;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Base class for all dialogue models.
|
|
305
|
+
* You can extend this class, but it is not reccomended. You can use the oltherParams property to store any other data you need.
|
|
233
306
|
* @example
|
|
234
307
|
* ```typescript
|
|
235
|
-
*
|
|
236
|
-
* constructor(
|
|
237
|
-
* character: CharacterBaseModel | string,
|
|
238
|
-
* text: string,
|
|
239
|
-
* emotion: string
|
|
240
|
-
* ) {
|
|
241
|
-
* super(character, text);
|
|
242
|
-
* this.emotion = emotion;
|
|
243
|
-
* }
|
|
244
|
-
* emotion = ""
|
|
245
|
-
* }
|
|
308
|
+
* setDialogue(new DialogueBaseModel("Hello World", character))
|
|
246
309
|
* ```
|
|
247
310
|
*/
|
|
248
311
|
declare class DialogueBaseModel<TCharacter extends CharacterBaseModel = CharacterBaseModel> {
|
|
249
|
-
|
|
312
|
+
/**
|
|
313
|
+
* @param text The text of the dialogue.
|
|
314
|
+
* @param character The id of the character that is speaking.
|
|
315
|
+
* @param oltherParams Other parameters that can be stored in the dialogue.
|
|
316
|
+
*/
|
|
317
|
+
constructor(text: string, character: string | TCharacter | undefined, oltherParams?: {
|
|
318
|
+
[key: string]: StorageElementType;
|
|
319
|
+
});
|
|
250
320
|
/**
|
|
251
321
|
* The text of the dialogue.
|
|
252
322
|
*/
|
|
@@ -255,6 +325,12 @@ declare class DialogueBaseModel<TCharacter extends CharacterBaseModel = Characte
|
|
|
255
325
|
* The id of the character that is speaking.
|
|
256
326
|
*/
|
|
257
327
|
characterId?: string;
|
|
328
|
+
/**
|
|
329
|
+
* Other parameters that can be stored in the dialogue.
|
|
330
|
+
*/
|
|
331
|
+
oltherParams: {
|
|
332
|
+
[key: string]: StorageElementType;
|
|
333
|
+
};
|
|
258
334
|
}
|
|
259
335
|
|
|
260
336
|
/**
|
|
@@ -552,11 +628,6 @@ interface ITicker<TArgs extends TickerArgsType> {
|
|
|
552
628
|
priority?: UPDATE_PRIORITY;
|
|
553
629
|
}
|
|
554
630
|
|
|
555
|
-
/**
|
|
556
|
-
* StorageElementType are all the types that can be stored in the storage
|
|
557
|
-
*/
|
|
558
|
-
type StorageElementType = string | number | boolean | object | undefined | null;
|
|
559
|
-
|
|
560
631
|
type TickerArgsType = {
|
|
561
632
|
[id: string]: StorageElementType;
|
|
562
633
|
};
|
|
@@ -592,6 +663,11 @@ type TickerArgsType = {
|
|
|
592
663
|
* ```
|
|
593
664
|
*/
|
|
594
665
|
declare class TickerBase<TArgs extends TickerArgsType> implements ITicker<TArgs> {
|
|
666
|
+
/**
|
|
667
|
+
* @param args The arguments that you want to pass to the ticker.
|
|
668
|
+
* @param duration The duration of the ticker. If is undefined, the ticker will be called every frame.
|
|
669
|
+
* @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL.
|
|
670
|
+
*/
|
|
595
671
|
constructor(args: TArgs, duration?: number, priority?: UPDATE_PRIORITY);
|
|
596
672
|
args: TArgs;
|
|
597
673
|
duration?: number;
|
|
@@ -907,16 +983,6 @@ interface ISaveData {
|
|
|
907
983
|
path: string;
|
|
908
984
|
}
|
|
909
985
|
|
|
910
|
-
declare const PauseValueType = "Pause";
|
|
911
|
-
type PauseType = {
|
|
912
|
-
type: typeof PauseValueType;
|
|
913
|
-
duration: number;
|
|
914
|
-
};
|
|
915
|
-
declare function Pause(duration: number): PauseType;
|
|
916
|
-
|
|
917
|
-
type RepeatType = "Repeat";
|
|
918
|
-
declare const Repeat: RepeatType;
|
|
919
|
-
|
|
920
986
|
interface ITickersStep<TArgs extends TickerArgsType> extends ITicker<TArgs> {
|
|
921
987
|
/**
|
|
922
988
|
* Ticker class name
|
|
@@ -941,12 +1007,6 @@ interface ITickersSteps {
|
|
|
941
1007
|
steps: (ITickersStep<any> | RepeatType | PauseType)[];
|
|
942
1008
|
}
|
|
943
1009
|
|
|
944
|
-
/**
|
|
945
|
-
* Munu is a type that contains a list of Label that a player can choose from.
|
|
946
|
-
* For Ren'py this is the equivalent of a menu.
|
|
947
|
-
*/
|
|
948
|
-
type ChoiceMenuOptionsType = ChoiceMenuOptionLabel[];
|
|
949
|
-
|
|
950
1010
|
/**
|
|
951
1011
|
* Set the dialogue to be shown in the game
|
|
952
1012
|
* @param text Text of the dialogue
|
|
@@ -1190,15 +1250,18 @@ declare class GameStepManager {
|
|
|
1190
1250
|
private static increaseCurrentStepIndex;
|
|
1191
1251
|
/**
|
|
1192
1252
|
* Execute the next step and add it to the history.
|
|
1193
|
-
* @returns
|
|
1253
|
+
* @returns StepLabelResultType or undefined.
|
|
1194
1254
|
* @example
|
|
1195
1255
|
* ```typescript
|
|
1196
1256
|
* function nextOnClick() {
|
|
1197
1257
|
* setLoading(true)
|
|
1198
1258
|
* GameStepManager.runNextStep()
|
|
1199
|
-
* .then(() => {
|
|
1259
|
+
* .then((result) => {
|
|
1200
1260
|
* setUpdate((p) => p + 1)
|
|
1201
1261
|
* setLoading(false)
|
|
1262
|
+
* if (result) {
|
|
1263
|
+
* // your code
|
|
1264
|
+
* }
|
|
1202
1265
|
* })
|
|
1203
1266
|
* .catch((e) => {
|
|
1204
1267
|
* setLoading(false)
|
|
@@ -1207,34 +1270,56 @@ declare class GameStepManager {
|
|
|
1207
1270
|
* }
|
|
1208
1271
|
* ```
|
|
1209
1272
|
*/
|
|
1210
|
-
static runNextStep(): Promise<
|
|
1273
|
+
static runNextStep(): Promise<StepLabelResultType>;
|
|
1211
1274
|
/**
|
|
1212
1275
|
* Execute the current step and add it to the history.
|
|
1213
|
-
* @returns
|
|
1276
|
+
* @returns StepLabelResultType or undefined.
|
|
1214
1277
|
*/
|
|
1215
1278
|
private static runCurrentStep;
|
|
1216
1279
|
/**
|
|
1217
1280
|
* Execute the label and add it to the history.
|
|
1218
1281
|
* Is a call function in Ren'Py.
|
|
1219
1282
|
* @param label The label to execute.
|
|
1220
|
-
* @returns
|
|
1283
|
+
* @returns StepLabelResultType or undefined.
|
|
1284
|
+
* @example
|
|
1285
|
+
* ```typescript
|
|
1286
|
+
* GameStepManager.callLabel(StartLabel).then((result) => {
|
|
1287
|
+
* if (result) {
|
|
1288
|
+
* // your code
|
|
1289
|
+
* }
|
|
1290
|
+
* })
|
|
1291
|
+
* ```
|
|
1221
1292
|
* @example
|
|
1222
1293
|
* ```typescript
|
|
1223
|
-
*
|
|
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
|
+
* })
|
|
1224
1298
|
* ```
|
|
1225
1299
|
*/
|
|
1226
|
-
static callLabel(label: typeof Label | Label): Promise<
|
|
1300
|
+
static callLabel(label: typeof Label | Label): Promise<StepLabelResultType>;
|
|
1227
1301
|
/**
|
|
1228
1302
|
* Execute the label, close all labels and add them to the history.
|
|
1229
1303
|
* Is a jump function in Ren'Py.
|
|
1230
|
-
* @param label
|
|
1231
|
-
* @returns
|
|
1304
|
+
* @param label The label to execute.
|
|
1305
|
+
* @returns StepLabelResultType or undefined.
|
|
1232
1306
|
* @example
|
|
1233
1307
|
* ```typescript
|
|
1234
|
-
* GameStepManager.jumpLabel(StartLabel)
|
|
1308
|
+
* GameStepManager.jumpLabel(StartLabel).then((result) => {
|
|
1309
|
+
* if (result) {
|
|
1310
|
+
* // your code
|
|
1311
|
+
* }
|
|
1312
|
+
* })
|
|
1313
|
+
* ```
|
|
1314
|
+
* @example
|
|
1315
|
+
* ```typescript
|
|
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
|
+
* })
|
|
1235
1320
|
* ```
|
|
1236
1321
|
*/
|
|
1237
|
-
static jumpLabel(label: typeof Label | Label): Promise<
|
|
1322
|
+
static jumpLabel(label: typeof Label | Label): Promise<StepLabelResultType>;
|
|
1238
1323
|
/**
|
|
1239
1324
|
* Go back to the last step and add it to the history.
|
|
1240
1325
|
* @param navigate The navigate function.
|
|
@@ -1572,4 +1657,4 @@ declare class GameWindowManager {
|
|
|
1572
1657
|
static import(data: object): void;
|
|
1573
1658
|
}
|
|
1574
1659
|
|
|
1575
|
-
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 };
|