Example #1
0
        public static void PackLuaResource()
        {
            Dictionary <string, AssetBundleBuild> assetBundleBuilds = new Dictionary <string, AssetBundleBuild>();

            //PackUtils.PackEffect(ref assetBundleBuilds);
            PackUtils.PackAtlas(ref assetBundleBuilds);
            PackUtils.PackUIPrefab(ref assetBundleBuilds);
            PackUtils.PackMode(ref assetBundleBuilds);
            if (assetBundleBuilds.Count <= 0)
            {
                return;
            }
            if (System.IO.Directory.Exists(PackUtils.GetBundlePath("Resources")) == false)
            {
                System.IO.Directory.CreateDirectory(PackUtils.GetBundlePath("Resources"));
            }
            BuildPipeline.BuildAssetBundles(PackUtils.GetBundlePath("/Resources"), new List <AssetBundleBuild>(assetBundleBuilds.Values).ToArray(), BuildAssetBundleOptions.ChunkBasedCompression, PackUtils.GetBuildTarget());
            AssetDatabase.Refresh();
            WLGame.BuildPackage.CreateResourcesLuaConfig(assetBundleBuilds);
            WLGame.BuildPackage.CreateResourcesXmlConfig(assetBundleBuilds);
            WLGame.BuildPackage.CreateUIResourceInfoXmlConfig(assetBundleBuilds);
            string resourceFolder = PackUtils.GetBundlePath("Resources");
            string zipPath        = Application.dataPath + "/Package/" + ResManager.RESOURCE_PATH + ".bytes";

            ZipHelper.ZipDir(resourceFolder, zipPath, 0);
            AssetDatabase.Refresh();
            UnityEngine.Object asset = AssetDatabase.LoadAssetAtPath("Assets/Package/" + ResManager.RESOURCE_PATH + ".bytes", typeof(TextAsset));
            BuildPipeline.BuildAssetBundle(asset, null, ResManager.RESOURCE_EDITOR_PATH, BuildAssetBundleOptions.ChunkBasedCompression, PackUtils.GetBuildTarget());
            AssetDatabase.Refresh();
        }
Example #2
0
        public static void PackLuaZip()
        {
            string luaFolder = Application.dataPath + "/Package/Lua/";
            string zipPath   = Application.dataPath + "/Package/" + ResManager.LUA_PATH + ".bytes";

            ZipHelper.ZipDir(luaFolder, zipPath, 0);
            AssetDatabase.Refresh();
            UnityEngine.Object asset = AssetDatabase.LoadAssetAtPath("Assets/Package/" + ResManager.LUA_PATH + ".bytes", typeof(TextAsset));
            BuildPipeline.BuildAssetBundle(asset, null, Application.dataPath + "/StreamingAssets/" + ResManager.LUA_PATH + ".unity3d", BuildAssetBundleOptions.ChunkBasedCompression, PackUtils.GetBuildTarget());
            AssetDatabase.Refresh();
        }
Example #3
0
        public static void PackVesionBytes()
        {
            string zipPath = Application.dataPath + "/Package/" + ResManager.VERSIONS_PATH + ".bytes";

            ZipHelper.ZipDir(Application.dataPath + "/Package/Version/", zipPath, 0);
            AssetDatabase.Refresh();
            UnityEngine.Object[] assets = new UnityEngine.Object[2];
            assets[0] = AssetDatabase.LoadAssetAtPath("Assets/Package/Version/" + ResManager.PACKAGE + ".json", typeof(TextAsset));
            assets[1] = AssetDatabase.LoadAssetAtPath("Assets/Package/" + ResManager.VERSIONS_PATH + ".bytes", typeof(TextAsset));
            BuildPipeline.BuildAssetBundle(assets[0], assets, Application.dataPath + "/StreamingAssets/" + ResManager.VERSIONS_PATH + ".unity3d", BuildAssetBundleOptions.ChunkBasedCompression, PackUtils.GetBuildTarget());
            AssetDatabase.Refresh();
        }