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");
                    }
                }
            }
        }
Beispiel #2
0
        public override void DoLayoutList()
        {
            base.DoLayoutList();
            var rect = ActionGUIUtil.GetDragRect();

            DrawDragField(rect);
        }
        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");
                    }
                }
            }
        }
        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");
                    }
                }
            }
        }