/// <summary> /// 深度释放内存,只应该在两种情况调用, 1切关时,2收到OnReceiveMemoryWarning时 /// </summary> public void FreeMemory(bool isMemoryWarning = false) { if (UiManager.Instance != null) { UiManager.Instance.DestroyAll(); } // 销毁所有界面模型 UiModelTool.DeleteAllModel(); // 2 管理层,释放缓存的数据 if (PoolManager.Instance != null) { PoolManager.Instance.Clear(); // manager本身在切关时已经释放一次了,不过无所谓,统一在这里写一次清晰一点 } if (!isMemoryWarning) { if (ResourceManager.Instance != null) { ResourceManager.Instance.Clear(); } } GC.Collect(); }
public override void Dispose() { UiModelTool.DeleteAllModel(); // 销毁所有界面模型 DestroyAll(true); }