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
    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);
    }