Mercurial > repos > IBBoard.WarFoundry.API
comparison api/Commands/SetUnitSizeCommand.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 |
---|---|
14 /// </summary> | 14 /// </summary> |
15 public class SetUnitSizeCommand : Command | 15 public class SetUnitSizeCommand : Command |
16 { | 16 { |
17 private Unit unit; | 17 private Unit unit; |
18 private int newSize, oldSize; | 18 private int newSize, oldSize; |
19 private string description; | |
20 private string undoDescription; | |
21 | 19 |
22 public SetUnitSizeCommand(Unit toResize, int size) | 20 public SetUnitSizeCommand(Unit toResize, int size) |
23 { | 21 { |
24 unit = toResize; | 22 unit = toResize; |
25 newSize = size; | 23 newSize = size; |
26 oldSize = unit.Size; | 24 oldSize = unit.Size; |
27 } | 25 } |
28 | 26 |
29 public override bool CanExecute() | 27 public override bool CanExecute() |
30 { | 28 { |
31 return (unit!=null && newSize >0 && oldSize > 0); | 29 return (unit != null && newSize > 0 && oldSize > 0); |
32 } | 30 } |
33 | 31 |
34 public override string Description | 32 public override string Description |
35 { | 33 { |
36 get | 34 get |
37 { | 35 { |
38 if (description == null) | 36 return Translation.GetTranslation("setUnitSizeCommandDescription", "set size of {0} to {1}", unit.Name, newSize); |
39 { | |
40 description = Translation.GetTranslation("setUnitSizeCommandDescription", "set size of {0} to {1}", unit.Name, newSize); | |
41 } | |
42 | |
43 return description; | |
44 } | 37 } |
45 } | 38 } |
46 | 39 |
47 public override string UndoDescription | 40 public override string UndoDescription |
48 { | 41 { |
49 get | 42 get |
50 { | 43 { |
51 if (undoDescription == null) | 44 return Translation.GetTranslation("setUnitSizeCommandUndoDescription", "set size of {0} to {1}", unit.Name, oldSize); |
52 { | |
53 undoDescription = Translation.GetTranslation("setUnitSizeCommandUndoDescription", "set size of {0} to {1}", unit.Name, oldSize); | |
54 } | |
55 | |
56 return undoDescription; | |
57 } | 45 } |
58 } | 46 } |
59 | 47 |
60 public override bool Execute() | 48 public override bool Execute() |
61 { | 49 { |