示例#1
0
    void EditSelection()
    {
        EditGroupViewMode();
        bool needSave = false;

        SelectWalkType();

        pathfindManager.drawWalkType = (WalkType)m_curentTab;

        if (m_selectecPoints == null || m_selectecPoints.Count == 0)
        {
            return;
        }
        PathfindNode root = m_selectecPoints[0];

        PathfindNodeGroupParameter curentParameter = root.GetParameter(m_curentTab);

        EditNodeParameters(ref needSave, curentParameter);
    }
示例#2
0
    void EditNodeParameters(ref bool needSave, PathfindNodeGroupParameter curentParameter)
    {
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("_______________NODES______________:");
        if (m_selectecPoints.Count > 0)
        {
            GUILayout.Label("Pos: " + m_selectecPoints[0].Point.X + " : " + m_selectecPoints[0].Point.Y, GUILayout.Width(Screen.width / 3 - 5));
        }
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Group:", GUILayout.Width(Screen.width / 3 - 5));
        int newGroup = EditorGUILayout.IntField(curentParameter.Group, GUILayout.Width(Screen.width / 3 - 5));

        needSave |= curentParameter.Group != newGroup;
        if (needSave)
        {
            foreach (PathfindNode node in m_selectecPoints)
            {
                node.GetParameter(m_curentTab).Group = newGroup;
            }
        }
        curentParameter.Group = newGroup;
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("walkable:", GUILayout.Width(Screen.width / 3 - 5));
        bool walkable = EditorGUILayout.Toggle(curentParameter.Enable, GUILayout.Width(2 * Screen.width / 3 - 5));

        if (walkable != curentParameter.Enable)
        {
            foreach (PathfindNode node in m_selectecPoints)
            {
                needSave |= curentParameter.Enable != walkable;
                node.GetParameter(m_curentTab).Enable = walkable;
            }
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Bridges:", GUILayout.Width(Screen.width / 3 - 5));
        EditorGUILayout.BeginVertical();
        if (curentParameter.GroupBridge != null)
        {
            for (int i = 0; i < curentParameter.GroupBridge.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                int newGroupID = EditorGUILayout.IntField(curentParameter.GroupBridge[i], GUILayout.Width(Screen.width / 6 - 5));
                if (newGroupID != curentParameter.GroupBridge[i])
                {
                    foreach (PathfindNode node in m_selectecPoints)
                    {
                        if (node.GetParameter(m_curentTab).GroupBridge.Count <= i)
                        {
                            node.GetParameter(m_curentTab).GroupBridge.Add(newGroupID);
                        }
                        node.GetParameter(m_curentTab).GroupBridge[i] = newGroupID;
                    }
                    needSave = true;
                }
                if (GUILayout.Button("-", GUILayout.Width(Screen.width / 6 - 5)))
                {
                    foreach (PathfindNode node in m_selectecPoints)
                    {
                        node.GetParameter(m_curentTab).GroupBridge.RemoveAt(i);
                    }
                    needSave = true;
                }
                EditorGUILayout.EndHorizontal();
            }
        }
        EditorGUILayout.EndVertical();
        if (GUILayout.Button("+", GUILayout.Width(Screen.width / 3 - 5)))
        {
            foreach (PathfindNode node in m_selectecPoints)
            {
                node.GetParameter(m_curentTab).GroupBridge.Add(0);
            }
            needSave = true;
        }
        EditorGUILayout.EndHorizontal();
    }