IEnumerator ShowUIWithLoadData(IUIBase i_ui_base, object data = null) { while (HasLockUI(i_ui_base, m_switch_lock_name)) { yield return(0); } LockUI(i_ui_base, m_switch_lock_name); //加载数据相关 if (NeedLoadDataBeforeShow(i_ui_base)) { UIAsyncRequestResult res = RecyclableObject.Create <UIAsyncRequestResult>(); res.Success = true; yield return(i_ui_base.LoadData(res)); if (!res.Success) { RecyclableObject.Recycle(res); UnLockUI(i_ui_base, m_switch_lock_name); yield break; } } if (i_ui_base.IsStateUI) { if (ms_stack_manager != null) { ms_stack_manager.OnShowMainUI(i_ui_base); } yield return(CloseAllShowedUI()); } yield return(ShowUIBase(i_ui_base, data)); ms_showed_ui[(int)i_ui_base.Name] = i_ui_base; //显示附属UI if (i_ui_base.IsStateUI) { for (int i = 0; i < i_ui_base.MateUIList.Count; ++i) { ShowUI(i_ui_base.MateUIList[i]); } } //加载数据相关 if (NeedLoadDataBeforeShow(i_ui_base)) { i_ui_base.UpdateUIOnShow(); } else { i_ui_base.UpdateUIByDefaultDataOnShow(); UIAsyncRequestResult res = RecyclableObject.Create <UIAsyncRequestResult>(); res.Success = true; yield return(i_ui_base.LoadData(res)); RecyclableObject.Recycle(res); i_ui_base.UpdateUIOnShow(); } UnLockUI(i_ui_base, m_switch_lock_name); }