示例#1
0
        public override void DoLayoutList()
        {
            base.DoLayoutList();
            var rect = ActionGUIUtil.GetDragRect();

            DrawDragField(rect);
        }
示例#2
0
 private void DrawElementGroup()
 {
     if (elementGroup_prop.objectReferenceValue == null)
     {
         if (GUILayout.Button("create new element group"))
         {
             var group = ScriptableObject.CreateInstance <ElementGroup>();
             ProjectWindowUtil.CreateAsset(group, "new element_group.asset");
             ActionGUIUtil.DelyAcceptObject(group, item =>
             {
                 elementGroup_prop = new SerializedObject(target).FindProperty("elementGroup");
                 elementGroup_prop.objectReferenceValue = item;
                 elementGroup_prop.serializedObject.ApplyModifiedProperties();
             });
         }
     }
     else
     {
         if (elementGroupDrawer == null)
         {
             Editor editor = null;
             Editor.CreateCachedEditor(elementGroup_prop.objectReferenceValue, typeof(ElementGroupDrawer), ref editor);
             elementGroupDrawer            = editor as ElementGroupDrawer;
             elementGroupDrawer.showScript = false;
         }
         elementGroupDrawer.OnInspectorGUI();
     }
 }
示例#3
0
        public override void DoLayoutList()
        {
            base.DoLayoutList();
            var rect = GUILayoutUtility.GetRect(ActionGUIUtil.currentViewWidth, EditorGUIUtility.singleLineHeight);

            if (Event.current.type == EventType.DragUpdated && rect.Contains(Event.current.mousePosition))
            {
                ActionGUIUtil.UpdateDragedObjects(".asset", dragedCommands);
            }
            else if (Event.current.type == EventType.DragPerform && rect.Contains(Event.current.mousePosition))
            {
                foreach (var item in dragedCommands)
                {
                    if (!HaveCommand(item))
                    {
                        property.InsertArrayElementAtIndex(property.arraySize);
                        var prop = property.GetArrayElementAtIndex(property.arraySize - 1);
                        prop.FindPropertyRelative("command").objectReferenceValue = item;
                    }
                    else
                    {
                        EditorUtility.DisplayDialog("警告", "步骤重复,无法添加:" + (item as ActionCommand).StepName, "ok");
                    }
                }
            }
        }
        private void DrawElement(Rect rect, int index, bool isActive, bool isFocused)
        {
            rect = ActionGUIUtil.DrawBoxRect(rect, index.ToString());
            var prop = itemListProp.GetArrayElementAtIndex(index);

            prop.stringValue = EditorGUI.TextField(rect, prop.stringValue);
        }
        protected override void DrawElementCallBack(Rect rect, int index, bool isActive, bool isFocused)
        {
            rect = ActionGUIUtil.DrawBoxRect(rect, index.ToString());
            var prop = property.GetArrayElementAtIndex(index);

            EditorGUI.PropertyField(rect, prop);
        }
        private void DrawNodeElement(Rect rect, int index, bool isActive, bool isFocused)
        {
            rect = ActionGUIUtil.DrawBoxRect(rect, "");
            var prop = nodes_prop.GetArrayElementAtIndex(index);

            EditorGUI.PropertyField(rect, prop, new GUIContent("第" + index + "个节点"));
        }
示例#7
0
        protected override void OnDrawProperty(SerializedProperty property)
        {
            if (property.propertyPath == "rule")
            {
                using (var hor = new EditorGUILayout.HorizontalScope())
                {
                    EditorGUILayout.PropertyField(rule_prop, new GUIContent("规   则"));
                    if (GUILayout.Button("new", EditorStyles.miniButtonRight, GUILayout.Width(40)))
                    {
                        var options = Array.ConvertAll(supportRules, x => new GUIContent(x.FullName));
                        var rect    = new Rect(Event.current.mousePosition, Vector2.zero);
                        EditorUtility.DisplayCustomMenu(rect, options, -1, (x, y, id) => {
                            var type     = supportRules[id];
                            var instence = ScriptableObject.CreateInstance(type);
                            ProjectWindowUtil.CreateAsset(instence, string.Format("new {0}.asset", type.Name));

                            ActionGUIUtil.DelyAcceptObject(instence, (prefab) =>
                            {
                                rule_prop = new SerializedObject(target).FindProperty("rule");
                                rule_prop.objectReferenceValue = prefab;
                                rule_prop.serializedObject.ApplyModifiedProperties();
                            });
                        }, null);
                    }
                }
            }
            else
            {
                base.OnDrawProperty(property);
            }
        }
        public override void DoLayoutList()
        {
            base.DoLayoutList();
            var rect = ActionGUIUtil.GetDragRect();

            if (Event.current.type == EventType.DragUpdated && rect.Contains(Event.current.mousePosition))
            {
                ActionGUIUtil.UpdateDragedObjects(".prefab", dragedGameObject);
            }
            else if (Event.current.type == EventType.DragPerform && rect.Contains(Event.current.mousePosition))
            {
                foreach (var item in dragedGameObject)
                {
                    if (!ActionEditorUtility.HaveElement(property, "prefab", item))
                    {
                        var prop = ActionEditorUtility.AddItem(property);
                        OnAddItem(prop, item);
                    }
                    else
                    {
                        EditorUtility.DisplayDialog("警告", "预制体重复,无法添加:" + item.name, "ok");
                    }
                }
            }
        }
示例#9
0
        private void DrawElementGroupHold()
        {
            var rect      = GUILayoutUtility.GetRect(ActionGUIUtil.currentViewWidth, EditorGUIUtility.singleLineHeight + ActionGUIUtil.padding * 2);
            var innerRect = ActionGUIUtil.DrawBoxRect(rect, "");
            var btnRect   = new Rect(innerRect.x, innerRect.y, innerRect.width - ActionGUIUtil.middleButtonWidth, innerRect.height);
            var style     = elementGroupDrawer != null && elementGroupDrawer.showAll ? EditorStyles.toolbarPopup : EditorStyles.toolbarDropDown;

            if (GUI.Button(btnRect, "元素列表", style))
            {
                if (elementGroupDrawer != null)
                {
                    elementGroupDrawer.showAll = !elementGroupDrawer.showAll;
                }
            }

            var contentRect = new Rect(innerRect.x + innerRect.width - ActionGUIUtil.middleButtonWidth, innerRect.y, ActionGUIUtil.middleButtonWidth, innerRect.height);

            if (elementGroup_prop.objectReferenceValue == null)
            {
                elementGroup_prop.objectReferenceValue = EditorGUI.ObjectField(contentRect, elementGroup_prop.objectReferenceValue, typeof(ElementGroup), false);
            }
            else
            {
                ActionGUIUtil.AcceptDrawField(contentRect, elementGroup_prop, typeof(ElementGroup));
            }
        }
        public override void DoLayoutList()
        {
            base.DoLayoutList();
            var rect = ActionGUIUtil.GetDragRect();

            if (Event.current.type == EventType.DragUpdated && rect.Contains(Event.current.mousePosition))
            {
                ActionGUIUtil.UpdateDragedObjects(".prefab", dragedGameObject);
            }
            else if (Event.current.type == EventType.DragPerform && rect.Contains(Event.current.mousePosition))
            {
                foreach (var item in dragedGameObject)
                {
                    if (!ActionEditorUtility.HaveElement(property, "prefab", item))
                    {
                        var prop       = property.AddItem();
                        var prefabProp = prop.FindPropertyRelative("prefab");
                        var _name_prop = prop.FindPropertyRelative("_name");
                        _name_prop.stringValue          = item.name;
                        prefabProp.objectReferenceValue = item;
                    }
                    else
                    {
                        EditorUtility.DisplayDialog("警告", "预制体重复,无法添加:" + item.name, "ok");
                    }
                }
            }
        }
示例#11
0
 public override void OnInspectorGUI()
 {
     ActionGUIUtil.DrawDisableProperty(script_prop);
     serializedObject.Update();
     EditorGUILayout.PropertyField(_stepName_prop, new GUIContent("步骤名"));
     DrawSwitchToolBar();
     serializedObject.ApplyModifiedProperties();
 }
示例#12
0
 public override void OnInspectorGUI()
 {
     ActionGUIUtil.DrawDisableProperty(script_prop);
     serializedObject.Update();
     DrawSwitchOptions();
     SwitchDrawLists();
     serializedObject.ApplyModifiedProperties();
 }
示例#13
0
 protected void DrawObjectDetail(UnityEngine.Object obj, Rect rect)
 {
     if (obj != null)
     {
         serializedObj = ActionGUIUtil.CreateCachedSerializedObject(obj);
         rect.y       += EditorGUIUtility.singleLineHeight + 5;
         serializedObj.Update();
         ActionGUIUtil.DrawChildInContent(serializedObj.GetIterator(), rect, ignoreProps, null, 1);
         serializedObj.ApplyModifiedProperties();
     }
 }
示例#14
0
        protected override void DrawElementCallBack(Rect rect, int index, bool isActive, bool isFocused)
        {
            rect = ActionGUIUtil.DrawBoxRect(rect, index.ToString());
            var item  = list[index] as Graph.OperaterNode;
            var rect0 = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight);

            EditorGUI.ObjectField(rect0, item.Name, item, typeof(Graph.OperaterNode), false);
            if (isFocused && item)
            {
                EditorGUIUtility.PingObject(item);
            }
        }
        protected override void DrawElementCallBack(Rect rect, int index, bool isActive, bool isFocused)
        {
            rect = ActionGUIUtil.DrawBoxRect(rect, index.ToString());
            var prop = property.GetArrayElementAtIndex(index);

            EditorGUI.PropertyField(rect, prop, null, true);
            if (isFocused)
            {
                prop.isExpanded = true;
                reorderList.ReleaseKeyboardFocus();
            }
        }
示例#16
0
        protected override float ElementHeightCallback(int index)
        {
            var prop   = property.GetArrayElementAtIndex(index);
            var height = EditorGUIUtility.singleLineHeight + ActionGUIUtil.padding * 2;

            if (prop.objectReferenceValue != null && prop.isExpanded)
            {
                var se = ActionGUIUtil.CreateCachedSerializedObject(prop.objectReferenceValue);
                height += ActionGUIUtil.GetSerializedObjectHeight(se, ignoreProps) + ActionGUIUtil.padding * 2;
            }
            return(height);
        }
示例#17
0
        protected override void DrawElementCallBack(Rect rect, int index, bool isActive, bool isFocused)
        {
            rect = ActionGUIUtil.DrawBoxRect(rect, "");
            var prop  = property.GetArrayElementAtIndex(index);
            var label = string.IsNullOrEmpty(titleFormat) ? "第" + index + "个节点" : string.Format(titleFormat, index);

            EditorGUI.PropertyField(rect, prop, new GUIContent(label));

            if (isFocused && Event.current.type == EventType.MouseUp)
            {
                EditorGUIUtility.PingObject(prop.objectReferenceValue);
            }
        }
        private void DrawGroupItem(Rect rect, int index, bool isActive, bool isFocused)
        {
            rect = ActionGUIUtil.DrawBoxRect(rect, "");
            var prop   = connectGroup_prop.GetArrayElementAtIndex(index);
            var prop_1 = prop.FindPropertyRelative("p1");
            var prop_2 = prop.FindPropertyRelative("p2");
            var rect0  = new Rect(rect.x, rect.y, rect.width * 0.3f, EditorGUIUtility.singleLineHeight);

            EditorGUI.LabelField(rect0, new GUIContent("第" + index + "组"));

            var rect1 = new Rect(rect.x + rect.width * 0.3f, rect.y, rect.width * 0.35f, EditorGUIUtility.singleLineHeight);

            prop_1.intValue = EditorGUI.IntField(rect1, prop_1.intValue);
            rect1.x        += rect.width * 0.35f;
            prop_2.intValue = EditorGUI.IntField(rect1, prop_2.intValue);
        }
 protected override void DrawDragField(Rect rect)
 {
     if (Event.current.type == EventType.DragUpdated && rect.Contains(Event.current.mousePosition))
     {
         ActionGUIUtil.UpdateDragedObjects(".asset", dragBindings);
     }
     else if (Event.current.type == EventType.DragPerform && rect.Contains(Event.current.mousePosition))
     {
         foreach (var item in dragBindings)
         {
             property.InsertArrayElementAtIndex(property.arraySize);
             var prop = property.GetArrayElementAtIndex(property.arraySize - 1);
             prop.objectReferenceValue = item;
         }
     }
 }
        protected override void DrawDragField(Rect objRect, SerializedProperty prop)
        {
            if (Event.current.type == EventType.DragUpdated && objRect.Contains(Event.current.mousePosition))
            {
                ActionGUIUtil.UpdateDragedObjects <ActionHook>(".asset", dragHooks);
            }

            else if (Event.current.type == EventType.DragPerform && objRect.Contains(Event.current.mousePosition))
            {
                foreach (var item in dragHooks)
                {
                    prop.objectReferenceValue = item;
                    break;
                }
            }
        }
示例#21
0
        protected override void DrawDragField(Rect objRect)
        {
            if (Event.current.type == EventType.DragUpdated && objRect.Contains(Event.current.mousePosition))
            {
                ActionGUIUtil.UpdateDragedObjects(".asset", dragBindings);
            }

            else if (Event.current.type == EventType.DragPerform && objRect.Contains(Event.current.mousePosition))
            {
                foreach (var item in dragBindings)
                {
                    var prop = property.AddItem();
                    prop.objectReferenceValue = item;
                    break;
                }
            }
        }
示例#22
0
        private void DrawSwitchOptions()
        {
            var rect = GUILayoutUtility.GetRect(ActionGUIUtil.currentViewWidth, EditorGUIUtility.singleLineHeight + ActionGUIUtil.padding * 2f);

            rect = ActionGUIUtil.DrawBoxRect(rect, "");
            var searchRect = new Rect(rect.x, rect.y, rect.width * 0.55f, rect.height);

            ActionGUIUtil.searchWord = EditorGUI.TextField(searchRect, ActionGUIUtil.searchWord);

            var toolBarRect = new Rect(rect.x + rect.width * 0.6f, rect.y, rect.width * 0.4f, rect.height);

            EditorGUI.BeginChangeCheck();
            selected = GUI.Toolbar(toolBarRect, selected, Selectables);
            if (EditorGUI.EndChangeCheck())
            {
                EditorPrefs.SetInt(prefer_selected, selected);
            }
        }
示例#23
0
        private void OnAddElement(ReorderableList list)
        {
            var element = ScriptableObject.CreateInstance <ActionCommand>();

            element.ControllerType = typeof(InteractSystem.Graph.AcionGraphCtrl).FullName;
            ProjectWindowUtil.CreateAsset(element, "new command.asset");
            var path = property.propertyPath;
            var obj  = property.serializedObject.targetObject;

            ActionGUIUtil.DelyAcceptObject(element, (item) =>
            {
                property             = new SerializedObject(obj).FindProperty(path);
                var prop             = property.AddItem();
                var commandName_prop = prop.FindPropertyRelative("commandName");
                var command_prop     = prop.FindPropertyRelative("command");
                command_prop.objectReferenceValue = item;
                commandName_prop.stringValue      = item.name;
                property.serializedObject.ApplyModifiedProperties();
            });
        }
        private void DrawConnectGroupItem(Rect rect, int index, bool isActive, bool isFocused)
        {
            var prop          = connectGroup_prop.GetArrayElementAtIndex(index);
            var p1_prop       = prop.FindPropertyRelative("p1");
            var p2_prop       = prop.FindPropertyRelative("p2");
            var material_prop = prop.FindPropertyRelative("material");
            var width_prop    = prop.FindPropertyRelative("width");

            rect = ActionGUIUtil.DrawBoxRect(rect, index.ToString());
            var leftRect = new Rect(rect.x, rect.y, rect.width * 0.4f, rect.height);
            var lineRect = new Rect(rect.x + rect.width * 0.2f, rect.y + ActionGUIUtil.padding, rect.width * 3f, rect.height);

            leftRect = ActionGUIUtil.PaddingRect(leftRect, 2);
            EditorGUI.LabelField(lineRect, "------------------------");

            var titleRect   = new Rect(leftRect.x, leftRect.y, leftRect.width * 0.3f, EditorGUIUtility.singleLineHeight);
            var contentRect = new Rect(leftRect.x + leftRect.width * 0.4f, leftRect.y, leftRect.width * 0.6f, EditorGUIUtility.singleLineHeight);

            EditorGUI.LabelField(titleRect, "A");
            p1_prop.stringValue = EditorGUI.TextField(contentRect, p1_prop.stringValue);

            titleRect.y   += EditorGUIUtility.singleLineHeight; // new Rect(rightRect.x, rightRect.y, rightRect.width * 0.3f,  EditorGUIUtility.singleLineHeight);
            contentRect.y += EditorGUIUtility.singleLineHeight; //= new Rect(rightRect.x + rightRect.width * 0.4f, rightRect.y, rightRect.width * 0.6f,  EditorGUIUtility.singleLineHeight);
            EditorGUI.LabelField(titleRect, "B");
            p2_prop.stringValue = EditorGUI.TextField(contentRect, p2_prop.stringValue);


            var rightRect = new Rect(rect.x + rect.width * 0.5f, rect.y, rect.width * 0.5f, EditorGUIUtility.singleLineHeight);

            titleRect   = new Rect(rightRect.x, rightRect.y, rightRect.width * 0.3f, rightRect.height);
            contentRect = new Rect(rightRect.x + rightRect.width * 0.4f, rightRect.y, rightRect.width * 0.6f, EditorGUIUtility.singleLineHeight);

            EditorGUI.LabelField(titleRect, "material");
            material_prop.objectReferenceValue = EditorGUI.ObjectField(contentRect, material_prop.objectReferenceValue, typeof(Material), false);

            titleRect.y   += EditorGUIUtility.singleLineHeight;
            contentRect.y += EditorGUIUtility.singleLineHeight;
            EditorGUI.LabelField(titleRect, "width");
            width_prop.floatValue = EditorGUI.FloatField(contentRect, width_prop.floatValue);
        }
示例#25
0
        protected override void DrawElementCallBack(Rect rect, int index, bool isActive, bool isFocused)
        {
            rect = ActionGUIUtil.DrawBoxRect(rect, index.ToString());
            var prop    = property.GetArrayElementAtIndex(index);
            var content = prop.objectReferenceValue == null ? new GUIContent("Null") : new GUIContent(prop.objectReferenceValue.name);

            var btnRect = new Rect(rect.x, rect.y, rect.width - ActionGUIUtil.middleButtonWidth, EditorGUIUtility.singleLineHeight);
            var objRect = new Rect(rect.x + rect.width - ActionGUIUtil.middleButtonWidth, rect.y, ActionGUIUtil.middleButtonWidth, EditorGUIUtility.singleLineHeight);

            if (GUI.Button(btnRect, content, EditorStyles.toolbarDropDown))
            {
                prop.isExpanded = !prop.isExpanded;
            }

            if (prop.objectReferenceValue != null)
            {
                if (GUI.Button(objRect, "", EditorStyles.objectFieldMiniThumb))
                {
                    EditorGUIUtility.PingObject(prop.objectReferenceValue);
                }
                DrawDragField(objRect, prop);
            }
            else
            {
                DrawObjectField(objRect, prop);
            }

            if (isFocused)
            {
                prop.isExpanded = true;
                reorderList.ReleaseKeyboardFocus();
            }

            if (prop.isExpanded && prop.objectReferenceValue != null)
            {
                DrawObjectDetail(prop.objectReferenceValue, rect);
            }
        }
        private void DrawLinkGroupItem(Rect rect, int index, bool isActive, bool isFocused)
        {
            var prop       = defultLink_prop.GetArrayElementAtIndex(index);
            var itemA_prop = prop.FindPropertyRelative("ItemA");
            var portA_prop = prop.FindPropertyRelative("portA");
            var itemB_prop = prop.FindPropertyRelative("ItemB");
            var portB_prop = prop.FindPropertyRelative("portB");

            rect = ActionGUIUtil.DrawBoxRect(rect, index.ToString());
            var leftRect  = new Rect(rect.x, rect.y, rect.width * 0.5f, rect.height);
            var rightRect = new Rect(rect.x + rect.width * 0.5f, rect.y, rect.width * 0.5f, rect.height);
            var lineRect  = new Rect(rect.x + rect.width * 0.45f, rect.y + ActionGUIUtil.padding, rect.width * 0.1f, rect.height);

            rightRect = ActionGUIUtil.DrawBoxRect(rightRect, "");
            leftRect  = ActionGUIUtil.DrawBoxRect(leftRect, "");
            EditorGUI.LabelField(lineRect, "------------------------");

            var titleRect   = new Rect(leftRect.x, leftRect.y, leftRect.width * 0.2f, leftRect.height);
            var contentRect = new Rect(leftRect.x + leftRect.width * 0.2f, leftRect.y, leftRect.width * 0.3f, leftRect.height);

            EditorGUI.LabelField(titleRect, "ID");
            itemA_prop.intValue = EditorGUI.IntField(contentRect, itemA_prop.intValue);
            titleRect.x        += leftRect.width * 0.5f;
            contentRect.x      += leftRect.width * 0.5f;

            EditorGUI.LabelField(titleRect, "Port");
            portA_prop.intValue = EditorGUI.IntField(contentRect, portA_prop.intValue);

            titleRect   = new Rect(rightRect.x, rightRect.y, rightRect.width * 0.2f, rightRect.height);
            contentRect = new Rect(rightRect.x + rightRect.width * 0.2f, rightRect.y, rightRect.width * 0.3f, rightRect.height);
            EditorGUI.LabelField(titleRect, "ID");
            itemB_prop.intValue = EditorGUI.IntField(contentRect, itemB_prop.intValue);

            titleRect.x   += rightRect.width * 0.5f;
            contentRect.x += rightRect.width * 0.5f;
            EditorGUI.LabelField(titleRect, "Port");
            portB_prop.intValue = EditorGUI.IntField(contentRect, portB_prop.intValue);
        }
示例#27
0
        private void OnAddElement(ReorderableList list)
        {
            var propertyPath = property.propertyPath;
            var obj          = property.serializedObject.targetObject;

            ActionGUIUtil.DrawScriptablesMenu(supportTypes, (hook) =>
            {
                ActionGUIUtil.DelyAcceptObject(hook, (item) =>
                {
                    try
                    {
                        property = new SerializedObject(obj).FindProperty(propertyPath);
                        var prop = property.AddItem();
                        prop.objectReferenceValue = item;
                        property.serializedObject.ApplyModifiedProperties();
                    }
                    catch (Exception e)
                    {
                        throw e;
                    }
                });
            });
        }
        public override void DoLayoutList()
        {
            base.DoLayoutList();
            var rect = ActionGUIUtil.GetDragRect();

            if (Event.current.type == EventType.DragUpdated && rect.Contains(Event.current.mousePosition))
            {
                ActionGUIUtil.UpdateDragedObjects(".prefab", dragedObjects);
            }
            else if (Event.current.type == EventType.DragPerform && rect.Contains(Event.current.mousePosition))
            {
                foreach (var item in dragedObjects)
                {
                    var path = AssetDatabase.GetAssetPath(item);
                    if (string.IsNullOrEmpty(path))
                    {
                        return;
                    }
                    var guid = AssetDatabase.AssetPathToGUID(path);
                    if (!ActionEditorUtility.HaveElement(property, "guid", guid))
                    {
                        var prop               = property.AddItem();
                        var guidProp           = prop.FindPropertyRelative("guid");
                        var enviromentNameProp = prop.FindPropertyRelative("enviromentName");
                        var coordinateProp     = prop.FindPropertyRelative("coordinate");

                        guidProp.stringValue           = guid;
                        enviromentNameProp.stringValue = item.name;
                        ActionEditorUtility.SaveCoordinatesInfo(coordinateProp, (item as GameObject).transform);
                    }
                    else
                    {
                        EditorUtility.DisplayDialog("警告", "预制体重复,无法添加:" + item.name, "ok");
                    }
                }
            }
        }
        protected override void DrawElementCallBack(Rect rect, int index, bool isActive, bool isFocused)
        {
            rect = ActionGUIUtil.DrawBoxRect(rect, index.ToString());
            var prop = property.GetArrayElementAtIndex(index);

            EditorGUI.PropertyField(rect, prop, true);

            var objRect = new Rect(rect.x + rect.width - ActionGUIUtil.bigButtonWidth, rect.y, ActionGUIUtil.bigButtonWidth, rect.height);

            if (Event.current.type == EventType.DragUpdated && objRect.Contains(Event.current.mousePosition))
            {
                ActionGUIUtil.UpdateDragedObjects(".prefab", dragedGameObject);
            }
            else if (Event.current.type == EventType.DragPerform && objRect.Contains(Event.current.mousePosition))
            {
                foreach (var item in dragedGameObject)
                {
                    if (!AddOneElement(item))
                    {
                        EditorUtility.DisplayDialog("警告", "预制体重复,无法添加:" + item.name, "ok");
                    }
                }
            }
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            elementNameProp    = property.FindPropertyRelative("enviromentName");
            guidProp           = property.FindPropertyRelative("guid");
            instenceIDProp     = property.FindPropertyRelative("instenceID");
            enviromentNameProp = property.FindPropertyRelative("enviromentName");
            coordinateProp     = property.FindPropertyRelative("coordinate");


            var btnRect = new Rect(position.x, position.y, position.width - ActionGUIUtil.middleButtonWidth, EditorGUIUtility.singleLineHeight);

            if (instenceIDProp.intValue != 0 && EditorUtility.InstanceIDToObject(instenceIDProp.intValue) == null)
            {
                instenceIDProp.intValue = 0;
                property.isExpanded     = false;
            }
            if (!string.IsNullOrEmpty(guidProp.stringValue) && string.IsNullOrEmpty(AssetDatabase.GUIDToAssetPath(guidProp.stringValue)))
            {
                guidProp.stringValue = null;
            }

            if (GUI.Button(btnRect, elementNameProp.stringValue, EditorStyles.toolbarDropDown))
            {
                property.isExpanded = !property.isExpanded;
                if (property.isExpanded)
                {
                    ActionEditorUtility.LoadPrefab(guidProp.stringValue, instenceIDProp, coordinateProp);
                }
                else
                {
                    ActionEditorUtility.SavePrefab(instenceIDProp, coordinateProp);
                }
            }

            var objRect = new Rect(position.x + position.width - ActionGUIUtil.middleButtonWidth, position.y, ActionGUIUtil.middleButtonWidth, EditorGUIUtility.singleLineHeight);

            if (!string.IsNullOrEmpty(guidProp.stringValue))
            {
                if (GUI.Button(objRect, "", EditorStyles.objectFieldMiniThumb))
                {
                    GameObject prefab = AssetDatabase.LoadAssetAtPath <GameObject>(AssetDatabase.GUIDToAssetPath(guidProp.stringValue));
                    EditorGUIUtility.PingObject(prefab);
                }

                if (Event.current.type == EventType.DragUpdated && objRect.Contains(Event.current.mousePosition))
                {
                    ActionGUIUtil.UpdateDragedObjects <GameObject>(".prefab", dragedGameObjs);
                }

                else if (Event.current.type == EventType.DragPerform && objRect.Contains(Event.current.mousePosition))
                {
                    foreach (var item in dragedGameObjs)
                    {
                        RecordPrefab(item);
                        break;
                    }
                }
            }
            else
            {
                var obj = EditorGUI.ObjectField(objRect, null, typeof(GameObject), false);
                if (obj != null)
                {
                    RecordPrefab(obj);
                }
            }

            if (instenceIDProp.intValue != 0)
            {
                DrawInfo(position);
            }

            if (property.isExpanded)
            {
                position.y += EditorGUIUtility.singleLineHeight + 2f;
                EditorGUI.BeginChangeCheck();
                ActionGUIUtil.DrawChildInContent(property, position, null, "ignore", -1);
                if (EditorGUI.EndChangeCheck())
                {
                    if (instenceTranform)
                    {
                        ActionEditorUtility.LoadCoordinatePropInfo(coordinateProp, instenceTranform);
                    }
                }
                else
                {
                    if (instenceTranform)
                    {
                        ActionEditorUtility.SaveCoordinatesInfo(coordinateProp, instenceTranform);
                    }
                }
            }
        }