少年修仙传客户端代码仓库
client_Wu Xijin
2018-10-26 b0026ed4e12ffb5672feaf511f74e7aae3ec023c
4334 【前端】随包资源支持热更
2个文件已修改
73 ■■■■■ 已修改文件
Core/GameEngine/Login/Launch.cs 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/ResModule/AssetBundle/AssetBundleUtility.cs 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Login/Launch.cs
@@ -34,6 +34,27 @@
    private void Awake()
    {
        ResourcesPath.Instance.Init();
        SnxxzGame.Instance.gameObject.name = "__SnxxzGame__";
        Application.backgroundLoadingPriority = ThreadPriority.BelowNormal;
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        ShaderUtility.InitGlobalParams();
        SoundPlayer.CreateSoundPlayer();
        SystemSetting.Instance.SetSoundVolume(SystemSetting.Instance.GetSoundVolume());
        SystemSetting.Instance.SetSoundEffect(SystemSetting.Instance.GetSoundEffect());
        SystemSetting.Instance.SetGameFps(SystemSetting.Instance.GetGameFps());
        SDKUtility.Instance.Init();
        GameObjectPoolManager.Instance.gameObject.name = "GameObjectPool";
        GameObjectPoolManager.Instance.Initialize();
        ExceptionCatcher.Init();
        ExceptionCatcher.Catch();
        DebugUtility.Instance.Init();
        GlobalTimeEvent.Instance.Begin();
#if UNITY_ANDROID && !UNITY_EDITOR
        var files = new List<FileInfo>();
        FileExtersion.GetAllDirectoryFileInfos(StringUtility.Contact(ResourcesPath.Instance.StreamingAssetPath, "builtin"), files);
@@ -80,32 +101,12 @@
        }
#endif
        ResourcesPath.Instance.Init();
        SnxxzGame.Instance.gameObject.name = "__SnxxzGame__";
        Application.backgroundLoadingPriority = ThreadPriority.BelowNormal;
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        ShaderUtility.InitGlobalParams();
        SoundPlayer.CreateSoundPlayer();
        SoundPlayer.Instance.PlayLoginMusic();
        SystemSetting.Instance.SetSoundVolume(SystemSetting.Instance.GetSoundVolume());
        SystemSetting.Instance.SetSoundEffect(SystemSetting.Instance.GetSoundEffect());
        SystemSetting.Instance.SetGameFps(SystemSetting.Instance.GetGameFps());
        SDKUtility.Instance.Init();
        GameObjectPoolManager.Instance.gameObject.name = "GameObjectPool";
        GameObjectPoolManager.Instance.Initialize();
        ExceptionCatcher.Init();
        ExceptionCatcher.Catch();
        DebugUtility.Instance.Init();
        GlobalTimeEvent.Instance.Begin();
        AssetBundleUtility.Instance.InitBuiltInAsset();
    }
    void Start()
    {
        SoundPlayer.Instance.PlayLoginMusic();
        Config.Instance.PreLoadConfigs();
        ServerListCenter.Instance.RequestJumpUrl();
Core/ResModule/AssetBundle/AssetBundleUtility.cs
@@ -14,6 +14,34 @@
    public bool initialized { get; private set; }
    public bool initializedUIAssetBundle { get; private set; }
    public void InitBuiltInAsset()
    {
        var path = AssetVersionUtility.GetAssetFilePath("builtin_assetbundle");
        var assetBundle = AssetBundle.LoadFromFile(path);
        if (assetBundle == null)
        {
            DebugEx.LogError("AssetBundleManifest的包文件为空或者加载出错.");
        }
        var manifest = assetBundle.LoadAsset<AssetBundleManifest>(ResourcesPath.AssetDependentFileAssetName);
        if (manifest == null)
        {
            DebugEx.LogError("AssetBundleManifest文件为空或者加载出错.");
        }
        var bundles = manifest.GetAllAssetBundles();
        foreach (var bundle in bundles)
        {
            var dependenices = manifest.GetAllDependencies(bundle);
            var hash = manifest.GetAssetBundleHash(bundle);
            var assetBundleInfo = new AssetBundleInfo(bundle, hash, dependenices);
            m_AssetBundleInfoList.Add(assetBundleInfo);
        }
        assetBundle.Unload(true);
        assetBundle = null;
    }
    public IEnumerator Initialize()
    {
        yield return StartCoroutine(Co_LoadMainfestFile("audio"));