public PlayerTableRow(Map map, Player ply) { _player = ply; _map = map; // player is currently visible? Cells.Add(VillageTableRow.GetVisibleImageCell(_map, _player)); Cells.Add(ColumnDisplay.CreatePlayerCell(ply)); string tribe = ply.HasTribe ? ply.Tribe.Tag : string.Empty; if (ply.TribeChange && ply.PreviousPlayerDetails.Tribe != null) { Cells.Add(ColumnDisplay.CreateDifferenceCell(ply.PreviousPlayerDetails.Tribe.Tag)); } else { Cells.Add(new Cell()); } Cells.Add(new Cell(tribe) { ToolTipText = ply.HasTribe ? ply.Tribe.Tooltip : "" }); Cells.Add(new Cell(ply.Points)); if (ply.PreviousPlayerDetails != null) { Cells.Add(ColumnDisplay.CreateDifferenceCell(ply.Points - ply.PreviousPlayerDetails.Points)); } else { Cells.Add(new Cell()); } Cells.Add(new Cell(ply.Villages.Count)); if (ply.PreviousPlayerDetails != null) { Cells.Add(new Cell(ply.ConquerString)); } else { Cells.Add(new Cell()); } }
public VillageTableRow(Map map, Village village) { _village = village; _map = map; // Village is currently visible? Cells.Add(GetVisibleImageCell(_map, _village)); // General village info columns if (village.Type != VillageType.None) { var cell = new Cell(string.Empty, village.Type.GetImage(true)); if (village.HasComments) { cell.ToolTipText = village.Comments; } else { cell.ToolTipText = village.Type.GetDescription(); } Cells.Add(cell); } else { Cells.Add(new Cell()); } Cells.Add(new Cell(village.LocationString)); Cells.Add(new Cell(village.Name)); Cells.Add(new Cell(village.Points)); if (village.PreviousVillageDetails != null) { Cells.Add(ColumnDisplay.CreateDifferenceCell(village.Points - village.PreviousVillageDetails.Points)); } else { Cells.Add(new Cell()); } // village owner details Player owner = null; Player prevOwner = null; int points = 0; int prevPoints = 0; int villages = 0; string prevVillages = null; string tribe = null; int tribeRank = 0; if (village.HasPlayer) { owner = village.Player; points = village.Player.Points; villages = village.Player.Villages.Count; if (village.Player.HasTribe) { tribe = village.Player.Tribe.Tag; tribeRank = village.Player.Tribe.Rank; } if (village.Player.PreviousPlayerDetails != null) { prevPoints = village.Player.Points - village.Player.PreviousPlayerDetails.Points; } prevVillages = village.Player.ConquerString; } if (village.PreviousVillageDetails != null && village.PreviousVillageDetails.Player != null && !village.PreviousVillageDetails.Player.Equals(village.Player)) { prevOwner = village.PreviousVillageDetails.Player; } Cells.Add(ColumnDisplay.CreatePlayerCell(prevOwner, true)); Cells.Add(ColumnDisplay.CreatePlayerCell(owner)); Cells.Add(points != 0 ? new Cell(points) : new Cell()); Cells.Add(ColumnDisplay.CreateDifferenceCell(prevPoints)); Cells.Add(villages != 0 ? new Cell(villages) : new Cell()); Cells.Add(ColumnDisplay.CreateDifferenceCell(prevVillages)); Cells.Add(new Cell(tribe)); Cells.Add(tribeRank != 0 ? new Cell(tribeRank) : new Cell()); }