예제 #1
0
        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;
            }
        }
예제 #2
0
        /// <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;
            }
        }
예제 #3
0
        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;
            }
        }
예제 #4
0
        private void InternalOpenUIForm(int serialId, string uiFormAssetName, object uiFormInstance, bool isNewInstance, float duration)
        {
            try
            {
                IUIForm uiForm = m_UIFormHelper.CreateUIForm(uiFormInstance, GetUIGroup, userData);
                if (uiForm == null)
                {

                }

                uiForm.OnInit(serialId, uiFormAssetName, GetUIGroup, isNewInstance, userData);
                uiGroup.AddUIForm(uiForm);
                uiForm.OnOpen(userData);
                GetUIGroup.Refresh();

                if (m_OpenUIFormSuccessEventHandler != null)
                {
                    m_OpenUIFormSuccessEventHandler(this, new OpenUIFormSuccessEventArgs(uiForm, duration, userData));
                }
            }
            catch (Exception exception)
            {
                if (m_OpenUIFormFailureEventHandler != null)
                {
                    m_OpenUIFormSuccessEventHandler(this, new OpenUIFormSuccessEventArgs(serialId, uiUIFormAssetName);
                    return;
                }
                throw;
            }
        }
예제 #5
0
            /// <summary>
            /// 激活界面。
            /// </summary>
            /// <param name="uiForm">要激活的界面。</param>
            /// <param name="userData">用户自定义数据。</param>
            public void RefocusUIForm(IUIForm uiForm, object userData)
            {
                UIFormInfo uiFormInfo = GetUIFormInfo(uiForm);

                if (uiFormInfo == null)
                {
                    Log.Error("Can not find UI form info.");
                }

                m_UIFormInfos.Remove(uiFormInfo);
                m_UIFormInfos.AddFirst(uiFormInfo);
                uiForm.OnOpen(userData);
            }
예제 #6
0
        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);
        }
예제 #7
0
        public void OpenForm(IUIForm form)
        {
            if (!form.IsShow)
            {
                if (m_Forms.Last.Value != form)
                {
                    m_Forms.Remove(form);
                    m_Forms.AddLast(form);
                }
                form.Depth = ++m_CurrentDepth;
                form.OnOpen();

                IUIForm prevForm = m_Forms.Last.Previous == null ? null : m_Forms.Last.Previous.Value;
                if (prevForm != null && prevForm.IsShow)
                {
                    prevForm.OnCover();
                }
            }
        }