BuildABs() 정적인 개인적인 메소드

static private BuildABs ( ) : void
리턴 void
예제 #1
0
    public static void exportLanguage()
    {
        string        assetPath = "Assets/Lan/";
        string        path      = Application.dataPath + "/Lan/"; //AssetDatabase.GetAssetPath(obj).Replace("Assets","");
        List <string> files     = getAllChildFiles(path, "csv");

        string outPath = ExportAssetBundles.GetOutPath();

        CheckDirectory(Application.dataPath.Replace("Assets", "") + outPath);
        CheckDirectory(Application.dataPath.Replace("Assets", "") + outPath + "/Lan");

        foreach (string name in files)
        {
            string abPath = assetPath + name.Replace(path, "");
//            Debug.Log(abPath);
            string tarPath = outPath + "/Lan";
            string abName  = CUtils.GetURLFileName(name) + "." + Common.LANGUAGE_SUFFIX;
            ExportAssetBundles.BuildABs(new string[] { abPath }, tarPath, abName, BuildAssetBundleOptions.CompleteAssets);
            Debug.Log(tarPath + abName + " export");
        }
    }
예제 #2
0
    public static void exportConfig()
    {
        string path = Application.dataPath + "/Config";       //AssetDatabase.GetAssetPath(obj).Replace("Assets","");

        List <string> files     = getAllChildFiles(path + "/", "csv");
        string        assetPath = "Assets/Config";
        List <string> res       = new List <string>();

        foreach (string name in files)
        {
            string abPath = assetPath + name.Replace(path, "");
            Debug.Log(abPath);
            res.Add(abPath);
        }

        string cname   = "font1.u3d";
        string outPath = ExportAssetBundles.GetOutPath();
        string tarName = outPath + "/" + cname;

        CheckDirectory(Application.dataPath.Replace("Assets", "") + outPath);

        ExportAssetBundles.BuildABs(res.ToArray(), outPath, cname, BuildAssetBundleOptions.CompleteAssets);
        Debug.Log(tarName + " export");
    }
예제 #3
0
    public static void exportLua()
    {
        checkLuaExportPath();

        string path = Application.dataPath + "/Lua/"; //AssetDatabase.GetAssetPath(obj).Replace("Assets","");

        List <string> files = getAllChildFiles(path); // Directory.GetFiles(Application.dataPath + path);

        IList <string> childrens = new List <string>();

        foreach (string file in files)
        {
            if (file.EndsWith("lua"))
            {
                childrens.Add(file);
            }
        }
        Debug.Log("luajit path = " + luacPath);
        string crypName = "", fileName = "", outfilePath = "", arg = "";

        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        //refresh directory
        DirectoryDelete(Application.dataPath + OutLuaPath);
        CheckDirectory(Application.dataPath + OutLuaPath);
        //CheckDirectory(Application.dataPath.Replace("Assets","")+outPath);

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

        foreach (string filePath in childrens)
        {
            fileName    = CUtils.GetURLFileName(filePath);
            crypName    = filePath.Replace(path, "").Replace(".lua", "." + Common.LUA_LC_SUFFIX).Replace("\\", "_").Replace("/", "_");
            outfilePath = Application.dataPath + OutLuaPath + crypName;
            exportNames.Add("Assets" + OutLuaPath + crypName);
            sb.Append(fileName);
            sb.Append("=");
            sb.Append(crypName);
            sb.Append("\n");

#if Nlua || UNITY_IPHONE
            arg = "-o " + outfilePath + " " + filePath; // luac
            File.Copy(filePath, outfilePath, true);     // source code copy
#else
            arg = "-b " + filePath + " " + outfilePath; //for jit
            //Debug.Log(arg);
            //System.Diagnostics.Process.Start(luacPath, arg);//jit
            File.Copy(filePath, outfilePath, true);// source code copy
#endif
        }
        Debug.Log("lua:" + path + "files=" + files.Count + " completed");
        System.Threading.Thread.Sleep(1000);
        AssetDatabase.Refresh();

        //u5 打包
        string outPath = ExportAssetBundles.GetOutPath();
        CheckDirectory(Application.dataPath.Replace("Assets", "") + outPath);
        ExportAssetBundles.BuildABs(exportNames.ToArray(), "Assets" + OutLuaPath, "luaout.bytes", BuildAssetBundleOptions.CompleteAssets);

        //Encrypt
        string tarName     = Application.dataPath + OutLuaPath + "luaout.bytes";
        string realOutPath = ExportAssetBundles.GetOutPath() + "/font.u3d";
        byte[] by          = File.ReadAllBytes(tarName);
        byte[] Encrypt     = CryptographHelper.Encrypt(by, GetKey(), GetIV());
        File.WriteAllBytes(realOutPath, Encrypt);
        Debug.Log(realOutPath + " export");
    }