private void InternalOpenUIForm(int serialId, string uiFormAssetName, UIGroup uiGroup, object uiFormInstance, bool pauseCoveredUIForm, bool isNewInstance, float duration, object userData) { try { IUIForm uiForm = m_UIFormHelper.CreateUIForm(uiFormInstance, uiGroup, userData); if (uiForm == null) { throw new GameFrameworkException("Can not create UI form in helper."); } uiForm.OnInit(serialId, uiFormAssetName, uiGroup, pauseCoveredUIForm, isNewInstance, userData); uiGroup.AddUIForm(uiForm); uiForm.OnOpen(userData); uiGroup.Refresh(); if (m_OpenUIFormSuccessEventHandler != null) { OpenUIFormSuccessEventArgs openUIFormSuccessEventArgs = OpenUIFormSuccessEventArgs.Create(uiForm, duration, userData); m_OpenUIFormSuccessEventHandler(this, openUIFormSuccessEventArgs); ReferencePool.Release(openUIFormSuccessEventArgs); } } catch (Exception exception) { if (m_OpenUIFormFailureEventHandler != null) { OpenUIFormFailureEventArgs openUIFormFailureEventArgs = OpenUIFormFailureEventArgs.Create(serialId, uiFormAssetName, uiGroup.Name, pauseCoveredUIForm, exception.ToString(), userData); m_OpenUIFormFailureEventHandler(this, openUIFormFailureEventArgs); ReferencePool.Release(openUIFormFailureEventArgs); return; } throw; } }
private void InternalOpenUIForm(int uiFormTypeId, string uiFormAssetName, UIGroup uiGroup, object uiFormInstance, bool pauseCoveredUIForm, bool isNewInstance, float duration, object userData) { try { IUIForm uiForm = m_UIFormHelper.CreateUIForm(uiFormInstance, uiGroup, userData); if (uiForm == null) { throw new GameFrameworkException("Can not create UI form in helper."); } uiForm.OnInit(uiFormTypeId, uiGroup, pauseCoveredUIForm, isNewInstance, userData); uiGroup.AddUIForm(uiForm); uiForm.OnOpen(userData); uiGroup.Refresh(); m_OpenUIFormSuccessEventHandler?.Invoke(this, new OpenUIFormSuccessEventArgs(uiFormAssetName, uiForm, duration, userData)); } catch (Exception exception) { if (m_OpenUIFormFailureEventHandler != null) { m_OpenUIFormFailureEventHandler(this, new OpenUIFormFailureEventArgs(uiFormTypeId, uiFormAssetName, uiGroup.Name, pauseCoveredUIForm, string.Format("{0}\n{1}", exception.Message, exception.StackTrace), userData)); return; } throw; } }
/// <summary> /// 立即打开界面 /// </summary> /// <param name="serialId"></param> /// <param name="uiFormAssetName"></param> /// <param name="uiGroup"></param> /// <param name="uiFormInstance"></param> /// <param name="pauseCoveredUIForm"></param> /// <param name="isNewInstance"></param> /// <param name="duration"></param> /// <param name="userData"></param> private void InternalOpenUIForm(int serialId, string uiFormAssetName, UIGroup uiGroup, object uiFormInstance, bool isNewInstance, float duration, object userData) { try { IUIForm uiForm = m_UIFormHelper.CreateUIForm(uiFormInstance, uiGroup, userData); if (uiForm == null) { Log.Error("Can not create UI form in helper."); } if (uiGroup.CurrentUIForm != null && uiGroup.CurrentUIForm.SerialId != uiForm.SerialId) { uiGroup.CurrentUIForm.OnClose(null); } uiForm.OnInit(serialId, uiFormAssetName, uiGroup, isNewInstance, userData); uiGroup.AddUIForm(uiForm); uiForm.OnOpen(userData); uiGroup.Refresh(); if (m_OpenUIFormSuccessEventHandler != null) { m_OpenUIFormSuccessEventHandler(this, new OpenUIFormSuccessEventArgs(uiForm, duration, userData)); } } catch (System.Exception exception) { if (m_OpenUIFormFailureEventHandler != null) { m_OpenUIFormFailureEventHandler(this, new OpenUIFormFailureEventArgs(serialId, uiFormAssetName, uiGroup.Name, exception.ToString(), userData)); return; } throw; } }
private IUIForm InnerOpenUIForm(string uiFormAssetName, UIGroup uiGroup, object uiFormInstance, bool pauseCoveredUIForm, bool isNewInstance, object userData) { IUIForm uiForm = m_UIFormHelper.CreateUIForm(uiFormInstance, uiGroup, userData); Guard.Verify <ArgumentException>(uiForm == null, $"Can not create UI form in helper."); uiForm.OnInit(uiFormAssetName, uiGroup, pauseCoveredUIForm, isNewInstance, userData); uiGroup.AddUIForm(uiForm); uiGroup.RefreshOnlyOlds(); uiForm.OnOpen(userData); uiGroup.RefreshOnlyNew(); return(uiForm); }