Ejemplo n.º 1
0
 private void OnGUI_ChildersButton(hwmQuadtreeChilderNodeIndex index)
 {
     if (m_Current.IsLeaf())
     {
         GUILayout.Button("No " + index.ToString());
     }
     else if (GUILayout.Button(index.ToString()))
     {
         if (m_ChilderIndex == index)                 // double click enter childer
         {
             m_LastNodes.Push(m_Current);
             m_Current      = m_Current.GetChilder(m_ChilderIndex);
             m_ChilderIndex = NOTSET_CHILDER_INDEX;
         }
         else
         {
             m_ChilderIndex = index;
         }
     }
 }
Ejemplo n.º 2
0
        public void OnGUI()
        {
            while (m_Current == null)
            {
                if (m_LastNodes.Count > 0)
                {
                    m_Current = m_LastNodes.Pop();
                }
                else
                {
                    m_Current = m_Quadtree.GetRootNode();
                    break;
                }
            }

            if (m_Current == null)
            {
                EditorGUILayout.HelpBox("not found any node", MessageType.Error);
                return;
            }

            hwmQuadtree <T> .Node displayNode = GetDisplayNode();
            EditorGUILayout.LabelField("Depth:", displayNode.GetDepth().ToString());
            EditorGUILayout.LabelField("Element Count:", displayNode.GetElements().Count.ToString());
            EditorGUILayout.LabelField("Element Count In Self&Childers :", displayNode.GetAllElementCount().ToString());

            EditorGUILayout.Space();
            if (m_Current.GetParent() == null &&
                m_ChilderIndex == NOTSET_CHILDER_INDEX)
            {
                GUILayout.Button("No Parent");
            }
            else if (GUILayout.Button("Parent"))
            {
                if (m_ChilderIndex != NOTSET_CHILDER_INDEX)
                {
                    m_ChilderIndex = NOTSET_CHILDER_INDEX;
                }
                else
                {
                    m_Current = m_LastNodes.Pop();
                }
            }
            EditorGUILayout.BeginHorizontal();
            OnGUI_ChildersButton(hwmQuadtreeChilderNodeIndex.LeftUp);
            OnGUI_ChildersButton(hwmQuadtreeChilderNodeIndex.RightUp);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            OnGUI_ChildersButton(hwmQuadtreeChilderNodeIndex.LeftDown);
            OnGUI_ChildersButton(hwmQuadtreeChilderNodeIndex.RightDown);
            EditorGUILayout.EndHorizontal();
            if (m_Current.IsLeaf() || m_ChilderIndex == NOTSET_CHILDER_INDEX)
            {
                GUILayout.Button("Cant Enter Childer");
            }
            else if (GUILayout.Button("Enter Childer: " + m_ChilderIndex.ToString()))
            {
                m_LastNodes.Push(m_Current);
                m_Current      = m_Current.GetChilder(m_ChilderIndex);
                m_ChilderIndex = NOTSET_CHILDER_INDEX;
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Gizmos");
            m_GizmosColor = EditorGUILayout.ColorField("Color", m_GizmosColor);
            m_GizmosZ     = EditorGUILayout.FloatField("Z", m_GizmosZ);
            m_GizomosDisplayChilderElement = EditorGUILayout.Toggle("Display Childer Element", m_GizomosDisplayChilderElement);

            if (GUI.changed)
            {
                GetWindow <SceneView>().Focus();
            }
        }