//是否有不同的cs资源需要打包
    static bool CopyToCsPath(string srcPath)
    {
        List <string> diffList = new List <string>();

        ConfigPathSet configPathSet = ConfigPathSet.GetConfig();
        string        destPath      = configPathSet.projectCSPath;

        if (!CheckPath(ref destPath))
        {
            return(false);
        }

        string projectTxtPath = configPathSet.projectTxtPath;

        if (!CheckPath(ref projectTxtPath))
        {
            return(false);
        }

        ImprotStaticDataResult importResult = ImportStaticData.ExecConfigPathSet(diffList, srcPath, destPath);

        if (importResult != ImprotStaticDataResult.Success)
        {
            Log("Log: ", "import Cs failed!\n error code : " + importResult.ToString());
            Debug.Log("导入静态数据Cs失败!\n 错误代码 : " + importResult.ToString());
            return(false);
        }

        return(true);
    }
    //是否有不同的txt资源需要打包
    static bool GetDifffTxtPath(string srcPath, ref Dictionary <string, string> dicDiffPath)
    {
        List <string> diffList = new List <string>();

        ConfigPathSet configPathSet = ConfigPathSet.GetConfig();
        string        destPath      = configPathSet.projectTxtPath;

        if (!CheckPath(ref destPath))
        {
            return(false);
        }

        ImprotStaticDataResult importResult = ImportStaticData.ExecConfigPathSet(diffList, srcPath, destPath);

        if (importResult != ImprotStaticDataResult.Success)
        {
            Log("Log: ", "import static Txt failed!\n error code : " + importResult.ToString());
            Debug.Log("导入静态数据Txt失败!\n 错误代码 : " + importResult.ToString());
            return(false);
        }

        foreach (var path in diffList)
        {
            string fileName  = Path.GetFileNameWithoutExtension(path);
            string assetPath = ToolCommon.GetAssetPath(path);

            if (!dicDiffPath.ContainsKey(fileName))
            {
                dicDiffPath.Add(fileName, assetPath);
            }
        }

        return(true);
    }
Пример #3
0
    public static ImprotStaticDataResult ExecConfigPathSet(List <string> copyList, string srcPath, string destPath)
    {
        ConfigPathSet config = ConfigPathSet.GetConfig();

        if (string.IsNullOrEmpty(destPath) || string.IsNullOrEmpty(srcPath))
        {
            Selection.activeObject = config;
            return(ImprotStaticDataResult.EmptyConfig);
        }

        if (copyList == null)
        {
            return(ImprotStaticDataResult.NoInitCopyList);
        }

        CopyFile(srcPath, destPath, copyList);

        AssetDatabase.Refresh();

        if (copyList.Count > 0)
        {
            return(ImprotStaticDataResult.Success);
        }
        else
        {
            return(ImprotStaticDataResult.EmptyCopy);
        }
    }
Пример #4
0
    public static void Exec(BuildTarget target)
    {
        Dictionary <string, string> dicPath = new Dictionary <string, string>();

        foreach (UnityEngine.Object o in Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets))
        {
            string filePath = AssetDatabase.GetAssetPath(o);
            if (Path.GetExtension(filePath) == ".txt")
            {
                string fileName      = Path.GetFileNameWithoutExtension(filePath);
                string assetFilePath = ToolCommon.GetAssetPath(filePath);

                if (!dicPath.ContainsKey(fileName))
                {
                    dicPath.Add(fileName, assetFilePath);
                }
            }
        }

        ConfigPathSet configPathSet = ConfigPathSet.GetConfig();
        string        boundlePath   = configPathSet.strBoundlePath;

        if (!CreateConfigAssetboundle.CheckPath(ref boundlePath))
        {
            return;
        }

        CreateConfigAssetboundle.InitTempLogs();
        CreateConfigAssetboundle.ExecutePath(boundlePath, target, dicPath);
    }
    public static void ExecuteWindow()
    {
        ConfigPathSet configPathSet = ConfigPathSet.GetConfig();

        InitTempLogs();

        if (!Exec(BuildTarget.StandaloneWindows, configPathSet.strBoundlePath, configPathSet.strTxtPath, configPathSet.strCsPath))
        {
            SaveLogToFile();
        }
    }
Пример #6
0
    public string strBoundlePath; //导出boundle目录

#if UNITY_EDITOR
    public static ConfigPathSet GetConfig()
    {
        ConfigPathSet config = AssetDatabase.LoadAssetAtPath <ConfigPathSet>(CONFIG_PATH);

        if (config == null)
        {
            config = ScriptableObject.CreateInstance <ConfigPathSet>();

            if (!Directory.Exists(Path.GetDirectoryName(CONFIG_PATH)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(CONFIG_PATH));
            }

            AssetDatabase.CreateAsset(config, CONFIG_PATH);
        }

        config.projectTxtPath = Application.dataPath + PROJECT_TMP_PATH;
        config.projectCSPath  = Application.dataPath + PROJECT_CS_PATH;

        return(config);
    }
Пример #7
0
    public override void OnInspectorGUI()
    {
        ConfigPathSet config = ConfigPathSet.GetConfig();

        GUILayout.Space(20);

        EditorGUILayout.BeginVertical();
        {
            EditorGUILayout.BeginHorizontal();
            {
                string newDataPath = EditorGUILayout.TextField("导入txt目录", config.strTxtPath);
                if (GUILayout.Button("...", GUILayout.MaxWidth(24)))
                {
                    GUIUtility.keyboardControl = 0;
                    newDataPath = EditorUtility.OpenFolderPanel("导入txt目录", config.strTxtPath, "");
                }

                if (newDataPath != "" && newDataPath != config.strTxtPath)
                {
                    config.strTxtPath = newDataPath;
                    EditorUtility.SetDirty(config);
                }
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            {
                string newDataPath = EditorGUILayout.TextField("导入cs目录", config.strCsPath);
                if (GUILayout.Button("...", GUILayout.MaxWidth(24)))
                {
                    GUIUtility.keyboardControl = 0;
                    newDataPath = EditorUtility.OpenFolderPanel("导入cs目录", config.strCsPath, "");
                }

                if (newDataPath != "" && newDataPath != config.strCsPath)
                {
                    config.strCsPath = newDataPath;
                    EditorUtility.SetDirty(config);
                }
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            {
                string newJsonPath = EditorGUILayout.TextField("生成assetboundle路径", config.strBoundlePath);
                if (GUILayout.Button("...", GUILayout.MaxWidth(24)))
                {
                    GUIUtility.keyboardControl = 0;
                    newJsonPath = EditorUtility.OpenFolderPanel("生成assetboundle路径", config.strBoundlePath, "");
                }

                if (newJsonPath != "" && newJsonPath != config.strBoundlePath)
                {
                    config.strBoundlePath = newJsonPath;
                    EditorUtility.SetDirty(config);
                }
            }
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.EndVertical();

        GUILayout.Space(20);
    }