public void UnExecute()
    {
        UIADJUSTATLAS_ERROR_TYPE errorType = UIADJUSTATLAS_ERROR_TYPE.UIADJUSTATLAS_ERROR_NONE;

        List <string> operateAtlasList = new List <string>();

        operateAtlasList.Add(m_destProjectPath);

        List <UIAdjust_SpriteOperateInfo> newOperateInfoList = new List <UIAdjust_SpriteOperateInfo>();

        UIAdjust_SpriteOperateInfo newInfo = new UIAdjust_SpriteOperateInfo();

        newInfo.SourceProjectPath = m_destProjectPath;
        foreach (var item in m_sourceInfoTable)
        {
            newInfo.OperateSpriteTable.AddRange(item.OperateSpriteTable);
        }
        newOperateInfoList.Add(newInfo);

        errorType = UIAdjustAtlasEditorModel.GetInstance().ReduceOperateCount(operateAtlasList.ToArray());
        errorType = UIAdjustAtlasEditorModel.GetInstance().RemoveSprite(newOperateInfoList);
        if (UIADJUSTATLAS_ERROR_TYPE.UIADJUSTATLAS_ERROR_NONE == errorType)
        {
            UniversalEditorLog.DebugLog("撤销复制");
        }
    }
 void OnEnable()
 {
     UIAdjustAtlasEditorModel.GetInstance().ReadProjectPathConfig(out m_projectPath);
     UIAdjustAtlasEditorModel.GetInstance().ReadImageBasePathConfig(out m_imageBasePath);
     UIAdjustAtlasEditorModel.GetInstance().ReadConsistencyResultPathConfig(out m_consisitencyResultPath);
     UIAdjustAtlasEditorModel.GetInstance().ReadConsistencyPrefabPathConfig(out m_consistencyPrefabPath);
     UIAdjustAtlasEditorModel.GetInstance().ReadReferencePrefabPathConfig(out m_referencePrefabPath);
     UIAdjustAtlasEditorModel.GetInstance().ReadReferenceScenePathConfig(out m_referenceScenePath);
     UIAdjustAtlasEditorModel.GetInstance().ReadReferenceResultPathConfig(out m_referenceResultPath);
 }
    public void UnExecute()
    {
        UIADJUSTATLAS_ERROR_TYPE errorType = UIADJUSTATLAS_ERROR_TYPE.UIADJUSTATLAS_ERROR_NONE;

        errorType = UIAdjustAtlasEditorModel.GetInstance().AddAtlasProject(m_ProjectPath);
        if (UIADJUSTATLAS_ERROR_TYPE.UIADJUSTATLAS_ERROR_NONE == errorType)
        {
            UniversalEditorLog.DebugLog("撤销移除工程:" + m_ProjectPath);
        }
    }
    private void ConfigReferenceResultPath()
    {
        string referenceResultPath = string.Empty;

        referenceResultPath = EditorUtility.SaveFolderPanel("配置引用关系导出路径", UIAtlasEditorConfig.ReferenceResultPath, "");
        if (!string.IsNullOrEmpty(referenceResultPath))
        {
            UIAdjustAtlasEditorModel.GetInstance().WriteReferenceResultPathConfig(referenceResultPath + "/");
            m_referenceResultPath = referenceResultPath + "/";
        }
    }
    private void ConfigConsistencyResultPath()
    {
        string consistencyResultPath = string.Empty;

        consistencyResultPath = EditorUtility.SaveFolderPanel("配置一致性检查结果路径", UIAtlasEditorConfig.ConsistencyResultPath, "");
        if (!string.IsNullOrEmpty(consistencyResultPath))
        {
            UIAdjustAtlasEditorModel.GetInstance().WriteConsistencyResultPathConfig(consistencyResultPath + "/");
            m_consisitencyResultPath = consistencyResultPath + "/";
        }
    }
    private void ConfigImageBasePath()
    {
        string imageBasePath = string.Empty;

        imageBasePath = EditorUtility.SaveFolderPanel("配置Spsrite图库路径", UIAtlasEditorConfig.ImageBasePath, "");
        if (!string.IsNullOrEmpty(imageBasePath))
        {
            UIAdjustAtlasEditorModel.GetInstance().WriteImageBasePathConfig(imageBasePath + "/");
            m_imageBasePath = imageBasePath + "/";
        }
    }
    private void ConfigProjectPath()
    {
        string projectPath = string.Empty;

        projectPath = EditorUtility.SaveFolderPanel("配置Project路径", UIAtlasEditorConfig.ProjectPath, "");
        if (!string.IsNullOrEmpty(projectPath))
        {
            UIAdjustAtlasEditorModel.GetInstance().WriteProjectPathConfig(projectPath + "/");
            m_projectPath = projectPath + "/";
        }
    }
    public void UnExecute()
    {
        UIADJUSTATLAS_ERROR_TYPE errorType = UIADJUSTATLAS_ERROR_TYPE.UIADJUSTATLAS_ERROR_NONE;

        List <string> operateAtlasList = new List <string>();

        operateAtlasList.Add(m_ProjectPath);
        errorType = UIAdjustAtlasEditorModel.GetInstance().ReduceOperateCount(operateAtlasList.ToArray());
        errorType = UIAdjustAtlasEditorModel.GetInstance().ZoomSprite(m_ProjectPath, m_SpritePath, m_oldScaleFactor);
        if (UIADJUSTATLAS_ERROR_TYPE.UIADJUSTATLAS_ERROR_NONE == errorType)
        {
            UniversalEditorLog.DebugLog("撤销缩放小图");
        }
    }
    public void Execute()
    {
        string dispStr = "加载" + Path.GetFileNameWithoutExtension(m_ProjectPath);

        EditorUtility.DisplayProgressBar("工程加载中", dispStr, 0f);

        UIADJUSTATLAS_ERROR_TYPE errorType = UIADJUSTATLAS_ERROR_TYPE.UIADJUSTATLAS_ERROR_NONE;

        errorType = UIAdjustAtlasEditorModel.GetInstance().AddAtlasProject(m_ProjectPath);
        if (UIADJUSTATLAS_ERROR_TYPE.UIADJUSTATLAS_ERROR_NONE == errorType)
        {
            UniversalEditorLog.DebugLog("加载工程:" + m_ProjectPath);
        }
    }
    private void UpdateInfoTableForUndo()
    {
        m_sourceInfoTableForUndo.Clear();

        foreach (var item in m_sourceInfoTable)
        {
            UIAdjust_SpriteOperateInfoForUndoCommand newInfo = new UIAdjust_SpriteOperateInfoForUndoCommand();
            newInfo.SourceProjectPath = item.SourceProjectPath;
            List <AtlasSpriteImage> spriteImage = null;
            UIAdjustAtlasEditorModel.GetInstance().GetSpriteImage(item.SourceProjectPath, item.OperateSpriteTable.ToArray(), out spriteImage);
            newInfo.SpriteImageTable = spriteImage;

            m_sourceInfoTableForUndo.Add(newInfo);
        }
    }
    public void Execute()
    {
        UIADJUSTATLAS_ERROR_TYPE errorType = UIADJUSTATLAS_ERROR_TYPE.UIADJUSTATLAS_ERROR_NONE;

        List <string> operateAtlasList = new List <string>();

        operateAtlasList.Add(m_destProjectPath);

        errorType = UIAdjustAtlasEditorModel.GetInstance().AddOperateCount(operateAtlasList.ToArray());
        errorType = UIAdjustAtlasEditorModel.GetInstance().CopySprites(m_sourceInfoTable, m_destProjectPath);
        if (UIADJUSTATLAS_ERROR_TYPE.UIADJUSTATLAS_ERROR_NONE == errorType)
        {
            UniversalEditorLog.DebugLog("复制小图");
        }
    }
    public void UnExecute()
    {
        UIADJUSTATLAS_ERROR_TYPE errorType = UIADJUSTATLAS_ERROR_TYPE.UIADJUSTATLAS_ERROR_NONE;

        List <string> operateAtlasList = new List <string>();

        foreach (var item in m_sourceInfoTable)
        {
            operateAtlasList.Add(item.SourceProjectPath);
        }

        errorType = UIAdjustAtlasEditorModel.GetInstance().ReduceOperateCount(operateAtlasList.ToArray());
        errorType = UIAdjustAtlasEditorModel.GetInstance().AddSprite(m_sourceInfoTableForUndo);
        if (UIADJUSTATLAS_ERROR_TYPE.UIADJUSTATLAS_ERROR_NONE == errorType)
        {
            UniversalEditorLog.DebugLog("撤销删除小图");
        }
    }
    public void Execute()
    {
        UIADJUSTATLAS_ERROR_TYPE errorType = UIADJUSTATLAS_ERROR_TYPE.UIADJUSTATLAS_ERROR_NONE;

        List <string> operateAtlasList = new List <string>();

        foreach (var item in m_sourceInfoTable)
        {
            operateAtlasList.Add(item.SourceProjectPath);
        }
        operateAtlasList.Add(m_destProjectPath);

        errorType = UIAdjustAtlasEditorModel.GetInstance().AddOperateCount(operateAtlasList.ToArray());
        errorType = UIAdjustAtlasEditorModel.GetInstance().MoveSprite(m_sourceInfoTable, m_destProjectPath, out m_ModifyRefTable);
        if (UIADJUSTATLAS_ERROR_TYPE.UIADJUSTATLAS_ERROR_NONE == errorType)
        {
            UniversalEditorLog.DebugLog("移动小图");
        }
    }
    private void ConfigReferenceScenePath()
    {
        string referenceScenePath = string.Empty;

        referenceScenePath = EditorUtility.SaveFolderPanel("配置一致性检查用Prefab路径", UIAtlasEditorConfig.ReferenceScenePath, "");
        if (!string.IsNullOrEmpty(referenceScenePath))
        {
            string U3DAssetPath = UnityEngine.Application.dataPath;
            if (!referenceScenePath.Contains(U3DAssetPath))
            {
                EditorUtility.DisplayDialog("配置失败", "\n请设置Assets/下的路径", "确认");
                return;
            }

            string relativityPath = referenceScenePath.Substring(U3DAssetPath.Length - "Assets".Length);

            UIAdjustAtlasEditorModel.GetInstance().WriteReferenceScenePathConfig(relativityPath + "/");
            m_referenceScenePath = relativityPath + "/";
        }
    }
    void OnGUI()
    {
        bool isForceBuild = UIAdjustAtlasEditorModel.GetInstance().IsForceBuild;

        maxSize = new Vector2(800f, 600f);
        minSize = new Vector2(800f, 600f);

        GUILayout.BeginVertical();

        GUILayout.Space(20f);
        GUILayout.Label("Common设定项:", GUILayout.Width(100f));

        GUILayout.Space(10f);
        GUILayout.BeginHorizontal();
        GUILayout.Label("Project路径", GUILayout.Width(80f));
        GUI.SetNextControlName("配置Project路径");
        m_projectPath = GUILayout.TextField(m_projectPath, 150, GUILayout.Width(600f));
        if (GUILayout.Button("配置", GUILayout.Width(76f)))
        {
            ConfigProjectPath();
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(10f);
        GUILayout.BeginHorizontal();
        GUILayout.Label("Sprite图库路径", GUILayout.Width(80f));
        GUI.SetNextControlName("配置Sprite图库路径");
        m_imageBasePath = GUILayout.TextField(m_imageBasePath, 150, GUILayout.Width(600f));
        if (GUILayout.Button("配置", GUILayout.Width(76f)))
        {
            ConfigImageBasePath();
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(10f);
        isForceBuild = GUILayout.Toggle(isForceBuild, "强制生成atlas");
        UIAdjustAtlasEditorModel.GetInstance().IsForceBuild = isForceBuild;

        GUILayout.Space(30f);
        GUILayout.Label("一致性检查设定项:", GUILayout.Width(100f));

        GUILayout.Space(10f);
        GUILayout.BeginHorizontal();
        GUILayout.Label("一致性检查用prefab路径", GUILayout.Width(130f));
        GUI.SetNextControlName("一致性检查用prefab路径");
        m_consistencyPrefabPath = GUILayout.TextField(m_consistencyPrefabPath, 150, GUILayout.Width(560f));
        if (GUILayout.Button("配置", GUILayout.Width(76f)))
        {
            ConfigConsistencyPrefabPath();
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(10f);
        GUILayout.BeginHorizontal();
        GUILayout.Label("一致性检查结果路径", GUILayout.Width(110f));
        GUI.SetNextControlName("一致性检查结果路径");
        m_consisitencyResultPath = GUILayout.TextField(m_consisitencyResultPath, 150, GUILayout.Width(580f));
        if (GUILayout.Button("配置", GUILayout.Width(76f)))
        {
            ConfigConsistencyResultPath();
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(30f);
        GUILayout.Label("引用关系导出设定项:", GUILayout.Width(110f));

        GUILayout.Space(10f);
        GUILayout.BeginHorizontal();
        GUILayout.Label("关联Prefab路径", GUILayout.Width(110f));
        GUI.SetNextControlName("关联Prefab路径");
        m_referencePrefabPath = GUILayout.TextField(m_referencePrefabPath, 150, GUILayout.Width(580f));
        if (GUILayout.Button("配置", GUILayout.Width(76f)))
        {
            ConfigReferencePrefabPath();
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(10f);
        GUILayout.BeginHorizontal();
        GUILayout.Label("关联Scene路径", GUILayout.Width(110f));
        GUI.SetNextControlName("关联Scene路径");
        m_referenceScenePath = GUILayout.TextField(m_referenceScenePath, 150, GUILayout.Width(580f));
        if (GUILayout.Button("配置", GUILayout.Width(76f)))
        {
            ConfigReferenceScenePath();
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(10f);
        GUILayout.BeginHorizontal();
        GUILayout.Label("引用关系导出路径", GUILayout.Width(110f));
        GUI.SetNextControlName("引用关系导出路径");
        m_referenceResultPath = GUILayout.TextField(m_referenceResultPath, 150, GUILayout.Width(580f));
        if (GUILayout.Button("配置", GUILayout.Width(76f)))
        {
            ConfigReferenceResultPath();
        }
        GUILayout.EndHorizontal();

        GUILayout.EndVertical();

        if (Event.current.keyCode == KeyCode.Return && Event.current.type == EventType.Used)
        {
            string U3DAssetPath = "Assets/";

            switch (GUI.GetNameOfFocusedControl())
            {
            case "配置Project路径":
                UIAdjustAtlasEditorModel.GetInstance().WriteProjectPathConfig(m_projectPath);
                break;

            case "配置Sprite图库路径":
                UIAdjustAtlasEditorModel.GetInstance().WriteImageBasePathConfig(m_imageBasePath);
                break;

            case "一致性检查结果路径":
                UIAdjustAtlasEditorModel.GetInstance().WriteConsistencyResultPathConfig(m_consisitencyResultPath);
                break;

            case "一致性检查用prefab路径":
                if (m_consistencyPrefabPath.Contains(U3DAssetPath))
                {
                    UIAdjustAtlasEditorModel.GetInstance().WriteConsistencyPrefabPathConfig(m_consistencyPrefabPath);
                }
                else
                {
                    EditorUtility.DisplayDialog("配置失败", "\n请设置Assets/下的路径", "确认");
                    UIAdjustAtlasEditorModel.GetInstance().ReadConsistencyPrefabPathConfig(out m_consistencyPrefabPath);
                }
                break;

            case "关联Prefab路径":
                if (m_referencePrefabPath.Contains(U3DAssetPath))
                {
                    UIAdjustAtlasEditorModel.GetInstance().WriteReferencePrefabPathConfig(m_referencePrefabPath);
                }
                else
                {
                    EditorUtility.DisplayDialog("配置失败", "\n请设置Assets/下的路径", "确认");
                    UIAdjustAtlasEditorModel.GetInstance().ReadReferencePrefabPathConfig(out m_referencePrefabPath);
                }
                break;

            case "关联Scene路径":
                if (m_referenceScenePath.Contains(U3DAssetPath))
                {
                    UIAdjustAtlasEditorModel.GetInstance().WriteReferenceScenePathConfig(m_referenceScenePath);
                }
                else
                {
                    EditorUtility.DisplayDialog("配置失败", "\n请设置Assets/下的路径", "确认");
                    UIAdjustAtlasEditorModel.GetInstance().ReadReferenceScenePathConfig(out m_referenceScenePath);
                }

                break;

            case "引用关系导出路径":
                UIAdjustAtlasEditorModel.GetInstance().WriteReferenceResultPathConfig(m_referenceResultPath);
                break;

            default:
                break;
            }
        }
    }