Exemple #1
0
        private IEnumerator _navigatorBack()
        {
            if (m_windows_name_stack.Count < 2)
            {
                Utility.Log.Exception("ui_win的Stack已经到底,不能再返回");
                yield break;
            }

            SetEventSystemEnable(false);

            // 先处理当前窗口的隐藏
            UI_Base current_win_obj = _getUIObject(m_windows_name_stack.Pop(), false);
            UI_Base next_win_obj    = _getUIObject(m_windows_name_stack.Peek(), true);

            Single exit_time_1 = current_win_obj.PreHide(next_win_obj);
            Single exit_time_2 = m_title_obj.PreHide(next_win_obj);
            Single exit_time   = exit_time_1 > exit_time_2 ? exit_time_1 : exit_time_2;

            current_win_obj.PlayExitAnimation();
            m_title_obj.PlayExitAnimation();

            if (m_dialog_name_list.Count == 0)
            {
                current_win_obj.OnFocusChanged(false);
            }

            yield return(new WaitForSeconds(exit_time));

            current_win_obj.gameObject.SetActive(false);
            m_title_obj.gameObject.SetActive(false);
            current_win_obj.OnHide(next_win_obj);
            m_title_obj.OnHide(next_win_obj);
            // 处理新窗口的显示

            next_win_obj.gameObject.SetActive(true);
            m_title_obj.gameObject.SetActive(true);
            // 打开窗口的参数暂时先不要
            Single entrance_time_1 = next_win_obj.PreShow(current_win_obj);
            Single entrance_time_2 = m_title_obj.PreShow(null, next_win_obj.GetTitleEntranceAnimationName(current_win_obj.name));

            Single entrance_time = entrance_time_1 > entrance_time_2 ? entrance_time_1 : entrance_time_2;

            next_win_obj.transform.SetAsLastSibling();
            m_title_obj.transform.SetAsLastSibling();
            next_win_obj.PlayEntranceAnimation();
            m_title_obj.PlayEntranceAnimation();
            m_current_window = next_win_obj;

            yield return(new WaitForSeconds(entrance_time));

            if (m_dialog_name_list.Count == 0)
            {
                next_win_obj.OnFocusChanged(true);
            }

            next_win_obj.OnShow(current_win_obj);
            m_title_obj.OnShow(null);
            SetEventSystemEnable(true);
        }
Exemple #2
0
        private IEnumerator _onReturnLobby(Int32 _idx)
        {
            if (m_windows_name_stack.Count == 0)
            {
                Log.Exception("[UIManager._onReturnLobby]: 返回到一个不存在的窗口!");
                yield break;
            }

            if (_idx < 0)
            {
                Int32 tmp = -_idx - 1;
                for (Int32 i = 0; i < tmp; ++i)
                {
                    m_windows_name_stack.Pop();
                }
            }
            else
            {
                if (m_windows_name_stack.Count < _idx)
                {
                    Utility.Log.Exception("[UIManager._onReturnLobby]: 返回窗口,栈idx 无效.");
                    yield break;
                }
                Int32 tmp = m_windows_name_stack.Count - _idx;
                for (Int32 i = 0; i < tmp; ++i)
                {
                    m_windows_name_stack.Pop();
                }
            }
            UI_Base ui_object       = _getUIObject(m_windows_name_stack.Peek(), true);
            Single  entrance_time_1 = ui_object.PreShow(null);
            Single  entrance_time_2 = m_title_obj.PreShow(null, ui_object.GetTitleEntranceAnimationName(ui_object.name));

            Single entrance_time = entrance_time_1 > entrance_time_2 ? entrance_time_1 : entrance_time_2;

            ui_object.gameObject.SetActive(true);
            m_title_obj.gameObject.SetActive(true);
            m_current_window = ui_object;
            ui_object.transform.SetAsLastSibling();
            m_title_obj.transform.SetAsLastSibling();
            ui_object.PlayEntranceAnimation();
            m_title_obj.PlayEntranceAnimation();

            yield return(entrance_time);

            if (m_dialog_name_list.Count == 0)
            {
                ui_object.OnFocusChanged(true);
            }
            ui_object.OnFocusChanged(true);

            ui_object.OnShow(null);
            m_title_obj.OnShow(null);
        }
Exemple #3
0
        private IEnumerator _showOtherUI(UI_Base _ui_object, params object[] _args)
        {
            _ui_object.gameObject.SetActive(true);
            Single entrance_time = _ui_object.PreShow(null, _args);

            _ui_object.transform.SetAsLastSibling();
            _ui_object.PlayEntranceAnimation();

            if (entrance_time > float.Epsilon)
            {
                yield return(new WaitForSeconds(entrance_time));
            }
            _ui_object.OnShow(null);
        }
Exemple #4
0
        private IEnumerator _showDialog(UI_Base _ui_dialog, params object[] _args)
        {
            if (m_dialog_name_list.Count == 0)
            {
                if (m_windows_name_stack.Count > 0)
                {
                    UI_Base ui_win = _getUIObject(m_windows_name_stack.Peek(), false);
                    if (ui_win != null)
                    {
                        ui_win.OnFocusChanged(false);
                    }
                }
            }
            else
            {
                UI_Base ui_dialog = _getUIObject(m_dialog_name_list.Last.Value, false);
                if (ui_dialog != null)
                {
                    ui_dialog.OnFocusChanged(false);
                }
            }
            _ui_dialog.gameObject.SetActive(true);
            Single entrance_time = _ui_dialog.PreShow(null, _args);

            _ui_dialog.transform.SetAsLastSibling();
            _ui_dialog.PlayEntranceAnimation();
            m_dialog_name_list.AddLast(_ui_dialog.name);

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

            _ui_dialog.OnFocusChanged(true);
            _ui_dialog.OnShow(null);
            yield return(new WaitForEndOfFrame());
            //SignalSystem.FireSignal( SignalId.UICore_OnLobbyUIShowed, _ui_dialog );
        }
Exemple #5
0
        private IEnumerator _showWindow(UI_Base _ui_object, Boolean _rebuild_stack, params object[] _args)
        {
            SetEventSystemEnable(false);
            UI_Base current_win_obj = null;

            if (m_windows_name_stack.Count != 0)
            {
                current_win_obj = _getUIObject(m_windows_name_stack.Peek(), false);

                if (current_win_obj != null)
                {
                    Single exit_time_1 = current_win_obj.PreHide(_ui_object);
                    Single exit_time_2 = m_title_obj.PreHide(_ui_object);

                    current_win_obj.PlayExitAnimation();
                    m_title_obj.PlayExitAnimation();

                    if (m_dialog_name_list.Count == 0)
                    {
                        current_win_obj.OnFocusChanged(false);
                    }

                    yield return(new WaitForSeconds(exit_time_1 > exit_time_2 ? exit_time_1 : exit_time_2));

                    current_win_obj.gameObject.SetActive(false);
                    m_title_obj.gameObject.SetActive(false);
                    current_win_obj.OnHide(_ui_object);
                    m_title_obj.OnHide(_ui_object);
                }
            }

            // 重建堆栈
            if (_rebuild_stack)
            {
                _rebuidStack(_ui_object.name);
            }


            _ui_object.gameObject.SetActive(true);
            m_title_obj.gameObject.SetActive(true);
            Single entrance_time_1 = _ui_object.PreShow(current_win_obj, _args);
            Single entrance_time_2 = m_title_obj.PreShow(
                null,
                _args,
                _ui_object.GetTitleEntranceAnimationName(current_win_obj != null ? current_win_obj.name : String.Empty));

            //Single entrance_time = entrance_time_1 > entrance_time_2 ? entrance_time_1 : entrance_time_2;

            _ui_object.transform.SetAsLastSibling();
            m_title_obj.transform.SetAsLastSibling();
            _ui_object.PlayEntranceAnimation();

            if (entrance_time_1 > entrance_time_2)
            {
                yield return(new WaitForSeconds(entrance_time_1 - entrance_time_2));
            }

            m_title_obj.PlayEntranceAnimation();

            m_windows_name_stack.Push(_ui_object.name);
            m_current_window = _ui_object;

            yield return(new WaitForSeconds(entrance_time_1 < entrance_time_2 ? entrance_time_1 : entrance_time_2));

            if (m_dialog_name_list.Count == 0)
            {
                _ui_object.OnFocusChanged(true);
            }

            _ui_object.OnShow(current_win_obj, _args);
            m_title_obj.OnShow(null);
            yield return(new WaitForEndOfFrame());

            SetEventSystemEnable(true);
            //SignalSystem.FireSignal( SignalId.UICore_OnLobbyUIShowed, _ui_object );
        }