Пример #1
0
        private void OnCommandEntered(string commandText)
        {
            if (!canPerformInput)
            {
                return;
            }
            var commandComponents = commandText.Split(' ');
            var command           = commandComponents[0];

            var commandParameters = new List <string>();

            if (commandComponents.Length > 0)
            {
                for (int i = 1; i < commandComponents.Length; i++)
                {
                    commandParameters.Add(commandComponents[i]);
                }
            }

            output.LogStringToConsoleWindow(commandText, EConsoleTextType.Command);
            var result = ConsoleCommandsRegistry.InvokeCommand(command, commandParameters.ToArray());

            output.LogStringToConsoleWindow(result, EConsoleTextType.Result);

            DidEnterCommand(commandText);

            CommandsInputField.text = "";
        }
Пример #2
0
        private static string ConsoleHelp(string[] args)
        {
            var    allCommands  = ConsoleCommandsRegistry.GetCommandsAndDescriptions();
            string resultString = "\nAll commands list.\n";

            foreach (var command in allCommands)
            {
                resultString += command + "\n";
            }

            resultString += "\n Please, add custom commands in ConsoleCommandsStorage.cs";
            return(resultString);
        }