Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
annotate Util/UnitEquipmentChoice.cs @ 36:6ab7ddc038f9
Re #121: Move all code to AGPL
* Move all WinForms code to the GNU Affero General Public License
* fix some copyright dates
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 15 Aug 2009 10:15:00 +0000 |
parents | 3ceb0efd261f |
children | 1576f669b3eb |
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 System.Collections; | |
7 using IBBoard.WarFoundry.API.Objects; | |
8 | |
9 | |
10 | |
11 namespace IBBoard.WarFoundry.GUI.WinForms.Util | |
12 { | |
13 /// <summary> | |
14 /// A helper object that holds an equipment choice for a unit. | |
15 /// </summary> | |
16 | |
17 public class UnitEquipmentChoice | |
18 { | |
19 private Unit unit; | |
20 private UnitEquipmentItem item; | |
21 | |
22 private static Hashtable equipObjs = new Hashtable(); | |
23 | |
24 public UnitEquipmentChoice(Unit unit, UnitEquipmentItem unitItem) | |
25 { | |
26 this.unit = unit; | |
27 item = unitItem; | |
28 } | |
29 | |
30 public override string ToString() | |
31 { | |
32 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
|
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 |
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 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
|
36 { |
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 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
|
38 { |
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 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
|
40 } |
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 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
|
42 { |
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
|
43 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
|
44 } |
36 | 45 } |
46 | |
47 public UnitEquipmentItem Item | |
48 { | |
49 get { return item; } | |
50 } | |
51 } | |
8
755e60be28be
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
52 } |