public static IMethodBindingArgument DrawArgumentEditor(Type type, IMethodBindingArgument argument, string label, out bool change)
    {
        change = false;

        bool result = MethodBindingArgument.TryGetBindingArgumentTypeFromObjectType(argument.GetType(), out Enum bindingType);

        if (result)
        {
            if (bindingType is ChangeableMethodBindingArgumentType changeable)
            {
                var newBindingType =
                    (ChangeableMethodBindingArgumentType)EditorGUILayout.EnumPopup(
                        changeable,
                        GUILayout.Width(70));

                if (newBindingType != changeable)
                {
                    argument = MethodBindingArgument.BuildArgumentOfType(argument.ArgName, type, newBindingType);
                    change   = true;
                }
            }
        }
        argument = GenericCustomEditors.DrawCustomEditor(argument, out _) as IMethodBindingArgument;

        return(argument);
    }
Ejemplo n.º 2
0
    public static AITreeDefinition DrawDefinitionEditor(AITreeDefinition value, string label)
    {
        GUILayout.Label(label);
        GUILayout.Label("AI Tree Definition");
        value.name = EditorGUILayout.TextField("Name", value.name);

        value.arguments = EditorGUICustomUtility.DrawArrayEditor(
            value.arguments,
            (x) =>
        {
            var newType  = GenericCustomEditors.AllEnumField <TypeEnumAttribute>(x.type, "");
            var newValue = EditorGUILayout.TextField("", x.value);
            if (newType != x.type || newValue != x.value)
            {
                return(new AITreeDefinitionArgument(newType, newValue));
            }
            else
            {
                return(x);
            }
        },
            "Add Argument",
            () => new AITreeDefinitionArgument(null, ""),
            false);

        return(value);
    }
    public static MemoryMethodBindingArgument DrawDynamicethodBindingArgumentEditor(MemoryMethodBindingArgument dynamicArgument, string label)
    {
        var output = GenericCustomEditors.AllEnumField <BindableEnumAttribute>(dynamicArgument.ArgumentKey, dynamicArgument.argName);

        if (output != dynamicArgument.ArgumentKey)
        {
            dynamicArgument.ArgumentKey = output;
        }
        return(dynamicArgument);
    }
Ejemplo n.º 4
0
    protected virtual void DrawInteriorGUI()
    {
        GUILayout.Space(5);

        if (data != null)
        {
            var output = GenericCustomEditors.DrawCustomEditor(data, out bool success);
            if (success)
            {
                data = output;
            }
        }

        GUILayout.Space(5);
    }
    public static StaticMethodBindingArgument DrawStaticMethodBindingArgumentEditor(StaticMethodBindingArgument staticArgument, string label)
    {
        Type   type = staticArgument.ArgumentType;
        bool   success;
        object newArgValue;

        if (type != null)
        {
            newArgValue = GenericCustomEditors.DrawCustomEditor(staticArgument.ArgValue, out success, type, staticArgument.ArgName);
        }
        else
        {
            newArgValue = GenericCustomEditors.DrawCustomEditor(staticArgument.ArgValue, out success, staticArgument.ArgName);
        }

        if (success)
        {
            staticArgument.ArgValue = newArgValue;
        }
        return(staticArgument);
    }