// 关闭最上层的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); }
public bool AssetView(E_ViewId viewId) { if (_currView == null) { return(false); } return(_currView.ViewId == viewId); }
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++; }
public void OnClose(E_ViewId viewId) { bool result = _panelHistoryStack.AssetView(viewId); PanelLog.Assert(result, "回退的界面,和当前的界面历史不一致"); if (!result) { return; } _panelHistoryStack.Back(viewId); }
public bool CheckPanelState(E_ViewId viewId) { BaseView baseView; _panelMap.TryGetValue(viewId, out baseView); if (baseView == null) { return(false); } return(baseView.gameObject.activeSelf); }
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]); }
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); }
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); }
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); } }
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); } }
// 第一次打开界面的相关步骤 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); }
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]; } }
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); }
public void OnOpen(E_ViewId viewId, System.Object info = null, Action <BaseView> action = null) { PanelInfo viewData = PanelManagerConfig.Get(viewId); _panelHistoryStack.Open(viewData, info); }
// 返回上一个界面,返回的含义包含了关闭和返回 public void Back(E_ViewId viewId) { _internal_back(viewId); //PanelLog.Log("<--当前界面:[{0}]", _curr_view.ViewId); }
public static PanelInfo Get(E_ViewId id) { return(ViewPrefabMap[id]); }
public static void Close(E_ViewId viewId) { _panelManager.OnClose(viewId); }
public static void Open(E_ViewId viewId, System.Object info = null, Action <BaseView> action = null) { _panelManager.OnOpen(viewId, info, action); }
// 关闭指定的界面,这里特指某一个指定的界面 public void Close(E_ViewId viewId) { _internal_close(viewId); }
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; }
public void OnRemoveValueEvent(E_ViewId viewId) { PanelInfo viewData = PanelManagerConfig.Get(viewId); Destory(viewData); }
protected void OpenView(E_ViewId id) { PanelManagerCtrl.Open(id); }
public virtual void SetPanelData(E_ViewId viewId) { _viewId = viewId; }