少年修仙传客户端代码仓库
client_Zxw
2019-01-21 26436be7f1ae7d7edae0d5b4bddf85cdf0367dfb
Core/MapEditor/Editor/MapEditor.cs
@@ -100,7 +100,7 @@
            EditorGUILayout.BeginVertical(gUISkin.box);
            EditorGUILayout.BeginHorizontal(GUILayout.Height(22));
            EditorGUI.indentLevel += 1;
            _mapData.showTriggerList = EditorGUILayout.Foldout(_mapData.showTriggerList, "  触发器列表", true, gUISkin.toggle);
            _mapData.showTriggerList = EditorGUILayout.Foldout(_mapData.showTriggerList, "  触发器列表", true, gUISkin.customStyles[3]);
            EditorGUI.indentLevel -= 1;
            if (GUILayout.Button("添加", gUISkin.button, GUILayout.Width(60), GUILayout.Height(22)))
            {
@@ -134,7 +134,7 @@
            EditorGUILayout.BeginVertical(gUISkin.box);
            EditorGUILayout.BeginHorizontal(GUILayout.Height(22));
            EditorGUI.indentLevel += 1;
            _mapData.showEventList = EditorGUILayout.Foldout(_mapData.showEventList, "  事件列表", true, gUISkin.toggle);
            _mapData.showEventList = EditorGUILayout.Foldout(_mapData.showEventList, "  事件列表", true, gUISkin.customStyles[3]);
            EditorGUI.indentLevel -= 1;
            eventType = (Evt.E_EventType)EditorGUILayout.EnumPopup(eventType, gUISkin.box, GUILayout.Height(22), GUILayout.Width(100));
            if (GUILayout.Button("添加", gUISkin.button, GUILayout.Width(60), GUILayout.Height(22)))
@@ -169,7 +169,7 @@
            EditorGUILayout.BeginVertical(gUISkin.box);
            EditorGUILayout.BeginHorizontal(GUILayout.Height(22));
            EditorGUI.indentLevel += 1;
            _mapData.showTransferList = EditorGUILayout.Foldout(_mapData.showTransferList, "  传送组列表", true, gUISkin.toggle);
            _mapData.showTransferList = EditorGUILayout.Foldout(_mapData.showTransferList, "  传送组列表", true, gUISkin.customStyles[3]);
            EditorGUI.indentLevel -= 1;
            if (GUILayout.Button("添加", gUISkin.button, GUILayout.Width(60), GUILayout.Height(22)))
            {
@@ -198,6 +198,12 @@
            /// 传送点列表 End
            /// --------------------------------------------------------------------------------
            /// --------------------------------------------------------------------------------
            /// 场景物件列表 Start
            /// 场景物件列表 End
            /// --------------------------------------------------------------------------------
            EditorGUILayout.EndVertical();
            if (GUI.changed)
@@ -223,11 +229,23 @@
            if (type == Evt.E_EventType.Enemy)
            {
                var _event = CreateNewGO(Bhv_MapData.NodeName_Event + RequestEventID());
                var _event = CreateNewGO(Bhv_MapData.NodeName_Event + "RefreshEvemy_" + RequestEventID());
                var _eventBhv = _event.AddComponent<Bhv_Evt_RefreshMonster>();
                _eventBhv.type = type;
                _event.transform.SetParent(_mapData.transform.Find(Bhv_MapData.NodeName_EventList));
                _mapData.eventList.Add(_eventBhv);
                _event.transform.position = SceneCameraRaycastPosition();
            }
            else if (type == Evt.E_EventType.SceneObject)
            {
                var _event = CreateNewGO(Bhv_MapData.NodeName_Event + "RefreshSceneObject_" +  RequestEventID());
                var _eventBhv = _event.AddComponent<Bhv_Evt_RefreshSceneObject>();
                _eventBhv.type = type;
                _event.transform.SetParent(_mapData.transform.Find(Bhv_MapData.NodeName_EventList));
                _mapData.eventList.Add(_eventBhv);
                _event.transform.position = SceneCameraRaycastPosition();
            }
        }
@@ -296,5 +314,17 @@
                }
            }
        }
        public static Vector3 SceneCameraRaycastPosition()
        {
            RaycastHit _hit;
            Ray _ray = SceneView.lastActiveSceneView.camera.ViewportPointToRay(new Vector3(.5f, .5f, 0));
            if (Physics.Raycast(_ray, out _hit, 1000f, LayerUtility.WalkbleMask))
            {
                return _hit.point;
            }
            return Vector3.zero;
        }
    }
}