changeset 16:e45af3c75b4e

Re #88 - Complete WinForms UI * Fix rendering of stats in unit windows
author IBBoard <dev@ibboard.co.uk>
date Wed, 17 Jun 2009 11:04:22 +0000
parents 76a15df10fa6
children 475d3cdb75f4
files FrmUnit.cs
diffstat 1 files changed, 8 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/FrmUnit.cs	Mon May 25 11:32:24 2009 +0000
+++ b/FrmUnit.cs	Wed Jun 17 11:04:22 2009 +0000
@@ -79,18 +79,16 @@
 
 		private void SetStats()
 		{
-			GameSystem system = unit.Army.GameSystem;
-			SystemStats stats = system.StandardSystemStats;
-			
 			DataTable dt = new DataTable();
-			DataColumn[] dc = new DataColumn[stats.SlotCount+1];
+			Stat[] stats = unit.UnitStatsArrayWithName;
+			DataColumn[] dc = new DataColumn[stats.Length+1];
 			dc[0] = new DataColumn("name");
 
 			DataGridTableStyle dgStyle = new DataGridTableStyle();
 			dgStyle.RowHeadersVisible = false;
 
 			DataGridTextBoxColumn colStyle = new DataGridTextBoxColumn();
-			colStyle.Width = statsGrid.ClientSize.Width - (stats.SlotCount * 40) - 4;
+			colStyle.Width = statsGrid.ClientSize.Width - (stats.Length * 40) - 4;
 			colStyle.MappingName = "name";
 			colStyle.HeaderText = "name";
 			colStyle.ReadOnly = true;
@@ -99,15 +97,15 @@
 			DataColumn tempCol;
 			int i = 1;
 
-			foreach (StatSlot stat in stats.StatSlots)
+			foreach (Stat stat in stats)
 			{
-				tempCol = new DataColumn(stat.Name);
+				tempCol = new DataColumn(stat.ParentSlotName);
 				dc[i] = tempCol;
 				colStyle = new DataGridTextBoxColumn();
 				colStyle.Alignment = HorizontalAlignment.Center;
 				colStyle.Width = 40;
-				colStyle.MappingName = stat.Name;
-				colStyle.HeaderText = stat.Name;
+				colStyle.MappingName = stat.ParentSlotName;
+				colStyle.HeaderText = stat.ParentSlotName;
 				colStyle.ReadOnly = true;
 				dgStyle.GridColumnStyles.Add(colStyle);
 				i++;
@@ -116,7 +114,7 @@
 			dt.Columns.AddRange(dc);
 
 			DataRow dr = dt.NewRow();
-			dr.ItemArray = unit.UnitStats.StatsArray;
+			dr.ItemArray = unit.UnitStatsArrayWithName;
 			dt.Rows.Add(dr);
 			statsGrid.DataSource = dt;
 			statsGrid.TableStyles.Add(dgStyle);