【更新】更新界面背景加载方式修改
parent
598b92f288
commit
10deef53cf
|
|
@ -28,6 +28,7 @@ namespace GameLogic
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
UpdateMsgBox msgBox;
|
UpdateMsgBox msgBox;
|
||||||
|
|
||||||
|
AssetBundle bundle;
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
msgBox.gameObject.SetActive(false);
|
msgBox.gameObject.SetActive(false);
|
||||||
|
|
@ -41,7 +42,29 @@ namespace GameLogic
|
||||||
string updatePanelBg = ConfigManager.Instance.GetConfigInfo("Setting.UPDATE_PANEL_BG.value");
|
string updatePanelBg = ConfigManager.Instance.GetConfigInfo("Setting.UPDATE_PANEL_BG.value");
|
||||||
if (updatePanelBg != null)
|
if (updatePanelBg != null)
|
||||||
{
|
{
|
||||||
this.transform.Find("Canvas/LoadingScreen/bg1").GetComponent<Image>().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<Image>().sprite = bundle.LoadAsset<Sprite>(updatePanelBg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
string path = AppConst.GameResPath + "/BG/Loading/" + updatePanelBg + ".jpg";
|
||||||
|
Sprite sp = UnityEditor.AssetDatabase.LoadAssetAtPath<Sprite>(path);
|
||||||
|
this.transform.Find("Canvas/LoadingScreen/bg1").GetComponent<Image>().sprite = sp;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
|
|
@ -49,7 +72,8 @@ namespace GameLogic
|
||||||
string updatePanelBg = ConfigManager.Instance.GetConfigInfo("Setting.UPDATE_PANEL_BG.value");
|
string updatePanelBg = ConfigManager.Instance.GetConfigInfo("Setting.UPDATE_PANEL_BG.value");
|
||||||
if (updatePanelBg != null)
|
if (updatePanelBg != null)
|
||||||
{
|
{
|
||||||
App.ResMgr.UnLoadAsset(updatePanelBg);
|
if (bundle != null) bundle.Unload(true);
|
||||||
|
bundle = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue