Пример #1
0
        /// <summary>
        /// Async the Load Data
        /// </summary>
        /// <returns>The load data</returns>
        private IEnumerator <int> AsyncLoadData()
        {
            UIInfoData _uiInfoData = null;

            UnityEngine.Object _prefabObj = null;
            GameObject         _uiObject  = null;

            if (stackOpenUIs != null && stackOpenUIs.Count > 0)
            {
                do
                {
                    _uiInfoData = stackOpenUIs.Pop();
                    _prefabObj  = Resources.Load(_uiInfoData.Path);
                    if (_prefabObj != null)
                    {
                        //此处需要处理,如果是NGUI需要使用AddChild,如果是用UGUI需要添加到桌布下面
                        //_uiObject = NGUITools.AddChild(GameObject.Instance.mainUICamera.gameObject, _prefabObj);
                        _uiObject = MonoBehaviour.Instantiate(_prefabObj) as GameObject;
                        BaseUI _baseUI = _uiObject.GetComponent <BaseUI>();
                        if (_baseUI == null)
                        {
                            _baseUI = _uiObject.AddComponent(_uiInfoData.ScriptType) as BaseUI;
                        }
                        if (_baseUI != null)
                        {
                            _baseUI.SetUIWhenOpening(_uiInfoData.UIparams);
                        }
                        dicOpenUIs.Add(_uiInfoData.UIType, _uiObject);
                    }
                } while (stackOpenUIs.Count > 0);
            }
            yield return(0);
        }
Пример #2
0
        public void OpenUI(int type, string name, object data)
        {
            UIInfoData uiInfoData = new UIInfoData()
            {
                m_type = type, m_name = name, m_data = data
            };

            OpenUI(uiInfoData);
        }
Пример #3
0
 public void OpenUICloseOthers(UIInfoData _uiInfoData)
 {
     UIInfoData[] uiInfoDataArr = new UIInfoData[1];
     uiInfoDataArr[0] = new UIInfoData()
     {
         m_type = _uiInfoData.m_type, m_name = _uiInfoData.m_name, m_data = _uiInfoData.m_data
     };
     OpenUI(uiInfoDataArr, true);
 }
Пример #4
0
        private void OpenUI(UIInfoData[] _UIInfoDataArr, bool _isCloseOthers)
        {
            // Close Others UI.
            if (_isCloseOthers)
            {
                CloseAllUI();
            }

            // push _uiTypes in Stack.
            for (int i = 0; i < _UIInfoDataArr.Length; i++)
            {
                UIInfoData uiInfoData = _UIInfoDataArr[i];
                int        p_uiType   = uiInfoData.m_type;
                if (!m_dicOpenedUIs.ContainsKey(p_uiType))
                {
                    LoadUIType(p_uiType, uiInfoData.m_name, uiInfoData.m_data);
                }
            }
        }
Пример #5
0
 public void OpenUI(UIInfoData _uiInfoData)
 {
     UIInfoData[] uiInfoDataArr = new UIInfoData[1];
     uiInfoDataArr[0] = _uiInfoData;
     OpenUI(uiInfoDataArr, false);
 }