using System;
using MCPForUnity.Editor.Dependencies;
using MCPForUnity.Editor.Dependencies.Models;
using MCPForUnity.Editor.Helpers;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
namespace MCPForUnity.Editor.Windows
{
///
/// Setup window for checking and guiding dependency installation
///
public class MCPSetupWindow : EditorWindow
{
// UI Elements
private VisualElement pythonIndicator;
private Label pythonVersion;
private Label pythonDetails;
private VisualElement uvIndicator;
private Label uvVersion;
private Label uvDetails;
private Label statusMessage;
private VisualElement installationSection;
private Label installationInstructions;
private Button openPythonLinkButton;
private Button openUvLinkButton;
private Button refreshButton;
private Button doneButton;
private DependencyCheckResult _dependencyResult;
public static void ShowWindow(DependencyCheckResult dependencyResult = null)
{
var window = GetWindow("MCP Setup");
window.minSize = new Vector2(480, 320);
window._dependencyResult = dependencyResult ?? DependencyManager.CheckAllDependencies();
window.Show();
}
public void CreateGUI()
{
string basePath = AssetPathUtility.GetMcpPackageRootPath();
// Load UXML
var visualTree = AssetDatabase.LoadAssetAtPath(
$"{basePath}/Editor/Windows/MCPSetupWindow.uxml"
);
if (visualTree == null)
{
McpLog.Error($"Failed to load UXML at: {basePath}/Editor/Windows/MCPSetupWindow.uxml");
return;
}
visualTree.CloneTree(rootVisualElement);
// Cache UI elements
pythonIndicator = rootVisualElement.Q("python-indicator");
pythonVersion = rootVisualElement.Q