@luna-editor/engine 0.4.1 → 0.4.3
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.js +3 -1
- package/dist/plugin/PluginManager.js +5 -9
- package/package.json +1 -1
package/dist/Player.js
CHANGED
|
@@ -39,7 +39,9 @@ import { ComponentType } from "./sdk";
|
|
|
39
39
|
import { convertBranchBlockToScenarioBlock } from "./utils/branchBlockConverter";
|
|
40
40
|
import { BranchNavigator } from "./utils/branchNavigator";
|
|
41
41
|
import { VariableManager } from "./utils/variableManager";
|
|
42
|
-
|
|
42
|
+
const EMPTY_PLUGINS = [];
|
|
43
|
+
const EMPTY_SOUNDS = [];
|
|
44
|
+
export const Player = ({ scenario: scenarioProp, settings, plugins = EMPTY_PLUGINS, sounds = EMPTY_SOUNDS, onEnd, onScenarioEnd, onScenarioStart, onScenarioCancelled, onSettingsChange, className, autoplay = false, preventDefaultScroll = true, screenSize: screenSizeProp, disableKeyboardNavigation = false, }) => {
|
|
43
45
|
var _a, _b, _c, _d;
|
|
44
46
|
// scenario.blocks が存在しない場合は空の配列を使用
|
|
45
47
|
const scenario = useMemo(() => {
|
|
@@ -117,13 +117,11 @@ export class PluginManager {
|
|
|
117
117
|
// 開発環境ではキャッシュをバイパスして常に最新コードをロード
|
|
118
118
|
const isDevelopment = this.isDevelopment();
|
|
119
119
|
if (isDevelopment) {
|
|
120
|
-
// 開発環境では強制リロード(キャッシュをクリア)
|
|
121
|
-
globalLoadedPlugins.delete(packageName);
|
|
122
|
-
this.plugins.delete(packageName);
|
|
123
120
|
// ロード中の場合はそのPromiseを待って完了させる(二重ロード防止)
|
|
124
121
|
const existingLoadPromise = globalLoadingPlugins.get(packageName);
|
|
125
122
|
if (existingLoadPromise) {
|
|
126
123
|
yield existingLoadPromise;
|
|
124
|
+
// ロード完了後、結果をローカルにコピー
|
|
127
125
|
const loaded = globalLoadedPlugins.get(packageName);
|
|
128
126
|
if (loaded) {
|
|
129
127
|
this.plugins.set(packageName, Object.assign(Object.assign({}, loaded), { config: config !== null && config !== void 0 ? config : loaded.config }));
|
|
@@ -133,6 +131,9 @@ export class PluginManager {
|
|
|
133
131
|
}
|
|
134
132
|
return;
|
|
135
133
|
}
|
|
134
|
+
// ロード中でなければキャッシュをクリアして再ロード
|
|
135
|
+
globalLoadedPlugins.delete(packageName);
|
|
136
|
+
this.plugins.delete(packageName);
|
|
136
137
|
}
|
|
137
138
|
else {
|
|
138
139
|
// 本番環境のみキャッシュを使用
|
|
@@ -1017,14 +1018,9 @@ export class PluginManager {
|
|
|
1017
1018
|
getPluginAssetUrl(packageName, filename) {
|
|
1018
1019
|
const plugin = this.plugins.get(packageName);
|
|
1019
1020
|
if (!plugin) {
|
|
1020
|
-
console.warn(`[PluginManager] Plugin not found: "${packageName}", registered plugins:`, Array.from(this.plugins.keys()));
|
|
1021
1021
|
return "";
|
|
1022
1022
|
}
|
|
1023
|
-
|
|
1024
|
-
if (!url) {
|
|
1025
|
-
console.warn(`[PluginManager] Asset not found: "${filename}" in "${packageName}", registered assets:`, Array.from(plugin.instance.assetUrls.keys()));
|
|
1026
|
-
}
|
|
1027
|
-
return url;
|
|
1023
|
+
return plugin.instance.assetUrls.get(filename) || "";
|
|
1028
1024
|
}
|
|
1029
1025
|
/**
|
|
1030
1026
|
* UI コンポーネントの表示状態を設定
|