narraleaf-react 0.4.4 → 0.6.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 +31 -33
- package/dist/game/nlcore/action/action.d.ts +29 -24
- package/dist/game/nlcore/action/actionHistory.d.ts +48 -37
- package/dist/game/nlcore/action/actionTypes.d.ts +142 -140
- package/dist/game/nlcore/action/actionable.d.ts +5 -5
- package/dist/game/nlcore/action/actions/characterAction.d.ts +19 -17
- package/dist/game/nlcore/action/actions/conditionAction.d.ts +26 -17
- package/dist/game/nlcore/action/actions/controlAction.d.ts +26 -38
- package/dist/game/nlcore/action/actions/displayableAction.d.ts +26 -22
- package/dist/game/nlcore/action/actions/imageAction.d.ts +25 -22
- package/dist/game/nlcore/action/actions/layerAction.d.ts +16 -12
- package/dist/game/nlcore/action/actions/menuAction.d.ts +21 -16
- package/dist/game/nlcore/action/actions/persistentAction.d.ts +17 -13
- package/dist/game/nlcore/action/actions/sceneAction.d.ts +47 -44
- package/dist/game/nlcore/action/actions/scriptAction.d.ts +14 -10
- package/dist/game/nlcore/action/actions/soundAction.d.ts +20 -18
- package/dist/game/nlcore/action/actions/storyAction.d.ts +8 -8
- package/dist/game/nlcore/action/actions/textAction.d.ts +16 -14
- package/dist/game/nlcore/action/actions/videoAction.d.ts +26 -22
- package/dist/game/nlcore/action/actions.d.ts +20 -13
- package/dist/game/nlcore/action/baseElement.d.ts +2 -2
- package/dist/game/nlcore/action/chain.d.ts +17 -17
- package/dist/game/nlcore/action/constructable.d.ts +5 -5
- package/dist/game/nlcore/action/gameHistory.d.ts +32 -28
- package/dist/game/nlcore/action/logicAction.d.ts +52 -52
- package/dist/game/nlcore/action/serviceAction.d.ts +24 -11
- package/dist/game/nlcore/action/srcManager.d.ts +47 -47
- package/dist/game/nlcore/action/stackModel.d.ts +106 -0
- package/dist/game/nlcore/action/tree/actionTree.d.ts +56 -56
- package/dist/game/nlcore/common/Utils.d.ts +25 -25
- package/dist/game/nlcore/common/core.d.ts +8 -8
- package/dist/game/nlcore/common/elements.d.ts +19 -19
- package/dist/game/nlcore/common/game.d.ts +8 -7
- package/dist/game/nlcore/common/player.d.ts +7 -7
- package/dist/game/nlcore/common/position.d.ts +2 -2
- package/dist/game/nlcore/common/transition.d.ts +6 -6
- package/dist/game/nlcore/common/types.d.ts +9 -9
- package/dist/game/nlcore/elements/character/pause.d.ts +8 -8
- package/dist/game/nlcore/elements/character/sentence.d.ts +25 -25
- package/dist/game/nlcore/elements/character/word.d.ts +18 -18
- package/dist/game/nlcore/elements/character.d.ts +56 -51
- package/dist/game/nlcore/elements/condition.d.ts +20 -20
- package/dist/game/nlcore/elements/control.d.ts +76 -76
- package/dist/game/nlcore/elements/displayable/displayable.d.ts +76 -76
- package/dist/game/nlcore/elements/displayable/image.d.ts +102 -91
- package/dist/game/nlcore/elements/displayable/text.d.ts +74 -74
- package/dist/game/nlcore/elements/layer.d.ts +33 -23
- package/dist/game/nlcore/elements/menu.d.ts +45 -43
- package/dist/game/nlcore/elements/persistent/storable.d.ts +24 -24
- package/dist/game/nlcore/elements/persistent/type.d.ts +3 -3
- package/dist/game/nlcore/elements/persistent.d.ts +86 -86
- package/dist/game/nlcore/elements/scene.d.ts +76 -76
- package/dist/game/nlcore/elements/script.d.ts +16 -16
- package/dist/game/nlcore/elements/service.d.ts +59 -59
- package/dist/game/nlcore/elements/sound.d.ts +89 -75
- package/dist/game/nlcore/elements/story.d.ts +92 -78
- package/dist/game/nlcore/elements/transform/position.d.ts +99 -101
- package/dist/game/nlcore/elements/transform/transform.d.ts +119 -119
- package/dist/game/nlcore/elements/transform/type.d.ts +32 -32
- package/dist/game/nlcore/elements/transition/transition.d.ts +29 -29
- package/dist/game/nlcore/elements/transition/transitions/image/darkness.d.ts +20 -0
- package/dist/game/nlcore/elements/transition/transitions/image/dissolve.d.ts +17 -17
- package/dist/game/nlcore/elements/transition/transitions/image/fadeIn.d.ts +20 -20
- package/dist/game/nlcore/elements/transition/transitions/image/imageTransition.d.ts +28 -28
- package/dist/game/nlcore/elements/transition/transitions/text/fontSize.d.ts +13 -13
- package/dist/game/nlcore/elements/transition/transitions/text/textTransition.d.ts +10 -10
- package/dist/game/nlcore/elements/transition/type.d.ts +51 -51
- package/dist/game/nlcore/elements/type.d.ts +16 -15
- package/dist/game/nlcore/elements/video.d.ts +23 -23
- package/dist/game/nlcore/game/liveGame.d.ts +148 -124
- package/dist/game/nlcore/game/plugin/plugin.d.ts +16 -16
- package/dist/game/nlcore/game/preference.d.ts +32 -32
- package/dist/game/nlcore/game.d.ts +79 -90
- package/dist/game/nlcore/gameTypes.d.ts +439 -334
- package/dist/game/nlcore/types.d.ts +67 -66
- package/dist/game/player/Tasks.d.ts +125 -106
- package/dist/game/player/elements/Player.d.ts +4 -4
- package/dist/game/player/elements/displayable/Displayable.d.ts +1 -1
- package/dist/game/player/elements/displayable/Displayables.d.ts +1 -1
- package/dist/game/player/elements/displayable/Text.d.ts +1 -1
- package/dist/game/player/elements/displayable/type.d.ts +1 -1
- package/dist/game/player/elements/elements.d.ts +8 -8
- package/dist/game/player/elements/image/AspectScaleImage.d.ts +1 -1
- package/dist/game/player/elements/image/Image.d.ts +3 -3
- package/dist/game/player/elements/menu/PlayerMenu.d.ts +3 -3
- package/dist/game/player/elements/menu/UIMenu/Item.d.ts +12 -12
- package/dist/game/player/elements/menu/UIMenu/Menu.d.ts +6 -6
- package/dist/game/player/elements/menu/UIMenu/context.d.ts +23 -23
- package/dist/game/player/elements/menu/type.d.ts +16 -16
- package/dist/game/player/elements/notification/Notifications.d.ts +3 -3
- package/dist/game/player/elements/notification/PlayerNotification.d.ts +4 -4
- package/dist/game/player/elements/notification/context.d.ts +11 -11
- package/dist/game/player/elements/notification/type.d.ts +18 -19
- package/dist/game/player/elements/player/KeyEventAnnouncer.d.ts +1 -1
- package/dist/game/player/elements/player/Layer.d.ts +8 -8
- package/dist/game/player/elements/player/PreferenceUpdateAnnouncer.d.ts +4 -0
- package/dist/game/player/elements/player/RenderEventAnnoucer.d.ts +4 -0
- package/dist/game/player/elements/player/SizeUpdateAnnouncer.d.ts +1 -1
- package/dist/game/player/elements/preload/Preload.d.ts +1 -1
- package/dist/game/player/elements/say/Dialog.d.ts +13 -13
- package/dist/game/player/elements/say/Nametag.d.ts +2 -2
- package/dist/game/player/elements/say/Sentence.d.ts +37 -37
- package/dist/game/player/elements/say/UIDialog.d.ts +72 -69
- package/dist/game/player/elements/say/context.d.ts +4 -4
- package/dist/game/player/elements/say/type.d.ts +53 -53
- package/dist/game/player/elements/say/useDialog.d.ts +18 -16
- package/dist/game/player/elements/scene/Scene.d.ts +1 -1
- package/dist/game/player/elements/type.d.ts +53 -53
- package/dist/game/player/elements/video/video.d.ts +1 -1
- package/dist/game/player/gameState.d.ts +193 -186
- package/dist/game/player/gameState.type.d.ts +1 -1
- package/dist/game/player/guard.d.ts +24 -24
- package/dist/game/player/lib/AspectRatio.d.ts +7 -7
- package/dist/game/player/lib/AudioManager.d.ts +50 -42
- package/dist/game/player/lib/Cursor.d.ts +6 -6
- package/dist/game/player/lib/ErrorBoundary.d.ts +24 -24
- package/dist/game/player/lib/ErrorFallback.d.ts +5 -5
- package/dist/game/player/lib/ImageCacheManager.d.ts +26 -26
- package/dist/game/player/lib/Inspect.d.ts +36 -36
- package/dist/game/player/lib/PageRouter/AnimatePresence.d.ts +4 -0
- package/dist/game/player/lib/PageRouter/Page.d.ts +9 -9
- package/dist/game/player/lib/PageRouter/PageRouter.d.ts +27 -27
- package/dist/game/player/lib/PageRouter/Stage.d.ts +6 -6
- package/dist/game/player/lib/PageRouter/router.d.ts +28 -23
- package/dist/game/player/lib/PlayerFrames.d.ts +10 -10
- package/dist/game/player/lib/Preloaded.d.ts +48 -48
- package/dist/game/player/lib/flush.d.ts +5 -5
- package/dist/game/player/lib/isolated.d.ts +7 -7
- package/dist/game/player/lib/notification.d.ts +47 -47
- package/dist/game/player/lib/preferences.d.ts +8 -8
- package/dist/game/player/lib/useElementVisibility.d.ts +5 -5
- package/dist/game/player/lib/useExposeState.d.ts +10 -10
- package/dist/game/player/lib/useLiveGame.d.ts +1 -1
- package/dist/game/player/libElements.d.ts +12 -12
- package/dist/game/player/provider/game-state.d.ts +24 -24
- package/dist/game/player/provider/preloaded.d.ts +1 -1
- package/dist/game/player/provider/providers.d.ts +7 -7
- package/dist/game/player/provider/ratio.d.ts +1 -1
- package/dist/game/player/type.d.ts +68 -64
- package/dist/index.d.ts +3 -3
- package/dist/main.js +54 -53
- package/dist/util/config.d.ts +37 -37
- package/dist/util/data.d.ts +346 -308
- package/dist/util/logger.d.ts +21 -21
- package/dist/util/singleton.d.ts +5 -5
- package/package.json +5 -3
|
@@ -1,334 +1,439 @@
|
|
|
1
|
-
import { LogicAction } from "./action/logicAction";
|
|
2
|
-
import { ContentNode, RawData } from "./action/tree/actionTree";
|
|
3
|
-
import { StorableData } from "./elements/persistent/type";
|
|
4
|
-
import { ElementStateRaw } from "./elements/story";
|
|
5
|
-
import { StringKeyOf } from "../../util/data";
|
|
6
|
-
import { PlayerStateData } from "../player/gameState";
|
|
7
|
-
import { GuardConfig } from "../player/guard";
|
|
8
|
-
import React from "react";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* @default
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
*
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
*
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
*
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
*
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*
|
|
133
|
-
* @default
|
|
134
|
-
*/
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
*
|
|
138
|
-
* @default false
|
|
139
|
-
*/
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
*
|
|
143
|
-
* @default 10
|
|
144
|
-
*/
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
*
|
|
148
|
-
* @default
|
|
149
|
-
*/
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
*
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
*
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
*
|
|
201
|
-
* @default
|
|
202
|
-
*/
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* If true, when you press [GameConfig.player.skipKey], the game will skip the
|
|
206
|
-
* @default true
|
|
207
|
-
*/
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* If true, when you press [GameConfig.player.skipKey], the game will skip the
|
|
211
|
-
* @default true
|
|
212
|
-
*/
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
*
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
*
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
* @default
|
|
239
|
-
*/
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
*
|
|
258
|
-
* @default
|
|
259
|
-
*/
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* The
|
|
263
|
-
* @default
|
|
264
|
-
*/
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* The
|
|
268
|
-
* @default
|
|
269
|
-
*/
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
*
|
|
317
|
-
* @default
|
|
318
|
-
*/
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
*
|
|
322
|
-
* @default
|
|
323
|
-
*/
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
1
|
+
import { LogicAction } from "./action/logicAction";
|
|
2
|
+
import { ContentNode, RawData } from "./action/tree/actionTree";
|
|
3
|
+
import { StorableData } from "./elements/persistent/type";
|
|
4
|
+
import { ElementStateRaw } from "./elements/story";
|
|
5
|
+
import { StringKeyOf } from "../../util/data";
|
|
6
|
+
import { PlayerStateData } from "../player/gameState";
|
|
7
|
+
import { GuardConfig } from "../player/guard";
|
|
8
|
+
import React from "react";
|
|
9
|
+
import { StackModel, StackModelRawData } from "./action/stackModel";
|
|
10
|
+
import { MenuComponent, NotificationComponent, SayComponent } from "./common/player";
|
|
11
|
+
import { Color, LiveGameEventToken } from "./types";
|
|
12
|
+
export interface SavedGameMetaData {
|
|
13
|
+
/**
|
|
14
|
+
* The timestamp of when the game was created
|
|
15
|
+
*/
|
|
16
|
+
created: number;
|
|
17
|
+
/**
|
|
18
|
+
* The timestamp of when the game was last updated
|
|
19
|
+
*/
|
|
20
|
+
updated: number;
|
|
21
|
+
/**
|
|
22
|
+
* The id of the game, unique to each saved game
|
|
23
|
+
*/
|
|
24
|
+
id: string;
|
|
25
|
+
/**
|
|
26
|
+
* The last sentence that was spoken
|
|
27
|
+
*/
|
|
28
|
+
lastSentence: string | null;
|
|
29
|
+
/**
|
|
30
|
+
* The last speaker that spoke
|
|
31
|
+
*/
|
|
32
|
+
lastSpeaker: string | null;
|
|
33
|
+
/**
|
|
34
|
+
* The hash of the story is used to check whether the stories are compatible.
|
|
35
|
+
*/
|
|
36
|
+
storyHash: string;
|
|
37
|
+
}
|
|
38
|
+
export interface SavedGame {
|
|
39
|
+
name: string;
|
|
40
|
+
meta: SavedGameMetaData;
|
|
41
|
+
game: {
|
|
42
|
+
store: {
|
|
43
|
+
[key: string]: StorableData;
|
|
44
|
+
};
|
|
45
|
+
elementStates: RawData<ElementStateRaw>[];
|
|
46
|
+
stage: PlayerStateData;
|
|
47
|
+
services: {
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
};
|
|
50
|
+
stackModel: StackModelRawData;
|
|
51
|
+
asyncStackModels: StackModelRawData[];
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export type GameConfig = {
|
|
55
|
+
/**
|
|
56
|
+
* The id of the container element for the game
|
|
57
|
+
* @default "__narraleaf_content"
|
|
58
|
+
*/
|
|
59
|
+
contentContainerId: string;
|
|
60
|
+
/**
|
|
61
|
+
* The aspect ratio of the game
|
|
62
|
+
* Ex: 16/9, 4/3, 1/1
|
|
63
|
+
* @default 16/9
|
|
64
|
+
*/
|
|
65
|
+
aspectRatio: number;
|
|
66
|
+
/**
|
|
67
|
+
* The minimum width and height of the player in pixels
|
|
68
|
+
* @default 800
|
|
69
|
+
*/
|
|
70
|
+
minWidth: number;
|
|
71
|
+
/**
|
|
72
|
+
* The minimum width and height of the player in pixels
|
|
73
|
+
* @default 450
|
|
74
|
+
*/
|
|
75
|
+
minHeight: number;
|
|
76
|
+
/**
|
|
77
|
+
* Base width of the player in pixels, Image scale will be calculated based on this value
|
|
78
|
+
*
|
|
79
|
+
* For 16/9, the recommended value is 1920
|
|
80
|
+
* @default 1920
|
|
81
|
+
*/
|
|
82
|
+
width: number;
|
|
83
|
+
/**
|
|
84
|
+
* Base height of the player in pixels, Image scale will be calculated based on this value
|
|
85
|
+
*
|
|
86
|
+
* For 16/9, the recommended value is 1080
|
|
87
|
+
* @default 1080
|
|
88
|
+
*/
|
|
89
|
+
height: number;
|
|
90
|
+
/**
|
|
91
|
+
* When the player presses one of these keys, the game will skip the current action
|
|
92
|
+
*
|
|
93
|
+
* See [Key_Values](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values)
|
|
94
|
+
* @default ["Control"]
|
|
95
|
+
*/
|
|
96
|
+
skipKey: React.KeyboardEvent["key"][];
|
|
97
|
+
/**
|
|
98
|
+
* If true, the game will listen to the window events instead of the player element
|
|
99
|
+
*
|
|
100
|
+
* Using this will allow the game to listen to the keyboard events even when the player is not focused
|
|
101
|
+
* Resulting in a better user experience on skipping actions
|
|
102
|
+
* @default true
|
|
103
|
+
*/
|
|
104
|
+
useWindowListener: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* The debounced interval in milliseconds for updating the aspect ratio
|
|
107
|
+
*
|
|
108
|
+
* Set to 0 to update the ratio immediately on every resize event.
|
|
109
|
+
* @default 50
|
|
110
|
+
*/
|
|
111
|
+
ratioUpdateInterval: number;
|
|
112
|
+
/**
|
|
113
|
+
* The game will preload the image with this delay between each preload task
|
|
114
|
+
*
|
|
115
|
+
* A single preload task may contain {@link GameConfig.preloadConcurrency} images
|
|
116
|
+
* @default 100
|
|
117
|
+
*/
|
|
118
|
+
preloadDelay: number;
|
|
119
|
+
/**
|
|
120
|
+
* Maximum number of images to preload at the same time
|
|
121
|
+
* @default 5
|
|
122
|
+
*/
|
|
123
|
+
preloadConcurrency: number;
|
|
124
|
+
/**
|
|
125
|
+
* Wait for the images to load before showing the game
|
|
126
|
+
* @default true
|
|
127
|
+
*/
|
|
128
|
+
waitForPreload: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Preload all possible images in the scene
|
|
131
|
+
*
|
|
132
|
+
* Enabling this may have a performance impact but is better for the user experience
|
|
133
|
+
* @default true
|
|
134
|
+
*/
|
|
135
|
+
preloadAllImages: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Force the game to clear the cache when the scene changes
|
|
138
|
+
* @default false
|
|
139
|
+
*/
|
|
140
|
+
forceClearCache: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* The number of actions will be predicted and preloaded
|
|
143
|
+
* @default 10
|
|
144
|
+
*/
|
|
145
|
+
maxPreloadActions: number;
|
|
146
|
+
/**
|
|
147
|
+
* Src of the cursor image, if null, the game will show the default cursor
|
|
148
|
+
* @default null
|
|
149
|
+
*/
|
|
150
|
+
cursor: string | null;
|
|
151
|
+
/**
|
|
152
|
+
* Cursor width in pixels
|
|
153
|
+
* @default 30
|
|
154
|
+
*/
|
|
155
|
+
cursorWidth: number;
|
|
156
|
+
/**
|
|
157
|
+
* Cursor height in pixels
|
|
158
|
+
* @default 30
|
|
159
|
+
*/
|
|
160
|
+
cursorHeight: number;
|
|
161
|
+
/**
|
|
162
|
+
* Show overflowed content on player components
|
|
163
|
+
* @default false
|
|
164
|
+
*/
|
|
165
|
+
showOverflow: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Max history size for the page router
|
|
168
|
+
* @default 10
|
|
169
|
+
*/
|
|
170
|
+
maxRouterHistory: number;
|
|
171
|
+
/**
|
|
172
|
+
* Quality of the screenshot, between 0 and 1
|
|
173
|
+
* @default 1
|
|
174
|
+
*/
|
|
175
|
+
screenshotQuality: number;
|
|
176
|
+
/**
|
|
177
|
+
* When the player presses one of these keys, the game will show the next sentence
|
|
178
|
+
*
|
|
179
|
+
* See [Key_Values](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values)
|
|
180
|
+
* @default [" "]
|
|
181
|
+
*/
|
|
182
|
+
nextKey: React.KeyboardEvent["key"][];
|
|
183
|
+
/**
|
|
184
|
+
* If true, the game will scale the dialog to fit the screen
|
|
185
|
+
*
|
|
186
|
+
* Text will look smaller when this is enabled
|
|
187
|
+
* @default true
|
|
188
|
+
*/
|
|
189
|
+
useAspectScale: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* The delay in milliseconds before the game automatically shows the next sentence
|
|
192
|
+
*
|
|
193
|
+
* Only works when the player preference "autoForward" is enabled
|
|
194
|
+
* @default 3000
|
|
195
|
+
*/
|
|
196
|
+
autoForwardDelay: number;
|
|
197
|
+
/**
|
|
198
|
+
* The default pause duration in milliseconds when auto-forward is enabled
|
|
199
|
+
*
|
|
200
|
+
* When auto-forward is enabled, any Pause without a custom duration will use this value
|
|
201
|
+
* @default 1000
|
|
202
|
+
*/
|
|
203
|
+
autoForwardDefaultPause: number;
|
|
204
|
+
/**
|
|
205
|
+
* If true, when you press [GameConfig.player.skipKey], the game will skip the image transform
|
|
206
|
+
* @default true
|
|
207
|
+
*/
|
|
208
|
+
allowSkipImageTransform: boolean;
|
|
209
|
+
/**
|
|
210
|
+
* If true, when you press [GameConfig.player.skipKey], the game will skip the image transition
|
|
211
|
+
* @default true
|
|
212
|
+
*/
|
|
213
|
+
allowSkipImageTransition: boolean;
|
|
214
|
+
/**
|
|
215
|
+
* If true, when you press [GameConfig.player.skipKey], the game will skip the background transform
|
|
216
|
+
* @default true
|
|
217
|
+
*/
|
|
218
|
+
allowSkipBackgroundTransform: boolean;
|
|
219
|
+
/**
|
|
220
|
+
* If true, when you press [GameConfig.player.skipKey], the game will skip the background transition
|
|
221
|
+
* @default false
|
|
222
|
+
*/
|
|
223
|
+
allowSkipBackgroundTransition: boolean;
|
|
224
|
+
/**
|
|
225
|
+
* If true, when you press [GameConfig.player.skipKey], the game will skip the text transform
|
|
226
|
+
* @default true
|
|
227
|
+
*/
|
|
228
|
+
allowSkipTextTransform: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* If true, when you press [GameConfig.player.skipKey], the game will skip the text transition
|
|
231
|
+
* @default true
|
|
232
|
+
*/
|
|
233
|
+
allowSkipTextTransition: boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Base width of the dialog in pixels
|
|
236
|
+
*
|
|
237
|
+
* For 16/9, the recommended value is 1920
|
|
238
|
+
* @default 1920
|
|
239
|
+
*/
|
|
240
|
+
dialogWidth: number;
|
|
241
|
+
/**
|
|
242
|
+
* Base height of the dialog in pixels
|
|
243
|
+
*
|
|
244
|
+
* For 16/9, the recommended value is 1080 * 0.2 (20% of the screen height)
|
|
245
|
+
* @default 1080 * 0.2
|
|
246
|
+
*/
|
|
247
|
+
dialogHeight: number;
|
|
248
|
+
/**
|
|
249
|
+
* If true, when you press [GameConfig.player.skipKey], the game will skip the text transform
|
|
250
|
+
* @default true
|
|
251
|
+
*/
|
|
252
|
+
allowSkipLayersTransform: boolean;
|
|
253
|
+
/**
|
|
254
|
+
* If true, when you press [GameConfig.player.skipKey], the game will skip the video transform
|
|
255
|
+
*
|
|
256
|
+
* This will only skip the "play" action
|
|
257
|
+
*
|
|
258
|
+
* @default false
|
|
259
|
+
*/
|
|
260
|
+
allowSkipVideo: boolean;
|
|
261
|
+
/**
|
|
262
|
+
* The default text color for the dialog
|
|
263
|
+
* @default "#000"
|
|
264
|
+
*/
|
|
265
|
+
defaultTextColor: Color;
|
|
266
|
+
/**
|
|
267
|
+
* The default text color for the character nametag
|
|
268
|
+
* @default "#000"
|
|
269
|
+
*/
|
|
270
|
+
defaultNametagColor: Color;
|
|
271
|
+
/**
|
|
272
|
+
* The component to use for the notification
|
|
273
|
+
* @default DefaultNotification
|
|
274
|
+
*/
|
|
275
|
+
notification: NotificationComponent;
|
|
276
|
+
/**
|
|
277
|
+
* The component to use for the menu
|
|
278
|
+
* @default DefaultMenu
|
|
279
|
+
*/
|
|
280
|
+
menu: MenuComponent;
|
|
281
|
+
/**
|
|
282
|
+
* The component to use for the say
|
|
283
|
+
* @default DefaultSay
|
|
284
|
+
*/
|
|
285
|
+
dialog: SayComponent;
|
|
286
|
+
/**
|
|
287
|
+
* The function to call when an error occurs
|
|
288
|
+
* @default () => {}
|
|
289
|
+
*/
|
|
290
|
+
onError: (error: Error) => void;
|
|
291
|
+
app: {
|
|
292
|
+
debug: boolean;
|
|
293
|
+
/**
|
|
294
|
+
* Log level for the logger
|
|
295
|
+
* Set to true to enable all logs
|
|
296
|
+
*/
|
|
297
|
+
logger: {
|
|
298
|
+
log: boolean;
|
|
299
|
+
info: boolean;
|
|
300
|
+
warn: boolean;
|
|
301
|
+
error: boolean;
|
|
302
|
+
debug: boolean;
|
|
303
|
+
trace: boolean;
|
|
304
|
+
verbose: boolean;
|
|
305
|
+
} | boolean;
|
|
306
|
+
/**
|
|
307
|
+
* If true, the game will show the inspector when you hover over the element
|
|
308
|
+
*/
|
|
309
|
+
inspector: boolean;
|
|
310
|
+
/**
|
|
311
|
+
* The config of {@link GameStateGuard}
|
|
312
|
+
*/
|
|
313
|
+
guard: GuardConfig;
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Default font size for the game
|
|
317
|
+
* @default "16px"
|
|
318
|
+
*/
|
|
319
|
+
fontSize: React.CSSProperties["fontSize"];
|
|
320
|
+
/**
|
|
321
|
+
* Default font weight for the game
|
|
322
|
+
* @default 400
|
|
323
|
+
*/
|
|
324
|
+
fontWeight: number;
|
|
325
|
+
/**
|
|
326
|
+
* Default font weight for the game
|
|
327
|
+
* @default 700
|
|
328
|
+
*/
|
|
329
|
+
fontWeightBold: number;
|
|
330
|
+
/**
|
|
331
|
+
* Default font family for the game
|
|
332
|
+
* @default "sans-serif"
|
|
333
|
+
*/
|
|
334
|
+
fontFamily: React.CSSProperties["fontFamily"];
|
|
335
|
+
/**
|
|
336
|
+
* Override the default stage
|
|
337
|
+
* @default null
|
|
338
|
+
*/
|
|
339
|
+
stage: React.ReactNode | null;
|
|
340
|
+
/**
|
|
341
|
+
* The default color for the menu choices
|
|
342
|
+
* @default "#000"
|
|
343
|
+
*/
|
|
344
|
+
defaultMenuChoiceColor: Color;
|
|
345
|
+
/**
|
|
346
|
+
* The maximum number of times a stack model can loop
|
|
347
|
+
* @default 1000
|
|
348
|
+
*/
|
|
349
|
+
maxStackModelLoop: number;
|
|
350
|
+
/**
|
|
351
|
+
* The maximum number of actions to store in the action history
|
|
352
|
+
* @default 100
|
|
353
|
+
*/
|
|
354
|
+
maxActionHistory: number;
|
|
355
|
+
};
|
|
356
|
+
export type GameSettings = {
|
|
357
|
+
volume: number;
|
|
358
|
+
};
|
|
359
|
+
export type StackModelWaiting = {
|
|
360
|
+
type: "any" | "all";
|
|
361
|
+
stackModels: StackModel[];
|
|
362
|
+
};
|
|
363
|
+
export type CalledActionResult<T extends keyof LogicAction.ActionContents = any> = {
|
|
364
|
+
[K in StringKeyOf<LogicAction.ActionContents>]: {
|
|
365
|
+
type: T extends undefined ? K : T;
|
|
366
|
+
node: ContentNode<LogicAction.ActionContents[T extends undefined ? K : T]> | null;
|
|
367
|
+
wait?: StackModelWaiting | null;
|
|
368
|
+
};
|
|
369
|
+
}[StringKeyOf<LogicAction.ActionContents>];
|
|
370
|
+
export interface NotificationToken extends LiveGameEventToken {
|
|
371
|
+
promise: Promise<void>;
|
|
372
|
+
}
|
|
373
|
+
export type GamePreference = {
|
|
374
|
+
/**
|
|
375
|
+
* If true, the game will automatically forward to the next sentence when the player has finished the current sentence
|
|
376
|
+
* @default false
|
|
377
|
+
*/
|
|
378
|
+
autoForward: boolean;
|
|
379
|
+
/**
|
|
380
|
+
* If true, the game will allow the player to skip the dialog
|
|
381
|
+
* @default true
|
|
382
|
+
*/
|
|
383
|
+
skip: boolean;
|
|
384
|
+
/**
|
|
385
|
+
* If true, the game will show the dialog
|
|
386
|
+
* @default true
|
|
387
|
+
*/
|
|
388
|
+
showDialog: boolean;
|
|
389
|
+
/**
|
|
390
|
+
* The multiplier of the dialog speed
|
|
391
|
+
*
|
|
392
|
+
* Dialog speed will apply to:
|
|
393
|
+
* - The text speed
|
|
394
|
+
* - The auto-forward delay
|
|
395
|
+
* @default 1.0
|
|
396
|
+
*/
|
|
397
|
+
gameSpeed: number;
|
|
398
|
+
/**
|
|
399
|
+
* The speed of the text effects in characters per second.
|
|
400
|
+
* @default 10
|
|
401
|
+
*/
|
|
402
|
+
cps: number;
|
|
403
|
+
/**
|
|
404
|
+
* The volume of the voice
|
|
405
|
+
* @default 1
|
|
406
|
+
*/
|
|
407
|
+
voiceVolume: number;
|
|
408
|
+
/**
|
|
409
|
+
* The volume of the background music
|
|
410
|
+
* @default 1
|
|
411
|
+
*/
|
|
412
|
+
bgmVolume: number;
|
|
413
|
+
/**
|
|
414
|
+
* The volume of the sound effects
|
|
415
|
+
* @default 1
|
|
416
|
+
*/
|
|
417
|
+
soundVolume: number;
|
|
418
|
+
/**
|
|
419
|
+
* The volume of the global audio
|
|
420
|
+
* @default 1
|
|
421
|
+
*/
|
|
422
|
+
globalVolume: number;
|
|
423
|
+
/**
|
|
424
|
+
* The delay in milliseconds before the game starts skipping actions
|
|
425
|
+
*
|
|
426
|
+
* This is used to prevent the game from skipping actions too quickly when the player presses the skip key.
|
|
427
|
+
*
|
|
428
|
+
* Set to 0 to skip actions immediately when the player presses the skip key.
|
|
429
|
+
* @default 500
|
|
430
|
+
*/
|
|
431
|
+
skipDelay: number;
|
|
432
|
+
/**
|
|
433
|
+
* The interval in milliseconds between each skip action.
|
|
434
|
+
* ex: 100 ms means the player can skip 10 actions per second.
|
|
435
|
+
* higher value means slower skipping.
|
|
436
|
+
* @default 100
|
|
437
|
+
*/
|
|
438
|
+
skipInterval: number;
|
|
439
|
+
};
|