示例#1
0
    public static string GetExportPath(BuildTarget platfrom)
    {
        string basePath = Path.GetFullPath(Application.dataPath + "/" + CCosmosEngine.GetConfig("AssetBundleRelPath") + "/");

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

        string path = null;

        switch (platfrom)
        {
        case BuildTarget.Android:
        case BuildTarget.iPhone:
        case BuildTarget.StandaloneWindows:
            path = basePath + CResourceManager.GetBuildPlatformName() + "/";
            break;

        default:
            CBuildTools.ShowDialog("构建平台配置错误");
            throw new System.Exception("构建平台配置错误");
        }
        return(path);
    }
示例#2
0
文件: CBuildTools.cs 项目: scris/_GS
    /// <summary>
    /// Extra Flag ->   ex:  Android/  AndroidSD/  AndroidHD/
    /// </summary>
    /// <param name="platfrom"></param>
    /// <param name="quality"></param>
    /// <returns></returns>
    public static string GetExportPath(BuildTarget platfrom, CResourceQuality quality = CResourceQuality.Sd)
    {
        string basePath = Path.GetFullPath(Application.dataPath + "/" + CCosmosEngine.GetConfig(CCosmosEngineDefaultConfig.AssetBundleBuildRelPath) + "/");

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

        string path = null;

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

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

        default:
            CBuildTools.ShowDialog("构建平台配置错误");
            throw new System.Exception("构建平台配置错误");
        }
        return(path);
    }
示例#3
0
文件: CBuild_UGUI.cs 项目: scris/_GS
    public static void ExportCurrentUI()
    {
        var UIName = Path.GetFileNameWithoutExtension(EditorApplication.currentScene);

        var uiRoot = GameObject.Find("UI");

        CBuildTools.BuildAssetBundle(uiRoot, GetBuildRelPath(UIName));
    }
示例#4
0
 public void ExportCurrentUI()
 {
     CreateTempPrefab();
     if (!CBuildTools.HookFunc(typeof(CBuild_UI), "Custom_ExportCurrentUI", this, UIScenePath, UIName, TempPanelObject))
     {
         CBuildTools.BuildAssetBundle(TempPanelObject, GetBuildRelPath(UIName));
     }
     DestroyTempPrefab();
 }
示例#5
0
    public static string MakeSureExportPath(string path, BuildTarget buildTarget)
    {
        path = CBuildTools.GetExportPath(buildTarget) + path;

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

        if (!System.IO.Directory.Exists(exportDirectory))
        {
            System.IO.Directory.CreateDirectory(exportDirectory);
        }

        return(path);
    }
示例#6
0
    public void ExportCurrentUI()
    {
        CreateTempPrefab();

        if (ExportCurrentUIEvent != null)
        {
            ExportCurrentUIEvent(this, UIScenePath, UIName, TempPanelObject);
        }
        else
        {
            CBuildTools.BuildAssetBundle(TempPanelObject, GetBuildRelPath(UIName));
        }
        DestroyTempPrefab();
    }
示例#7
0
    public static void ExportUIMenu()
    {
        CBuildTools.HookFunc(typeof(CBuild_UI), "Custom_ExportUIMenu");

        CBuild_UI uiBuild = new CBuild_UI();

        if (!uiBuild.CheckUI(true))
        {
            return;
        }

        uiBuild.BeginExport();
        uiBuild.ExportCurrentUI();
        uiBuild.EndExport();
    }
示例#8
0
文件: CBuildTools.cs 项目: scris/_GS
    /// <summary>
    /// 获取完整的打包路径,并确保目录存在
    /// </summary>
    /// <param name="path"></param>
    /// <param name="buildTarget"></param>
    /// <returns></returns>
    public static string MakeSureExportPath(string path, BuildTarget buildTarget, CResourceQuality quality)
    {
        path = CBuildTools.GetExportPath(buildTarget, quality) + path;

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

        if (!System.IO.Directory.Exists(exportDirectory))
        {
            System.IO.Directory.CreateDirectory(exportDirectory);
        }

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

        return(path);
    }
示例#9
0
    public static uint BuildScriptableObject <T>(T scriptObject, string path, BuildTarget buildTarget) 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 = CBuildTools.BuildAssetBundle(tempObj, path, buildTarget);

        AssetDatabase.DeleteAsset(tempAssetPath);

        return(crc);
    }
示例#10
0
    public bool BuildPkg(string file)
    {
        //if (!CBuildTools.CheckNeedBuild(file))
        //{
        //    return false;
        //}

        AudioClip audioClip = AssetDatabase.LoadAssetAtPath(file, typeof(AudioClip)) as AudioClip;

        if (audioClip != null)
        {
            string subDirName = Path.GetFileName(Path.GetDirectoryName(file));
            string exportFile = string.Format("Audio/{0}/{1}_Audio{2}", subDirName, Path.GetFileNameWithoutExtension(file), CCosmosEngine.GetConfig("AssetBundleExt"));

            CBuildTools.BuildAssetBundle(audioClip, exportFile);

            //CBuildTools.MarkBuildVersion(file);
        }

        return(true);
    }
示例#11
0
文件: CAutoBuilder.cs 项目: scris/_GS
    public static string GetResourceExportPath()
    {
        var resourcePath = CBuildTools.GetExportPath(EditorUserBuildSettings.activeBuildTarget, CResourceModule.Quality);

        return(resourcePath);
    }
示例#12
0
文件: CAutoBuilder.cs 项目: scris/_GS
 public static void ClearPlayerPrefs()
 {
     PlayerPrefs.DeleteAll();
     PlayerPrefs.Save();
     CBuildTools.ShowDialog("Prefs Cleared!");
 }
示例#13
0
    public bool CheckUI(bool showMsg)
    {
        PanelRoot    = GameObject.Find("UIRoot/PanelRoot").GetComponent <UIPanel>();
        AnchorObject = (GameObject)GameObject.Find("UIRoot/PanelRoot/Anchor");

        if (AnchorObject == null)
        {
            if (showMsg)
            {
                CBuildTools.ShowDialog("找不到UIRoot/PanelRoot/Anchor");
            }
            else
            {
                Debug.Log("找不到UIRoot/PanelRoot/Anchor");
            }
            return(false);
        }

        if (AnchorObject.transform.childCount != 1)
        {
            if (showMsg)
            {
                CBuildTools.ShowDialog("UI结构错误,Ahchor下应该只有一个节点");
            }
            else
            {
                Debug.Log("UI结构错误,Ahchor下应该只有一个节点");
            }
            return(false);
        }

        WindowObject = AnchorObject.transform.GetChild(0).gameObject;
        UIName       = EditorApplication.currentScene.Substring(EditorApplication.currentScene.LastIndexOf('/') + 1);
        UIName       = UIName.Substring(0, UIName.LastIndexOf('.'));

        // 確保Layer正確
        bool changeLayer = false;

        foreach (Transform loopTrans in GameObject.FindObjectsOfType <Transform>())
        {
            if (loopTrans.gameObject.layer != (int)CLayerDef.UI)
            {
                NGUITools.SetLayer(loopTrans.gameObject, (int)CLayerDef.UI);
                changeLayer = true;
            }
        }

        foreach (Camera cam in GameObject.FindObjectsOfType <Camera>())
        {
            NGUITools.SetLayer(cam.gameObject, (int)CLayerDef.UI);
            if (cam.cullingMask != 1 << (int)CLayerDef.UI)
            {
                cam.cullingMask = 1 << (int)CLayerDef.UI;
                changeLayer     = true;
            }
        }

        if (changeLayer)
        {
            EditorApplication.SaveScene();
        }



        return(true);
    }
示例#14
0
 public override void EndExport()
 {
     CBuildTools.HookFunc(typeof(CBuild_UI), "Custom_EndExport", this);
 }