| | |
| | | {
|
| | | UIManager.Instance.DestroyAllUI();
|
| | |
|
| | | // 清理上一场景的资源,防止内存泄漏
|
| | | if (AssetSource.isUseAssetBundle)
|
| | | {
|
| | | AssetBundleUtility.Instance.UnloadAll();
|
| | | // 等待资源卸载完成
|
| | | await UniTask.Yield();
|
| | | Resources.UnloadUnusedAssets();
|
| | | await UniTask.DelayFrame(1);
|
| | |
|
| | | AssetBundleUtility.Instance.Sync_LoadAll("maps/Login");
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | UIManager.Instance.DestroyAllUI();
|
| | |
|
| | | // 清理上一场景的资源,防止内存泄漏
|
| | | if (AssetSource.isUseAssetBundle)
|
| | | {
|
| | | AssetBundleUtility.Instance.UnloadAll();
|
| | | // 等待资源卸载完成
|
| | | await UniTask.Yield();
|
| | | Resources.UnloadUnusedAssets();
|
| | | await UniTask.DelayFrame(1);
|
| | | }
|
| | |
|
| | | BeforeLoadingGameScene?.Invoke();
|
| | |
|
| | | // ResManager.Instance.PrewarmResources();
|
| | |
| | | #region 执行事件 |
| | | public void OnPointerClick(PointerEventData eventData) |
| | | { |
| | | // 检查组件是否已禁用或销毁,避免空指针解引用 |
| | | if (!this.isActiveAndEnabled) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | OnClick?.Invoke(); |
| | | if (HrefClick) |
| | | { |
| | |
| | | // 字符宽度缓存,避免重复计算相同字符 |
| | | private Dictionary<string, float> charWidthCache = new Dictionary<string, float>(); |
| | | |
| | | protected override void OnDisable() |
| | | { |
| | | base.OnDisable(); |
| | | // 组件禁用时清空缓存,防止内存泄漏 |
| | | charWidthCache.Clear(); |
| | | } |
| | | |
| | | private bool IsModifySize(int _index,out int _size) |
| | | { |
| | | _size = 0; |
| | |
| | | |
| | | public bool ExecuteEvent(RichTextEventEnum type,HrefInfo href) |
| | | { |
| | | return m_RichEvents[type].Execute(type,href); |
| | | if (m_RichEvents == null || !m_RichEvents.ContainsKey(type)) |
| | | { |
| | | Debug.LogWarning($"RichTextMgr: Event type {type} not registered"); |
| | | return false; |
| | | } |
| | | |
| | | var evt = m_RichEvents[type]; |
| | | if (evt == null) |
| | | { |
| | | Debug.LogWarning($"RichTextMgr: Event handler for {type} is null"); |
| | | return false; |
| | | } |
| | | |
| | | return evt.Execute(type, href); |
| | | } |
| | | |
| | | public string GetDisplay(RichTextEventEnum type,Dictionary<string,string> dic) |