Mercurial > repos > IBBoard.WarFoundry.API
comparison api/Commands/CreateAndAddUnitCommand.cs @ 298:483b491d18f4
Fixes #337: Merge API v0.1.1 changes into v0.2
* Merge translation-related changes from v0.1.1 branch
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 17 Jan 2011 20:02:41 +0000 |
parents | 391446c9b250 |
children |
comparison
equal
deleted
inserted
replaced
297:349e521785c1 | 298:483b491d18f4 |
---|---|
12 public class CreateAndAddUnitCommand : Command | 12 public class CreateAndAddUnitCommand : Command |
13 { | 13 { |
14 private UnitType addedUnitType; | 14 private UnitType addedUnitType; |
15 private ArmyCategory armyCat; | 15 private ArmyCategory armyCat; |
16 private Unit addedUnit; | 16 private Unit addedUnit; |
17 private string description; | 17 |
18 private string undoDescription; | |
19 | |
20 public CreateAndAddUnitCommand(UnitType toAdd, ArmyCategory armyCatTo) | 18 public CreateAndAddUnitCommand(UnitType toAdd, ArmyCategory armyCatTo) |
21 { | 19 { |
22 addedUnitType = toAdd; | 20 addedUnitType = toAdd; |
23 armyCat = armyCatTo; | 21 armyCat = armyCatTo; |
24 } | 22 } |
25 | 23 |
26 public override bool CanExecute() | 24 public override bool CanExecute() |
27 { | 25 { |
28 return (addedUnitType!=null && armyCat!=null); | 26 return (addedUnitType != null && armyCat != null); |
29 } | 27 } |
30 | 28 |
31 public override string Description | 29 public override string Description |
32 { | 30 { |
33 get | 31 get |
34 { | 32 { |
35 if (description == null) | 33 return Translation.GetTranslation("createAndAddUnitCommandDescription", "add unit of {0} to the army", addedUnitType.Name); |
36 { | |
37 description = Translation.GetTranslation("createAndAddUnitCommandDescription", "add unit of {0} to the army", addedUnitType.Name); | |
38 } | |
39 | |
40 return description; | |
41 } | 34 } |
42 } | 35 } |
43 | 36 |
44 public override string UndoDescription | 37 public override string UndoDescription |
45 { | 38 { |
46 get | 39 get |
47 { | 40 { |
48 if (undoDescription == null) | 41 return Translation.GetTranslation("createAndAddUnitCommandUndoDescription", "remove unit of {0} from army", addedUnitType.Name); |
49 { | |
50 undoDescription = Translation.GetTranslation("createAndAddUnitCommandUndoDescription", "remove unit of {0} from army", addedUnitType.Name); | |
51 } | |
52 | |
53 return undoDescription; | |
54 } | 42 } |
55 } | 43 } |
56 | 44 |
57 public override bool Execute() | 45 public override bool Execute() |
58 { | 46 { |