示例#1
0
    private static void ProcessUpdateResourcesImpl(string channel)
    {
        var versionPath = string.Format("../../Public/Version/Cn/Android/{0}/Game.ver", channel);

        GameVersionPath = Path.Combine(Application.dataPath, versionPath);
        string AssetBundlePath = Path.Combine(Application.dataPath, "BundleAsset");

        AssetBundleManagerEditor.RefreshDirectory();
        AssetBundleManagerEditor.RebuildAll();
    }
示例#2
0
    private static void ProcessResourcesImpl(bool bRebuildBundle)
    {
        string AssetBundlePath = Path.Combine(Application.dataPath, "BundleAsset");

        if (bRebuildBundle)
        {
            if (Directory.Exists(AssetBundlePath))
            {
                Directory.Delete(AssetBundlePath, true);
                Directory.CreateDirectory(AssetBundlePath);
            }
            AssetBundleManagerEditor.RefreshDirectory();
            AssetBundleManagerEditor.RebuildAll();
        }
        else
        {
            var data  = AssetBundleManager.GetManageData(false);
            var index = 0;
            {
                var __list3      = data.assetbundles;
                var __listCount3 = __list3.Count;
                for (int __i3 = 0; __i3 < __listCount3; ++__i3)
                {
                    var assetBundleData = __list3[__i3];
                    {
                        if (assetBundleData.File.Contains("Script"))
                        {
                            AssetBundleManagerEditor.CreateAssetBundleWithDependency(data, index, true);
                            break;
                        }
                        index++;
                    }
                }
            }
        }

        string streamAssetsPath = Application.streamingAssetsPath;

        if (Directory.Exists(streamAssetsPath))
        {
            Directory.Delete(streamAssetsPath, true);
        }
        Directory.CreateDirectory(streamAssetsPath);

        //是不是要打小包
        string path = Path.Combine(Application.dataPath, "../../thinpackage.txt");

        if (File.Exists(path))
        {
            s_IsThinPackage = true;
            File.Delete(path);
        }
        else
        {
            s_IsThinPackage = false;
        }

        if (s_IsThinPackage)
        {
            ModifyVersionFile(GameVersionPath, 1);
            ProcessThinPackageResource();
            string destPath = Path.Combine(Application.streamingAssetsPath, "Game.ver");
            File.Copy(GameVersionPath, destPath, true);
            if (bRebuildBundle)
            {
                ModifyVersionFile(GameVersionPath, 1);
            }
        }
        else
        {
            DirectoryCopy(AssetBundlePath, streamAssetsPath, true);
            if (bRebuildBundle)
            {
                ModifyVersionFile(GameVersionPath, 1);
            }
            string destPath = Path.Combine(Application.streamingAssetsPath, "Game.ver");
            File.Copy(GameVersionPath, destPath, true);
        }

        string destPath3 = Path.Combine(Application.streamingAssetsPath, "logo.mp4");
        string mp4Path   = Path.Combine(Application.dataPath, "../../PlatformPlugin/logo.mp4");

        if (File.Exists(mp4Path))
        {
            File.Copy(mp4Path, destPath3, true);
        }

        ToLuaMenu.BuildNotJitBundles();
        DirectoryCopy(Path.Combine(Application.streamingAssetsPath, LuaConst.osDir),
                      Path.Combine(AssetBundlePath, LuaConst.osDir), true);

        //把需要更新文件备份
        string assetBundlePath = Path.Combine(Application.dataPath, "BundleAsset");
        string verInfo         = File.ReadAllText(GameVersionPath).Trim();
        var    config          = verInfo.Split(',');
        var    backupPathStr   = string.Format("../../Update/{0}/{1}/{2}/{3}/BundleAsset", config[0], config[1], config[2], config[3]);
        var    backupPath      = Path.Combine(Application.dataPath, backupPathStr);

        CheckTargetPath(backupPath);

        if (Directory.Exists(backupPath))
        {
            Directory.Delete(backupPath, true);
        }
        DirectoryCopy(assetBundlePath, backupPath, true);
        DllBackupPath = backupPath;
    }