コード例 #1
0
        private IEnumerator _returnLastWindow()
        {
            if (m_windows_name_stack.Count <= 1)
            {
                Debug.LogErrorFormat("Windows型界面的Stack已经到底,不能再返回");
                yield break;
            }
            // 先处理当前窗口的隐藏
            UIBase hide_win_obj = _getLoadedUI(m_windows_name_stack.Pop());

            if (hide_win_obj == null)
            {
                Debug.LogErrorFormat("当前Window为空");
                yield break;
            }
            UIBase show_win_obj = _getLoadedUI(m_windows_name_stack.Peek());

            if (show_win_obj == null)
            {
                _createUI(m_windows_name_stack.Peek(), _base => { show_win_obj = _base; });
            }
            Single exit_time = hide_win_obj.PlayExitAnimation();

            if (exit_time > Single.Epsilon)
            {
                yield return(new WaitForSeconds(exit_time));
            }
            _handleUIHide(hide_win_obj);

            yield return(new WaitUntil(() => show_win_obj != null));

            // 处理新窗口的显示
            _showOrHide(show_win_obj, true);
            show_win_obj.transform.SetAsLastSibling();
            _resetLayerSortingOrder(show_win_obj.Layer);
            show_win_obj.PreShow(hide_win_obj);

            Single entrance_time = show_win_obj.PlayEntranceAnimation();

            if (entrance_time > Single.Epsilon)
            {
                yield return(new WaitForSeconds(entrance_time));
            }
            show_win_obj.OnShow(hide_win_obj);
        }
コード例 #2
0
        private IEnumerator _hideDialog(UIBase _ui_dialog)
        {
            var target_node = m_dialog_name_list.Find(_ui_dialog.name);

            if (null != target_node)
            {
                m_dialog_name_list.Remove(target_node);
            }

            float exit_time = _ui_dialog.PlayExitAnimation();

            if (exit_time > float.Epsilon)
            {
                yield return(new WaitForSeconds(exit_time));
            }

            _handleUIHide(_ui_dialog);
        }
コード例 #3
0
        private IEnumerator _showWindow(UIBase _ui_object, params object[] _args)
        {
            UIBase current_win_obj = null;

            //播放上一个界面的退场动画和事件回调
            if (m_windows_name_stack.Count != 0)
            {
                current_win_obj = _getLoadedUI(m_windows_name_stack.Peek());
                if (current_win_obj != null)
                {
                    Single exit_time = current_win_obj.PlayExitAnimation();

                    if (exit_time > Single.Epsilon)
                    {
                        yield return(new WaitForSeconds(exit_time));
                    }

                    _handleUIHide(current_win_obj);
                }
            }
            //播放当前界面的入场动画和事件回调
            _showOrHide(_ui_object, true);
            _ui_object.transform.SetAsLastSibling();
            _resetLayerSortingOrder(_ui_object.Layer);
            _ui_object.PreShow(current_win_obj, _args);

            Single entrance_time = _ui_object.PlayEntranceAnimation();

            m_windows_name_stack.Push(_ui_object.name);

            if (entrance_time > Single.Epsilon)
            {
                yield return(new WaitForSeconds(entrance_time));
            }

            _ui_object.OnShow(current_win_obj, _args);
        }