comparison api/Requirements/UnitExcludesRequirement.cs @ 229:6083010a005c

Re #223: Use translations within the API * Update requirements to use translations * Remove duplicate classes
author IBBoard <dev@ibboard.co.uk>
date Mon, 21 Dec 2009 20:37:35 +0000
parents 2f3cafb69799
children
comparison
equal deleted inserted replaced
228:ece26f6a62f3 229:6083010a005c
2 // 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. 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 4
5 using System; 5 using System;
6 using System.Collections.Generic; 6 using System.Collections.Generic;
7 using System.Text;
7 using IBBoard.WarFoundry.API.Objects; 8 using IBBoard.WarFoundry.API.Objects;
9 using IBBoard.Lang;
8 10
9 namespace IBBoard.WarFoundry.API.Requirements 11 namespace IBBoard.WarFoundry.API.Requirements
10 { 12 {
11 /// <summary> 13 /// <summary>
12 /// Summary description for UnitExcludesRequirement. 14 /// Summary description for UnitExcludesRequirement.
22 24
23 public override string Description 25 public override string Description
24 { 26 {
25 get 27 get
26 { 28 {
27 return "Some units are already included that excluded this unit"; 29 string otherUnits = GetOtherUnitTypeNames();
30 return Translation.GetTranslation("requirementUnitExcludesDescription", "{0} can only be taken if none of the following are taken: {1}", unitType.Name, otherUnits);
28 } 31 }
32 }
33
34 private string GetOtherUnitTypeNames()
35 {
36 StringBuilder sb = new StringBuilder();
37
38 foreach (UnitRequirementItem req in excludingTypes)
39 {
40 sb.Append(req.UnitType.Name);
41 }
42
43 return sb.ToString();
29 } 44 }
30 45
31 protected override AbstractFailedRequirement CanAddToArmy(Army army, UnitType type) 46 protected override AbstractFailedRequirement CanAddToArmy(Army army, UnitType type)
32 { 47 {
33 FailedUnitRequirement failed = null; 48 FailedUnitRequirement failed = null;