Пример #1
0
        public static void Initialize(GameObject systemObject)
        {
            if (!Initialized)
            {
                HelpCommand = new Command
                {
                    OnSubmit    = Help,
                    CommandName = "help"
                };
                var param = new BaseConsoleParameter
                {
                    Name              = "Command",
                    IsOptional        = true,
                    ListValueRequired = true,
                    TooltipText       = "The command to show help for",
                    UseAutoComplete   = true
                };
                HelpCommand.Parameters.Add(param);

                RegisterCommand(HelpCommand);

                RegisterCommand(new Command
                {
                    CommandName = "test",
                    HelpText    = "This is a test method",
                    OnSubmit    = delegate { },
                    Parameters  = new List <IConsoleParameter>
                    {
                        new BaseConsoleParameter
                        {
                            Name              = "Testparam",
                            IsOptional        = true,
                            TooltipText       = "testtooltip",
                            ListValueRequired = true,
                            UseAutoComplete   = true,
                            Values            = new List <string>
                            {
                                "test1a",
                                "best1",
                                "test2b",
                                "test3b",
                                "best2"
                            }
                        }
                    }
                });
                Initialized = true;
            }

            if (systemObject.transform.FindChild("__ModAPIConsole__") == null)
            {
                var console = new GameObject("__ModAPIConsole__");
                ConsoleComponent         = console.AddComponent <ConsoleComponent>();
                console.transform.parent = systemObject.transform;
            }
        }
Пример #2
0
        public static void Initialize(GameObject SystemObject)
        {
            if (!initialized)
            {
                helpCommand             = new Command();
                helpCommand.OnSubmit    = Help;
                helpCommand.CommandName = "help";
                BaseConsoleParameter param = new BaseConsoleParameter();
                param.Name              = "Command";
                param.IsOptional        = true;
                param.ListValueRequired = true;
                param.TooltipText       = "The command to show help for";
                param.UseAutoComplete   = true;
                helpCommand.Parameters.Add(param);

                RegisterCommand(helpCommand);

                RegisterCommand(new Command()
                {
                    CommandName = "test",
                    HelpText    = "This is a test method",
                    OnSubmit    = delegate(object[] objs) { },
                    Parameters  = new List <IConsoleParameter>()
                    {
                        new ModAPI.Console.BaseConsoleParameter()
                        {
                            Name              = "Testparam",
                            IsOptional        = true,
                            TooltipText       = "testtooltip",
                            ListValueRequired = true,
                            UseAutoComplete   = true,
                            Values            = new List <string>()
                            {
                                "test1a",
                                "best1",
                                "test2b",
                                "test3b",
                                "best2"
                            }
                        }
                    }
                });
                initialized = true;
            }

            if (SystemObject.transform.FindChild("__ModAPIConsole__") == null)
            {
                GameObject console = new GameObject("__ModAPIConsole__");
                consoleComponent         = console.AddComponent <ConsoleComponent>();
                console.transform.parent = SystemObject.transform;
            }
        }
Пример #3
0
        public static void Initialize(GameObject SystemObject)
        {
            if (!initialized)
            {
                helpCommand = new Command();
                helpCommand.OnSubmit = Help;
                helpCommand.CommandName = "help";
                BaseConsoleParameter param = new BaseConsoleParameter();
                param.Name = "Command";
                param.IsOptional = true;
                param.ListValueRequired = true;
                param.TooltipText = "The command to show help for";
                param.UseAutoComplete = true;
                helpCommand.Parameters.Add(param);

                RegisterCommand(helpCommand);

                RegisterCommand(new Command()
                {
                    CommandName = "test",
                    HelpText = "This is a test method",
                    OnSubmit = delegate(object[] objs) { },
                    Parameters = new List<IConsoleParameter>()
                    {
                        new ModAPI.Console.BaseConsoleParameter()
                        {
                            Name = "Testparam",
                            IsOptional = true,
                            TooltipText = "testtooltip",
                            ListValueRequired = true,
                            UseAutoComplete = true,
                            Values = new List<string>()
                            {
                                "test1a",
                                "best1",
                                "test2b",
                                "test3b",
                                "best2"
                            }
                        }
                    }
                });
                initialized = true;
            }

            if (SystemObject.transform.FindChild("__ModAPIConsole__") == null)
            {
                GameObject console = new GameObject("__ModAPIConsole__");
                consoleComponent = console.AddComponent<ConsoleComponent>();
                console.transform.parent = SystemObject.transform;
            }
        }