private void UpdateCurrentPanel() { IZUIPanel panel = null; for (int i = 0; i < panels.Count; i++) { IZUIPanel tmp = panels[i]; if (tmp.isOpen && panel == null) { panel = tmp; } else if (tmp.isOpen && tmp.depth > panel.depth) { panel = tmp; } } if (panel != null) { UpdateHistory(); _currentPanel = panel as ZUIPanel; current = _currentPanel.name; } else { current = ""; _currentPanel = null; } }
private IZUIPanel CreatePanel(string uname, RectTransform parent) { ZUIPanel panel = null; for (int i = 0; i < prefabs.Count; i++) { ZUIPanel prefab = prefabs[i]; if (prefab != null) { panel = Instantiate(prefab); if (panel != null) { panel.name = prefab.name; panel.mTransform.SetParent(parent, false); panel.mTransform.localScale = Vector3.one; panel.effectPoint = effectPoint; panels.Add(panel); } else { ZLog.Warning("this is not ZUIPanel of these prefabs that is " + uname + "!!!"); } break; } } if (panel == null) { ZLog.Warning("can not find prefab that name = " + uname); } return(panel); }
IEnumerator OpenInspector(ZUIPanel panel, UIParamInfo info) { while (panel.IsStartEnd == false) { yield return(null); } panel.Open(info); }
private void CloseWakenPanels() { UpdateHistory(); for (int i = 0; i < panels.Count; i++) { if (panels[i].isOpen) { ClosePanel(panels[i]); } } _currentPanel = null; }
private void ActivePanel(IZUIPanel panel, UIParamInfo param) { if (panel == null) { return; } UpdateHistory(); panel.WakenUp(panelParent); _currentPanel = panel as ZUIPanel; current = _currentPanel.name; StartCoroutine(OpenInspector(_currentPanel, param)); }
/// <summary> /// 重复打开 /// </summary> /// <param name="panel"></param> /// <param name="param"></param> public void RepeatOpenPanel(IZUIPanel panel, UIParamInfo param) { if (panel == null) { return; } UpdateHistory(); panel.Open(panelParent, param); _currentPanel = panel as ZUIPanel; current = _currentPanel.name; ZLog.Warning("panel name = " + current + " is opened!!!"); }
public static ZUIPanel[] GetWakendPanels() { if (Instance == null) { Debug.LogError("panel controller is not find!!!"); } List <ZUIPanel> list = new List <ZUIPanel>(); for (int i = 0; i < Instance.panels.Count; i++) { ZUIPanel panel = Instance.panels[i] as ZUIPanel; if (panel != null && panel.isOpen) { list.Add(panel); } } return(list.ToArray()); }
public void InitPrefabs(List <AssetInfo> assets) { if (assets == null || assets.Count < 1) { return; } prefabs.Clear(); for (int i = 0; i < assets.Count; i++) { AssetInfo info = assets[i]; ZUIPanel prefab = ZAssetController.Instance.GetPrefab <ZUIPanel>(info.asset); if (prefab != null) { prefab.name = info.name; prefab.grade = info.grade; prefabs.Add(prefab); //CreatePanel<ZUIPanel>(prefab,panelParent); } } }
public void ShowBackPanel() { if (_currentPanel != null) { ClosePanel(_currentPanel); } string uname = parent; if (string.IsNullOrEmpty(uname)) { return; } history.RemoveAt(history.Count - 1); IZUIPanel panel = null; for (int i = 0; i < panels.Count; i++) { if (panels[i].definition == uname) { panel = panels[i]; break; } } if (panel != null) { ZUIPanel tmp = panel as ZUIPanel; if (panel.isOpen) { panel.Open(tmp.Info); } else { panel.WakenUp(panelParent); StartCoroutine(OpenInspector(tmp, tmp.Info)); } _currentPanel = tmp; current = _currentPanel.name; ZLog.Warning("ShowBackPanel....." + current); } }
void OnDestroy() { _currentPanel = null; panels.Clear(); }