Exemplo n.º 1
0
        /// <summary>
        /// 打包资源 (依赖关系)
        /// </summary>
        /// <param name="source">资源名称(No1_Res/)</param>
        /// <param name="abConfig"></param>
        static void fileWithDepends(string source, ref AssetbundleConfig abConfig)
        {
            string _source = Replace(source);

            if (_source == "")
            {
                return;
            }
            _source = _source.Substring(Application.dataPath.Length + 1);
            _source = "Assets/" + _source;
            string[] dps = AssetDatabase.GetDependencies(_source);
            foreach (var dp in dps)
            {
                if (dp.EndsWith(".cs"))
                {
                    continue;
                }
                AssetImporter assetImporter = AssetImporter.GetAtPath(dp);
                string        fullname      = dp.Replace("Assets/ForAssetbundleMaking/", "");
                fullname = fullname.Substring(fullname.IndexOf('/') + 1);  //资源的名字
                string bagname = fullname.Replace(Path.GetExtension(fullname), ".unity3d");
                assetImporter.assetBundleName = bagname;
                //Debug.Log("bagna:" + bagname);
                abConfig.AddAssetBundle(fullname, bagname);  //资源名和包名关系
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 打包 不处理依赖关系
        /// </summary>
        /// <param name="source"></param>
        static void file(string source, ref AssetbundleConfig abconfig)
        {
            string _source = Replace(source);

            if (_source == "")
            {
                return;
            }
            _source = _source.Substring(Application.dataPath.Length + 1);
            _source = "Assets/" + _source;
            AssetImporter assetImport = AssetImporter.GetAtPath(_source);

            string fullname = _source.Replace("Assets/ForAssetbundleMaking/", "");

            fullname = fullname.Substring(fullname.IndexOf('/') + 1);  //资源的名字
            string bagname = fullname.Replace(Path.GetExtension(fullname), ".unity3d");

            assetImport.assetBundleName = bagname;
            //Debug.Log("bagna:" + bagname);
            abconfig.AddAssetBundle(fullname, bagname);  //资源名和包名关系
        }
Exemplo n.º 3
0
    void initAppConfig()
    {
        string[]   gs  = System.Enum.GetNames(typeof(GameEnum));
        APPVersion app = new APPVersion();

        //AssetConfig
        for (int i = 0; i < gs.Length; i++)
        {
            GameVersion ver = new GameVersion(gs[i], "name:" + gs[i]);
            app.Add(ver);
            AssetVersion aver = new AssetVersion();
            aver.assetVersion = 0;
            AssetbundleConfig abcon = new AssetbundleConfig();
            abcon.AddAssetBundle("test", "has001");
            PreloadConfig pre = new PreloadConfig();

            FileUtil.SaveFile(path + "/" + gs[i] + "/assetVersion.config", aver.ToStr());
            FileUtil.SaveFile(path + "/" + gs[i] + "/abConfig.config", abcon.ToString());
            FileUtil.SaveFile(path + "/" + gs[i] + "/preloadConfig.config", pre.ToString());
        }
        FileUtil.SaveFile(path + "/appVersion.config", app.ToString());                   //appversion
    }