chore(unity): 固定Unity CLI Loop本地包并移除UnitySkills依赖

This commit is contained in:
Liubing\LB
2026-09-28 18:14:59 +08:00
parent 0eb43b2b40
commit c4ae02def9
952 changed files with 70137 additions and 11 deletions

View File

@@ -0,0 +1,51 @@
namespace io.github.hatayama.uLoopMCP
{
/// <summary>
/// Response returned by the Focus Unity Window MCP tool.
/// Indicates whether the foregrounding request succeeded and includes details for optional UI display.
/// </summary>
public class FocusUnityWindowResponse : BaseToolResponse
{
/// <summary>
/// Gets whether the Unity Editor window was successfully brought to the foreground.
/// </summary>
public bool Success { get; set; }
/// <summary>
/// Gets or sets a message describing the outcome in human-readable form.
/// </summary>
public string Message { get; set; } = string.Empty;
/// <summary>
/// Gets or sets an error description, populated only when <see cref="Success"/> is false.
/// </summary>
public string ErrorMessage { get; set; } = string.Empty;
/// <summary>
/// Initializes a successful response.
/// </summary>
public FocusUnityWindowResponse(string message)
{
Success = true;
Message = message;
ErrorMessage = string.Empty;
}
/// <summary>
/// Initializes a failed response with error details.
/// </summary>
public FocusUnityWindowResponse(string message, string errorMessage)
{
Success = false;
Message = message;
ErrorMessage = errorMessage;
}
/// <summary>
/// Initializes an empty response, primarily for JSON deserialization.
/// </summary>
public FocusUnityWindowResponse()
{
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e05922b5b28da402382bbff60b5b4163
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,12 @@
namespace io.github.hatayama.uLoopMCP
{
/// <summary>
/// Schema for the Focus Unity Window MCP tool.
/// Bringing the currently connected Unity Editor window to the foreground
/// does not require any parameters.
/// </summary>
public class FocusUnityWindowSchema : BaseToolSchema
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 66062c0a01557491e8a79321ff2cf127
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,52 @@
using System.Threading;
using System.Threading.Tasks;
namespace io.github.hatayama.uLoopMCP
{
// ==========================================================================
// IMPORTANT: Why this class still exists (Do not delete)
// ==========================================================================
// The focus-window functionality is now handled at OS level by TypeScript
// MCP server and CLI using the launch-unity package. This works even when
// Unity is busy (compiling/domain reload).
//
// This class remains for two reasons:
//
// 1. Tool List Registration:
// - MCP tool list is built from Unity's tool registry
// - Without this class, "focus-window" won't appear in tools/list
//
// 2. Graceful CLI Upgrade Message:
// - Old CLI versions connect directly to Unity TCP (bypass TypeScript)
// - When old CLI calls this tool, we return an upgrade prompt
// - New CLI uses OS-level focus and never reaches this code
//
// Execution flow:
// - New CLI/MCP: TypeScript intercepts → OS-level focus → This code NOT called
// - Old CLI: Direct Unity TCP → This code called → Returns upgrade message
// ==========================================================================
/// <summary>
/// Stub for tool list registration. Actual focus is handled by TypeScript MCP server.
/// </summary>
[McpTool(Description = "Bring Unity Editor window to front using OS-level commands. Works even when Unity is busy (compiling, domain reload).")]
public class FocusUnityWindowTool : AbstractUnityTool<FocusUnityWindowSchema, FocusUnityWindowResponse>
{
/// <inheritdoc />
public override string ToolName => "focus-window";
/// <inheritdoc />
protected override Task<FocusUnityWindowResponse> ExecuteAsync(
FocusUnityWindowSchema parameters,
CancellationToken ct)
{
// This code is only reached by old CLI versions that bypass TypeScript.
// New CLI and MCP clients use OS-level focus via launch-unity package.
return Task.FromResult(new FocusUnityWindowResponse(
"Please update uloop-cli to the latest version for improved focus-window support. " +
"Run: npm install -g uloop-cli@latest",
"focus-window now uses OS-level commands and works even during Unity compilation. " +
"Update CLI to use this feature."));
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 171cdb24042a94e34990a983f8d39fb1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: