public override void Execute(Game game, string command) { ConsoleText console = game.Console; var commandComponents = command.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (commandComponents.Length < 2) { console.AddMessage("Status command provides details about either 'computer' or 'money'."); console.AddMessage("Please provide the component for which to receive status, e.g. 'status computer'"); return; } if (commandComponents.Length > 2) { console.AddMessage("Status command receives only 1 parameter from 'computer' or 'money'"); return; } HandleStatus(game, commandComponents[1]); }
public void AddCommand() { command = InputField.text; if (string.IsNullOrEmpty(command)) { return; } InputField.placeholder.GetComponent <Text>().text = "Enter command..."; InputField.text = string.Empty; InputField.ActivateInputField(); console.AddMessage(command); theGame.ExecuteCommand(command); }