/// <summary> /// build a table with all parser item details, matches and parsed values ( for debug purpose ) /// </summary> public override string ToString() { var rows = new List <List <string> >(); foreach (var x in AllItems.OrderBy(w => w.SortOrder)) { rows.Add(new List <string>() { x.Type.ToString(), x.ShortName, x.LongName, x.Description, x.GlobalFlagAction != null ? "X" : "", x.Mandatory ? "X" : "", x.Matches ? "X" : "", x.Type == CmdlineParseItemType.parameterArray ? ((x.ArgValues.Count > 0) ? $"[ {string.Join(",", x.ArgValues.Select(h=>$"\"{h.Argument}\""))} ]" : "") : (string)x }); } var left = ColumnAlignment.left; var center = ColumnAlignment.center; return(rows.TableFormat( new[] { "TYPE", "SHORT-NAME", "LONG-NAME", "DESCRIPTION", "GLOBAL", "MANDATORY", "MATCHES", "VALUE" }, new[] { left, left, left, left, center, center, center, left })); }
public void DoAILoop() { foreach (var unit in AllUnits) { unit.Act(); } AllItems = AllItems.OrderBy(a => Math.Abs(a.Location.Grid.X)).ToList(); }
public override void Draw() { { GraphicsProvider.Current.FillRectangle(Bounds.Screen, Color.GhostWhite); GraphicsProvider.Current.DrawBackground(GraphicsProvider.Current.Background, Bounds.ScreenWithScroll); string text = string.Empty; var DrawItems = AllItems.OrderBy(a => a.Location.World.Y); foreach (var item in DrawItems) { // if (Bounds.Screen.Contains((int)item.Location.Screen.X,(int)item.Location.Screen.Y)) { item.Draw(); } //text += string.Format("({0:000},{1:000})\n", item.Bounds.World.Left, item.Bounds.World.Top); } text = ToNetworkString(); GraphicsProvider.Current.DrawString(text, new Vector2(1200, 200)); } foreach (var item in UIElements) { item.Draw(); } foreach (var item in AllItems.Where(a => a is Factory)) { item.Draw(); } Location l1 = new Location() { Screen = new Vector2(LastMouseState.X, LastMouseState.Y) }; Location l2 = new Location() { Grid = l1.Grid }; Rectangle rect = new Rectangle((int)l2.Screen.X, (int)l2.Screen.Y, (int)Constants.TileSize, (int)Constants.TileSize); GraphicsProvider.Current.DrawButton(rect, ""); }