예제 #1
0
    private void EditSafeArea()
    {
        Event e = Event.current;

        if (e.button == 0 && e.type == EventType.MouseDown)
        {
            Ray        ray = HandleUtility.GUIPointToWorldRay(e.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit, Mathf.Infinity, m_layer))
            {
                EditSelectSquare square = m_infoTileTool.TryGetSubArea(m_selectAreaIndex);
                square.AddPoint(CreatePoint(hit.point, square.parent.transform));
            }
        }
    }
예제 #2
0
    void OnSceneGUI()
    {
        Event e = Event.current;

        if (m_startEditorWork)
        {
            /*
             * if (e.button == 1 && e.type == EventType.MouseDown)
             * {
             *  Ray ray = HandleUtility.GUIPointToWorldRay(e.mousePosition);
             *  RaycastHit hit;
             *  if (Physics.Raycast(ray, out hit, Mathf.Infinity, m_layer))
             *  {
             *      m_infoTileTool.SetSquareType(hit.transform.gameObject, m_selectArea);
             *  }
             * }*/
            /*
             * if (e.button == 0 && e.type == EventType.MouseDown)
             * {
             *  Ray ray = HandleUtility.GUIPointToWorldRay(e.mousePosition);
             *  RaycastHit hit;
             *  if (Physics.Raycast(ray, out hit, Mathf.Infinity, m_layer))
             *  {
             *      m_infoTileTool.SetSelectStartPoint(hit.point);
             *  }
             * }
             * else if (e.button == 0 && e.type == EventType.MouseUp)
             * {
             *  Ray ray = HandleUtility.GUIPointToWorldRay(e.mousePosition);
             *  RaycastHit hit;
             *  if (Physics.Raycast(ray, out hit, Mathf.Infinity, m_layer))
             *  {
             *      m_infoTileTool.BoxSelection(hit.point, m_selectArea);
             *  }
             * }*/
            /*
             * if (m_selectAreaIndex == BarrierArea)
             * {
             *
             * }
             * if (m_selectAreaIndex == BornArea)
             * {
             *
             * }
             * if (m_selectAreaIndex == CollectArea)
             * {
             *
             * }
             *
             * if (m_selectAreaIndex == JumpArea)
             * {
             *
             * }
             *
             * if (m_selectAreaIndex == MonsterArea)
             * {
             *
             * }
             *
             * if (m_selectAreaIndex == NormalArea)
             * {
             *
             * }
             *
             * if (m_selectAreaIndex == PortolArea)
             * {
             *
             * }
             *
             * if (m_selectAreaIndex == RebornArea)
             * {
             *
             * }
             *
             * if (m_selectAreaIndex == SafeArea)
             * {
             *
             * }*/
            if (e.button == 0 && e.type == EventType.MouseDown)
            {
                Ray        ray = HandleUtility.GUIPointToWorldRay(e.mousePosition);
                RaycastHit hit;
                if (Physics.Raycast(ray, out hit, Mathf.Infinity, m_layer))
                {
                    EditSelectSquare square = m_infoTileTool.TryGetSubArea(m_selectAreaIndex);
                    if (square != null)
                    {
                        square.AddPoint(CreatePoint(hit.point, square.parent.transform));
                    }
                }
            }
        }
    }
예제 #3
0
    private void ShowSquarePoint(int areaIndex, string areaName)
    {
        EditorGUILayout.BeginVertical();
        {
            GUILayout.Label(areaName + "点");

            m_AreaPointViewPos = EditorGUILayout.BeginScrollView(m_AreaPointViewPos, GUILayout.Height(60));
            {
                List <string>    lst          = new List <string>();
                EditSelectSquare selectSquare = m_infoTileTool.TryGetSubArea(areaIndex);

                if (selectSquare != null)
                {
                    if (selectSquare.StartPoint != null)
                    {
                        lst.Add(GetPointName(areaName, selectSquare.StartPoint));
                    }
                    if (selectSquare.EndPoint != null)
                    {
                        lst.Add(GetPointName(areaName, selectSquare.EndPoint));
                    }


                    switch (areaIndex)
                    {
                    case BarrierArea:
                        m_infoTileTool.m_selBarrierPoint = GUILayout.SelectionGrid(m_infoTileTool.m_selBarrierPoint, lst.ToArray(), 1);
                        break;

                    case SafeArea:
                        m_infoTileTool.m_selSafePoint = GUILayout.SelectionGrid(m_infoTileTool.m_selSafePoint, lst.ToArray(), 1);
                        break;

                    case PortolArea:
                        m_infoTileTool.m_selPortolPoint = GUILayout.SelectionGrid(m_infoTileTool.m_selPortolPoint, lst.ToArray(), 1);
                        break;

                    case MonsterArea:
                        m_infoTileTool.m_selMonsterPoint = GUILayout.SelectionGrid(m_infoTileTool.m_selMonsterPoint, lst.ToArray(), 1);
                        break;

                    case BornArea:
                        m_infoTileTool.m_selBornPoint = GUILayout.SelectionGrid(m_infoTileTool.m_selBornPoint, lst.ToArray(), 1);
                        break;

                    case RebornArea:
                        m_infoTileTool.m_selRebornPoint = GUILayout.SelectionGrid(m_infoTileTool.m_selRebornPoint, lst.ToArray(), 1);
                        break;

                    case CollectArea:
                        m_infoTileTool.m_selCollectPoint = GUILayout.SelectionGrid(m_infoTileTool.m_selCollectPoint, lst.ToArray(), 1);
                        break;

                    case JumpArea:
                        m_infoTileTool.m_selJumpPoint = GUILayout.SelectionGrid(m_infoTileTool.m_selJumpPoint, lst.ToArray(), 1);
                        break;
                    }
                }
            }
            EditorGUILayout.EndScrollView();

            EditorGUILayout.BeginHorizontal();
            {
                if (GUILayout.Button("删除" + areaName + "点"))
                {
                    m_infoTileTool.DeleteSubAreaPoint(areaIndex);
                }
            }
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.EndVertical();
    }