using MultiversalDiplomacy.Model; namespace MultiversalDiplomacy.Script; /// /// A script handler for defining order sets. /// public class OrderSetScriptHandler : IScriptHandler { public OrderSetScriptHandler(GameScriptHandler parent, World world, string orderCommand) { this.parent = parent; this.world = world; this.orderSet = new() { orderCommand }; } public string Prompt => "...> "; private GameScriptHandler parent { get; } private World world { get; } private List orderSet { get; } public IScriptHandler? HandleInput(string input) { if (string.IsNullOrEmpty(input)) { parent.World = GameController.SubmitOrderSet(world, string.Join('\n', orderSet)); Console.WriteLine("Submitted order set"); return parent; } else { orderSet.Add(input); return this; } } }