chore: 纳入项目全部源码进根仓库统一管理

删除 YouleNexus 内嵌 .git,统一由根仓库唯一管理。提交:
- projects/ 旧 H5 模板 Game_Surface_3 与各子游戏源码
- cocoscreator_projects/YouleNexus 工程 + cocos-creator-mcp 扩展源码
- CLAUDE.md、.mcp.json 等配置
library/temp/node_modules/dist 等缓存由 .gitignore 排除。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-28 11:55:13 +08:00
co-authored by Claude Opus 4.8
parent f5673c33c8
commit 7ab748919a
7317 changed files with 2810014 additions and 0 deletions
@@ -0,0 +1,128 @@
/**
* Prefab保存テスト — プロパティがPrefabに保持されるか検証
*
* 前提: CocosCreatorでcocos-creator-mcpサーバーが起動中、MainScene開いてる
*/
const PORT = process.argv[2] || 3001;
const BASE = `http://127.0.0.1:${PORT}`;
let rpcId = 0;
async function rpc(method, params = {}) {
const res = await fetch(`${BASE}/mcp`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ jsonrpc: "2.0", id: ++rpcId, method, params }),
});
return res.json();
}
async function callTool(name, args = {}) {
const res = await rpc("tools/call", { name, arguments: args });
if (res.error) return { _rpcError: res.error };
const text = res.result?.content?.[0]?.text;
return text ? JSON.parse(text) : res.result;
}
async function sceneScript(method, args) {
// Call execute-scene-script through a raw JSON-RPC (not via tool)
// Actually we need to go through the MCP server... let's use node_set_property hack
// Or better: add a scene_script tool call
// For now, use the existing setComponentProperty that IS registered in scene.ts
// We can't call execute-scene-script directly from outside.
// But we CAN call the node_set_property tool which internally calls setNodeProperty scene script.
// For component property, we need a dedicated tool.
// Workaround: Use curl to call the Editor's Messages API if available
return null;
}
async function main() {
console.log("\n🧪 Prefab Property Persistence Test\n");
// Step 1: Create test node with Label
console.log("1. Creating test node with Label...");
const created = await callTool("node_create", {
name: "PrefabPropertyTest",
parent: "83A39G7PtBqLLEoVjvUo4h", // Canvas
components: ["cc.Label"],
});
console.log(` Node UUID: ${created.uuid}`);
const nodeUuid = created.uuid;
// Step 2: Set position (this should persist)
console.log("2. Setting position to (100, 200, 0)...");
await callTool("node_set_transform", {
uuid: nodeUuid,
position: { x: 100, y: 200, z: 0 },
});
// Step 3: Verify position was set
const info1 = await callTool("node_get_info", { uuid: nodeUuid });
console.log(` Position: (${info1.data?.position?.x}, ${info1.data?.position?.y})`);
console.log(` Components: ${info1.data?.components?.map(c => c.type).join(", ")}`);
// Step 4: Try to create prefab via Editor API
console.log("3. Attempting to create prefab via Editor.Message...");
// We'll try the create-prefab scene message
// This requires calling: Editor.Message.request("scene", "create-prefab", nodeUuid, url)
// Since we don't have a tool for this, let's try different approaches:
// Approach A: Try "create-prefab" message (3 args: nodeUuid, url, ?)
const prefabUrl = "db://assets/test/PrefabPropertyTest.prefab";
// We need to add this capability. For now, let's check if we can use
// asset-db to create an asset
console.log(` Target: ${prefabUrl}`);
// Actually, let me just check the scene script createPrefabFromNode
// which IS registered in package.json scene methods
// But wait - our own MCP's scene.ts doesn't have createPrefabFromNode
console.log("\n⚠️ Prefab creation tool not yet implemented in our MCP.");
console.log(" This is what needs to be built for v0.5.\n");
// Step 5: Test what the Editor API returns for prefab-related messages
console.log("4. Probing available prefab-related Editor Messages...");
const messages = [
["scene", "create-prefab"],
["scene", "save-prefab"],
["asset-db", "create-asset"],
];
for (const [target, msg] of messages) {
try {
const res = await fetch(`${BASE}/mcp`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
jsonrpc: "2.0", id: ++rpcId, method: "tools/call",
params: { name: "node_get_info", arguments: { uuid: "test" } }
}),
});
console.log(` ${target}:${msg} — needs testing`);
} catch (e) {
console.log(` ${target}:${msg} — error: ${e.message}`);
}
}
// Cleanup
console.log("\n5. Cleaning up test node...");
await callTool("node_delete", { uuid: nodeUuid });
console.log(" Deleted.\n");
console.log("═".repeat(50));
console.log(" Summary:");
console.log(" - Node creation with components: ✅");
console.log(" - Position/transform setting: ✅");
console.log(" - Component property setting: ❓ (needs component tool)");
console.log(" - Prefab creation: ❓ (needs prefab tool)");
console.log(" - Property persistence in prefab: ❓ (blocked by above)");
console.log("═".repeat(50));
console.log("\n→ v0.5 で component + prefab ツール実装後に再検証");
}
main().catch(e => { console.error("Fatal:", e); process.exit(1); });