Exemplo n.º 1
0
        private static bool GetCommandSupported(CommandData command, out string unsupportedReason)
        {
            for (int i = 0; i < command.ParamCount; i++)
            {
                ParameterInfo param     = command.MethodParamData[i];
                Type          paramType = param.ParameterType;

                if (!_parser.CanParse(paramType) && !paramType.IsGenericParameter)
                {
                    unsupportedReason = $"Parameter type {paramType} is not supported by the Quantum Parser.";
                    return(false);
                }
            }

            if (command.MonoTarget != MonoTargetType.Registry &&
                !command.MethodData.IsStatic &&
                !command.MethodData.DeclaringType.IsDerivedTypeOf(typeof(MonoBehaviour)))
            {
                unsupportedReason = $"Non static non MonoBehaviour commands are incompatible with MonoTargetType.{command.MonoTarget}.";
                return(false);
            }

            unsupportedReason = string.Empty;
            return(true);
        }
Exemplo n.º 2
0
        private static bool GetCommandSupported(CommandData command, out string unsupportedReason)
        {
            for (int i = 0; i < command.ParamCount; i++)
            {
                ParameterInfo param     = command.MethodParamData[i];
                Type          paramType = param.ParameterType;

                if (!_parser.CanParse(paramType) && !paramType.IsGenericParameter)
                {
                    unsupportedReason = $"Parameter type {paramType} is not supported by the Quantum Parser.";
                    return(false);
                }
            }

            unsupportedReason = string.Empty;
            return(true);
        }