Exemple #1
0
        public static string GetResourceExportPath()
        {
            var resourcePath = BuildTools.GetExportPath(EditorUserBuildSettings.activeBuildTarget,
                                                        KResourceModule.Quality);

            return(resourcePath);
        }
        /// <summary>
        /// Extra Flag ->   ex:  Android/  AndroidSD/  AndroidHD/
        /// </summary>
        /// <param name="platfrom"></param>
        /// <param name="quality"></param>
        /// <returns></returns>
        public static string GetExportPath(BuildTarget platfrom, KResourceQuality quality = KResourceQuality.Sd)
        {
            string basePath =
                Path.GetFullPath(KEngine.AppEngine.GetConfig(KEngineDefaultConfigs.AssetBundleBuildRelPath));

            if (File.Exists(basePath))
            {
                BuildTools.ShowDialog("路径配置错误: " + basePath);
                throw new System.Exception("路径配置错误");
            }
            if (!Directory.Exists(basePath))
            {
                Directory.CreateDirectory(basePath);
            }

            string path         = null;
            var    platformName = KResourceModule.BuildPlatformName;

            if (quality != KResourceQuality.Sd) // SD no need add
            {
                platformName += quality.ToString().ToUpper();
            }

            path = basePath + "/" + platformName + "/";
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            return(path);
        }
        public static void MenuCheckAndLogDependencies()
        {
            var obj = Selection.activeObject;

            if (obj == null)
            {
                Debug.LogError("No selection object");
                return;
            }
            var assetPath = AssetDatabase.GetAssetPath(obj);

            BuildTools.CheckAndLogDependencies(assetPath);
        }
Exemple #4
0
        /// <summary>
        /// 获取完整的打包路径,并确保目录存在
        /// </summary>
        /// <param name="path"></param>
        /// <param name="buildTarget"></param>
        /// <returns></returns>
        public static string MakeSureExportPath(string path, BuildTarget buildTarget)
        {
            path = BuildTools.GetExportPath(buildTarget) + path;

            path = path.Replace("\\", "/");

            string exportDirectory = path.Substring(0, path.LastIndexOf('/'));

            if (!System.IO.Directory.Exists(exportDirectory))
            {
                System.IO.Directory.CreateDirectory(exportDirectory);
            }
            return(path);
        }
Exemple #5
0
        public static void ExportCurrentUI()
        {
            if (EditorApplication.isPlaying)
            {
                Log.Error("Cannot export in playing mode! Please stop!");
                return;
            }
#if UNITY_4
            var windowAssets = GetUIWIndoeAssetsFromCurrentScene();
            foreach (var windowAsset in windowAssets)
            {
                BuildTools.BuildAssetBundle(windowAsset.gameObject, GetBuildRelPath(windowAsset.name));
            }
#else
            UISceneToPrefabs();
#endif
        }
Exemple #6
0
        public static void ExportAllUI()
        {
            if (Application.isPlaying)
            {
                Log.Error("Cannot export in playing mode! Please stop!");
                return;
            }
            var uiPath   = Application.dataPath + "/" + KEngineDef.ResourcesEditDir + "/UI";
            var uiScenes = Directory.GetFiles(uiPath, "*.unity", SearchOption.AllDirectories);

            foreach (string uiScene in uiScenes)
            {
                Log.Info("begin export {0}", uiScene);
                EditorSceneManager.OpenScene(uiScene);
                KUGUIBuilder.UISceneToPrefabs();
            }
            BuildTools.BuildAllAssetBundles();
        }
Exemple #7
0
        public static uint BuildScriptableObject <T> (T scriptObject, string path, BuildTarget buildTarget,
                                                      KResourceQuality quality) where T : ScriptableObject
        {
            const string tempAssetPath = "Assets/~Temp.asset";

            AssetDatabase.CreateAsset(scriptObject, tempAssetPath);
            T tempObj = (T)AssetDatabase.LoadAssetAtPath(tempAssetPath, typeof(T));

            if (tempObj == null)
            {
                throw new System.Exception();
            }

            uint crc = BuildTools.BuildAssetBundle(tempObj, path, buildTarget, quality);

            AssetDatabase.DeleteAsset(tempAssetPath);

            return(crc);
        }
Exemple #8
0
        /// <summary>
        /// Extra Flag ->   ex:  Android/  AndroidSD/  AndroidHD/
        /// </summary>
        /// <param name="platfrom"></param>
        /// <param name="quality"></param>
        /// <returns></returns>
        public static string GetExportPath(BuildTarget platfrom)
        {
            string basePath = Path.GetFullPath(EngineConfig.instance.AssetBundleBuildRelPath);

            if (File.Exists(basePath))
            {
                BuildTools.ShowDialog("路径配置错误: " + basePath);
                throw new System.Exception("路径配置错误");
            }
            if (!Directory.Exists(basePath))
            {
                Directory.CreateDirectory(basePath);
            }
            var    platformName = KResourceManager.BuildPlatformName;
            string path         = basePath + "/" + platformName + "/";

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            return(path);
        }
Exemple #9
0
 public static void ClearPlayerPrefs()
 {
     PlayerPrefs.DeleteAll();
     PlayerPrefs.Save();
     BuildTools.ShowDialog("Prefs Cleared!");
 }
Exemple #10
0
        public static string GetResourceExportPath()
        {
            var resourcePath = BuildTools.GetExportPath(KResourceModule.Quality);

            return(resourcePath);
        }