narraleaf-react 0.4.4 → 0.5.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/actionHistory.d.ts +3 -1
- package/dist/game/nlcore/action/actionTypes.d.ts +4 -2
- package/dist/game/nlcore/action/actions/imageAction.d.ts +1 -0
- package/dist/game/nlcore/action/actions/layerAction.d.ts +2 -1
- package/dist/game/nlcore/action/gameHistory.d.ts +5 -1
- package/dist/game/nlcore/common/types.d.ts +2 -2
- package/dist/game/nlcore/elements/character.d.ts +1 -0
- package/dist/game/nlcore/elements/condition.d.ts +5 -5
- package/dist/game/nlcore/elements/control.d.ts +13 -13
- package/dist/game/nlcore/elements/displayable/image.d.ts +11 -0
- package/dist/game/nlcore/elements/layer.d.ts +10 -0
- package/dist/game/nlcore/elements/menu.d.ts +8 -6
- package/dist/game/nlcore/elements/scene.d.ts +3 -3
- package/dist/game/nlcore/elements/sound.d.ts +15 -1
- package/dist/game/nlcore/elements/transform/position.d.ts +3 -1
- package/dist/game/nlcore/elements/transition/transitions/image/darkness.d.ts +20 -0
- package/dist/game/nlcore/elements/type.d.ts +1 -0
- package/dist/game/nlcore/game/liveGame.d.ts +14 -0
- package/dist/game/nlcore/game.d.ts +26 -0
- package/dist/game/nlcore/gameTypes.d.ts +8 -5
- package/dist/game/nlcore/types.d.ts +1 -0
- package/dist/game/player/elements/image/AspectScaleImage.d.ts +1 -1
- 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/say/UIDialog.d.ts +2 -0
- package/dist/game/player/elements/say/useDialog.d.ts +2 -0
- package/dist/game/player/gameState.d.ts +6 -1
- package/dist/game/player/lib/AudioManager.d.ts +9 -1
- package/dist/game/player/lib/PageRouter/AnimatePresence.d.ts +4 -0
- package/dist/game/player/type.d.ts +4 -0
- package/dist/main.js +56 -53
- package/dist/util/data.d.ts +1 -0
- package/package.json +1 -1
|
@@ -7,6 +7,8 @@ export type DialogContext = {
|
|
|
7
7
|
done: boolean;
|
|
8
8
|
/** The text content of the dialog */
|
|
9
9
|
text: string;
|
|
10
|
+
/** Whether the dialog is the narrator */
|
|
11
|
+
isNarrator: boolean;
|
|
10
12
|
};
|
|
11
13
|
/**
|
|
12
14
|
* A custom hook that provides access to the current dialog's state and content.
|
|
@@ -24,6 +24,7 @@ import { Timelines } from "./Tasks";
|
|
|
24
24
|
import { Notification, NotificationManager } from "./lib/notification";
|
|
25
25
|
import { ActionHistoryManager } from "../../game/nlcore/action/actionHistory";
|
|
26
26
|
import { GameHistoryManager } from "../../game/nlcore/action/gameHistory";
|
|
27
|
+
import { Router } from "./lib/PageRouter/router";
|
|
27
28
|
type Legacy_PlayerStateElement = {
|
|
28
29
|
texts: Clickable<TextElement>[];
|
|
29
30
|
menus: Clickable<MenuElement, Chosen>[];
|
|
@@ -74,6 +75,7 @@ type GameStateEvents = {
|
|
|
74
75
|
"event:state.player.requestFlush": [];
|
|
75
76
|
"event.state.onExpose": [unknown, ExposedState[ExposedStateType]];
|
|
76
77
|
"event:state.onRender": [];
|
|
78
|
+
"event:state:flushPreloadedScenes": [];
|
|
77
79
|
};
|
|
78
80
|
/**
|
|
79
81
|
* Core game state management class
|
|
@@ -93,6 +95,7 @@ export declare class GameState {
|
|
|
93
95
|
guard: GameStateGuard;
|
|
94
96
|
timelines: Timelines;
|
|
95
97
|
preloadingScene: Scene | null;
|
|
98
|
+
flushDep: number;
|
|
96
99
|
readonly notificationMgr: NotificationManager;
|
|
97
100
|
readonly events: EventDispatcher<GameStateEvents>;
|
|
98
101
|
readonly logger: Logger;
|
|
@@ -101,7 +104,9 @@ export declare class GameState {
|
|
|
101
104
|
readonly idManager: IdManager;
|
|
102
105
|
readonly actionHistory: ActionHistoryManager;
|
|
103
106
|
readonly gameHistory: GameHistoryManager;
|
|
107
|
+
pageRouter: Router | null;
|
|
104
108
|
constructor(game: Game, stage: StageUtils);
|
|
109
|
+
get deps(): number;
|
|
105
110
|
addVideo(video: Video): this;
|
|
106
111
|
removeVideo(video: Video): this;
|
|
107
112
|
isVideoAdded(video: Video): boolean;
|
|
@@ -109,7 +114,7 @@ export declare class GameState {
|
|
|
109
114
|
findElementByScene(scene: Scene): PlayerStateElement | null;
|
|
110
115
|
findElementByDisplayable(displayable: LogicAction.DisplayableElements, layer?: Layer | null): PlayerStateElement | null;
|
|
111
116
|
removeElement(element: PlayerStateElement): this;
|
|
112
|
-
preloadScene(
|
|
117
|
+
preloadScene(arg: Scene | Story): this;
|
|
113
118
|
getPreloadingScene(): Scene | null;
|
|
114
119
|
addElement(element: PlayerStateElement): this;
|
|
115
120
|
addScene(scene: Scene): this;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Sound } from "../../nlcore/elements/sound";
|
|
1
|
+
import { Sound, SoundType } from "../../nlcore/elements/sound";
|
|
2
2
|
import { FadeOptions } from "../../nlcore/elements/type";
|
|
3
3
|
import { Awaitable } from "../../../util/data";
|
|
4
4
|
import { GameState } from "../gameState";
|
|
@@ -9,11 +9,13 @@ export type AudioDataRaw = {
|
|
|
9
9
|
};
|
|
10
10
|
export type AudioManagerDataRaw = {
|
|
11
11
|
sounds: [string, AudioDataRaw][];
|
|
12
|
+
groups: [SoundType, number][];
|
|
12
13
|
};
|
|
13
14
|
export declare class AudioManager {
|
|
14
15
|
private gameState;
|
|
15
16
|
private state;
|
|
16
17
|
private tasks;
|
|
18
|
+
private groups;
|
|
17
19
|
constructor(gameState: GameState);
|
|
18
20
|
play(sound: Sound, options?: FadeOptions): Awaitable<void>;
|
|
19
21
|
stop(sound: Sound, duration?: number): Awaitable<void>;
|
|
@@ -28,6 +30,11 @@ export declare class AudioManager {
|
|
|
28
30
|
soundFromData(sound: Sound, data: AudioDataRaw): void;
|
|
29
31
|
isManaged(sound: Sound): boolean;
|
|
30
32
|
reset(): void;
|
|
33
|
+
setGroupVolume(type: SoundType, volume: number): void;
|
|
34
|
+
setGlobalVolume(volume: number): void;
|
|
35
|
+
getGlobalVolume(): number;
|
|
36
|
+
getGroupVolume(type: SoundType): number;
|
|
37
|
+
private setupGroupVolume;
|
|
31
38
|
private initSound;
|
|
32
39
|
private pushTask;
|
|
33
40
|
private getState;
|
|
@@ -39,4 +46,5 @@ export declare class AudioManager {
|
|
|
39
46
|
private getHowlConfig;
|
|
40
47
|
private createTask;
|
|
41
48
|
private wrapTask;
|
|
49
|
+
private applyEffectiveVolume;
|
|
42
50
|
}
|
|
@@ -30,17 +30,20 @@ export type ExposedState = {
|
|
|
30
30
|
initDisplayable: (onResolve: () => void) => Timeline;
|
|
31
31
|
applyTransform: (transform: Transform, onResolve: () => void) => Timeline;
|
|
32
32
|
applyTransition: (transition: Transition<any>, onResolve: () => void) => Timeline;
|
|
33
|
+
updateStyleSync: () => void;
|
|
33
34
|
};
|
|
34
35
|
[ExposedStateType.text]: {
|
|
35
36
|
initDisplayable: (onResolve: () => void) => Timeline;
|
|
36
37
|
applyTransform: (transform: Transform, onResolve: () => void) => Timeline;
|
|
37
38
|
applyTransition: (transition: Transition<any>, onResolve: () => void) => Timeline;
|
|
39
|
+
updateStyleSync: () => void;
|
|
38
40
|
flush: () => void;
|
|
39
41
|
};
|
|
40
42
|
[ExposedStateType.layer]: {
|
|
41
43
|
initDisplayable: (onResolve: () => void) => Timeline;
|
|
42
44
|
applyTransform: (transform: Transform, onResolve: () => void) => Timeline;
|
|
43
45
|
applyTransition: (transition: Transition<any>, onResolve: () => void) => Timeline;
|
|
46
|
+
updateStyleSync: () => void;
|
|
44
47
|
};
|
|
45
48
|
[ExposedStateType.scene]: {
|
|
46
49
|
setBackgroundMusic: (music: Sound | null, fade: number) => Promise<void>;
|
|
@@ -62,3 +65,4 @@ export type ExposedKeys = {
|
|
|
62
65
|
[ExposedStateType.scene]: Scene;
|
|
63
66
|
[ExposedStateType.video]: Video;
|
|
64
67
|
};
|
|
68
|
+
export type { INotificationsProps } from "./elements/notification/type";
|