private void AttemptInvokation(string rawinput) { string[] keys = ConsoleHeader.Parse(rawinput, out int wc); // if action is described: if (keys.Length > 0) { // if action exists: if (Commands.TryGetValue(keys[0], out ConsoleHeader.Command cmd)) { int size = wc - 1; size = Mathf.Max(size, 1); string[] modifiers = new string[size]; // deep copy strings bc C# forces me to for (int i = 0; i < size; i++) { modifiers[i] = keys[i + 1]; } cmd.Invoke(modifiers, out string output); WriteToScreen(output); } else { WriteToScreen("Error: '" + keys[0] + "' is not a recognized command."); } } else { WriteToScreen("Error: The input string provided could not be parsed."); } }
protected override void OnAwake() { Printer.CacheLines(); Printer.Write("Console initialized at frame: " + Time.frameCount); ConsoleHeader.SetDefaults(ref Commands); }