Esempio n. 1
0
        // 再一次打开
        public BaseView _again_open_panel(PanelInfo data)
        {
            BaseView baseView = _panelMap[data.ViewId];

            baseView.SetPanelData(data.ViewId);
            return(baseView);
        }
Esempio n. 2
0
        public BaseView Open(PanelInfo viewInfo, System.Object info = null)
        {
            BaseView baseView = _internal_open(viewInfo);

            _panelCache.Set(viewInfo.ViewId, PanelHistoryInfo.Get(viewInfo.ViewId));
            return(baseView);
        }
Esempio n. 3
0
 public void _internal_history_close(PanelInfo viewData, Action <BaseView> action = null)
 {
     if (OnClose != null)
     {
         OnClose(viewData, action);
     }
 }
Esempio n. 4
0
 public void _internal_history_open(PanelInfo viewData, Action <BaseView> action = null)
 {
     if (OnOpen != null)
     {
         OnOpen(viewData, action);
     }
 }
Esempio n. 5
0
 public void Close(PanelInfo viewInfo)
 {
     if (viewInfo == null)
     {
         return;
     }
     _internal_close(viewInfo);
 }
Esempio n. 6
0
 // 添加到历史记录并且打开
 public void _internal_real_open(PanelInfo viewData, Object info, Action <BaseView> action = null)
 {
     _currView = viewData;
     PushHistory(viewData);
     if (OnOpen != null)
     {
         OnOpen(viewData, info, action);
     }
 }
Esempio n. 7
0
 // 剔除历史记录,并且关闭
 public void _internal_real_close(PanelInfo viewData, Action <BaseView> action = null)
 {
     Remove(viewData);
     _currView = PeekHistory();
     if (OnClose != null)
     {
         OnClose(viewData, action);
     }
 }
Esempio n. 8
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++;
        }
Esempio n. 9
0
 public void Open(PanelInfo viewData, Object info, Action <BaseView> action = null)
 {
     if (viewData.IsPanel() && _currView != null)
     {
         for (int i = _panelHistory.Count - 1; i >= 0; i--)
         {
             _internal_history_close(_panelHistory[i]);
         }
     }
     _internal_real_open(viewData, info, action);
     //PanelLog.Log("-->当前界面:[{0}]",_curr_view.ViewId);
 }
Esempio n. 10
0
        public void _real_open(PanelInfo viewData, System.Object info = null, Action <BaseView> action = null)
        {
            BaseView baseView = _panelFactory.Open(viewData, info);

            if (action != null)
            {
                action(baseView);
            }
            baseView.gameObject.SetActive(false);
            GameObjectHelper.SetParent(baseView.gameObject, _panelCanvas.gameObject, true);
            baseView.gameObject.SetActive(true);
        }
Esempio n. 11
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);
        }
Esempio n. 12
0
 public bool Remove(PanelInfo viewData)
 {
     for (int i = _panelHistory.Count - 1; i >= 0; i--)
     {
         if (viewData == _panelHistory[i])
         {
             PanelLog.Log("Remove :[{0}]", viewData.ViewId);
             _panelHistory.RemoveAt(i);
             return(true);
         }
     }
     return(false);
 }
Esempio n. 13
0
        public PanelInfo PopHistory()
        {
            PanelInfo viewData = null;

            if (_panelHistory.Count > 0)
            {
                viewData = _panelHistory[_panelHistory.Count - 1];

                PanelLog.Log("Remove :[{0}]", viewData.ViewId);
                _panelHistory.RemoveAt(_panelHistory.Count - 1);
            }
            return(viewData);
        }
Esempio n. 14
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);
        }
Esempio n. 15
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);
        }
Esempio n. 16
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];
            }
        }
Esempio n. 17
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);
        }
Esempio n. 18
0
        public void OnOpen(E_ViewId viewId, System.Object info = null, Action <BaseView> action = null)
        {
            PanelInfo viewData = PanelManagerConfig.Get(viewId);

            _panelHistoryStack.Open(viewData, info);
        }
Esempio n. 19
0
 public void _real_close(PanelInfo viewData, System.Object info = null, Action <BaseView> action = null)
 {
     _panelFactory.Close(viewData);
 }
Esempio n. 20
0
 public void PushHistory(PanelInfo viewData)
 {
     PanelLog.Log("Add :[{0}]", viewData.ViewId);
     _panelHistory.Add(viewData);
 }
Esempio n. 21
0
        public void OnRemoveValueEvent(E_ViewId viewId)
        {
            PanelInfo viewData = PanelManagerConfig.Get(viewId);

            Destory(viewData);
        }