コード例 #1
0
        // 关闭最上层的UI
        public bool _internal_close_top_view(E_ViewId viewId)
        {
            PanelLog.Assert(_currView != null, "当前界面为空");
            if (_currView == null)
            {
                return(true);
            }

            // 正常通道的历史界面必定是Panel打开头
            PanelLog.Assert(_panelHistory.Count != 1, "已经回退到最后一个历史界面");
            if (_panelHistory.Count <= 1)
            {
                return(true);
            }

            if (viewId != _currView.ViewId)
            {
                return(true);
            }

            bool result = _currView.IsPanel();

            // 关闭当前界面
            _internal_real_close(_currView);
            if (result)
            {
                return(false);
            }
            return(true);
        }
コード例 #2
0
 public bool AssetView(E_ViewId viewId)
 {
     if (_currView == null)
     {
         return(false);
     }
     return(_currView.ViewId == viewId);
 }
コード例 #3
0
        private static void _init_view_data(E_ViewId id, E_PanelType type, string pfbName, E_PanelBgType showMode = E_PanelBgType.NOTHING,
                                            bool hasBgClickClose = true)
        {
            PanelInfo view = new PanelInfo(id, type, ResPath.Get(PathType.PANEL_PFB, pfbName));

            view._showMode        = showMode;
            view._hasBgClickClose = hasBgClickClose;
            ViewPrefabMap.Add(id, view);
            _viewCount++;
        }
コード例 #4
0
        public void OnClose(E_ViewId viewId)
        {
            bool result = _panelHistoryStack.AssetView(viewId);

            PanelLog.Assert(result, "回退的界面,和当前的界面历史不一致");
            if (!result)
            {
                return;
            }
            _panelHistoryStack.Back(viewId);
        }
コード例 #5
0
        public bool CheckPanelState(E_ViewId viewId)
        {
            BaseView baseView;

            _panelMap.TryGetValue(viewId, out baseView);
            if (baseView == null)
            {
                return(false);
            }

            return(baseView.gameObject.activeSelf);
        }
コード例 #6
0
 public int FindSoundIdByKey(E_ViewId id, string key)
 {
     if (!_ui_sound.ContainsKey(id))
     {
         return(-1);
     }
     if (!_ui_sound[id].ContainsKey(key))
     {
         return(-1);
     }
     return(_ui_sound[id][key]);
 }
コード例 #7
0
        public void _internal_close(PanelInfo data)
        {
            E_ViewId viewId = data.ViewId;

            if (!_panelMap.ContainsKey(viewId))
            {
                return;
            }
            BaseView baseView = _panelMap[viewId];

            baseView.OnExit();
            GameObjectHelper.SetActive(baseView.gameObject, false);
        }
コード例 #8
0
        public BaseView _internal_open(PanelInfo data)
        {
            if (data == null)
            {
                return(null);
            }

            E_ViewId viewId   = data.ViewId;
            BaseView baseView = !_panelMap.ContainsKey(viewId) ? _first_open_panel(data) : _again_open_panel(data);

            baseView.OnEnter();
            GameObjectHelper.SetActive(baseView.gameObject, true);
            return(baseView);
        }
コード例 #9
0
 public static PanelHistoryInfo Get(E_ViewId viewId)
 {
     if (_map.ContainsKey(viewId))
     {
         return(_map[viewId]);
     }
     else
     {
         PanelHistoryInfo info = new PanelHistoryInfo {
             _viewId = viewId
         };
         _map.Add(viewId, info);
         return(info);
     }
 }
コード例 #10
0
        public void _internal_back(E_ViewId viewId, bool flag = false)
        {
            if (_internal_close_top_view(viewId))
            {
                return;
            }

            while (_panelHistory.Count >= 1 && _currView != null)
            {
                if (_currView.IsPanel())
                {
                    _internal_history_open(_currView);
                    break;
                }

                _internal_real_close(_currView);
            }
        }
コード例 #11
0
        // 第一次打开界面的相关步骤
        public BaseView _first_open_panel(PanelInfo data)
        {
            E_ViewId viewId = data.ViewId;
            // 2.加载GameObject 并且 _instantiate
            GameObject go       = ResManager.instance.LoadPrefab(data.GetPfbName);
            BaseView   baseView = go.GetComponent <BaseView>();

            // 3.Instantiate
            //view = _instantiate(obj, data);
            // 4.view的额外操作
            //base_view.OpenExtraOpertion(data);
            baseView.SetPanelData(viewId);
            // 6.添加到层
            //_add_layer(view.gameObject);
            baseView.OnInit();
            // 5.view的额外data
            //base_view.SetPanelData(data);
            // 8.添加到缓存
            _panelMap.Add(viewId, baseView);
            return(baseView);
        }
コード例 #12
0
        public void _internal_close(E_ViewId viewId)
        {
            if (_internal_close_top_view(viewId))
            {
                return;
            }

            PanelInfo tmpData = _currView;
            int       index   = _panelHistory.Count - 1;

            while (_panelHistory.Count >= 1 && tmpData != null)
            {
                if (tmpData.IsPanel())
                {
                    _internal_history_open(tmpData);
                    break;
                }
                _internal_history_close(tmpData);

                index--;
                tmpData = _panelHistory[index];
            }
        }
コード例 #13
0
        public void Destory(PanelInfo info)
        {
            if (info == null)
            {
                return;
            }

            BaseView baseView;

            _panelMap.TryGetValue(info.ViewId, out baseView);
            E_ViewId viewId = info.ViewId;

            if (baseView == null)
            {
                return;
            }

            _panelMap.Remove(viewId);

            baseView.OnDestroySelf();
            GameObjectHelper.DestroySelf(baseView.gameObject);

            ResLoader.Instance.UnLoadRes(info.GetPfbName);
        }
コード例 #14
0
        public void OnOpen(E_ViewId viewId, System.Object info = null, Action <BaseView> action = null)
        {
            PanelInfo viewData = PanelManagerConfig.Get(viewId);

            _panelHistoryStack.Open(viewData, info);
        }
コード例 #15
0
 // 返回上一个界面,返回的含义包含了关闭和返回
 public void Back(E_ViewId viewId)
 {
     _internal_back(viewId);
     //PanelLog.Log("<--当前界面:[{0}]", _curr_view.ViewId);
 }
コード例 #16
0
 public static PanelInfo Get(E_ViewId id)
 {
     return(ViewPrefabMap[id]);
 }
コード例 #17
0
 public static void Close(E_ViewId viewId)
 {
     _panelManager.OnClose(viewId);
 }
コード例 #18
0
 public static void Open(E_ViewId viewId, System.Object info = null, Action <BaseView> action = null)
 {
     _panelManager.OnOpen(viewId, info, action);
 }
コード例 #19
0
 // 关闭指定的界面,这里特指某一个指定的界面
 public void Close(E_ViewId viewId)
 {
     _internal_close(viewId);
 }
コード例 #20
0
        public bool _hasBgClickClose   = true;                          //点击不关闭本界面

        //public System.Object Info { get; set; }

        public PanelInfo(E_ViewId viewId, E_PanelType viewType, string name)
        {
            _viewId   = viewId;
            _viewType = viewType;
            _pfbName  = name;
        }
コード例 #21
0
        public void OnRemoveValueEvent(E_ViewId viewId)
        {
            PanelInfo viewData = PanelManagerConfig.Get(viewId);

            Destory(viewData);
        }
コード例 #22
0
 protected void OpenView(E_ViewId id)
 {
     PanelManagerCtrl.Open(id);
 }
コード例 #23
0
 public virtual void SetPanelData(E_ViewId viewId)
 {
     _viewId = viewId;
 }