From da8327bb478ff84e3eb150ef5f1c88d5b48b2d89 Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期五, 18 一月 2019 21:48:21 +0800
Subject: [PATCH] 382 地图布场景物件编辑器逻辑

---
 Core/MapEditor/Editor/MapEditor.cs |   38 ++++++++++++++++++++++++++++++++++----
 1 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/Core/MapEditor/Editor/MapEditor.cs b/Core/MapEditor/Editor/MapEditor.cs
index c56e25c..346e3ef 100644
--- a/Core/MapEditor/Editor/MapEditor.cs
+++ b/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;
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0