Exemplo n.º 1
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();
            });
        }
Exemplo n.º 2
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;
                    }
                });
            });
        }