sa2kit 1.0.2 → 1.0.4
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/mmd/index.js +46 -2
- package/dist/mmd/index.js.map +1 -1
- package/dist/mmd/index.mjs +46 -2
- package/dist/mmd/index.mjs.map +1 -1
- package/package.json +20 -18
package/dist/mmd/index.js
CHANGED
|
@@ -596,7 +596,24 @@ var MMDPlayerEnhanced = ({
|
|
|
596
596
|
});
|
|
597
597
|
console.log("\u2705 [MMDPlayerEnhanced] Ammo.js \u52A0\u8F7D\u5B8C\u6210");
|
|
598
598
|
}
|
|
599
|
-
const
|
|
599
|
+
const manager = new THREE2__namespace.LoadingManager();
|
|
600
|
+
const modelUrl = currentResources.modelPath;
|
|
601
|
+
const basePath = modelUrl.substring(0, modelUrl.lastIndexOf("/") + 1);
|
|
602
|
+
console.log("\u{1F4C2} [MMDPlayerEnhanced] \u6A21\u578B\u57FA\u7840\u8DEF\u5F84:", basePath);
|
|
603
|
+
manager.setURLModifier((url) => {
|
|
604
|
+
if (url.startsWith("http://") || url.startsWith("https://")) {
|
|
605
|
+
console.log("\u{1F517} [MMDPlayerEnhanced] \u4F7F\u7528\u5B8C\u6574 URL:", url);
|
|
606
|
+
return url;
|
|
607
|
+
}
|
|
608
|
+
if (url.startsWith("/")) {
|
|
609
|
+
console.log("\u{1F517} [MMDPlayerEnhanced] \u4F7F\u7528\u7EDD\u5BF9\u8DEF\u5F84:", url);
|
|
610
|
+
return url;
|
|
611
|
+
}
|
|
612
|
+
const fullUrl = basePath + url;
|
|
613
|
+
console.log("\u{1F517} [MMDPlayerEnhanced] \u76F8\u5BF9\u8DEF\u5F84\u8F6C\u6362:", url, "->", fullUrl);
|
|
614
|
+
return fullUrl;
|
|
615
|
+
});
|
|
616
|
+
const loader = new threeStdlib.MMDLoader(manager);
|
|
600
617
|
const helper = new threeStdlib.MMDAnimationHelper();
|
|
601
618
|
helperRef.current = helper;
|
|
602
619
|
setLoadingProgress(20);
|
|
@@ -1189,8 +1206,35 @@ var MMDPlaylist = ({
|
|
|
1189
1206
|
return /* @__PURE__ */ React2__default.default.createElement("div", { className: "flex h-full w-full items-center justify-center bg-black text-white" }, /* @__PURE__ */ React2__default.default.createElement("p", null, "\u64AD\u653E\u5217\u8868\u8282\u70B9\u7D22\u5F15\u65E0\u6548"));
|
|
1190
1207
|
}
|
|
1191
1208
|
console.log("\u{1F3AF} [MMDPlaylist] \u5F53\u524D\u8282\u70B9:", currentNode.name, "\u7D22\u5F15:", currentNodeIndex);
|
|
1209
|
+
const stopNode = (nodeIndex) => {
|
|
1210
|
+
const playerElement = playerRefsMap.current.get(nodeIndex);
|
|
1211
|
+
if (!playerElement) return;
|
|
1212
|
+
console.log(`\u23F9\uFE0F [MMDPlaylist] \u505C\u6B62\u8282\u70B9 ${nodeIndex}`);
|
|
1213
|
+
const audioElement = playerElement.querySelector("audio");
|
|
1214
|
+
if (audioElement) {
|
|
1215
|
+
audioElement.pause();
|
|
1216
|
+
audioElement.currentTime = 0;
|
|
1217
|
+
console.log(` \u{1F507} \u505C\u6B62\u97F3\u9891`);
|
|
1218
|
+
}
|
|
1219
|
+
const stopButton = playerElement.querySelector('button[title="\u505C\u6B62"]');
|
|
1220
|
+
if (stopButton) {
|
|
1221
|
+
stopButton.click();
|
|
1222
|
+
console.log(` \u23F9\uFE0F \u70B9\u51FB\u505C\u6B62\u6309\u94AE`);
|
|
1223
|
+
} else {
|
|
1224
|
+
const pauseButton = playerElement.querySelector('button[title="\u6682\u505C"]');
|
|
1225
|
+
if (pauseButton) {
|
|
1226
|
+
pauseButton.click();
|
|
1227
|
+
console.log(` \u23F8\uFE0F \u70B9\u51FB\u6682\u505C\u6309\u94AE`);
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1192
1231
|
React2.useEffect(() => {
|
|
1193
1232
|
console.log(`\u{1F504} [MMDPlaylist] \u8282\u70B9\u5207\u6362: ${currentNodeIndex} - ${currentNode.name}`);
|
|
1233
|
+
editableNodes.forEach((_, index) => {
|
|
1234
|
+
if (index !== currentNodeIndex) {
|
|
1235
|
+
stopNode(index);
|
|
1236
|
+
}
|
|
1237
|
+
});
|
|
1194
1238
|
onNodeChange?.(currentNodeIndex, currentNode);
|
|
1195
1239
|
if (!isPreloading && (isAutoSwitchRef.current || playlist.autoPlay)) {
|
|
1196
1240
|
console.log(`\u25B6\uFE0F [MMDPlaylist] \u51C6\u5907\u64AD\u653E\u8282\u70B9 ${currentNodeIndex}`);
|
|
@@ -1213,7 +1257,7 @@ var MMDPlaylist = ({
|
|
|
1213
1257
|
}
|
|
1214
1258
|
});
|
|
1215
1259
|
}
|
|
1216
|
-
}, [currentNodeIndex, currentNode, onNodeChange, isPreloading, playlist.autoPlay, preloadedNodes]);
|
|
1260
|
+
}, [currentNodeIndex, currentNode, onNodeChange, isPreloading, playlist.autoPlay, preloadedNodes, editableNodes]);
|
|
1217
1261
|
const handleNodePreloaded = (nodeIndex) => {
|
|
1218
1262
|
console.log(`\u2705 [MMDPlaylist] \u8282\u70B9 ${nodeIndex} \u9884\u52A0\u8F7D\u5B8C\u6210`);
|
|
1219
1263
|
setPreloadedNodes((prev) => {
|