Exemple #1
0
        /// <summary>
        /// Pushs the view.
        /// </summary>
        /// <param name="_uiInfoDatas">UI info datas.</param>
        /// <param name="_popOtherViews">If set to <c>true</c> pop other views.</param>
        public void PushUI(UIInfoData[] _viewInfoDatas, bool _popOthers)
        {
            if (_popOthers)
            {
                //close current dialog
                PopAllUI();
            }

            //push ui in stack
            for (int i = 0; i < _viewInfoDatas.Length; i++)
            {
                EnumUIClass _uiClass    = _viewInfoDatas [i].UIClass;
                object[]    _params     = _viewInfoDatas [i].UIParams;
                string      _uiPath     = UIDefinePath.UI_VIEW_PREFABS_PATH + _uiClass;
                UIInfoData  _uiInfoData = new UIInfoData(_uiClass, _uiPath, _params);
                if (!dicOpenUI.ContainsKey(_uiClass))
                {
                    stackOpenUI.Push(_uiInfoData);
                }
            }

            //open ui
            if (stackOpenUI.Count > 0)
            {
                QCoroutineController.Instance.StartCoroutine(AsyncLoadData());
            }
        }
Exemple #2
0
        /// <summary>
        /// 异步加载 View
        /// </summary>
        /// <returns>The load data.</returns>
        private IEnumerator <int> AsyncLoadData()
        {
            UIInfoData _uiInfoData = null;

            UnityEngine.Object _prefab = null;
            GameObject         _uiObj  = null;

            if (null != stackOpenUI && stackOpenUI.Count > 0)
            {
                do
                {
                    _uiInfoData = stackOpenUI.Pop();
                    QResourceManager.Instance.ResourcesLoad(_uiInfoData.UIPath, out _prefab);
                    if (null != _prefab)
                    {
                        _uiObj = MonoBehaviour.Instantiate(_prefab) as GameObject;
                        QUIBaseVIew _baseView = _uiObj.GetComponent <QUIBaseVIew>();
                        if (null != _baseView)
                        {
                            //open UI View
                            _baseView.OpenUI(_uiInfoData.UIClass, _uiInfoData.UIParams);
                        }
                        dicOpenUI.Add(_uiInfoData.UIClass, _uiObj);
                    }
                }while(stackOpenUI.Count > 0);
            }

            yield return(0);
        }
Exemple #3
0
 public void PushUIAndPopOthers(UIInfoData _viewInfoData)
 {
     UIInfoData[] _viewInfoDatas = { _viewInfoData };
     PushUI(_viewInfoDatas, true);
 }
Exemple #4
0
 /// <summary>
 /// Pushs the view.
 /// </summary>
 /// <param name="_uiInfoData">UI info data.</param>
 public void PushUI(UIInfoData _viewInfoData)
 {
     UIInfoData[] _viewInfoDatas = { _viewInfoData };
     PushUI(_viewInfoDatas, false);
 }