1
This commit is contained in:
@@ -2,6 +2,7 @@ using Assets.MyGame.Scripts.Net;
|
||||
using Assets.MyGame.Scripts.Net.API.GameConfig_SubClass;
|
||||
using Assets.MyGame.Scripts.Net.APIRequest.Objs;
|
||||
using Assets.MyGame.Scripts.Net.APIResponses.HomeMain_User;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
@@ -245,6 +246,9 @@ public class UIHomeMain : UIBase
|
||||
{
|
||||
|
||||
base.OnShow(args);
|
||||
// ⭐ 登录成功进入大厅:登录面板资源(LoginUIRes)不再需要,立即释放
|
||||
// (销毁登录面板实例 + 释放 prefab 句柄;登出回登录页时 ShowAsync 会重新加载)
|
||||
UIManager.Instance.ReleaseLoginUI();
|
||||
AudioManager.Instance.ChangeBG(69001);
|
||||
|
||||
|
||||
@@ -307,4 +311,22 @@ public class UIHomeMain : UIBase
|
||||
GameManager.Instance.OnUserDataChanged -= UpdateUserData;
|
||||
AudioManager.Instance.StopBG();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ⭐ 大厅面板销毁时释放全部子面板(VIP/背包/邮件/商店等 20 个)的 Addressables 资源:
|
||||
/// SubUIManager 的 handleCache 此前从不释放 → 进游戏后 HomeUIRes 一直占内存。
|
||||
/// 配合 UIManager.ReleaseHomeUI(进房时调用)实现大厅资源的完整卸载。
|
||||
/// </summary>
|
||||
private void OnDestroy()
|
||||
{
|
||||
try
|
||||
{
|
||||
subUIManager?.ReleaseAll();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogWarning($"[UIHomeMain] OnDestroy 释放子面板资源异常: {e.Message}");
|
||||
}
|
||||
subUIManager = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user