Mercurial > repos > IBBoard.WarFoundry.GUI.WinForms
annotate Util/UnitEquipmentChoice.cs @ 46:1576f669b3eb
Fixes #137: Remove use of old collections
* Remove all references (lots unused) in WinForms code
* Remove DebugOutput window as it isn't used any more
* Remove unused static hashtable from UnitEquipmentChoice
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 13 Sep 2009 17:33:36 +0000 |
parents | 6ab7ddc038f9 |
children | acaea18ac0a1 |
rev | line source |
---|---|
36 | 1 // This file (UnitEquipmentChoice.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2009 IBBoard. |
2 // | |
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. | |
4 | |
5 using System; | |
6 using IBBoard.WarFoundry.API.Objects; | |
7 | |
8 | |
9 | |
10 namespace IBBoard.WarFoundry.GUI.WinForms.Util | |
11 { | |
12 /// <summary> | |
13 /// A helper object that holds an equipment choice for a unit. | |
14 /// </summary> | |
15 | |
16 public class UnitEquipmentChoice | |
17 { | |
18 private Unit unit; | |
19 private UnitEquipmentItem item; | |
20 | |
21 public UnitEquipmentChoice(Unit unit, UnitEquipmentItem unitItem) | |
22 { | |
23 this.unit = unit; | |
24 item = unitItem; | |
25 } | |
26 | |
27 public override string ToString() | |
28 { | |
29 return String.Format("{0} (For {1} at {2}pts each)", item.Name, GetAmountString(), item.Cost); | |
34
3ceb0efd261f
Re #118: Allow equipment amounts of "ratio" equipment to be define as absolute or ratio amounts
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
30 } |
3ceb0efd261f
Re #118: Allow equipment amounts of "ratio" equipment to be define as absolute or ratio amounts
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
31 |
3ceb0efd261f
Re #118: Allow equipment amounts of "ratio" equipment to be define as absolute or ratio amounts
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
32 private string GetAmountString() |
3ceb0efd261f
Re #118: Allow equipment amounts of "ratio" equipment to be define as absolute or ratio amounts
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
33 { |
3ceb0efd261f
Re #118: Allow equipment amounts of "ratio" equipment to be define as absolute or ratio amounts
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
34 if (unit.GetEquipmentAmountIsRatio(item)) |
3ceb0efd261f
Re #118: Allow equipment amounts of "ratio" equipment to be define as absolute or ratio amounts
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
35 { |
3ceb0efd261f
Re #118: Allow equipment amounts of "ratio" equipment to be define as absolute or ratio amounts
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
36 return UnitEquipmentRatioSelection.GetEquipmentAmountString(unit.GetEquipmentAmount(item)); |
3ceb0efd261f
Re #118: Allow equipment amounts of "ratio" equipment to be define as absolute or ratio amounts
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
37 } |
3ceb0efd261f
Re #118: Allow equipment amounts of "ratio" equipment to be define as absolute or ratio amounts
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
38 else |
3ceb0efd261f
Re #118: Allow equipment amounts of "ratio" equipment to be define as absolute or ratio amounts
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
39 { |
3ceb0efd261f
Re #118: Allow equipment amounts of "ratio" equipment to be define as absolute or ratio amounts
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
40 return UnitEquipmentNumericSelection.GetEquipmentAmountString(unit.GetEquipmentAmount(item)); |
3ceb0efd261f
Re #118: Allow equipment amounts of "ratio" equipment to be define as absolute or ratio amounts
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
41 } |
36 | 42 } |
43 | |
44 public UnitEquipmentItem Item | |
45 { | |
46 get { return item; } | |
47 } | |
48 } | |
8
755e60be28be
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
49 } |