示例#1
0
        private void ExecuteCommand(OldCommand.Command command, string [] args, Game game)
        {
            bool success = command.AttemptExecution(args, game);

            if (!success)
            {
            }
        }
示例#2
0
        public OldCommand.Command FindCommand(OldCommand.Command commandType, bool inMenu)
        {
            foreach (var command in inMenu ? _menuCommands : _gameCommands)
            {
                if (command.GetType() == commandType.GetType())
                {
                    return(command);
                }
            }

            return(null);
        }
示例#3
0
        public void FindAndExecute(string input, string [] args, Game game)
        {
            OldCommand.Command command = FindCommand(input, game.IsInMenu);
            if (command == null)
            {
                CustomConsole.WriteLine($"{CustomConsole.Red}ERROR: The command \"{input}\" does not exist!");
            }
            else if (command.NeedsGodMode && !game.IsGodMode)
            {
                CustomConsole.WriteLine($"{CustomConsole.Red}ERROR: The command \"{input}\" requires {CustomConsole.DarkYellow}God Mode{CustomConsole.White} to run.");
                CustomConsole.WriteLine($"Use the command \"{new GodModeCommand().Aliases[0]}\" to enter {CustomConsole.DarkYellow}God Mode{CustomConsole.White}.");
            }
            else
            {
                if (command.NeedsValidation && !ValidateCommand(command))
                {
                    return;
                }

                ExecuteCommand(command, args, game);
            }
        }
示例#4
0
 private bool ValidateCommand(OldCommand.Command command)
 {
     return(IOManager.GetYesNo($"Run command \"{command.Name}\"? (y/n)"));
 }