Exemple #1
0
        protected void DrawHelperText(ICheatCommand InCommand)
        {
            // GUILayout.Label(InCommand.fullyHelper);
            GUILayout.BeginHorizontal();
            DrawLabel(InCommand.command.baseName + " ");
            int CurrentArgIndex = arguments != null && arguments.Length > 0 ? arguments.Length - 1 : -1;

            if (InCommand.argumentsTypes != null)
            {
                for (int i = 0; i < InCommand.argumentsTypes.Length; ++i)
                {
                    Type ThisType = InCommand.argumentsTypes[i].argumentType;

                    string ArgDesc = string.Format(" <{0}{2}|{1}>", InCommand.argumentsTypes[i].name, ThisType.Name, InCommand.argumentsTypes[i].isOptional ? "(Optional)" : "");

                    if (CurrentArgIndex == i)
                    {
                        GUI.contentColor = Color.green;
                    }

                    DrawLabel(ArgDesc);

                    if (CurrentArgIndex == i)
                    {
                        GUI.contentColor = Color.white;
                    }
                }
            }

            DrawLabel(string.Format(" Desc: {0}", InCommand.comment));

            GUILayout.EndHorizontal();
        }
Exemple #2
0
        public void AddCommand(ICheatCommand InCommand, int HierarchiesIndex)
        {
            DebugHelper.Assert(InCommand != null);
            string[] GroupHierarchies = InCommand.command.groupHierarchies;

            DebugHelper.Assert(GroupHierarchies != null);

            if (HierarchiesIndex < GroupHierarchies.Length)
            {
                // should add to children group
                CheatCommandGroup Groups = null;
                if (!ChildrenGroups.TryGetValue(GroupHierarchies[HierarchiesIndex], out Groups))
                {
                    Groups = new CheatCommandGroup();
                    ChildrenGroups.Add(GroupHierarchies[HierarchiesIndex], Groups);
                }

                DebugHelper.Assert(Groups != null);

                Groups.AddCommand(InCommand, HierarchiesIndex + 1);
            }
            else
            {
                // add to this group
                Commands.Add(InCommand.command.baseName, InCommand);
            }
        }
    public ICheatCommand FindCommand(string InCommand)
    {
        ICheatCommand command = null;

        this.GeneralRepositories.Commands.TryGetValue(InCommand.ToLower(), out command);
        return(command);
    }
Exemple #4
0
        private void DrawCommand(string InGroupName, string InName, ICheatCommand InCommand)
        {
            GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));

            ArgumentDescriptionAttribute[] ArgTypes = InCommand.argumentsTypes;
            string[] Arguments = InCommand.arguments;

            if (ArgTypes != null && ArgTypes.Length > 0)
            {
                DebugHelper.Assert(ArgTypes.Length == Arguments.Length);

                for (int i = 0; i < ArgTypes.Length; ++i)
                {
                    ArgumentDescriptionAttribute ArgAttr = ArgTypes[i];

                    if (!DrawArgument(ArgAttr, ArgTypes, ref Arguments, ref Arguments[i]))
                    {
                        break;
                    }
                }
            }

            if (GUILayout.Button(InCommand.comment, GUILayout.Width(InCommand.comment.Length * 12 + 10)))
            {
                Logger.AddMessage(InCommand.StartProcess(Arguments));
            }

            GUILayout.EndHorizontal();
        }
Exemple #5
0
        public void SelectionCommand(ICheatCommand InCommand)
        {
            DebugHelper.Assert(InCommand != null);

            States.Push(new CommandDisplayState(ParentWindow, this));

            (States.TopState() as CommandDisplayState).ResetCheatCommand(InCommand);
        }
Exemple #6
0
        public ICheatCommand FindCommand(string InCommand)
        {
            ICheatCommand Result = null;

            GeneralRepositories.Commands.TryGetValue(InCommand.ToLower(), out Result);

            return(Result);
        }
Exemple #7
0
        public override void PreGUI()
        {
            CurrentCommand = CheatCommandsRepository.instance.FindCommand(baseCommand);

            if (CurrentCommand != null)
            {
                DrawHelperText(CurrentCommand);
                DrawDynamicCheckResult(CurrentCommand);
            }
        }
Exemple #8
0
        protected void DrawCommands()
        {
            var Iter = currentGroup.Commands.GetEnumerator();

            int Index = 0;

            while (Iter.MoveNext())
            {
                if (Iter.Current.Value.isHiddenInMobile)
                {
                    continue;
                }

                GUILayout.BeginHorizontal();

                try
                {
                    string FunctionName = Iter.Current.Value.comment;

                    if (Count++ >= ParentView.skipCount)
                    {
                        if (DrawButton(FunctionName, Iter.Current.Value.fullyHelper))
                        {
                            ICheatCommand Command = Iter.Current.Value;

                            if (Command.argumentsTypes == null ||
                                Command.argumentsTypes.Length == 0)
                            {
                                // execute this command directly.
                                logger.AddMessage(Command.StartProcess(new string[] { "" }));
                            }
                            else
                            {
                                logger.Clear();
                                ParentView.SelectionCommand(Iter.Current.Value);
                                break;
                            }
                        }

                        GUILayout.Label(GUI.tooltip, ParentView.CustomLabelStyle);

                        GUI.tooltip = "";
                    }

                    ++Index;
                }
                finally
                {
                    GUILayout.EndHorizontal();
                }

                GUILayout.Space(SpaceHeight);
            }
        }
Exemple #9
0
        protected void DrawDynamicCheckResult(ICheatCommand InCommand)
        {
            GUI.contentColor = Color.yellow;

            // update error codes.
            InCommand.CheckArguments(ParentView.parser.arguments, out ErrorMessage);

            GUILayout.Label(ErrorMessage);

            GUI.contentColor = Color.white;
        }
Exemple #10
0
    protected void OnFoundClass(string InID, Type InType)
    {
        CheatCommandAttribute cheatCommandAttribute = InType.GetCustomAttributes(typeof(CheatCommandAttribute), false)[0] as CheatCommandAttribute;

        DebugHelper.Assert(cheatCommandAttribute != null);
        ICheatCommand cheatCommand = Activator.CreateInstance(InType) as ICheatCommand;

        DebugHelper.Assert(cheatCommand != null);
        this.CommandRepositories.Add(cheatCommand);
        Singleton <CheatCommandsRepository> .instance.RegisterCommand(cheatCommand);
    }
Exemple #11
0
        protected bool CheckCandinateState(ICheatCommand InCommand)
        {
            string InputText = inputText.TrimStart(' ');

            if (InCommand == null || InputText.IndexOf(' ') == -1)
            {
                ParentView.ChangeState("CommandCandinateState");
                return(false);
            }

            return(true);
        }
        protected void OnFoundClass(string InID, Type InType)
        {
            CheatCommandAttribute Attribute = InType.GetCustomAttributes(typeof(CheatCommandAttribute), false)[0] as CheatCommandAttribute;

            DebugHelper.Assert(Attribute != null);

            ICheatCommand CommandHandler = Activator.CreateInstance(InType) as ICheatCommand;

            DebugHelper.Assert(CommandHandler != null);

            CommandRepositories.Add(CommandHandler);

            CheatCommandsRepository.instance.RegisterCommand(CommandHandler);
        }
Exemple #13
0
    protected void DrawCommands()
    {
        DictionaryView <string, ICheatCommand> .Enumerator enumerator = this.currentGroup.Commands.GetEnumerator();
        int num = 0;

        while (enumerator.MoveNext())
        {
            KeyValuePair <string, ICheatCommand> current = enumerator.Current;
            if (!current.get_Value().isHiddenInMobile)
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                try
                {
                    KeyValuePair <string, ICheatCommand> current2 = enumerator.Current;
                    string comment = current2.get_Value().comment;
                    if (this.Count++ >= this.ParentView.skipCount)
                    {
                        string arg_92_1 = comment;
                        KeyValuePair <string, ICheatCommand> current3 = enumerator.Current;
                        if (base.DrawButton(arg_92_1, current3.get_Value().fullyHelper))
                        {
                            KeyValuePair <string, ICheatCommand> current4 = enumerator.Current;
                            ICheatCommand value = current4.get_Value();
                            if (value.argumentsTypes != null && value.argumentsTypes.Length != 0)
                            {
                                base.logger.Clear();
                                ConsoleViewMobile arg_10A_0 = this.ParentView;
                                KeyValuePair <string, ICheatCommand> current5 = enumerator.Current;
                                arg_10A_0.SelectionCommand(current5.get_Value());
                                break;
                            }
                            base.logger.AddMessage(value.StartProcess(new string[]
                            {
                                string.Empty
                            }));
                        }
                        GUILayout.Label(GUI.tooltip, this.ParentView.CustomLabelStyle, new GUILayoutOption[0]);
                        GUI.tooltip = string.Empty;
                    }
                    num++;
                }
                finally
                {
                    GUILayout.EndHorizontal();
                }
                GUILayout.Space((float)CommandDisplayBasicState.SpaceHeight);
            }
        }
    }
Exemple #14
0
    protected void DrawCommands()
    {
        DictionaryView <string, ICheatCommand> .Enumerator enumerator = this.currentGroup.Commands.GetEnumerator();
        int num = 0;

        while (enumerator.MoveNext())
        {
            KeyValuePair <string, ICheatCommand> current = enumerator.Current;
            if (!current.Value.isHiddenInMobile)
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                try
                {
                    KeyValuePair <string, ICheatCommand> pair2 = enumerator.Current;
                    string comment = pair2.Value.comment;
                    if (this.Count++ >= base.ParentView.skipCount)
                    {
                        KeyValuePair <string, ICheatCommand> pair3 = enumerator.Current;
                        if (base.DrawButton(comment, pair3.Value.fullyHelper))
                        {
                            KeyValuePair <string, ICheatCommand> pair4 = enumerator.Current;
                            ICheatCommand command = pair4.Value;
                            if ((command.argumentsTypes == null) || (command.argumentsTypes.Length == 0))
                            {
                                string[] inArguments = new string[] { string.Empty };
                                base.logger.AddMessage(command.StartProcess(inArguments));
                            }
                            else
                            {
                                base.logger.Clear();
                                KeyValuePair <string, ICheatCommand> pair5 = enumerator.Current;
                                base.ParentView.SelectionCommand(pair5.Value);
                                break;
                            }
                        }
                        GUILayout.Label(GUI.tooltip, base.ParentView.CustomLabelStyle, new GUILayoutOption[0]);
                        GUI.tooltip = string.Empty;
                    }
                    num++;
                }
                finally
                {
                    GUILayout.EndHorizontal();
                }
                GUILayout.Space((float)CommandDisplayBasicState.SpaceHeight);
            }
        }
    }
    public void RegisterCommand(ICheatCommand InCommand)
    {
        DebugHelper.Assert((InCommand != null) && !this.HasCommand(InCommand.command.baseName));
        this.GeneralRepositories.Commands[InCommand.command.baseName.ToLower()] = InCommand;
        string[] groupHierarchies = InCommand.command.groupHierarchies;
        DebugHelper.Assert(groupHierarchies != null);
        string            key   = groupHierarchies[0];
        CheatCommandGroup group = null;

        if (!this.Repositories.TryGetValue(key, out group))
        {
            group = new CheatCommandGroup();
            this.Repositories[key] = group;
        }
        group.AddCommand(InCommand, 1);
    }
Exemple #16
0
        public void CheckCandinateState()
        {
            ICheatCommand Command = CheatCommandsRepository.instance.FindCommand(baseCommand);

            if (Command == null)
            {
                return;
            }

            string InputText = inputText.TrimStart(' ');

            if (InputText.IndexOf(' ') != -1)
            {
                ParentView.ChangeState("ArgumentCandinateState");
            }
        }
    public ListView <ICheatCommand> FilterByString(string InPrefix)
    {
        DebugHelper.Assert(InPrefix != null);
        ListView <ICheatCommand> view = new ListView <ICheatCommand>(0x10);

        DictionaryView <string, ICheatCommand> .Enumerator enumerator = this.GeneralRepositories.Commands.GetEnumerator();
        while (enumerator.MoveNext())
        {
            KeyValuePair <string, ICheatCommand> current = enumerator.Current;
            ICheatCommand item = current.Value;
            if (item.command.baseName.StartsWith(InPrefix, StringComparison.CurrentCultureIgnoreCase) || string.IsNullOrEmpty(InPrefix))
            {
                view.Add(item);
            }
        }
        return(view);
    }
    public ListView <ICheatCommand> FilterByString(string InPrefix)
    {
        DebugHelper.Assert(InPrefix != null);
        ListView <ICheatCommand> listView = new ListView <ICheatCommand>(16);

        DictionaryView <string, ICheatCommand> .Enumerator enumerator = this.GeneralRepositories.Commands.GetEnumerator();
        while (enumerator.MoveNext())
        {
            KeyValuePair <string, ICheatCommand> current = enumerator.Current;
            ICheatCommand value = current.get_Value();
            if (value.command.baseName.StartsWith(InPrefix, 1) || string.IsNullOrEmpty(InPrefix))
            {
                listView.Add(value);
            }
        }
        return(listView);
    }
 public void AddCommand(ICheatCommand InCommand, int HierarchiesIndex)
 {
     DebugHelper.Assert(InCommand != null);
     string[] groupHierarchies = InCommand.command.groupHierarchies;
     DebugHelper.Assert(groupHierarchies != null);
     if (HierarchiesIndex < groupHierarchies.Length)
     {
         CheatCommandGroup cheatCommandGroup = null;
         if (!this.ChildrenGroups.TryGetValue(groupHierarchies[HierarchiesIndex], out cheatCommandGroup))
         {
             cheatCommandGroup = new CheatCommandGroup();
             this.ChildrenGroups.Add(groupHierarchies[HierarchiesIndex], cheatCommandGroup);
         }
         DebugHelper.Assert(cheatCommandGroup != null);
         cheatCommandGroup.AddCommand(InCommand, HierarchiesIndex + 1);
     }
     else
     {
         this.Commands.Add(InCommand.command.baseName, InCommand);
     }
 }
Exemple #20
0
        public void RegisterCommand(ICheatCommand InCommand)
        {
            // 1.
            DebugHelper.Assert(InCommand != null && !HasCommand(InCommand.command.baseName));

            GeneralRepositories.Commands[InCommand.command.baseName.ToLower()] = InCommand;

            // 2.
            string[] GroupHierarchies = InCommand.command.groupHierarchies;

            DebugHelper.Assert(GroupHierarchies != null);

            string BaseGroup = GroupHierarchies[0];

            CheatCommandGroup Groups = null;

            if (!Repositories.TryGetValue(BaseGroup, out Groups))
            {
                Groups = new CheatCommandGroup();
                Repositories[BaseGroup] = Groups;
            }

            Groups.AddCommand(InCommand, 1);
        }
Exemple #21
0
 public CheatCommandItem(ICheatCommand InCommand)
 {
     command = InCommand;
 }
Exemple #22
0
        protected void DrawHelperText(ICheatCommand InCommand)
        {
            // GUILayout.Label(InCommand.fullyHelper);
            GUILayout.BeginHorizontal();
            DrawLabel(InCommand.command.baseName + " ");
            int CurrentArgIndex = arguments != null && arguments.Length > 0 ? arguments.Length - 1 : -1;

            if (InCommand.argumentsTypes != null)
            {
                for (int i = 0; i < InCommand.argumentsTypes.Length; ++i)
                {
                    Type ThisType = InCommand.argumentsTypes[i].argumentType;

                    string ArgDesc = string.Format(" <{0}{2}|{1}>", InCommand.argumentsTypes[i].name, ThisType.Name, InCommand.argumentsTypes[i].isOptional ? "(Optional)" : "");

                    if (CurrentArgIndex == i)
                    {
                        GUI.contentColor = Color.green;
                    }

                    DrawLabel(ArgDesc);

                    if (CurrentArgIndex == i)
                    {
                        GUI.contentColor = Color.white;
                    }
                }
            }

            DrawLabel(string.Format(" Desc: {0}", InCommand.comment));

            GUILayout.EndHorizontal();
        }
Exemple #23
0
        protected void DrawDynamicCheckResult(ICheatCommand InCommand)
        {
            GUI.contentColor = Color.yellow;

            // update error codes.
            InCommand.CheckArguments(ParentView.parser.arguments, out ErrorMessage);

            GUILayout.Label(ErrorMessage);

            GUI.contentColor = Color.white;
        }
Exemple #24
0
        protected bool CheckCandinateState(ICheatCommand InCommand)
        {
            string InputText = inputText.TrimStart(' ');

            if (InCommand == null || InputText.IndexOf(' ') == -1)
            {
                ParentView.ChangeState("CommandCandinateState");
                return false;
            }

            return true;
        }
Exemple #25
0
        public override void PreGUI()
        {
            CurrentCommand = CheatCommandsRepository.instance.FindCommand(baseCommand);

            if (CurrentCommand != null)
            {
                DrawHelperText(CurrentCommand);
                DrawDynamicCheckResult(CurrentCommand);
            }
        }
        private void DrawCommand(string InGroupName, string InName, ICheatCommand InCommand)
        {
            GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));

            ArgumentDescriptionAttribute[] ArgTypes = InCommand.argumentsTypes;
            string[] Arguments = InCommand.arguments;

            if (ArgTypes != null && ArgTypes.Length > 0)
            {
                DebugHelper.Assert(ArgTypes.Length == Arguments.Length);

                for (int i = 0; i < ArgTypes.Length; ++i)
                {
                    ArgumentDescriptionAttribute ArgAttr = ArgTypes[i];

                    if (!DrawArgument(ArgAttr, ArgTypes, ref Arguments, ref Arguments[i]))
                    {
                        break;
                    }
                }
            }

            if (GUILayout.Button(InCommand.comment, GUILayout.Width(InCommand.comment.Length * 12 + 10)))
            {
                Logger.AddMessage(InCommand.StartProcess(Arguments));
            }

            GUILayout.EndHorizontal();
        }
 public void ResetCheatCommand(ICheatCommand InCommand)
 {
     CheatCommand = InCommand;
 }
        public void SelectionCommand(ICheatCommand InCommand)
        {
            DebugHelper.Assert(InCommand != null);

            States.Push(new CommandDisplayState(ParentWindow, this));

            (States.TopState() as CommandDisplayState).ResetCheatCommand(InCommand);
        }
 public void ResetCheatCommand(ICheatCommand InCommand)
 {
     this.CheatCommand = InCommand;
 }
Exemple #30
0
 public CheatCommandItem(ICheatCommand InCommand)
 {
     command = InCommand;
 }