예제 #1
0
        protected void RegisterMethods(Type InType)
        {
            CheatCommandEntryAttribute EntryAttr = ((CheatCommandEntryAttribute)InType.GetCustomAttributes(typeof(CheatCommandEntryAttribute), false)[0]);

            DebugHelper.Assert(EntryAttr != null);

            MethodInfo[] Methods = InType.GetMethods();

            if (Methods != null)
            {
                var Iter = Methods.GetEnumerator();

                while (Iter.MoveNext())
                {
                    MethodInfo Method = (MethodInfo)Iter.Current;

                    if (Method.IsStatic)
                    {
                        var Attributes = Method.GetCustomAttributes(typeof(CheatCommandEntryMethodAttribute), false);

                        if (Attributes != null && Attributes.Length > 0 && ValidateMethodArguments(Method))
                        {
                            CheatCommandEntryMethodAttribute MethodAttr = (CheatCommandEntryMethodAttribute)Attributes[0];

                            RegisterMethod(
                                InType,
                                EntryAttr,
                                Method,
                                MethodAttr
                                );
                        }
                    }
                }
            }
        }
예제 #2
0
        protected void RegisterMethod(
            Type InEntryType,
            CheatCommandEntryAttribute InEntryAttr,
            MethodInfo InMethod,
            CheatCommandEntryMethodAttribute InMethodAttr
            )
        {
            CheatCommandMethod MethodCommand =
                new CheatCommandMethod(InMethod, InEntryAttr, InMethodAttr);

            CheatCommandsRepository.instance.RegisterCommand(MethodCommand);
        }
예제 #3
0
        protected void RegisterMethod(
            Type InEntryType,
            CheatCommandEntryAttribute InEntryAttr,
            MethodInfo InMethod,
            CheatCommandEntryMethodAttribute InMethodAttr
            )
        {
            Debug.Log("[CheatCommandRegister::RegisterMethod]Name:" + InEntryType.Name + " Method:" + InMethod.Name);
            CheatCommandMethod MethodCommand =
                new CheatCommandMethod(InMethod, InEntryAttr, InMethodAttr);

            CheatCommandsRepository.instance.RegisterCommand(MethodCommand);
        }
예제 #4
0
        public CheatCommandMethod(
            MethodInfo InMethod,
            CheatCommandEntryAttribute InEntryAttr,
            CheatCommandEntryMethodAttribute InMethodAttr)
        {
            Method      = InMethod;
            CommandName = new MethodCheatCommandName(
                string.Format("{0}/{1}", InEntryAttr.group, InMethodAttr.comment),
                InMethod.Name
                );

            MethodAttr = InMethodAttr;

            String[] Comments = MethodAttr.comment.Split('/');
            Comment = Comments != null && Comments.Length > 0 ? Comments[Comments.Length - 1] : Method.Name;

            CacheArgumentDescriptions();

            ValidateArgumentsBuffer();
        }