@luna-editor/engine 0.1.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/dist/Player.d.ts +3 -0
- package/dist/Player.js +336 -0
- package/dist/atoms/screen-size.d.ts +22 -0
- package/dist/atoms/screen-size.js +8 -0
- package/dist/components/BacklogUI.d.ts +2 -0
- package/dist/components/BacklogUI.js +115 -0
- package/dist/components/ConversationLogUI.d.ts +2 -0
- package/dist/components/ConversationLogUI.js +115 -0
- package/dist/components/DebugControls.d.ts +12 -0
- package/dist/components/DebugControls.js +5 -0
- package/dist/components/DialogueBox.d.ts +2 -0
- package/dist/components/DialogueBox.js +28 -0
- package/dist/components/EndScreen.d.ts +8 -0
- package/dist/components/EndScreen.js +5 -0
- package/dist/components/GameScreen.d.ts +9 -0
- package/dist/components/GameScreen.js +111 -0
- package/dist/components/OverlayUI.d.ts +13 -0
- package/dist/components/OverlayUI.js +21 -0
- package/dist/components/PluginComponentProvider.d.ts +14 -0
- package/dist/components/PluginComponentProvider.js +24 -0
- package/dist/constants/screen-size.d.ts +3 -0
- package/dist/constants/screen-size.js +6 -0
- package/dist/contexts/DataContext.d.ts +24 -0
- package/dist/contexts/DataContext.js +101 -0
- package/dist/hooks/useBacklog.d.ts +14 -0
- package/dist/hooks/useBacklog.js +82 -0
- package/dist/hooks/useConversationLog.d.ts +14 -0
- package/dist/hooks/useConversationLog.js +82 -0
- package/dist/hooks/usePlayerLogic.d.ts +21 -0
- package/dist/hooks/usePlayerLogic.js +145 -0
- package/dist/hooks/usePluginAPI.d.ts +19 -0
- package/dist/hooks/usePluginAPI.js +42 -0
- package/dist/hooks/usePluginEvents.d.ts +14 -0
- package/dist/hooks/usePluginEvents.js +197 -0
- package/dist/hooks/usePreloadImages.d.ts +2 -0
- package/dist/hooks/usePreloadImages.js +56 -0
- package/dist/hooks/useScreenSize.d.ts +89 -0
- package/dist/hooks/useScreenSize.js +87 -0
- package/dist/hooks/useTypewriter.d.ts +11 -0
- package/dist/hooks/useTypewriter.js +56 -0
- package/dist/hooks/useUIVisibility.d.ts +9 -0
- package/dist/hooks/useUIVisibility.js +19 -0
- package/dist/hooks/useVoice.d.ts +4 -0
- package/dist/hooks/useVoice.js +21 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +9 -0
- package/dist/plugin/PluginManager.d.ts +108 -0
- package/dist/plugin/PluginManager.js +851 -0
- package/dist/plugin/luna-react.d.ts +41 -0
- package/dist/plugin/luna-react.js +99 -0
- package/dist/sdk.d.ts +512 -0
- package/dist/sdk.js +64 -0
- package/dist/types.d.ts +186 -0
- package/dist/types.js +2 -0
- package/dist/utils/attributeNormalizer.d.ts +5 -0
- package/dist/utils/attributeNormalizer.js +53 -0
- package/dist/utils/facePositionCalculator.d.ts +29 -0
- package/dist/utils/facePositionCalculator.js +127 -0
- package/package.json +55 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* プラグインAPIからReactインスタンスを設定
|
|
3
|
+
*/
|
|
4
|
+
export declare function setReactRuntime(react: any): void;
|
|
5
|
+
/**
|
|
6
|
+
* JSX Transform用のjsx関数
|
|
7
|
+
*/
|
|
8
|
+
export declare function jsx(type: any, props: any, key?: any): any;
|
|
9
|
+
/**
|
|
10
|
+
* JSX Transform用のjsxs関数(複数子要素用)
|
|
11
|
+
*/
|
|
12
|
+
export declare function jsxs(type: any, props: any, key?: any): any;
|
|
13
|
+
/**
|
|
14
|
+
* Fragment用
|
|
15
|
+
*/
|
|
16
|
+
export declare function Fragment(props: {
|
|
17
|
+
children?: any;
|
|
18
|
+
}): any;
|
|
19
|
+
/**
|
|
20
|
+
* Reactフックと関数のプロキシ
|
|
21
|
+
*/
|
|
22
|
+
export declare const useState: (...args: any[]) => any;
|
|
23
|
+
export declare const useEffect: (...args: any[]) => any;
|
|
24
|
+
export declare const useCallback: (...args: any[]) => any;
|
|
25
|
+
export declare const useMemo: (...args: any[]) => any;
|
|
26
|
+
export declare const useRef: (...args: any[]) => any;
|
|
27
|
+
export declare const useContext: (...args: any[]) => any;
|
|
28
|
+
export declare const useReducer: (...args: any[]) => any;
|
|
29
|
+
export declare const createElement: (...args: any[]) => any;
|
|
30
|
+
declare const _default: {
|
|
31
|
+
createElement: (...args: any[]) => any;
|
|
32
|
+
Fragment: typeof Fragment;
|
|
33
|
+
useState: (...args: any[]) => any;
|
|
34
|
+
useEffect: (...args: any[]) => any;
|
|
35
|
+
useCallback: (...args: any[]) => any;
|
|
36
|
+
useMemo: (...args: any[]) => any;
|
|
37
|
+
useRef: (...args: any[]) => any;
|
|
38
|
+
useContext: (...args: any[]) => any;
|
|
39
|
+
useReducer: (...args: any[]) => any;
|
|
40
|
+
};
|
|
41
|
+
export default _default;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/* eslint-disable import/no-anonymous-default-export */
|
|
3
|
+
let runtimeReact = null;
|
|
4
|
+
/**
|
|
5
|
+
* プラグインAPIからReactインスタンスを設定
|
|
6
|
+
*/
|
|
7
|
+
export function setReactRuntime(react) {
|
|
8
|
+
runtimeReact = react;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* JSX Transform用のjsx関数
|
|
12
|
+
*/
|
|
13
|
+
export function jsx(type, props, key) {
|
|
14
|
+
if (!runtimeReact) {
|
|
15
|
+
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
16
|
+
}
|
|
17
|
+
return runtimeReact.createElement(type, key ? Object.assign(Object.assign({}, props), { key }) : props);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* JSX Transform用のjsxs関数(複数子要素用)
|
|
21
|
+
*/
|
|
22
|
+
export function jsxs(type, props, key) {
|
|
23
|
+
if (!runtimeReact) {
|
|
24
|
+
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
25
|
+
}
|
|
26
|
+
return runtimeReact.createElement(type, key ? Object.assign(Object.assign({}, props), { key }) : props);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Fragment用
|
|
30
|
+
*/
|
|
31
|
+
export function Fragment(props) {
|
|
32
|
+
if (!runtimeReact) {
|
|
33
|
+
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
34
|
+
}
|
|
35
|
+
return runtimeReact.createElement(runtimeReact.Fragment, null, props.children);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Reactフックと関数のプロキシ
|
|
39
|
+
*/
|
|
40
|
+
export const useState = (...args) => {
|
|
41
|
+
if (!runtimeReact) {
|
|
42
|
+
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
43
|
+
}
|
|
44
|
+
return runtimeReact.useState(...args);
|
|
45
|
+
};
|
|
46
|
+
export const useEffect = (...args) => {
|
|
47
|
+
if (!runtimeReact) {
|
|
48
|
+
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
49
|
+
}
|
|
50
|
+
return runtimeReact.useEffect(...args);
|
|
51
|
+
};
|
|
52
|
+
export const useCallback = (...args) => {
|
|
53
|
+
if (!runtimeReact) {
|
|
54
|
+
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
55
|
+
}
|
|
56
|
+
return runtimeReact.useCallback(...args);
|
|
57
|
+
};
|
|
58
|
+
export const useMemo = (...args) => {
|
|
59
|
+
if (!runtimeReact) {
|
|
60
|
+
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
61
|
+
}
|
|
62
|
+
return runtimeReact.useMemo(...args);
|
|
63
|
+
};
|
|
64
|
+
export const useRef = (...args) => {
|
|
65
|
+
if (!runtimeReact) {
|
|
66
|
+
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
67
|
+
}
|
|
68
|
+
return runtimeReact.useRef(...args);
|
|
69
|
+
};
|
|
70
|
+
export const useContext = (...args) => {
|
|
71
|
+
if (!runtimeReact) {
|
|
72
|
+
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
73
|
+
}
|
|
74
|
+
return runtimeReact.useContext(...args);
|
|
75
|
+
};
|
|
76
|
+
export const useReducer = (...args) => {
|
|
77
|
+
if (!runtimeReact) {
|
|
78
|
+
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
79
|
+
}
|
|
80
|
+
return runtimeReact.useReducer(...args);
|
|
81
|
+
};
|
|
82
|
+
export const createElement = (...args) => {
|
|
83
|
+
if (!runtimeReact) {
|
|
84
|
+
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
85
|
+
}
|
|
86
|
+
return runtimeReact.createElement(...args);
|
|
87
|
+
};
|
|
88
|
+
// デフォルトエクスポート(互換性用)
|
|
89
|
+
export default {
|
|
90
|
+
createElement,
|
|
91
|
+
Fragment,
|
|
92
|
+
useState,
|
|
93
|
+
useEffect,
|
|
94
|
+
useCallback,
|
|
95
|
+
useMemo,
|
|
96
|
+
useRef,
|
|
97
|
+
useContext,
|
|
98
|
+
useReducer,
|
|
99
|
+
};
|
package/dist/sdk.d.ts
ADDED
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ActionNode, BacklogEntry, Character, EntityState, ScenarioBlock } from "./types";
|
|
3
|
+
export interface LunaPlugin {
|
|
4
|
+
name: string;
|
|
5
|
+
version: string;
|
|
6
|
+
description: string;
|
|
7
|
+
/** プラグインインストール時の処理(オプション) */
|
|
8
|
+
onInstall?(api: PluginInstallAPI): Promise<void>;
|
|
9
|
+
/** プラグインアンインストール時の処理(オプション) */
|
|
10
|
+
onUninstall?(api: PluginInstallAPI): Promise<void>;
|
|
11
|
+
setup(api: PluginAPI): void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* シナリオ再生の動的データ
|
|
15
|
+
*/
|
|
16
|
+
export interface ScenarioPlaybackData {
|
|
17
|
+
/** 現在のブロックインデックス(0始まり) */
|
|
18
|
+
currentBlockIndex: number;
|
|
19
|
+
/** 総ブロック数 */
|
|
20
|
+
totalBlocks: number;
|
|
21
|
+
/** 現在のシナリオID */
|
|
22
|
+
scenarioId: string;
|
|
23
|
+
/** シナリオ名 */
|
|
24
|
+
scenarioName: string;
|
|
25
|
+
/** 現在のブロック */
|
|
26
|
+
currentBlock: ScenarioBlock | null;
|
|
27
|
+
/** 表示中のテキスト */
|
|
28
|
+
displayText?: string;
|
|
29
|
+
/** テキストアニメーション中かどうか */
|
|
30
|
+
isTyping?: boolean;
|
|
31
|
+
/** 表示中のキャラクター */
|
|
32
|
+
displayedCharacters?: any[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* バックログデータ
|
|
36
|
+
*/
|
|
37
|
+
export interface BacklogData {
|
|
38
|
+
/** バックログエントリ */
|
|
39
|
+
entries: BacklogEntry[];
|
|
40
|
+
/** 総エントリ数 */
|
|
41
|
+
totalEntries: number;
|
|
42
|
+
/** ログエントリを追加 */
|
|
43
|
+
addLogEntry?: (entry: BacklogEntry) => void;
|
|
44
|
+
/** ログをクリア */
|
|
45
|
+
clearLogs?: () => void;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* プレイヤー設定データ
|
|
49
|
+
*/
|
|
50
|
+
export interface PlayerSettingsData extends PlayerSettings {
|
|
51
|
+
/** テキスト速度 (1-10) */
|
|
52
|
+
textSpeed: number;
|
|
53
|
+
/** 自動再生速度 (秒) */
|
|
54
|
+
autoPlaySpeed: number;
|
|
55
|
+
/** BGM音量 (0-1) */
|
|
56
|
+
bgmVolume: number;
|
|
57
|
+
/** SE音量 (0-1) */
|
|
58
|
+
seVolume: number;
|
|
59
|
+
/** ボイス音量 (0-1) */
|
|
60
|
+
voiceVolume: number;
|
|
61
|
+
/** スキップ設定 */
|
|
62
|
+
skipMode?: "all" | "unread" | "none";
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* プラグインアセットデータ
|
|
66
|
+
*/
|
|
67
|
+
export interface PluginAssetsData {
|
|
68
|
+
/**
|
|
69
|
+
* プラグインのアセットURLを取得
|
|
70
|
+
* @param pluginName - プラグインのパッケージ名
|
|
71
|
+
* @param filename - アセットファイル名
|
|
72
|
+
* @returns アセットのURL
|
|
73
|
+
*/
|
|
74
|
+
getAssetUrl: (pluginName: string, filename: string) => string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* 全データコンテキスト
|
|
78
|
+
*/
|
|
79
|
+
export interface DataContext {
|
|
80
|
+
/** シナリオ再生情報 */
|
|
81
|
+
playback: ScenarioPlaybackData;
|
|
82
|
+
/** バックログ情報 */
|
|
83
|
+
backlog: BacklogData;
|
|
84
|
+
/** プレイヤー設定 */
|
|
85
|
+
settings: PlayerSettingsData;
|
|
86
|
+
/** プラグインアセット */
|
|
87
|
+
pluginAssets: PluginAssetsData;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* データ購読コールバック
|
|
91
|
+
*/
|
|
92
|
+
export type DataSubscriber<T> = (data: T) => void;
|
|
93
|
+
/**
|
|
94
|
+
* データAPI - プラグインからのデータアクセスインターフェース
|
|
95
|
+
*
|
|
96
|
+
* @example Pull型(現在値の取得)
|
|
97
|
+
* ```typescript
|
|
98
|
+
* const blockIndex = api.data.get('playback', 'currentBlockIndex');
|
|
99
|
+
* const playback = api.data.get('playback');
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @example Push型(変更の監視)
|
|
103
|
+
* ```typescript
|
|
104
|
+
* const unsubscribe = api.data.subscribe('playback', (data) => {
|
|
105
|
+
* console.log('Playback updated:', data);
|
|
106
|
+
* });
|
|
107
|
+
* // cleanup
|
|
108
|
+
* unsubscribe();
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* @example プロパティ単位での監視
|
|
112
|
+
* ```typescript
|
|
113
|
+
* api.data.watch('playback', 'currentBlockIndex', (index) => {
|
|
114
|
+
* console.log('Block changed to:', index);
|
|
115
|
+
* });
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
/**
|
|
119
|
+
* UI表示管理API - プラグインUIコンポーネントの表示/非表示を制御
|
|
120
|
+
*/
|
|
121
|
+
export interface UIAPI {
|
|
122
|
+
/**
|
|
123
|
+
* 指定したUIコンポーネントを表示
|
|
124
|
+
* @param type - コンポーネントタイプ
|
|
125
|
+
*/
|
|
126
|
+
show(type: ComponentType): void;
|
|
127
|
+
/**
|
|
128
|
+
* 指定したUIコンポーネントを非表示
|
|
129
|
+
* @param type - コンポーネントタイプ
|
|
130
|
+
*/
|
|
131
|
+
hide(type: ComponentType): void;
|
|
132
|
+
/**
|
|
133
|
+
* 指定したUIコンポーネントの表示/非表示を切り替え
|
|
134
|
+
* @param type - コンポーネントタイプ
|
|
135
|
+
*/
|
|
136
|
+
toggle(type: ComponentType): void;
|
|
137
|
+
/**
|
|
138
|
+
* 指定したUIコンポーネントの表示状態を取得
|
|
139
|
+
* @param type - コンポーネントタイプ
|
|
140
|
+
* @returns 表示中ならtrue
|
|
141
|
+
*/
|
|
142
|
+
isVisible(type: ComponentType): boolean;
|
|
143
|
+
}
|
|
144
|
+
export interface DataAPI {
|
|
145
|
+
/**
|
|
146
|
+
* データの現在値を取得(Pull型)
|
|
147
|
+
* @param key - データカテゴリ
|
|
148
|
+
*/
|
|
149
|
+
get<K extends keyof DataContext>(key: K): DataContext[K];
|
|
150
|
+
/**
|
|
151
|
+
* データの特定プロパティを取得(Pull型)
|
|
152
|
+
* @param key - データカテゴリ
|
|
153
|
+
* @param property - プロパティ名
|
|
154
|
+
*/
|
|
155
|
+
get<K extends keyof DataContext, P extends keyof DataContext[K]>(key: K, property: P): DataContext[K][P];
|
|
156
|
+
/**
|
|
157
|
+
* データカテゴリ全体の変更を監視(Push型)
|
|
158
|
+
* @param key - データカテゴリ
|
|
159
|
+
* @param callback - 変更時のコールバック
|
|
160
|
+
* @returns unsubscribe関数
|
|
161
|
+
*/
|
|
162
|
+
subscribe<K extends keyof DataContext>(key: K, callback: DataSubscriber<DataContext[K]>): () => void;
|
|
163
|
+
/**
|
|
164
|
+
* 特定プロパティの変更を監視(Push型)
|
|
165
|
+
* @param key - データカテゴリ
|
|
166
|
+
* @param property - プロパティ名
|
|
167
|
+
* @param callback - 変更時のコールバック
|
|
168
|
+
* @returns unsubscribe関数
|
|
169
|
+
*/
|
|
170
|
+
watch<K extends keyof DataContext, P extends keyof DataContext[K]>(key: K, property: P, callback: DataSubscriber<DataContext[K][P]>): () => void;
|
|
171
|
+
}
|
|
172
|
+
export interface PluginAPI {
|
|
173
|
+
style: StyleAPI;
|
|
174
|
+
defineActionNode(definition: ActionNodeDefinition): void;
|
|
175
|
+
hooks: PluginHooks;
|
|
176
|
+
effects: EffectAPI;
|
|
177
|
+
storage: StorageAPI;
|
|
178
|
+
assets: AssetAPI;
|
|
179
|
+
components: ComponentAPI;
|
|
180
|
+
data: DataAPI;
|
|
181
|
+
ui: UIAPI;
|
|
182
|
+
React: typeof React;
|
|
183
|
+
setNextCharacterSpeakHandler(callback: (context: CharacterSpeakContext) => void): void;
|
|
184
|
+
getConfig?(): unknown;
|
|
185
|
+
}
|
|
186
|
+
export interface StyleAPI {
|
|
187
|
+
elements: {
|
|
188
|
+
speakerName: StyleElement;
|
|
189
|
+
scenarioBlockContent: StyleElement;
|
|
190
|
+
dialogueBox: StyleElement;
|
|
191
|
+
gameScreen: StyleElement;
|
|
192
|
+
characterSprite: StyleElement;
|
|
193
|
+
background: StyleElement;
|
|
194
|
+
};
|
|
195
|
+
injectCSS(css: string): void;
|
|
196
|
+
enableTailwind(): void;
|
|
197
|
+
}
|
|
198
|
+
export interface OverlayOptions {
|
|
199
|
+
color: string;
|
|
200
|
+
opacity?: number;
|
|
201
|
+
blendMode?: string;
|
|
202
|
+
duration?: number;
|
|
203
|
+
zIndex?: number;
|
|
204
|
+
id?: string;
|
|
205
|
+
}
|
|
206
|
+
export interface StyleElement {
|
|
207
|
+
setClassName(className: string): void;
|
|
208
|
+
addClassName(className: string): void;
|
|
209
|
+
removeClassName(className: string): void;
|
|
210
|
+
toggleClassName(className: string): void;
|
|
211
|
+
setStyle(style: Partial<CSSStyleDeclaration>): void;
|
|
212
|
+
when(condition: () => boolean, className: string): void;
|
|
213
|
+
setOverlay(options: OverlayOptions): string;
|
|
214
|
+
removeOverlay(overlayId: string): void;
|
|
215
|
+
clearOverlays(): void;
|
|
216
|
+
}
|
|
217
|
+
export interface ActionNodeDefinition {
|
|
218
|
+
type: string;
|
|
219
|
+
displayName: string;
|
|
220
|
+
icon?: string;
|
|
221
|
+
attributes: AttributeDefinition[];
|
|
222
|
+
execute(context: ActionExecutionContext): void | Promise<void>;
|
|
223
|
+
}
|
|
224
|
+
export interface AttributeDefinition {
|
|
225
|
+
name: string;
|
|
226
|
+
type: "text" | "textarea" | "number" | "select" | "entity";
|
|
227
|
+
label: string;
|
|
228
|
+
default?: any;
|
|
229
|
+
required?: boolean;
|
|
230
|
+
placeholder?: string;
|
|
231
|
+
min?: number;
|
|
232
|
+
max?: number;
|
|
233
|
+
options?: Array<{
|
|
234
|
+
value: string;
|
|
235
|
+
label: string;
|
|
236
|
+
}>;
|
|
237
|
+
/**
|
|
238
|
+
* entity型の場合、選択可能なオブジェクトタイプ名を制限
|
|
239
|
+
* 指定されない場合は全てのオブジェクトタイプから選択可能
|
|
240
|
+
*/
|
|
241
|
+
entityObjectTypeName?: string;
|
|
242
|
+
/**
|
|
243
|
+
* 条件付き表示設定
|
|
244
|
+
* 他の属性の値に基づいて、この属性を表示するかどうかを制御
|
|
245
|
+
*/
|
|
246
|
+
conditionalDisplay?: {
|
|
247
|
+
dependsOn: string;
|
|
248
|
+
showWhen: string | string[];
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* プラグインインストール時に利用可能なAPI
|
|
253
|
+
*/
|
|
254
|
+
export interface PluginInstallAPI {
|
|
255
|
+
/** オブジェクトタイプを作成 */
|
|
256
|
+
createObjectType(definition: ObjectTypeDefinition): Promise<void>;
|
|
257
|
+
/** オブジェクトタイプを名前で検索 */
|
|
258
|
+
findObjectType(name: string): Promise<ObjectType | null>;
|
|
259
|
+
/** オブジェクトタイプを更新 */
|
|
260
|
+
updateObjectType(name: string, definition: Partial<ObjectTypeDefinition>): Promise<void>;
|
|
261
|
+
}
|
|
262
|
+
/** オブジェクトタイプの定義 */
|
|
263
|
+
export interface ObjectTypeDefinition {
|
|
264
|
+
name: string;
|
|
265
|
+
description?: string;
|
|
266
|
+
isEntity: boolean;
|
|
267
|
+
attributes: ObjectAttributeDefinition[];
|
|
268
|
+
}
|
|
269
|
+
/** オブジェクト属性の定義 */
|
|
270
|
+
export interface ObjectAttributeDefinition {
|
|
271
|
+
name: string;
|
|
272
|
+
displayName: string;
|
|
273
|
+
dataType: "string" | "number" | "boolean" | "text";
|
|
274
|
+
isRequired: boolean;
|
|
275
|
+
defaultValue?: any;
|
|
276
|
+
sortOrder?: number;
|
|
277
|
+
}
|
|
278
|
+
/** 簡易的なオブジェクトタイプ情報 */
|
|
279
|
+
export interface ObjectType {
|
|
280
|
+
id: string;
|
|
281
|
+
name: string;
|
|
282
|
+
description?: string;
|
|
283
|
+
isEntity: boolean;
|
|
284
|
+
}
|
|
285
|
+
export interface ActionExecutionContext {
|
|
286
|
+
attributes: Record<string, unknown>;
|
|
287
|
+
currentBlock: ScenarioBlock;
|
|
288
|
+
currentSpeaker?: Character;
|
|
289
|
+
displayedCharacters: Character[];
|
|
290
|
+
api: PluginAPI;
|
|
291
|
+
}
|
|
292
|
+
export interface PluginHooks {
|
|
293
|
+
onInit(callback: () => void): void;
|
|
294
|
+
onScenarioReady(callback: (context: ScenarioReadyContext) => void): void;
|
|
295
|
+
onBlockChange(callback: (context: BlockChangeContext) => void): void;
|
|
296
|
+
onCharacterEnter(callback: (context: CharacterContext) => void): void;
|
|
297
|
+
onCharacterExit(callback: (context: CharacterContext) => void): void;
|
|
298
|
+
onDialogueShow(callback: (context: DialogueContext) => void): void;
|
|
299
|
+
onActionExecute(callback: (context: ActionExecutionContext) => void): void;
|
|
300
|
+
onScenarioStart(callback: (context: ScenarioContext) => void): void;
|
|
301
|
+
onScenarioEnd(callback: (context: ScenarioContext) => void): void;
|
|
302
|
+
}
|
|
303
|
+
export interface BlockChangeContext {
|
|
304
|
+
previousBlock?: ScenarioBlock;
|
|
305
|
+
currentBlock: ScenarioBlock;
|
|
306
|
+
blockIndex: number;
|
|
307
|
+
}
|
|
308
|
+
export interface CharacterContext {
|
|
309
|
+
character: Character;
|
|
310
|
+
state: EntityState;
|
|
311
|
+
position?: number;
|
|
312
|
+
}
|
|
313
|
+
export interface DialogueContext {
|
|
314
|
+
dialogue: {
|
|
315
|
+
content: string;
|
|
316
|
+
speakerName?: string;
|
|
317
|
+
speakerState?: string;
|
|
318
|
+
};
|
|
319
|
+
speakerElement?: HTMLElement;
|
|
320
|
+
dialogueElement: HTMLElement;
|
|
321
|
+
}
|
|
322
|
+
export interface CharacterSpeakContext {
|
|
323
|
+
speaker: {
|
|
324
|
+
id: string;
|
|
325
|
+
name: string;
|
|
326
|
+
state?: string;
|
|
327
|
+
position?: number;
|
|
328
|
+
};
|
|
329
|
+
dialogue: {
|
|
330
|
+
content: string;
|
|
331
|
+
isNewSpeaker: boolean;
|
|
332
|
+
};
|
|
333
|
+
speakerElement?: HTMLElement;
|
|
334
|
+
characterElement?: HTMLElement;
|
|
335
|
+
previousSpeaker?: {
|
|
336
|
+
id?: string;
|
|
337
|
+
name?: string;
|
|
338
|
+
};
|
|
339
|
+
facePosition?: {
|
|
340
|
+
x: number;
|
|
341
|
+
y: number;
|
|
342
|
+
width: number;
|
|
343
|
+
height: number;
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
export interface ScenarioContext {
|
|
347
|
+
scenario: {
|
|
348
|
+
id: string;
|
|
349
|
+
name: string;
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
export interface ScenarioReadyContext {
|
|
353
|
+
scenario: {
|
|
354
|
+
id: string;
|
|
355
|
+
name: string;
|
|
356
|
+
};
|
|
357
|
+
allBlocks: ScenarioBlock[];
|
|
358
|
+
currentBlockIndex: number;
|
|
359
|
+
currentBlock: ScenarioBlock;
|
|
360
|
+
}
|
|
361
|
+
export interface EffectAPI {
|
|
362
|
+
show(options: EffectOptions): string;
|
|
363
|
+
hide(effectId: string): void;
|
|
364
|
+
hideAll(): void;
|
|
365
|
+
}
|
|
366
|
+
export interface EffectOptions {
|
|
367
|
+
target?: "speaker" | "dialogue" | "screen" | HTMLElement;
|
|
368
|
+
html: string;
|
|
369
|
+
duration?: number;
|
|
370
|
+
className?: string;
|
|
371
|
+
position?: "above" | "below" | "left" | "right" | "center" | "precise";
|
|
372
|
+
animation?: "fade" | "slide" | "bounce" | "none";
|
|
373
|
+
}
|
|
374
|
+
export interface StorageAPI {
|
|
375
|
+
get<T = any>(key: string): T | null;
|
|
376
|
+
set<T = any>(key: string, value: T): void;
|
|
377
|
+
remove(key: string): void;
|
|
378
|
+
clear(): void;
|
|
379
|
+
}
|
|
380
|
+
export interface AssetAPI {
|
|
381
|
+
getUrl(filename: string): string;
|
|
382
|
+
preload(filenames: string[]): Promise<void>;
|
|
383
|
+
playSound(filename: string, options?: SoundOptions): void;
|
|
384
|
+
stopSound(filename: string): void;
|
|
385
|
+
}
|
|
386
|
+
export interface SoundOptions {
|
|
387
|
+
volume?: number;
|
|
388
|
+
loop?: boolean;
|
|
389
|
+
fadeDuration?: number;
|
|
390
|
+
}
|
|
391
|
+
export declare enum ComponentType {
|
|
392
|
+
Backlog = "Backlog",
|
|
393
|
+
DialogueBox = "DialogueBox",
|
|
394
|
+
CharacterDisplay = "CharacterDisplay",
|
|
395
|
+
ActionMenu = "ActionMenu",
|
|
396
|
+
SaveLoadMenu = "SaveLoadMenu",
|
|
397
|
+
SaveMenu = "SaveMenu",
|
|
398
|
+
LoadMenu = "LoadMenu",
|
|
399
|
+
SettingsMenu = "SettingsMenu",
|
|
400
|
+
GameMenu = "GameMenu",
|
|
401
|
+
Config = "Config"
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* コンポーネント登録API
|
|
405
|
+
* すべてのデータはDataContext経由で提供されるため、propsは使用しません
|
|
406
|
+
*/
|
|
407
|
+
export interface ComponentAPI {
|
|
408
|
+
registerComponent(type: ComponentType, component: React.ComponentType): void;
|
|
409
|
+
}
|
|
410
|
+
export type { BacklogEntry };
|
|
411
|
+
export interface DisplayedCharacter {
|
|
412
|
+
objectId: string;
|
|
413
|
+
stateId?: string;
|
|
414
|
+
position?: {
|
|
415
|
+
x: number;
|
|
416
|
+
y: number;
|
|
417
|
+
};
|
|
418
|
+
scale?: number;
|
|
419
|
+
}
|
|
420
|
+
export interface PlayerSettings {
|
|
421
|
+
textSpeed: number;
|
|
422
|
+
autoPlaySpeed: number;
|
|
423
|
+
bgmVolume: number;
|
|
424
|
+
seVolume: number;
|
|
425
|
+
voiceVolume: number;
|
|
426
|
+
}
|
|
427
|
+
export type { ScenarioBlock, Character, EntityState, ActionNode };
|
|
428
|
+
export declare function definePlugin(plugin: LunaPlugin): LunaPlugin;
|
|
429
|
+
export declare function defineComponent(type: ComponentType, component: React.ComponentType): {
|
|
430
|
+
type: ComponentType;
|
|
431
|
+
component: React.ComponentType;
|
|
432
|
+
};
|
|
433
|
+
export interface FaceRelativeEffectOptions {
|
|
434
|
+
facePosition: {
|
|
435
|
+
x: number;
|
|
436
|
+
y: number;
|
|
437
|
+
width: number;
|
|
438
|
+
height: number;
|
|
439
|
+
};
|
|
440
|
+
relativePosition: "forehead" | "cheek_left" | "cheek_right" | "chin" | "center";
|
|
441
|
+
offsetX?: number;
|
|
442
|
+
offsetY?: number;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Calculate effect position relative to face
|
|
446
|
+
* Utility function for plugins to position effects relative to character face
|
|
447
|
+
*/
|
|
448
|
+
export declare function calculateFaceRelativePosition(options: FaceRelativeEffectOptions): {
|
|
449
|
+
x: number;
|
|
450
|
+
y: number;
|
|
451
|
+
};
|
|
452
|
+
export { React };
|
|
453
|
+
/**
|
|
454
|
+
* 画面サイズ変換ユーティリティの型定義
|
|
455
|
+
*/
|
|
456
|
+
export interface PixelConverter {
|
|
457
|
+
/** 高さ基準でピクセル値を変換 */
|
|
458
|
+
pixel: (basisX: number) => number;
|
|
459
|
+
/** 幅基準でピクセル値を変換 */
|
|
460
|
+
pixelWidth: (basisX: number) => number;
|
|
461
|
+
/** アスペクト比を考慮したサイズを返す */
|
|
462
|
+
aspectSize: (basisSize: number) => {
|
|
463
|
+
width: number;
|
|
464
|
+
height: number;
|
|
465
|
+
};
|
|
466
|
+
/** 2D座標を変換 */
|
|
467
|
+
pos: (basisPos: {
|
|
468
|
+
x: number;
|
|
469
|
+
y: number;
|
|
470
|
+
}) => {
|
|
471
|
+
x: number;
|
|
472
|
+
y: number;
|
|
473
|
+
};
|
|
474
|
+
/** 3D座標を変換 */
|
|
475
|
+
vec3d: (basisPos: {
|
|
476
|
+
x: number;
|
|
477
|
+
y: number;
|
|
478
|
+
z: number;
|
|
479
|
+
}) => {
|
|
480
|
+
x: number;
|
|
481
|
+
y: number;
|
|
482
|
+
z: number;
|
|
483
|
+
};
|
|
484
|
+
/** 相対幅を実際のピクセル幅に変換 */
|
|
485
|
+
relativeWidth: (basisWidth: number) => number;
|
|
486
|
+
/** 相対高さを実際のピクセル高さに変換 */
|
|
487
|
+
relativeHeight: (basisHeight: number) => number;
|
|
488
|
+
/** 相対座標を実際のピクセル座標に変換 */
|
|
489
|
+
relativePos: (basisPos: {
|
|
490
|
+
x: number;
|
|
491
|
+
y: number;
|
|
492
|
+
}) => {
|
|
493
|
+
x: number;
|
|
494
|
+
y: number;
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* 画面サイズの型定義
|
|
499
|
+
*/
|
|
500
|
+
export interface ScreenSize {
|
|
501
|
+
width: number;
|
|
502
|
+
height: number;
|
|
503
|
+
}
|
|
504
|
+
export declare function useToPixel(): PixelConverter;
|
|
505
|
+
export declare function useScreenSize(): ScreenSize;
|
|
506
|
+
export declare function useScreenScale(): number;
|
|
507
|
+
export declare function useScreenSizeAtom(): [
|
|
508
|
+
ScreenSize,
|
|
509
|
+
(size: ScreenSize) => void
|
|
510
|
+
];
|
|
511
|
+
export { OverlayUI } from "./components/OverlayUI";
|
|
512
|
+
export { aspectRatio, BasisHeight, BasisWidth } from "./constants/screen-size";
|