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
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<picture>
|
|
2
2
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/NarraLeaf/.github/refs/heads/master/doc/banner-md-transparent.png">
|
|
3
3
|
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/NarraLeaf/.github/refs/heads/master/doc/banner-md-light.png">
|
|
4
|
-
<img alt="
|
|
4
|
+
<img alt="NarraLeaf Logo" src="https://raw.githubusercontent.com/NarraLeaf/.github/refs/heads/master/doc/banner-md-light.png">
|
|
5
5
|
</picture>
|
|
6
6
|
|
|
7
7
|
<h1 align="center">NarraLeaf-React</h1>
|
|
@@ -31,49 +31,36 @@ NarraLeaf-React uses TypeScript for all scripting, so you don't have to learn a
|
|
|
31
31
|
It also has a highly abstracted and easy-to-use API, for example:
|
|
32
32
|
|
|
33
33
|
```typescript
|
|
34
|
-
import {Character, Menu, Scene,
|
|
34
|
+
import {Character, Menu, Scene, c, b} from "narraleaf-react";
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
```typescript
|
|
38
|
-
const scene1 = new Scene("
|
|
39
|
-
background: "/background
|
|
38
|
+
const scene1 = new Scene("Scene1: Hello World", {
|
|
39
|
+
background: "/link/to/background.jpg",
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
const
|
|
43
|
-
const
|
|
42
|
+
const jS = new Character("John Smith");
|
|
43
|
+
const jD = new Character("John Doe");
|
|
44
44
|
|
|
45
45
|
scene1.action([
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* John Doe: Also, don't forget to check out the documentation!
|
|
58
|
-
*/
|
|
59
|
-
johnDoe.say("Also, don't forget to check out the documentation!"),
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Menu: Start the journey
|
|
63
|
-
* > Yes I will!
|
|
64
|
-
* - John Smith: Great! Let's start the journey!
|
|
65
|
-
* - John Smith: You can open issues on GitHub if you have any questions.
|
|
66
|
-
* > No, I'm going to check the documentation
|
|
67
|
-
* - John Smith: Sure! Take your time!
|
|
68
|
-
*/
|
|
46
|
+
jS`Hello, world!`,
|
|
47
|
+
jS`This is my first ${b("NarraLeaf")} story.`,
|
|
48
|
+
jS`Start editing ${c("src/story.js", "#00f")} and enjoy the journey!`,
|
|
49
|
+
|
|
50
|
+
jD`Also, don't forget to check out the ${c("documentation", "#00f")}!`,
|
|
51
|
+
|
|
52
|
+
"By the way, the documentation is available on https://react.narraleaf.com/documentation",
|
|
53
|
+
"You can also visit the website for demo and more information.",
|
|
54
|
+
|
|
69
55
|
Menu.prompt("Start the journey")
|
|
56
|
+
|
|
70
57
|
.choose("Yes I will!", [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
.say("You can open issues on GitHub if you have any questions.")
|
|
58
|
+
jS`Great! Let's start the journey!`,
|
|
59
|
+
jS`You can open issues on GitHub if you have any questions.`
|
|
74
60
|
])
|
|
61
|
+
|
|
75
62
|
.choose("No, I'm going to check the documentation", [
|
|
76
|
-
|
|
63
|
+
jS`Sure! Take your time!`
|
|
77
64
|
])
|
|
78
65
|
]);
|
|
79
66
|
```
|
|
@@ -133,6 +120,17 @@ npm install narraleaf-react
|
|
|
133
120
|
- [Plugin](https://react.narraleaf.com/documentation/core/plugin)
|
|
134
121
|
- [Utils](https://react.narraleaf.com/documentation/core/utils)
|
|
135
122
|
- [Player](https://react.narraleaf.com/documentation/player)
|
|
123
|
+
- [Player](https://react.narraleaf.com/documentation/player/player)
|
|
124
|
+
- [GameProviders](https://react.narraleaf.com/documentation/player/game-providers)
|
|
125
|
+
- Hooks
|
|
126
|
+
- [useGame](https://react.narraleaf.com/documentation/player/hooks/useGame)
|
|
127
|
+
- [usePreferences](https://react.narraleaf.com/documentation/player/hooks/usePreferences)
|
|
128
|
+
- [useRouter](https://react.narraleaf.com/documentation/player/hooks/useRouter)
|
|
129
|
+
- [useDialog](https://react.narraleaf.com/documentation/player/hooks/useDialog)
|
|
130
|
+
- [Page Router](https://react.narraleaf.com/documentation/player/page-router)
|
|
131
|
+
- [Dialog](https://react.narraleaf.com/documentation/player/dialog)
|
|
132
|
+
- [Notification](https://react.narraleaf.com/documentation/player/notification)
|
|
133
|
+
- [Menu](https://react.narraleaf.com/documentation/player/menu)
|
|
136
134
|
- About
|
|
137
135
|
- [License](https://react.narraleaf.com/documentation/info/license)
|
|
138
136
|
- [Incompatible Changes](https://react.narraleaf.com/documentation/info/incompatible-changes)
|
|
@@ -1,24 +1,29 @@
|
|
|
1
|
-
import { LogicAction } from "./logicAction";
|
|
2
|
-
import { ContentNode } from "../action/tree/actionTree";
|
|
3
|
-
import type { CalledActionResult } from "../gameTypes";
|
|
4
|
-
import { Awaitable } from "../../../util/data";
|
|
5
|
-
import { GameState } from "../../player/gameState";
|
|
6
|
-
import { Story } from "../elements/story";
|
|
7
|
-
import { ActionSearchOptions } from "../types";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { LogicAction } from "./logicAction";
|
|
2
|
+
import { ContentNode } from "../action/tree/actionTree";
|
|
3
|
+
import type { CalledActionResult } from "../gameTypes";
|
|
4
|
+
import { Awaitable } from "../../../util/data";
|
|
5
|
+
import { GameState } from "../../player/gameState";
|
|
6
|
+
import { Story } from "../elements/story";
|
|
7
|
+
import { ActionSearchOptions } from "../types";
|
|
8
|
+
import type { StackModel } from "./stackModel";
|
|
9
|
+
export type ActionExecutionInjection = {
|
|
10
|
+
stackModel: StackModel;
|
|
11
|
+
};
|
|
12
|
+
export type ExecutedActionResult = CalledActionResult | Awaitable<CalledActionResult, any> | (CalledActionResult | Awaitable<CalledActionResult, any>)[] | null;
|
|
13
|
+
export declare class Action<ContentNodeType = any, Callee = LogicAction.GameElement, Type extends string = any> {
|
|
14
|
+
static ActionTypes: {
|
|
15
|
+
action: string;
|
|
16
|
+
};
|
|
17
|
+
callee: Callee;
|
|
18
|
+
type: Type;
|
|
19
|
+
contentNode: ContentNode<ContentNodeType>;
|
|
20
|
+
_id: string;
|
|
21
|
+
readonly __stack: string;
|
|
22
|
+
constructor(callee: Callee, type: Type, contentNode: ContentNode<ContentNodeType>);
|
|
23
|
+
executeAction(_state: GameState, _injection: ActionExecutionInjection): ExecutedActionResult;
|
|
24
|
+
getId(): string;
|
|
25
|
+
setId(id: string): void;
|
|
26
|
+
setContent(content: ContentNodeType): this;
|
|
27
|
+
setContentNode(contentNode: ContentNode<ContentNodeType>): this;
|
|
28
|
+
getFutureActions(_story: Story, _options: ActionSearchOptions): LogicAction.Actions[];
|
|
29
|
+
}
|
|
@@ -1,37 +1,48 @@
|
|
|
1
|
-
import { Timeline } from "../../../game/player/Tasks";
|
|
2
|
-
import { Action } from "./action";
|
|
3
|
-
import { LiveGameEventToken } from "../types";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
1
|
+
import { Timeline } from "../../../game/player/Tasks";
|
|
2
|
+
import { Action } from "./action";
|
|
3
|
+
import { LiveGameEventToken } from "../types";
|
|
4
|
+
import { GameHistoryManager } from "./gameHistory";
|
|
5
|
+
import { StackModel, StackModelRawData } from "./stackModel";
|
|
6
|
+
import type { LiveGame } from "../game/liveGame";
|
|
7
|
+
export type ActionHistory<T extends Array<unknown> = any> = {
|
|
8
|
+
action: Action;
|
|
9
|
+
timeline?: Timeline;
|
|
10
|
+
args: T;
|
|
11
|
+
id: string;
|
|
12
|
+
undo?: (...args: T) => void;
|
|
13
|
+
rootStackSnapshot: StackModelRawData;
|
|
14
|
+
stackModel: StackModel;
|
|
15
|
+
};
|
|
16
|
+
export type ActionHistoryPushOptions = {
|
|
17
|
+
timeline?: Timeline;
|
|
18
|
+
stackModel: StackModel;
|
|
19
|
+
action: Action;
|
|
20
|
+
};
|
|
21
|
+
export declare class ActionHistoryManager {
|
|
22
|
+
readonly liveGame: LiveGame;
|
|
23
|
+
private history;
|
|
24
|
+
private readonly maxHistorySize;
|
|
25
|
+
private hooks;
|
|
26
|
+
constructor(maxHistorySize: number | undefined, liveGame: LiveGame);
|
|
27
|
+
/**
|
|
28
|
+
* Push an action to the history
|
|
29
|
+
*/
|
|
30
|
+
push<T extends Array<any> = Array<any>>(props: ActionHistoryPushOptions, onUndo?: (...args: T) => void, args?: T): {
|
|
31
|
+
id: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Undo all actions until the given id
|
|
35
|
+
*
|
|
36
|
+
* If the given id is not found, nothing will happen
|
|
37
|
+
* @param id random id generated by push
|
|
38
|
+
*/
|
|
39
|
+
undoUntil(id: string): ActionHistory | null;
|
|
40
|
+
undo(gameHistory: GameHistoryManager): ActionHistory | null;
|
|
41
|
+
ableToUndo(gameHistory: GameHistoryManager): boolean;
|
|
42
|
+
onUndo(callback: (affected: ActionHistory<any>[]) => void): LiveGameEventToken;
|
|
43
|
+
offUndo(callback: (affected: ActionHistory<any>[]) => void): void;
|
|
44
|
+
getHistory(): ActionHistory<any>[];
|
|
45
|
+
onHistoryLimit(callback: (removed: ActionHistory<any>[]) => void): LiveGameEventToken;
|
|
46
|
+
offHistoryLimit(callback: (removed: ActionHistory<any>[]) => void): void;
|
|
47
|
+
reset(): void;
|
|
48
|
+
}
|
|
@@ -1,140 +1,142 @@
|
|
|
1
|
-
import { LogicAction } from "../action/logicAction";
|
|
2
|
-
import type { Story } from "../elements/story";
|
|
3
|
-
import type { ConditionData } from "../elements/condition";
|
|
4
|
-
import { Color, ImageSrc } from "../types";
|
|
5
|
-
import { Transform } from "../elements/transform/transform";
|
|
6
|
-
import type { Scene } from "../elements/scene";
|
|
7
|
-
import type { MenuData } from "../elements/menu";
|
|
8
|
-
import { Awaitable, FlexibleTuple, SelectElementFromEach } from "../../../util/data";
|
|
9
|
-
import type { Sound } from "../elements/sound";
|
|
10
|
-
import type { Script } from "../elements/script";
|
|
11
|
-
import { Sentence } from "../elements/character/sentence";
|
|
12
|
-
import type { TransformDefinitions } from "../elements/transform/type";
|
|
13
|
-
import { Image, TagGroupDefinition } from "../elements/displayable/image";
|
|
14
|
-
import { FadeOptions } from "../elements/type";
|
|
15
|
-
import { Transition } from "../elements/transition/transition";
|
|
16
|
-
import { ImageTransition } from "../elements/transition/transitions/image/imageTransition";
|
|
17
|
-
import { Layer } from "../elements/layer";
|
|
18
|
-
export declare const DisplayableActionTypes: {
|
|
19
|
-
readonly action: "displayable:action";
|
|
20
|
-
readonly applyTransform: "displayable:applyTransform";
|
|
21
|
-
readonly applyTransition: "displayable:applyTransition";
|
|
22
|
-
readonly init: "displayable:init";
|
|
23
|
-
};
|
|
24
|
-
export type DisplayableActionContentType<TransitionType extends Transition = Transition> = {
|
|
25
|
-
[K in typeof DisplayableActionTypes[keyof typeof DisplayableActionTypes]]: K extends "displayable:applyTransform" ? [Transform] : K extends "displayable:applyTransition" ? [TransitionType, ((transition: TransitionType) => TransitionType)?] : K extends "displayable:init" ? [scene: Scene | null, layer: Layer | null, isElement?: boolean] : any;
|
|
26
|
-
};
|
|
27
|
-
export declare const CharacterActionTypes: {
|
|
28
|
-
readonly say: "character:say";
|
|
29
|
-
readonly action: "character:action";
|
|
30
|
-
readonly setName: "character:setName";
|
|
31
|
-
};
|
|
32
|
-
export type CharacterActionContentType = {
|
|
33
|
-
[K in typeof CharacterActionTypes[keyof typeof CharacterActionTypes]]: K extends "character:say" ? Sentence : K extends "character:action" ? any : K extends "character:setName" ? [string] : any;
|
|
34
|
-
};
|
|
35
|
-
export declare const SceneActionTypes: {
|
|
36
|
-
readonly action: "scene:action";
|
|
37
|
-
readonly init: "scene:init";
|
|
38
|
-
readonly exit: "scene:exit";
|
|
39
|
-
readonly jumpTo: "scene:jumpTo";
|
|
40
|
-
readonly setBackgroundMusic: "scene:setBackgroundMusic";
|
|
41
|
-
readonly preUnmount: "scene:preUnmount";
|
|
42
|
-
readonly transitionToScene: "scene:transitionToScene";
|
|
43
|
-
};
|
|
44
|
-
export type SceneActionContentType = {
|
|
45
|
-
[K in typeof SceneActionTypes[keyof typeof SceneActionTypes]]: K extends typeof SceneActionTypes["action"] ? Scene : K extends typeof SceneActionTypes["init"] ? [Scene] : K extends typeof SceneActionTypes["exit"] ? [] : K extends typeof SceneActionTypes["jumpTo"] ? [Scene] : K extends typeof SceneActionTypes["setBackgroundMusic"] ? [Sound | null, number?] : K extends typeof SceneActionTypes["preUnmount"] ? [] : K extends typeof SceneActionTypes["transitionToScene"] ? [ImageTransition, Scene | undefined, ImageSrc | Color | undefined] : any;
|
|
46
|
-
};
|
|
47
|
-
export declare const StoryActionTypes: {
|
|
48
|
-
readonly action: "story:action";
|
|
49
|
-
};
|
|
50
|
-
export type StoryActionContentType = {
|
|
51
|
-
[K in typeof StoryActionTypes[keyof typeof StoryActionTypes]]: K extends "story:action" ? Story : any;
|
|
52
|
-
};
|
|
53
|
-
export declare const ImageActionTypes: {
|
|
54
|
-
readonly action: "image:action";
|
|
55
|
-
readonly setSrc: "image:setSrc";
|
|
56
|
-
readonly flush: "image:flush";
|
|
57
|
-
readonly initWearable: "image:initWearable";
|
|
58
|
-
readonly setAppearance: "image:setAppearance";
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
readonly
|
|
84
|
-
readonly
|
|
85
|
-
readonly
|
|
86
|
-
readonly
|
|
87
|
-
readonly
|
|
88
|
-
readonly
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
readonly
|
|
96
|
-
readonly
|
|
97
|
-
readonly
|
|
98
|
-
readonly
|
|
99
|
-
readonly
|
|
100
|
-
readonly
|
|
101
|
-
readonly
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
readonly
|
|
109
|
-
readonly
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
readonly
|
|
117
|
-
readonly
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
readonly
|
|
132
|
-
readonly
|
|
133
|
-
readonly
|
|
134
|
-
readonly
|
|
135
|
-
readonly
|
|
136
|
-
readonly
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
1
|
+
import { LogicAction } from "../action/logicAction";
|
|
2
|
+
import type { Story } from "../elements/story";
|
|
3
|
+
import type { ConditionData } from "../elements/condition";
|
|
4
|
+
import { Color, ImageSrc } from "../types";
|
|
5
|
+
import { Transform } from "../elements/transform/transform";
|
|
6
|
+
import type { Scene } from "../elements/scene";
|
|
7
|
+
import type { MenuData } from "../elements/menu";
|
|
8
|
+
import { Awaitable, FlexibleTuple, SelectElementFromEach } from "../../../util/data";
|
|
9
|
+
import type { Sound } from "../elements/sound";
|
|
10
|
+
import type { Script } from "../elements/script";
|
|
11
|
+
import { Sentence } from "../elements/character/sentence";
|
|
12
|
+
import type { TransformDefinitions } from "../elements/transform/type";
|
|
13
|
+
import { Image, TagGroupDefinition } from "../elements/displayable/image";
|
|
14
|
+
import { FadeOptions } from "../elements/type";
|
|
15
|
+
import { Transition } from "../elements/transition/transition";
|
|
16
|
+
import { ImageTransition } from "../elements/transition/transitions/image/imageTransition";
|
|
17
|
+
import { Layer } from "../elements/layer";
|
|
18
|
+
export declare const DisplayableActionTypes: {
|
|
19
|
+
readonly action: "displayable:action";
|
|
20
|
+
readonly applyTransform: "displayable:applyTransform";
|
|
21
|
+
readonly applyTransition: "displayable:applyTransition";
|
|
22
|
+
readonly init: "displayable:init";
|
|
23
|
+
};
|
|
24
|
+
export type DisplayableActionContentType<TransitionType extends Transition = Transition> = {
|
|
25
|
+
[K in typeof DisplayableActionTypes[keyof typeof DisplayableActionTypes]]: K extends "displayable:applyTransform" ? [Transform] : K extends "displayable:applyTransition" ? [TransitionType, ((transition: TransitionType) => TransitionType)?] : K extends "displayable:init" ? [scene: Scene | null, layer: Layer | null, isElement?: boolean] : any;
|
|
26
|
+
};
|
|
27
|
+
export declare const CharacterActionTypes: {
|
|
28
|
+
readonly say: "character:say";
|
|
29
|
+
readonly action: "character:action";
|
|
30
|
+
readonly setName: "character:setName";
|
|
31
|
+
};
|
|
32
|
+
export type CharacterActionContentType = {
|
|
33
|
+
[K in typeof CharacterActionTypes[keyof typeof CharacterActionTypes]]: K extends "character:say" ? Sentence : K extends "character:action" ? any : K extends "character:setName" ? [string] : any;
|
|
34
|
+
};
|
|
35
|
+
export declare const SceneActionTypes: {
|
|
36
|
+
readonly action: "scene:action";
|
|
37
|
+
readonly init: "scene:init";
|
|
38
|
+
readonly exit: "scene:exit";
|
|
39
|
+
readonly jumpTo: "scene:jumpTo";
|
|
40
|
+
readonly setBackgroundMusic: "scene:setBackgroundMusic";
|
|
41
|
+
readonly preUnmount: "scene:preUnmount";
|
|
42
|
+
readonly transitionToScene: "scene:transitionToScene";
|
|
43
|
+
};
|
|
44
|
+
export type SceneActionContentType = {
|
|
45
|
+
[K in typeof SceneActionTypes[keyof typeof SceneActionTypes]]: K extends typeof SceneActionTypes["action"] ? Scene : K extends typeof SceneActionTypes["init"] ? [Scene] : K extends typeof SceneActionTypes["exit"] ? [] : K extends typeof SceneActionTypes["jumpTo"] ? [Scene] : K extends typeof SceneActionTypes["setBackgroundMusic"] ? [Sound | null, number?] : K extends typeof SceneActionTypes["preUnmount"] ? [] : K extends typeof SceneActionTypes["transitionToScene"] ? [ImageTransition, Scene | undefined, ImageSrc | Color | undefined] : any;
|
|
46
|
+
};
|
|
47
|
+
export declare const StoryActionTypes: {
|
|
48
|
+
readonly action: "story:action";
|
|
49
|
+
};
|
|
50
|
+
export type StoryActionContentType = {
|
|
51
|
+
[K in typeof StoryActionTypes[keyof typeof StoryActionTypes]]: K extends "story:action" ? Story : any;
|
|
52
|
+
};
|
|
53
|
+
export declare const ImageActionTypes: {
|
|
54
|
+
readonly action: "image:action";
|
|
55
|
+
readonly setSrc: "image:setSrc";
|
|
56
|
+
readonly flush: "image:flush";
|
|
57
|
+
readonly initWearable: "image:initWearable";
|
|
58
|
+
readonly setAppearance: "image:setAppearance";
|
|
59
|
+
readonly setDarkness: "image:setDarkness";
|
|
60
|
+
};
|
|
61
|
+
export type ImageActionContentType = {
|
|
62
|
+
[K in typeof ImageActionTypes[keyof typeof ImageActionTypes]]: K extends "image:setSrc" ? [ImageSrc | Color] : K extends "image:flush" ? [] : K extends "image:initWearable" ? [Image] : K extends "image:setAppearance" ? [FlexibleTuple<SelectElementFromEach<TagGroupDefinition>> | string[], ImageTransition | undefined] : K extends "image:setDarkness" ? [darkness: number, duration?: number, easing?: TransformDefinitions.EasingDefinition] : any;
|
|
63
|
+
} & DisplayableActionContentType<ImageTransition>;
|
|
64
|
+
export declare const ConditionActionTypes: {
|
|
65
|
+
readonly action: "condition:action";
|
|
66
|
+
};
|
|
67
|
+
export type ConditionActionContentType = {
|
|
68
|
+
[K in typeof ConditionActionTypes[keyof typeof ConditionActionTypes]]: K extends "condition:action" ? ConditionData : any;
|
|
69
|
+
};
|
|
70
|
+
export declare const ScriptActionTypes: {
|
|
71
|
+
readonly action: "script:action";
|
|
72
|
+
};
|
|
73
|
+
export type ScriptActionContentType = {
|
|
74
|
+
[K in typeof ScriptActionTypes[keyof typeof ScriptActionTypes]]: K extends "script:action" ? Script : any;
|
|
75
|
+
};
|
|
76
|
+
export declare const MenuActionTypes: {
|
|
77
|
+
readonly action: "menu:action";
|
|
78
|
+
};
|
|
79
|
+
export type MenuActionContentType = {
|
|
80
|
+
[K in typeof MenuActionTypes[keyof typeof MenuActionTypes]]: K extends "menu:action" ? MenuData : any;
|
|
81
|
+
};
|
|
82
|
+
export declare const SoundActionTypes: {
|
|
83
|
+
readonly action: "sound:action";
|
|
84
|
+
readonly play: "sound:play";
|
|
85
|
+
readonly stop: "sound:stop";
|
|
86
|
+
readonly setVolume: "sound:setVolume";
|
|
87
|
+
readonly setRate: "sound:setRate";
|
|
88
|
+
readonly pause: "sound:pause";
|
|
89
|
+
readonly resume: "sound:resume";
|
|
90
|
+
};
|
|
91
|
+
export type SoundActionContentType = {
|
|
92
|
+
[K in typeof SoundActionTypes[keyof typeof SoundActionTypes]]: K extends "sound:play" ? [FadeOptions] : K extends "sound:stop" ? [FadeOptions] : K extends "sound:setVolume" ? [volumn: number, duration: number] : K extends "sound:setRate" ? [number] : K extends "sound:pause" ? [FadeOptions] : K extends "sound:resume" ? [FadeOptions] : any;
|
|
93
|
+
};
|
|
94
|
+
export declare const ControlActionTypes: {
|
|
95
|
+
readonly action: "control:action";
|
|
96
|
+
readonly do: "control:do";
|
|
97
|
+
readonly doAsync: "control:doAsync";
|
|
98
|
+
readonly any: "control:any";
|
|
99
|
+
readonly all: "control:all";
|
|
100
|
+
readonly allAsync: "control:allAsync";
|
|
101
|
+
readonly repeat: "control:repeat";
|
|
102
|
+
readonly sleep: "control:sleep";
|
|
103
|
+
};
|
|
104
|
+
export type ControlActionContentType = {
|
|
105
|
+
[K in typeof ControlActionTypes[keyof typeof ControlActionTypes]]: K extends "control:do" ? [LogicAction.Actions[]] : K extends "control:doAsync" ? [LogicAction.Actions[]] : K extends "control:any" ? [LogicAction.Actions[]] : K extends "control:all" ? [LogicAction.Actions[]] : K extends "control:parallel" ? [LogicAction.Actions[]] : K extends "control:allAsync" ? [LogicAction.Actions[]] : K extends "control:repeat" ? [LogicAction.Actions[], number] : K extends "control:sleep" ? [LogicAction.Actions[], number | Awaitable<any> | Promise<any>] : any;
|
|
106
|
+
};
|
|
107
|
+
export declare const TextActionTypes: {
|
|
108
|
+
readonly action: "text:action";
|
|
109
|
+
readonly setText: "text:setText";
|
|
110
|
+
readonly setFontSize: "text:setFontSize";
|
|
111
|
+
};
|
|
112
|
+
export type TextActionContentType = {
|
|
113
|
+
[K in typeof TextActionTypes[keyof typeof TextActionTypes]]: K extends "text:setText" ? [string] : K extends "text:show" ? [Transform<TransformDefinitions.TextTransformProps>] : K extends "text:hide" ? [Transform<TransformDefinitions.TextTransformProps>] : K extends "text:applyTransform" ? [Transform<TransformDefinitions.TextTransformProps>] : K extends "text:init" ? [Scene?] : K extends "text:setFontSize" ? [number] : any;
|
|
114
|
+
};
|
|
115
|
+
export declare const PersistentActionTypes: {
|
|
116
|
+
readonly action: "persistent:action";
|
|
117
|
+
readonly set: "persistent:set";
|
|
118
|
+
readonly assign: "persistent:assign";
|
|
119
|
+
};
|
|
120
|
+
export type PersistentActionContentType = {
|
|
121
|
+
[K in typeof PersistentActionTypes[keyof typeof PersistentActionTypes]]: K extends "persistent:action" ? any : K extends "persistent:set" ? [string, unknown | ((value: unknown) => unknown)] : K extends "persistent:assign" ? [Partial<unknown>] : any;
|
|
122
|
+
};
|
|
123
|
+
export declare const LayerActionTypes: {
|
|
124
|
+
readonly action: "layer:action";
|
|
125
|
+
readonly setZIndex: "layer:setZIndex";
|
|
126
|
+
};
|
|
127
|
+
export type LayerActionContentType = {
|
|
128
|
+
[K in typeof LayerActionTypes[keyof typeof LayerActionTypes]]: K extends "layer:action" ? any : K extends "layer:setZIndex" ? [number] : any;
|
|
129
|
+
};
|
|
130
|
+
export declare const VideoActionTypes: {
|
|
131
|
+
readonly action: "video:action";
|
|
132
|
+
readonly show: "video:show";
|
|
133
|
+
readonly hide: "video:hide";
|
|
134
|
+
readonly play: "video:play";
|
|
135
|
+
readonly pause: "video:pause";
|
|
136
|
+
readonly resume: "video:resume";
|
|
137
|
+
readonly stop: "video:stop";
|
|
138
|
+
readonly seek: "video:seek";
|
|
139
|
+
};
|
|
140
|
+
export type VideoActionContentType = {
|
|
141
|
+
[K in typeof VideoActionTypes[keyof typeof VideoActionTypes]]: K extends "video:action" ? any : K extends "video:show" | "video:hide" | "video:play" | "video:pause" | "video:stop" ? [] : K extends "video:seek" ? [number] : any;
|
|
142
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LogicAction } from "../action/logicAction";
|
|
2
|
-
import { Chainable } from "../action/chain";
|
|
3
|
-
export declare class Actionable<StateData extends Record<string, any> | null = Record<string, any>, Self extends Actionable = any> extends Chainable<LogicAction.Actions, Self> {
|
|
4
|
-
constructor();
|
|
5
|
-
}
|
|
1
|
+
import { LogicAction } from "../action/logicAction";
|
|
2
|
+
import { Chainable } from "../action/chain";
|
|
3
|
+
export declare class Actionable<StateData extends Record<string, any> | null = Record<string, any>, Self extends Actionable = any> extends Chainable<LogicAction.Actions, Self> {
|
|
4
|
+
constructor();
|
|
5
|
+
}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { CharacterActionContentType, CharacterActionTypes } from "../../action/actionTypes";
|
|
2
|
-
import type { Character } from "../../elements/character";
|
|
3
|
-
import { GameState } from "../../../player/gameState";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { CharacterActionContentType, CharacterActionTypes } from "../../action/actionTypes";
|
|
2
|
+
import type { Character } from "../../elements/character";
|
|
3
|
+
import { GameState } from "../../../player/gameState";
|
|
4
|
+
import { Sentence } from "../../elements/character/sentence";
|
|
5
|
+
import { TypedAction } from "../../action/actions";
|
|
6
|
+
import { Sound } from "../../elements/sound";
|
|
7
|
+
import { ActionExecutionInjection, ExecutedActionResult } from "../../action/action";
|
|
8
|
+
import { LogicAction } from "../../action/logicAction";
|
|
9
|
+
import { Story } from "../../elements/story";
|
|
10
|
+
export declare class CharacterAction<T extends typeof CharacterActionTypes[keyof typeof CharacterActionTypes] = typeof CharacterActionTypes[keyof typeof CharacterActionTypes]> extends TypedAction<CharacterActionContentType, T, Character> {
|
|
11
|
+
static ActionTypes: {
|
|
12
|
+
readonly say: "character:say";
|
|
13
|
+
readonly action: "character:action";
|
|
14
|
+
readonly setName: "character:setName";
|
|
15
|
+
};
|
|
16
|
+
static getVoice(state: GameState, sentence: Sentence): Sound | null;
|
|
17
|
+
executeAction(gameState: GameState, injection: ActionExecutionInjection): ExecutedActionResult;
|
|
18
|
+
stringify(_story: Story, _seen: Set<LogicAction.Actions>, _strict: boolean): string;
|
|
19
|
+
}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
import { ConditionActionContentType, ConditionActionTypes } from "../../action/actionTypes";
|
|
2
|
-
import type { Condition } from "../../elements/condition";
|
|
3
|
-
import { GameState } from "../../../player/gameState";
|
|
4
|
-
import { LogicAction } from "../../action/logicAction";
|
|
5
|
-
import { TypedAction } from "../../action/actions";
|
|
6
|
-
import { Story } from "../../elements/story";
|
|
7
|
-
import { ActionSearchOptions } from "../../types";
|
|
8
|
-
export declare class ConditionAction<T extends typeof ConditionActionTypes[keyof typeof ConditionActionTypes] = typeof ConditionActionTypes[keyof typeof ConditionActionTypes]> extends TypedAction<ConditionActionContentType, T, Condition> {
|
|
9
|
-
static ActionTypes: {
|
|
10
|
-
readonly action: "condition:action";
|
|
11
|
-
};
|
|
12
|
-
executeAction(gameState: GameState): {
|
|
13
|
-
type:
|
|
14
|
-
node: import("
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { ConditionActionContentType, ConditionActionTypes } from "../../action/actionTypes";
|
|
2
|
+
import type { Condition } from "../../elements/condition";
|
|
3
|
+
import { GameState } from "../../../player/gameState";
|
|
4
|
+
import { LogicAction } from "../../action/logicAction";
|
|
5
|
+
import { TypedAction } from "../../action/actions";
|
|
6
|
+
import { Story } from "../../elements/story";
|
|
7
|
+
import { ActionSearchOptions } from "../../types";
|
|
8
|
+
export declare class ConditionAction<T extends typeof ConditionActionTypes[keyof typeof ConditionActionTypes] = typeof ConditionActionTypes[keyof typeof ConditionActionTypes]> extends TypedAction<ConditionActionContentType, T, Condition> {
|
|
9
|
+
static ActionTypes: {
|
|
10
|
+
readonly action: "condition:action";
|
|
11
|
+
};
|
|
12
|
+
executeAction(gameState: GameState): ({
|
|
13
|
+
type: T;
|
|
14
|
+
node: import("../../action/tree/actionTree").RenderableNode | null;
|
|
15
|
+
wait?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
type: T;
|
|
18
|
+
node: null;
|
|
19
|
+
wait: {
|
|
20
|
+
type: "all";
|
|
21
|
+
stackModels: import("../stackModel").StackModel[];
|
|
22
|
+
};
|
|
23
|
+
})[];
|
|
24
|
+
getFutureActions(story: Story, options: ActionSearchOptions): LogicAction.Actions[];
|
|
25
|
+
stringify(story: Story, seen: Set<LogicAction.Actions>, strict: boolean): string;
|
|
26
|
+
}
|