Esempio n. 1
0
        public static string ProcessCommand(string command)
        {
            // Split the commands to get all the info
            List <string> commands = RemoveEmpty(command.Split(' ').ToList());

            // Get the first element to see what the command is

            if (commands != null && commands[0] != null)
            {
                // Get the first command
                string commandStr = commands[0].ToLower().Trim();

                // Get rid of the command we just processed
                commands.RemoveAt(0);

                Debug.Log($"Processing Command: {commandStr}");

                // First command analysis

                RunCommand runCommand = GameManager.Instance.GetCommand(commandStr);

                if (runCommand != null)
                {
                    return(runCommand.Invoke(commands));
                }
                else if (commandStr == "help")
                {
                    return("usage: \n" +
                           "list\n" +
                           "\tscp [wanted, captured, all]\n" +
                           "\tstaff [research, security, all]\n" +
                           "\tbuilding <building name>\n" +
                           "\tcell [filled, empty, all]\n" +
                           "capture\n" +
                           "\t<name> <cellnumber>\n" +
                           "move\n" +
                           "\tstaff <name> building <building name>\n" +
                           "\tstaff <name> floor <floor number>\n" +
                           "\tfloor <floor number>\n" +
                           "\tbuilding <building name>\n" +
                           "\tout\n" +
                           "hire\n" +
                           "\t[security / research] <floor number>\n" +
                           "upgrade\n" +
                           "\tbuilding [research / security / containment]");
                }

                else
                {
                    return($"bash: {commandStr}: command not found...");
                }
            }
            else
            {
                // Maybe fix this later
                return("");
            }
        }