Mercurial > repos > IBBoard.WarFoundry.API
comparison api/Commands/RemoveUnitCommand.cs @ 215:391446c9b250
Re #223: Use translations within the API
* Translate and cache undo/redo descriptions of commands
* Simplify "set equipment amount" descriptions because of ticket:224
Also:
* Line ending change on ICostedWarFoundryObject
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 22 Nov 2009 20:08:45 +0000 |
parents | 2f3cafb69799 |
children | 650bbe79b884 |
comparison
equal
deleted
inserted
replaced
214:1b718b67f7f6 | 215:391446c9b250 |
---|---|
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 IBBoard.Commands; | 6 using IBBoard.Commands; |
7 using IBBoard.Lang; | |
7 using IBBoard.WarFoundry.API.Objects; | 8 using IBBoard.WarFoundry.API.Objects; |
8 | 9 |
9 namespace IBBoard.WarFoundry.API.Commands | 10 namespace IBBoard.WarFoundry.API.Commands |
10 { | 11 { |
11 /// <summary> | 12 /// <summary> |
13 /// </summary> | 14 /// </summary> |
14 public class RemoveUnitCommand : Command | 15 public class RemoveUnitCommand : Command |
15 { | 16 { |
16 private Unit unit; | 17 private Unit unit; |
17 private ArmyCategory cat; | 18 private ArmyCategory cat; |
19 private string description; | |
20 private string undoDescription; | |
18 | 21 |
19 public RemoveUnitCommand(Unit toRemove) | 22 public RemoveUnitCommand(Unit toRemove) |
20 { | 23 { |
21 unit = toRemove; | 24 unit = toRemove; |
22 cat = unit.Category; | 25 cat = unit.Category; |
27 return (unit!=null); | 30 return (unit!=null); |
28 } | 31 } |
29 | 32 |
30 public override string Description | 33 public override string Description |
31 { | 34 { |
32 get { return "Remove an existing unit from the army"; } | 35 get |
36 { | |
37 if (description == null) | |
38 { | |
39 description = Translation.GetTranslation("removeUnitCommandDescription", "remove {0} from the army", unit.Name); | |
40 } | |
41 | |
42 return description; | |
43 } | |
33 } | 44 } |
34 | 45 |
35 public override string UndoDescription | 46 public override string UndoDescription |
36 { | 47 { |
37 get { return "Replace a removed unit"; } | 48 get |
49 { | |
50 if (undoDescription == null) | |
51 { | |
52 undoDescription = Translation.GetTranslation("removeUnitCommandUndoDescription", "re-add {0} to the army", unit.Name); | |
53 } | |
54 | |
55 return undoDescription; | |
56 } | |
38 } | 57 } |
39 | 58 |
40 public override bool Execute() | 59 public override bool Execute() |
41 { | 60 { |
42 this.Redo(); | 61 this.Redo(); |