namespace MultiversalDiplomacy.Script; /// /// A script handler for the interactive repl. /// public class ReplScriptHandler : IScriptHandler { public string Prompt => "5dp> "; public IScriptHandler? HandleInput(string input) { var args = input.Split(' ', StringSplitOptions.RemoveEmptyEntries); if (args.Length == 0) { return this; } var command = args[0]; switch (command) { case "help": case "?": Console.WriteLine("commands:"); Console.WriteLine(" help, ?: print this message"); Console.WriteLine(" stab: stab"); Console.WriteLine(" new: start a new game"); break; case "stab": Console.WriteLine("stab"); break; case "new": var world = GameController.InitializeWorld(); var handler = new GameScriptHandler(world); Console.WriteLine("Started a new game"); return handler; default: Console.WriteLine("Unrecognized command"); break; } return this; } }