/// 在某节点上打开新的 /// </summary> /// <param name="parentNode">某节点</param> /// <param name="path"></param> /// <param name="userData"></param> /// <param name="unitGroupIndex"></param> /// <param name="open">是否自动打开</param> /// <returns></returns> internal PanelBase Open(TreeNode <PanelBase> parentNode, string path, object userData, int unitGroupIndex = -1, bool open = true) { //-1则用父节点的Unit组Id 否则用参数指定的Id PanelBase newChild = Z.UI.Load(path, userData, this, unitGroupIndex == -1?parentNode.Value._UnitGroupIndex: unitGroupIndex); if (newChild == null) { return(null); } var node = Z.Pool.Take <TreeNode <PanelBase> >(); node.Fill(newChild); newChild.NodeInGroup = node; parentNode.AddChild(node); if (open) { _Open(parentNode, node, userData); } return(newChild); }/// <summary>
/// <summary> /// 打开/关闭一个子面板 /// </summary> /// <param name="child"></param> /// <param name="await"></param> /// <param name="userData"></param> protected void Switch(PanelBase child, bool await = false, object userData = null) { if (!Available) { return; } if (child.Available && child.Visible) { UIGroup.CloseChild(NodeInGroup, child); } else if (!child.Available && !child.Visible) { UIGroup.Open(NodeInGroup, child, await, userData); } else { Z.Debug.Warning("Switch操作可能存在问题"); } }
/// <summary> /// 在某节点上打开旧的 /// </summary> /// <param name="parentNode"></param> /// <param name="child"></param> /// <param name="userData"></param> /// <returns></returns> internal void Open(TreeNode <PanelBase> parentNode, PanelBase child, bool await, object userData) { if (child.Unit.GO == null) { Z.Debug.Warning("要打开的面板的unit里的GO为空"); return; } if (Lock) { Z.Debug.Log("UI锁定中"); return; } if (child.Available && child.Visible) { Z.Debug.Log("拒绝重复打开"); return; } var childNode = parentNode.Children.Find(n => n.Value == child); _Open(parentNode, childNode, await, userData); }
/// <summary> /// 关闭自己 /// </summary> /// <param name="self"></param> /// <param name="userData"></param> internal void Close(PanelBase self)//应该只有关闭自己的接口 不用留关掉其他子的接口 { var selfNode = self.NodeInGroup; var parentNode = selfNode.Parent; selfNode.ActionRecursive(n => { n.Value.OnClose(); }); for (int i = 0; i < parentNode.Children.Count; i++) { var curPanel = parentNode.Children[i].Value; if (curPanel == self) { continue; } if (curPanel.Available || curPanel.Visible) { return; } } parentNode.Value?.OnReveal(); }
/// <summary> /// 切换(同一个父节点下的子节点切换) /// </summary> /// <param name="parentNode"></param> /// <param name="child"></param> /// <param name="userData"></param> internal void Switch(TreeNode <PanelBase> parentNode, PanelBase child, object userData) { Open(parentNode, child, userData); }
/// <summary> /// 在某节点上打开旧的 /// </summary> /// <param name="parentNode"></param> /// <param name="child"></param> /// <param name="userData"></param> /// <returns></returns> internal void Open(TreeNode <PanelBase> parentNode, PanelBase child, object userData) { var childNode = parentNode.Children.Find(n => n.Value == child); _Open(parentNode, childNode, userData); }
}/// <summary> /// 在根节点上打开旧的 /// </summary> /// <param name="panel"></param> /// <param name="userData"></param> /// <param name="open"></param> /// <returns></returns> internal void Open(PanelBase panel, object userData) { Open(mPanelTree.Root, panel, userData); }
public void Open(PanelBase panel, bool await = false, object userData = null, int uiGroupIndex = 0) { mGroupLst[uiGroupIndex].Open(panel, await, userData); }
/// <summary> /// 在根节点上打开旧的 /// </summary> /// <param name="panel"></param> /// <param name="userData"></param> /// <param name="open"></param> /// <returns></returns> internal void Open(PanelBase panel, bool await, object userData) { Open(mPanelTree.Root, panel, await, userData); }