Example #1
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, 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);
        }
Example #2
0
        /// <summary>
        /// Different platform's assetBundles is incompatible.
        /// CosmosEngine put different platform's assetBundles in different folder.
        /// Here, get Platform name that represent the AssetBundles Folder.
        /// </summary>
        /// <returns>Platform folder Name</returns>
        public static string GetBuildPlatformName()
        {
            string buildPlatformName = "Windows"; // default

            if (Application.isEditor)
            {
                var buildTarget = UnityEditor_EditorUserBuildSettings_activeBuildTarget;
                //UnityEditor.EditorUserBuildSettings.activeBuildTarget;
                switch (buildTarget)
                {
                    case "StandaloneOSXIntel":
                    case "StandaloneOSXIntel64":
                    case "StandaloneOSXUniversal":
                        buildPlatformName = "MacOS";
                        break;
                    case "StandaloneWindows": // UnityEditor.BuildTarget.StandaloneWindows:
                    case "StandaloneWindows64": // UnityEditor.BuildTarget.StandaloneWindows64:
                        buildPlatformName = "Windows";
                        break;
                    case "Android": // UnityEditor.BuildTarget.Android:
                        buildPlatformName = "Android";
                        break;
                    case "iPhone": // UnityEditor.BuildTarget.iPhone:
                    case "iOS":
                        buildPlatformName = "iOS";
                        break;
                    default:
                        Debuger.Assert(false);
                        break;
                }
            }
            else
            {
                switch (Application.platform)
                {
                    case RuntimePlatform.OSXPlayer:
                        buildPlatformName = "MacOS";
                        break;
                    case RuntimePlatform.Android:
                        buildPlatformName = "Android";
                        break;
                    case RuntimePlatform.IPhonePlayer:
                        buildPlatformName = "iOS";
                        break;
                    case RuntimePlatform.WindowsPlayer:
#if !UNITY_5_4_OR_NEWER
                    case RuntimePlatform.WindowsWebPlayer:
#endif
                        buildPlatformName = "Windows";
                        break;
                    default:
                        Debuger.Assert(false);
                        break;
                }
            }

            if (Quality != KResourceQuality.Sd) // SD no need add
                buildPlatformName += Quality.ToString().ToUpper();
            return buildPlatformName;
        }
Example #3
0
    /// <summary>
    /// Different platform's assetBundles is incompatible.
    /// CosmosEngine put different platform's assetBundles in different folder.
    /// Here, get Platform name that represent the AssetBundles Folder.
    /// </summary>
    /// <returns>Platform folder Name</returns>
    public static string GetBuildPlatformName()
    {
        string buildPlatformName = "Win32"; // default

        if (Application.isEditor)
        {
            var buildTarget = UnityEditor_EditorUserBuildSettings_activeBuildTarget;
            //UnityEditor.EditorUserBuildSettings.activeBuildTarget;
            switch (buildTarget)
            {
            case "StandaloneWindows":     // UnityEditor.BuildTarget.StandaloneWindows:
            case "StandaloneWindows64":   // UnityEditor.BuildTarget.StandaloneWindows64:
                buildPlatformName = "Win32";
                break;

            case "Android":     // UnityEditor.BuildTarget.Android:
                buildPlatformName = "Android";
                break;

            case "iPhone":     // UnityEditor.BuildTarget.iPhone:
                buildPlatformName = "IOS";
                break;

            default:
                Debuger.Assert(false);
                break;
            }
        }
        else
        {
            switch (Application.platform)
            {
            case RuntimePlatform.Android:
                buildPlatformName = "Android";
                break;

            case RuntimePlatform.IPhonePlayer:
                buildPlatformName = "IOS";
                break;

            case RuntimePlatform.WindowsPlayer:
            case RuntimePlatform.WindowsWebPlayer:
                buildPlatformName = "Win32";
                break;

            default:
                Debuger.Assert(false);
                break;
            }
        }

        if (Quality != KResourceQuality.Sd) // SD no need add
        {
            buildPlatformName += Quality.ToString().ToUpper();
        }
        return(buildPlatformName);
    }
Example #4
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, KResourceQuality quality = KResourceQuality.Sd)
    {
        string basePath =
            Path.GetFullPath(Application.dataPath + "/" +
                             KEngine.AppEngine.GetConfig(KEngineDefaultConfigs.AssetBundleBuildRelPath) + "/");

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

        string path = null;

        switch (platfrom)
        {
        case BuildTarget.Android:
        case BuildTarget.iPhone:
        case BuildTarget.StandaloneWindows:
            var platformName = KResourceModule.BuildPlatformName;
            if (quality != KResourceQuality.Sd)     // SD no need add
            {
                platformName += quality.ToString().ToUpper();
            }

            path = basePath + platformName + "/";
            break;

        default:
            KBuildTools.ShowDialog("构建平台配置错误");
            throw new System.Exception("构建平台配置错误");
        }
        return(path);
    }