Example #1
0
        protected void startProgress()
        {
            PrefabExport prefabExport;

            prefabExport = new PrefabExport(exportPrefabFromPath, exportPrefabToPath);

            List <BuildTarget> buildTargets = new List <BuildTarget>();

            buildTargets.Add(buildTarget);

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

            exNameArr.Add("*.prefab");

            if (string.IsNullOrEmpty(exprotExtentions) == false)
            {
                string[] temp = exprotExtentions.Split(',');
                string   key;
                foreach (string s in temp)
                {
                    key = "*." + s;
                    if (exNameArr.Contains(key) == false)
                    {
                        exNameArr.Add(key);
                    }
                }
            }

            prefabExport.exportAllPrefab(buildTargets, exNameArr);
        }
Example #2
0
        protected void startProgress()
        {
            PrefabExport prefabExport;

            prefabExport = new PrefabExport(buildTarget, exportPrefabToPrefix, rootFolderName);
            prefabExport.isForceRebuild = isForceRebuild;
            prefabExport.lz4Compress    = lz4Compress;

            prefabExport.exportAllPrefab(mapList.Values.ToList());

            if (hasSVN)
            {
                startSVNCommit(buildTarget);
            }
        }
Example #3
0
    public static void BuildAssetbundle()
    {
        autoInit();
        BuildTarget      buildTarget = BuildTarget.Android;
        BuildTargetGroup targetGroup = BuildTargetGroup.Android;

        string[] args = Environment.GetCommandLineArgs();
        //int len = args.Length;
        if (args.Length < 0)
        {
            return;
        }
        int index = Array.IndexOf(args, "-buildTarget");

        if (index != -1)
        {
            string buildTargetKey = args[index + 1].ToLower();
            Debug.Log("buildTarget:" + buildTargetKey);
            buildTarget = platfromDictionary[buildTargetKey];
            targetGroup = platfromGroupDictionary[buildTargetKey];
        }

        bool isForceRebuild = false;

        index = Array.IndexOf(args, "-isForceRebuild");
        if (index != -1)
        {
            isForceRebuild = true;
        }

        bool lz4Compress = false;

        index = Array.IndexOf(args, "-lz4");
        if (index != -1)
        {
            lz4Compress = true;
        }

        string exportPrefabToPrefix = "";

        switchToPlatform(targetGroup, buildTarget);

        XmlDocument  doc           = EditorConfigUtils.doc;
        XmlNode      node          = doc.SelectSingleNode("config/prefabExport");
        XmlAttribute nodeAttribute = node.Attributes["to"];

        if (nodeAttribute == null)
        {
            FileInfo fileInfo = new FileInfo(Application.dataPath);
            exportPrefabToPrefix = Path.Combine(fileInfo.Directory.FullName, "ReleaseResource/");
        }
        else
        {
            string[] paths = nodeAttribute.InnerText.Split(',');
            foreach (string s in paths)
            {
                if (Directory.Exists(s))
                {
                    exportPrefabToPrefix = s;
                    break;
                }
            }
        }

        index = Array.IndexOf(args, "-exportTo");
        if (index != -1)
        {
            string value = args[index + 1];
            if (string.IsNullOrEmpty(value) == false)
            {
                exportPrefabToPrefix = value;
            }
        }

        Dictionary <string, ExportRootVO> mapList = new Dictionary <string, ExportRootVO>();

        foreach (XmlNode itemNode in node.ChildNodes)
        {
            ExportRootVO itemVo = new ExportRootVO();
            string       name   = itemNode.Attributes["name"].InnerText;
            if (mapList.ContainsKey(name))
            {
                continue;
            }
            itemVo.bindXML(itemNode);
            mapList.Add(name, itemVo);
        }
        string       rootFolderName = node.Attributes["zipName"].InnerText;
        PrefabExport prefabExport   = new PrefabExport(buildTarget, exportPrefabToPrefix, rootFolderName);

        prefabExport.isForceRebuild = isForceRebuild;

        if (node.Attributes["lz4"].InnerText == "1" || lz4Compress)
        {
            prefabExport.lz4Compress = true;
        }

        prefabExport.exportAllPrefab(mapList.Values.ToList());
    }