private void SetParentNodeExpand(GameObj rd, bool bExpand) { GameObj rdParent = null; ShowPanelDataSet.TryGetGameObj(rd.m_nParentID, out rdParent); if (rdParent != null) { rdParent.m_bExpand = true; SetParentNodeExpand(rdParent, bExpand); } }
private void ShowNodeList(ShowType eDataType, GameObj obj, GUIStyle labelStyle) { if (obj == null) { return; } if (!obj.m_bActive) { labelStyle = m_LabelStyleInActive; } GUIStyle selectedStyle = labelStyle; if (select_obj == obj) { selectedStyle = m_LabelStyleSelected; } if (obj.m_szName.ToLower().Contains(m_szObjName.ToLower())) { GUILayout.BeginHorizontal(); if (GUILayout.Button(obj.m_szName, selectedStyle)) { select_obj = obj; SetParentNodeExpand(obj, true); string data = IObject.Serializer <GameObj>(select_obj); Cmd cmd = new Cmd(data.Length); cmd.WriteNetCmd(NetCmd.C2S_QueryComponent); cmd.WriteString(data); net_client.SendCmd(cmd); OnUpdateUI(); } GUILayout.EndHorizontal(); } if (obj.m_childrenID.Length > 0) { for (int i = 0; i < obj.m_childrenID.Length; ++i) { GameObj rd = null; ShowPanelDataSet.TryGetGameObj(obj.m_childrenID[i], out rd); if (rd != null) { ShowNodeList(eDataType, rd, labelStyle); } } } }
private void ShowNodeRecursion(ShowType eDataType, GameObj obj, int split, GUIStyle labelStyle) { if (obj == null) { return; } if (!obj.m_bActive) { labelStyle = m_LabelStyleInActive; } GUILayout.BeginHorizontal(); GUILayout.Label("", GUILayout.Width(split)); GUIStyle selectedStyle = labelStyle; if (select_obj == obj) { selectedStyle = m_LabelStyleSelected; } if (obj.m_childrenID.Length > 0) { obj.m_bExpand = GUILayout.Toggle(obj.m_bExpand, "", EditorStyles.foldout, GUILayout.Width(10)); } else { GUILayout.Label("", GUILayout.Width(10)); } if (GUILayout.Button(obj.m_szName, selectedStyle)) { select_obj = obj; string data = IObject.Serializer <GameObj>(select_obj); Cmd cmd = new Cmd(data.Length); cmd.WriteNetCmd(NetCmd.C2S_QueryComponent); cmd.WriteString(data); net_client.SendCmd(cmd); OnUpdateUI(); } GUILayout.EndHorizontal(); if (obj.m_bExpand && obj.m_childrenID.Length > 0) { for (int i = 0; i < obj.m_childrenID.Length; ++i) { GameObj rd = null; if (eDataType == ShowType.enum_SceneObjs) { ShowPanelDataSet.TryGetGameObj(obj.m_childrenID[i], out rd); } else { ShowPanelDataSet.TryGetFrustumGameObj(obj.m_childrenID[i], out rd); } if (rd != null) { ShowNodeRecursion(eDataType, rd, 15 + split, labelStyle); } } } }