Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
view 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 |
line wrap: on
line source
// This file (UnitEquipmentChoice.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2009 IBBoard. // // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. using System; using System.Collections; using IBBoard.WarFoundry.API.Objects; namespace IBBoard.WarFoundry.GUI.WinForms.Util { /// <summary> /// A helper object that holds an equipment choice for a unit. /// </summary> public class UnitEquipmentChoice { private Unit unit; private UnitEquipmentItem item; private static Hashtable equipObjs = new Hashtable(); public UnitEquipmentChoice(Unit unit, UnitEquipmentItem unitItem) { this.unit = unit; item = unitItem; } public override string ToString() { return String.Format("{0} (For {1} at {2}pts each)", item.Name, GetAmountString(), item.Cost); } private string GetAmountString() { if (unit.GetEquipmentAmountIsRatio(item)) { return UnitEquipmentRatioSelection.GetEquipmentAmountString(unit.GetEquipmentAmount(item)); } else { return UnitEquipmentNumericSelection.GetEquipmentAmountString(unit.GetEquipmentAmount(item)); } } public UnitEquipmentItem Item { get { return item; } } } }