Mercurial > repos > IBBoard.WarFoundry.GUI.GTK
comparison Widgets/UnitDisplayWidget.cs @ 11:4e5e382fbd2e
Re #10 (Code readability) and Re #86 (Complete GTK# GUI):
* Update UnitDisplayWidget to use new way of getting unit stats
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 27 May 2009 19:44:40 +0000 |
parents | 65279b85446f |
children | 6b2c8e55564a |
comparison
equal
deleted
inserted
replaced
10:c687bbe901f8 | 11:4e5e382fbd2e |
---|---|
41 | 41 |
42 private void SetStats() | 42 private void SetStats() |
43 { | 43 { |
44 //GameSystem system = unit.Army.GameSystem; | 44 //GameSystem system = unit.Army.GameSystem; |
45 //SystemStats stats = system.StandardSystemStats; | 45 //SystemStats stats = system.StandardSystemStats; |
46 Stats stats = unit.UnitType.UnitStats; | |
47 CellRendererText renderer = new CellRendererText(); | 46 CellRendererText renderer = new CellRendererText(); |
48 unitStats.AppendColumn(Translation.GetTranslation("UnitNameColumn", "Unit Type", null), renderer, new TreeCellDataFunc(RenderUnitName)); | 47 unitStats.AppendColumn(Translation.GetTranslation("UnitNameColumn", "Unit Type", null), renderer, new TreeCellDataFunc(RenderUnitName)); |
49 | 48 |
50 TreeCellDataFunc statFunc = new TreeCellDataFunc(RenderUnitStat); | 49 TreeCellDataFunc statFunc = new TreeCellDataFunc(RenderUnitStat); |
50 Stat[] stats = unit.UnitStatsArray; | |
51 | 51 |
52 int length = stats.StatCount; | 52 int length = stats.Length; |
53 | 53 |
54 for (int i = 0; i < length; i++) | 54 for (int i = 0; i < length; i++) |
55 { | 55 { |
56 unitStats.AppendColumn(stats[i].ParentSlot.Name, renderer, statFunc); | 56 unitStats.AppendColumn(stats[i].ParentSlot.Name, renderer, statFunc); |
57 } | 57 } |
77 object o = model.GetValue(iter, 0); | 77 object o = model.GetValue(iter, 0); |
78 | 78 |
79 if (o is IBBoard.WarFoundry.API.Objects.Unit) | 79 if (o is IBBoard.WarFoundry.API.Objects.Unit) |
80 { | 80 { |
81 IBBoard.WarFoundry.API.Objects.Unit u = (IBBoard.WarFoundry.API.Objects.Unit)o; | 81 IBBoard.WarFoundry.API.Objects.Unit u = (IBBoard.WarFoundry.API.Objects.Unit)o; |
82 //TODO Check for correct value based on the column | 82 (cell as CellRendererText).Text = u.GetStatValue(column.Title); |
83 (cell as CellRendererText).Text = u.UnitStats[column.Title].SlotValueString; | |
84 } | 83 } |
85 } | 84 } |
86 | 85 |
87 private void UnitNameChanged(WarFoundryObject obj, string oldValue, string newValue) | 86 private void UnitNameChanged(WarFoundryObject obj, string oldValue, string newValue) |
88 { | 87 { |