comparison Util/UnitEquipmentChoice.cs @ 34:3ceb0efd261f

Re #118: Allow equipment amounts of "ratio" equipment to be define as absolute or ratio amounts * Use new commands created in previous revision Re #122: Make usage of percentage or ratio common * Make sure all usage of percentages are correct Re #117: Add percentage and number boxes to equipment item dialogs * Fix some enable/disable inconsistencies for percentage amounts * Fix problems where fixed limits weren't honoured by widgets
author IBBoard <dev@ibboard.co.uk>
date Thu, 13 Aug 2009 21:16:21 +0000
parents 7c366fe55635
children 6ab7ddc038f9
comparison
equal deleted inserted replaced
33:67c283ea77a7 34:3ceb0efd261f
27 item = unitItem; 27 item = unitItem;
28 } 28 }
29 29
30 public override string ToString() 30 public override string ToString()
31 { 31 {
32 return String.Format("{0} (For {1} at {2}pts each)", item.Name, UnitEquipmentItem.FormatEquipmentAmount(item, unit.GetEquipmentAmount(item)), item.Cost); 32 return String.Format("{0} (For {1} at {2}pts each)", item.Name, GetAmountString(), item.Cost);
33 } 33 }
34
35 private string GetAmountString()
36 {
37 if (unit.GetEquipmentAmountIsRatio(item))
38 {
39 return UnitEquipmentRatioSelection.GetEquipmentAmountString(unit.GetEquipmentAmount(item));
40 }
41 else
42 {
43 return UnitEquipmentNumericSelection.GetEquipmentAmountString(unit.GetEquipmentAmount(item));
44 }
45 }
34 46
35 public UnitEquipmentItem Item 47 public UnitEquipmentItem Item
36 { 48 {
37 get { return item; } 49 get { return item; }
38 } 50 }