diff --git a/Assets/Scripts/GameInit/UpdatePanel.cs b/Assets/Scripts/GameInit/UpdatePanel.cs index a21ddcd880..cc4aca00c2 100644 --- a/Assets/Scripts/GameInit/UpdatePanel.cs +++ b/Assets/Scripts/GameInit/UpdatePanel.cs @@ -28,6 +28,7 @@ namespace GameLogic [SerializeField] UpdateMsgBox msgBox; + AssetBundle bundle; void Awake() { msgBox.gameObject.SetActive(false); @@ -41,7 +42,29 @@ namespace GameLogic string updatePanelBg = ConfigManager.Instance.GetConfigInfo("Setting.UPDATE_PANEL_BG.value"); if (updatePanelBg != null) { - this.transform.Find("Canvas/LoadingScreen/bg1").GetComponent().sprite = App.ResMgr.LoadSpriteAsset(updatePanelBg); + if (AppConst.bundleMode) + { + string path = AppConst.PersistentDataPath + "lz4/bg/loading/" + updatePanelBg + ".unity3d"; + if (!File.Exists(path)) + { + path = AppConst.StreamPath + "lz4/bg/loading/" + updatePanelBg + ".unity3d"; + } + bundle = AssetBundle.LoadFromFile(path, 0, GameLogic.AppConst.EncyptBytesLength); + if (bundle == null) + { + XDebug.Log.error(string.Format("{0} 不存在,请检查", path)); + return; + } + this.transform.Find("Canvas/LoadingScreen/bg1").GetComponent().sprite = bundle.LoadAsset(updatePanelBg); + } + else + { +#if UNITY_EDITOR + string path = AppConst.GameResPath + "/BG/Loading/" + updatePanelBg + ".jpg"; + Sprite sp = UnityEditor.AssetDatabase.LoadAssetAtPath(path); + this.transform.Find("Canvas/LoadingScreen/bg1").GetComponent().sprite = sp; +#endif + } } } private void OnDestroy() @@ -49,7 +72,8 @@ namespace GameLogic string updatePanelBg = ConfigManager.Instance.GetConfigInfo("Setting.UPDATE_PANEL_BG.value"); if (updatePanelBg != null) { - App.ResMgr.UnLoadAsset(updatePanelBg); + if (bundle != null) bundle.Unload(true); + bundle = null; } }