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,19 +1,18 @@
|
|
|
1
|
-
import { GameState } from "../../../../game/nlcore/common/game";
|
|
2
|
-
import React from "react";
|
|
3
|
-
export type Notification = {
|
|
4
|
-
message: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
1
|
+
import { GameState } from "../../../../game/nlcore/common/game";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export type Notification = {
|
|
4
|
+
message: string;
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
export type PlayerNotificationProps = {
|
|
8
|
+
gameState: GameState;
|
|
9
|
+
};
|
|
10
|
+
export type NotificationsProps = {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
13
|
+
export type NotificationProps = React.PropsWithChildren<{
|
|
14
|
+
notification: Notification;
|
|
15
|
+
}> & React.HTMLAttributes<HTMLDivElement>;
|
|
16
|
+
export interface INotificationsProps {
|
|
17
|
+
notifications: Notification[];
|
|
18
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Layer as GameLayer } from "../../../nlcore/elements/layer";
|
|
3
|
-
import { GameState } from "../../gameState";
|
|
4
|
-
export declare function Layer({ state, layer, children }: Readonly<{
|
|
5
|
-
state: GameState;
|
|
6
|
-
layer: GameLayer;
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
}>): React.JSX.Element;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Layer as GameLayer } from "../../../nlcore/elements/layer";
|
|
3
|
+
import { GameState } from "../../gameState";
|
|
4
|
+
export declare function Layer({ state, layer, children }: Readonly<{
|
|
5
|
+
state: GameState;
|
|
6
|
+
layer: GameLayer;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}>): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { DialogProps } from "../../elements/say/type";
|
|
2
|
-
import React from "react";
|
|
3
|
-
export declare function RawDialog(props: DialogProps): React.JSX.Element;
|
|
4
|
-
/**
|
|
5
|
-
* Context-based wrapper component
|
|
6
|
-
* Provides integration with the say context
|
|
7
|
-
*/
|
|
8
|
-
export declare function Dialog({ children, ...props }: DialogProps): React.JSX.Element | null;
|
|
9
|
-
export default Dialog;
|
|
10
|
-
/**
|
|
11
|
-
* Default dialog component with Texts as children
|
|
12
|
-
*/
|
|
13
|
-
export declare function DefaultDialog(): React.JSX.Element;
|
|
1
|
+
import { DialogProps } from "../../elements/say/type";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export declare function RawDialog(props: DialogProps): React.JSX.Element;
|
|
4
|
+
/**
|
|
5
|
+
* Context-based wrapper component
|
|
6
|
+
* Provides integration with the say context
|
|
7
|
+
*/
|
|
8
|
+
export declare function Dialog({ children, ...props }: DialogProps): React.JSX.Element | null;
|
|
9
|
+
export default Dialog;
|
|
10
|
+
/**
|
|
11
|
+
* Default dialog component with Texts as children
|
|
12
|
+
*/
|
|
13
|
+
export declare function DefaultDialog(): React.JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export default function Nametag({ ...props }: Readonly<React.HTMLAttributes<HTMLDivElement>>): React.JSX.Element;
|
|
1
|
+
import React from "react";
|
|
2
|
+
export default function Nametag({ ...props }: Readonly<React.HTMLAttributes<HTMLDivElement>>): React.JSX.Element;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { Pausing } from "../../../nlcore/elements/character/pause";
|
|
2
|
-
import { Sentence } from "../../../nlcore/elements/character/sentence";
|
|
3
|
-
import { Word } from "../../../nlcore/elements/character/word";
|
|
4
|
-
import { GameState } from "../../../../game/nlcore/common/game";
|
|
5
|
-
import { Color } from "../../../../game/nlcore/types";
|
|
6
|
-
import React from "react";
|
|
7
|
-
import { DialogElementProps } from "./type";
|
|
8
|
-
import { DialogState } from "./UIDialog";
|
|
9
|
-
type BaseTextsProps = {
|
|
10
|
-
/**
|
|
11
|
-
* The default color of the text
|
|
12
|
-
*/
|
|
13
|
-
defaultColor?: Color;
|
|
14
|
-
className?: string;
|
|
15
|
-
style?: React.CSSProperties;
|
|
16
|
-
dialog?: DialogState;
|
|
17
|
-
} & React.HTMLAttributes<HTMLDivElement>;
|
|
18
|
-
/**
|
|
19
|
-
* Props-based wrapper component
|
|
20
|
-
* Provides a clean interface for direct prop usage
|
|
21
|
-
*/
|
|
22
|
-
export interface TextsProps extends DialogElementProps {
|
|
23
|
-
sentence: Sentence;
|
|
24
|
-
gameState: GameState;
|
|
25
|
-
useTypeEffect?: boolean;
|
|
26
|
-
onCompleted?: () => void;
|
|
27
|
-
finished?: boolean;
|
|
28
|
-
count?: number;
|
|
29
|
-
words?: Word<Pausing | string>[];
|
|
30
|
-
}
|
|
31
|
-
export declare function RawTexts(props: BaseTextsProps): React.JSX.Element;
|
|
32
|
-
/**
|
|
33
|
-
* Context-based wrapper component
|
|
34
|
-
* Provides integration with the sentence context
|
|
35
|
-
*/
|
|
36
|
-
export declare function Texts(props: BaseTextsProps): React.JSX.Element;
|
|
37
|
-
export default Texts;
|
|
1
|
+
import { Pausing } from "../../../nlcore/elements/character/pause";
|
|
2
|
+
import { Sentence } from "../../../nlcore/elements/character/sentence";
|
|
3
|
+
import { Word } from "../../../nlcore/elements/character/word";
|
|
4
|
+
import { GameState } from "../../../../game/nlcore/common/game";
|
|
5
|
+
import { Color } from "../../../../game/nlcore/types";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { DialogElementProps } from "./type";
|
|
8
|
+
import { DialogState } from "./UIDialog";
|
|
9
|
+
type BaseTextsProps = {
|
|
10
|
+
/**
|
|
11
|
+
* The default color of the text
|
|
12
|
+
*/
|
|
13
|
+
defaultColor?: Color;
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
dialog?: DialogState;
|
|
17
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
18
|
+
/**
|
|
19
|
+
* Props-based wrapper component
|
|
20
|
+
* Provides a clean interface for direct prop usage
|
|
21
|
+
*/
|
|
22
|
+
export interface TextsProps extends DialogElementProps {
|
|
23
|
+
sentence: Sentence;
|
|
24
|
+
gameState: GameState;
|
|
25
|
+
useTypeEffect?: boolean;
|
|
26
|
+
onCompleted?: () => void;
|
|
27
|
+
finished?: boolean;
|
|
28
|
+
count?: number;
|
|
29
|
+
words?: Word<Pausing | string>[];
|
|
30
|
+
}
|
|
31
|
+
export declare function RawTexts(props: BaseTextsProps): React.JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* Context-based wrapper component
|
|
34
|
+
* Provides integration with the sentence context
|
|
35
|
+
*/
|
|
36
|
+
export declare function Texts(props: BaseTextsProps): React.JSX.Element;
|
|
37
|
+
export default Texts;
|
|
@@ -1,69 +1,72 @@
|
|
|
1
|
-
import { Pausing } from "../../../nlcore/elements/character/pause";
|
|
2
|
-
import { Word } from "../../../nlcore/elements/character/word";
|
|
3
|
-
import { GameState } from "../../../../game/nlcore/common/game";
|
|
4
|
-
import { EventDispatcher, EventToken } from "../../../../util/data";
|
|
5
|
-
import React from "react";
|
|
6
|
-
import { DialogAction, DialogStateType, SayElementProps } from "./type";
|
|
7
|
-
type DialogEvents = {
|
|
8
|
-
"event:dialog.requestComplete": [];
|
|
9
|
-
"event:dialog.complete": [];
|
|
10
|
-
"event:dialog.forceSkip": [];
|
|
11
|
-
"event:dialog.onFlush": [];
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
private
|
|
31
|
-
private
|
|
32
|
-
private
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
* Only
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
1
|
+
import { Pausing } from "../../../nlcore/elements/character/pause";
|
|
2
|
+
import { Word } from "../../../nlcore/elements/character/word";
|
|
3
|
+
import { GameState } from "../../../../game/nlcore/common/game";
|
|
4
|
+
import { EventDispatcher, EventToken } from "../../../../util/data";
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { DialogAction, DialogStateType, SayElementProps } from "./type";
|
|
7
|
+
type DialogEvents = {
|
|
8
|
+
"event:dialog.requestComplete": [];
|
|
9
|
+
"event:dialog.complete": [force: boolean];
|
|
10
|
+
"event:dialog.forceSkip": [];
|
|
11
|
+
"event:dialog.onFlush": [];
|
|
12
|
+
"event:dialog.simulateClick": [];
|
|
13
|
+
};
|
|
14
|
+
type DialogStateConfig = {
|
|
15
|
+
useTypeEffect: boolean;
|
|
16
|
+
action: DialogAction;
|
|
17
|
+
evaluatedWords: Word<Pausing | string>[];
|
|
18
|
+
gameState: GameState;
|
|
19
|
+
};
|
|
20
|
+
export declare class DialogState {
|
|
21
|
+
static Events: {
|
|
22
|
+
requestComplete: "event:dialog.requestComplete";
|
|
23
|
+
complete: "event:dialog.complete";
|
|
24
|
+
forceSkip: "event:dialog.forceSkip";
|
|
25
|
+
onFlush: "event:dialog.onFlush";
|
|
26
|
+
simulateClick: "event:dialog.simulateClick";
|
|
27
|
+
};
|
|
28
|
+
readonly config: Readonly<DialogStateConfig>;
|
|
29
|
+
readonly events: EventDispatcher<DialogEvents>;
|
|
30
|
+
private _state;
|
|
31
|
+
private _count;
|
|
32
|
+
private _forceSkipped;
|
|
33
|
+
private _idle;
|
|
34
|
+
private autoForwardScheduler;
|
|
35
|
+
constructor(config: DialogStateConfig);
|
|
36
|
+
get state(): DialogStateType;
|
|
37
|
+
get deps(): React.DependencyList;
|
|
38
|
+
isIdle(): boolean;
|
|
39
|
+
setIdle(idle: boolean): void;
|
|
40
|
+
/**
|
|
41
|
+
* Only for dialog component to call
|
|
42
|
+
*
|
|
43
|
+
* Calling this method will request the sentence to be completed
|
|
44
|
+
* If the sentence is already completed, it will exit the dialog
|
|
45
|
+
*/
|
|
46
|
+
requestComplete(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Only for dialog state to call
|
|
49
|
+
*
|
|
50
|
+
* Force the sentence to cancel/skip all the tasks
|
|
51
|
+
*/
|
|
52
|
+
forceSkip(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Only for sentence component to call
|
|
55
|
+
*
|
|
56
|
+
* Only call this method when the sentence is completed
|
|
57
|
+
* Calling this method will schedule the exit of the dialog
|
|
58
|
+
*/
|
|
59
|
+
dispatchComplete(): this | undefined;
|
|
60
|
+
emitComplete(): this;
|
|
61
|
+
isEnded(): boolean;
|
|
62
|
+
setPause(pause: boolean): void;
|
|
63
|
+
isForceSkipped(): boolean;
|
|
64
|
+
tryScheduleAutoForward(): void;
|
|
65
|
+
cancelAutoForward(): void;
|
|
66
|
+
emitFlush(): this;
|
|
67
|
+
onFlush(listener: () => void): EventToken;
|
|
68
|
+
safeEmit(event: keyof DialogEvents, ...args: DialogEvents[keyof DialogEvents]): this;
|
|
69
|
+
private scheduleAutoForward;
|
|
70
|
+
}
|
|
71
|
+
export default function PlayerDialog({ action, onFinished, useTypeEffect, gameState, }: Readonly<SayElementProps>): React.JSX.Element;
|
|
72
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { DialogState } from "./UIDialog";
|
|
3
|
-
export declare const DialogContext: React.Context<DialogState | null>;
|
|
4
|
-
export declare function useDialogContext(): DialogState;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DialogState } from "./UIDialog";
|
|
3
|
+
export declare const DialogContext: React.Context<DialogState | null>;
|
|
4
|
+
export declare function useDialogContext(): DialogState;
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import type { Character } from "../../../nlcore/elements/character";
|
|
2
|
-
import type { GameState } from "../../gameState";
|
|
3
|
-
import { Sentence } from "../../../nlcore/elements/character/sentence";
|
|
4
|
-
import { Word } from "../../../nlcore/elements/character/word";
|
|
5
|
-
import { Pausing } from "../../../nlcore/elements/character/pause";
|
|
6
|
-
import React from "react";
|
|
7
|
-
export interface SayElementProps {
|
|
8
|
-
action: {
|
|
9
|
-
sentence: Sentence | null;
|
|
10
|
-
character: Character | null;
|
|
11
|
-
words: Word<Pausing | string>[] | null;
|
|
12
|
-
id?: string;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated
|
|
16
|
-
* Callback function to be called when the player triggers the next action
|
|
17
|
-
*/
|
|
18
|
-
onClick?: (skiped?: boolean) => void;
|
|
19
|
-
onFinished?: (skiped?: boolean) => void;
|
|
20
|
-
useTypeEffect?: boolean;
|
|
21
|
-
gameState: GameState;
|
|
22
|
-
}
|
|
23
|
-
export interface IDialogProps {
|
|
24
|
-
}
|
|
25
|
-
export type DialogProps = {
|
|
26
|
-
children: React.ReactNode;
|
|
27
|
-
} & React.HTMLAttributes<HTMLDivElement>;
|
|
28
|
-
export type DialogElementProps = {
|
|
29
|
-
children?: never;
|
|
30
|
-
} & React.HTMLAttributes<HTMLDivElement>;
|
|
31
|
-
export interface IDialogElementProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
32
|
-
children?: never;
|
|
33
|
-
}
|
|
34
|
-
export declare enum DialogStateType {
|
|
35
|
-
Pending = "pending",
|
|
36
|
-
Paused = "paused",
|
|
37
|
-
Ended = "ended"
|
|
38
|
-
}
|
|
39
|
-
export interface DialogContext {
|
|
40
|
-
gameState: GameState;
|
|
41
|
-
action: {
|
|
42
|
-
sentence: Sentence | null;
|
|
43
|
-
character: Character | null;
|
|
44
|
-
words: Word<Pausing | string>[] | null;
|
|
45
|
-
};
|
|
46
|
-
state: DialogStateType;
|
|
47
|
-
}
|
|
48
|
-
export type DialogAction = {
|
|
49
|
-
sentence: Sentence | null;
|
|
50
|
-
character: Character | null;
|
|
51
|
-
words: Word<Pausing | string>[] | null;
|
|
52
|
-
id?: string;
|
|
53
|
-
};
|
|
1
|
+
import type { Character } from "../../../nlcore/elements/character";
|
|
2
|
+
import type { GameState } from "../../gameState";
|
|
3
|
+
import { Sentence } from "../../../nlcore/elements/character/sentence";
|
|
4
|
+
import { Word } from "../../../nlcore/elements/character/word";
|
|
5
|
+
import { Pausing } from "../../../nlcore/elements/character/pause";
|
|
6
|
+
import React from "react";
|
|
7
|
+
export interface SayElementProps {
|
|
8
|
+
action: {
|
|
9
|
+
sentence: Sentence | null;
|
|
10
|
+
character: Character | null;
|
|
11
|
+
words: Word<Pausing | string>[] | null;
|
|
12
|
+
id?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated
|
|
16
|
+
* Callback function to be called when the player triggers the next action
|
|
17
|
+
*/
|
|
18
|
+
onClick?: (skiped?: boolean) => void;
|
|
19
|
+
onFinished?: (skiped?: boolean) => void;
|
|
20
|
+
useTypeEffect?: boolean;
|
|
21
|
+
gameState: GameState;
|
|
22
|
+
}
|
|
23
|
+
export interface IDialogProps {
|
|
24
|
+
}
|
|
25
|
+
export type DialogProps = {
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
28
|
+
export type DialogElementProps = {
|
|
29
|
+
children?: never;
|
|
30
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
31
|
+
export interface IDialogElementProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
32
|
+
children?: never;
|
|
33
|
+
}
|
|
34
|
+
export declare enum DialogStateType {
|
|
35
|
+
Pending = "pending",
|
|
36
|
+
Paused = "paused",
|
|
37
|
+
Ended = "ended"
|
|
38
|
+
}
|
|
39
|
+
export interface DialogContext {
|
|
40
|
+
gameState: GameState;
|
|
41
|
+
action: {
|
|
42
|
+
sentence: Sentence | null;
|
|
43
|
+
character: Character | null;
|
|
44
|
+
words: Word<Pausing | string>[] | null;
|
|
45
|
+
};
|
|
46
|
+
state: DialogStateType;
|
|
47
|
+
}
|
|
48
|
+
export type DialogAction = {
|
|
49
|
+
sentence: Sentence | null;
|
|
50
|
+
character: Character | null;
|
|
51
|
+
words: Word<Pausing | string>[] | null;
|
|
52
|
+
id?: string;
|
|
53
|
+
};
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents the context of a dialog, containing information about its completion status
|
|
3
|
-
* and the text content.
|
|
4
|
-
*/
|
|
5
|
-
export type DialogContext = {
|
|
6
|
-
/** Whether the dialog has finished displaying */
|
|
7
|
-
done: boolean;
|
|
8
|
-
/** The text content of the dialog */
|
|
9
|
-
text: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Represents the context of a dialog, containing information about its completion status
|
|
3
|
+
* and the text content.
|
|
4
|
+
*/
|
|
5
|
+
export type DialogContext = {
|
|
6
|
+
/** Whether the dialog has finished displaying */
|
|
7
|
+
done: boolean;
|
|
8
|
+
/** The text content of the dialog */
|
|
9
|
+
text: string;
|
|
10
|
+
/** Whether the dialog is the narrator */
|
|
11
|
+
isNarrator: boolean;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A custom hook that provides access to the current dialog's state and content.
|
|
15
|
+
* It retrieves the dialog information from the sentence context and processes
|
|
16
|
+
* the words to generate the final text.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useDialog(): DialogContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { IDialogProps, SayElementProps } from "../elements/say/type";
|
|
3
|
-
import { IUserMenuProps, MenuElementProps } from "../elements/menu/type";
|
|
4
|
-
import { Story } from "../../nlcore/elements/story";
|
|
5
|
-
import clsx from "clsx";
|
|
6
|
-
import { Game } from "../../nlcore/game";
|
|
7
|
-
import { GameState } from "../gameState";
|
|
8
|
-
import { Storable } from "../../nlcore/elements/persistent/storable";
|
|
9
|
-
import { LiveGame } from "../../nlcore/game/liveGame";
|
|
10
|
-
import { INotificationsProps, NotificationsProps } from "./notification/type";
|
|
11
|
-
export type Components<T extends Record<string, any>> = (props: Readonly<T>) => React.JSX.Element;
|
|
12
|
-
export type SayComponent = Components<IDialogProps>;
|
|
13
|
-
export type MenuComponent = Components<IUserMenuProps>;
|
|
14
|
-
export type NotificationComponent = Components<INotificationsProps>;
|
|
15
|
-
export type ComponentsTypes = {
|
|
16
|
-
say: SayComponent;
|
|
17
|
-
menu: MenuComponent;
|
|
18
|
-
notification: NotificationComponent;
|
|
19
|
-
};
|
|
20
|
-
export type { SayElementProps, MenuElementProps, NotificationsProps as INotificationProps, };
|
|
21
|
-
export type PlayerEventContext = {
|
|
22
|
-
game: Game;
|
|
23
|
-
gameState: GameState;
|
|
24
|
-
liveGame: LiveGame;
|
|
25
|
-
storable: Storable;
|
|
26
|
-
};
|
|
27
|
-
export interface PlayerProps {
|
|
28
|
-
story?: Story;
|
|
29
|
-
width?: string | number;
|
|
30
|
-
height?: string | number;
|
|
31
|
-
className?: clsx.ClassValue;
|
|
32
|
-
/**
|
|
33
|
-
* Once the game is ready to be played
|
|
34
|
-
*
|
|
35
|
-
* only called each lifecycle once
|
|
36
|
-
*/
|
|
37
|
-
onReady?: (ctx: PlayerEventContext) => void;
|
|
38
|
-
/**
|
|
39
|
-
* Once the game is ended
|
|
40
|
-
*
|
|
41
|
-
* only called each lifecycle once
|
|
42
|
-
*/
|
|
43
|
-
onEnd?: (ctx: PlayerEventContext) => void;
|
|
44
|
-
children?: React.ReactNode;
|
|
45
|
-
/**
|
|
46
|
-
* Whether to show the player
|
|
47
|
-
*
|
|
48
|
-
* Even the active is false, the pages will be rendered
|
|
49
|
-
*
|
|
50
|
-
* @default true
|
|
51
|
-
*/
|
|
52
|
-
active?: boolean;
|
|
53
|
-
}
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IDialogProps, SayElementProps } from "../elements/say/type";
|
|
3
|
+
import { IUserMenuProps, MenuElementProps } from "../elements/menu/type";
|
|
4
|
+
import { Story } from "../../nlcore/elements/story";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import { Game } from "../../nlcore/game";
|
|
7
|
+
import { GameState } from "../gameState";
|
|
8
|
+
import { Storable } from "../../nlcore/elements/persistent/storable";
|
|
9
|
+
import { LiveGame } from "../../nlcore/game/liveGame";
|
|
10
|
+
import { INotificationsProps, NotificationsProps } from "./notification/type";
|
|
11
|
+
export type Components<T extends Record<string, any>> = (props: Readonly<T>) => React.JSX.Element;
|
|
12
|
+
export type SayComponent = Components<IDialogProps>;
|
|
13
|
+
export type MenuComponent = Components<IUserMenuProps>;
|
|
14
|
+
export type NotificationComponent = Components<INotificationsProps>;
|
|
15
|
+
export type ComponentsTypes = {
|
|
16
|
+
say: SayComponent;
|
|
17
|
+
menu: MenuComponent;
|
|
18
|
+
notification: NotificationComponent;
|
|
19
|
+
};
|
|
20
|
+
export type { SayElementProps, MenuElementProps, NotificationsProps as INotificationProps, };
|
|
21
|
+
export type PlayerEventContext = {
|
|
22
|
+
game: Game;
|
|
23
|
+
gameState: GameState;
|
|
24
|
+
liveGame: LiveGame;
|
|
25
|
+
storable: Storable;
|
|
26
|
+
};
|
|
27
|
+
export interface PlayerProps {
|
|
28
|
+
story?: Story;
|
|
29
|
+
width?: string | number;
|
|
30
|
+
height?: string | number;
|
|
31
|
+
className?: clsx.ClassValue;
|
|
32
|
+
/**
|
|
33
|
+
* Once the game is ready to be played
|
|
34
|
+
*
|
|
35
|
+
* only called each lifecycle once
|
|
36
|
+
*/
|
|
37
|
+
onReady?: (ctx: PlayerEventContext) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Once the game is ended
|
|
40
|
+
*
|
|
41
|
+
* only called each lifecycle once
|
|
42
|
+
*/
|
|
43
|
+
onEnd?: (ctx: PlayerEventContext) => void;
|
|
44
|
+
children?: React.ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* Whether to show the player
|
|
47
|
+
*
|
|
48
|
+
* Even the active is false, the pages will be rendered
|
|
49
|
+
*
|
|
50
|
+
* @default true
|
|
51
|
+
*/
|
|
52
|
+
active?: boolean;
|
|
53
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|