Mercurial > repos > IBBoard.WarFoundry.API
comparison API/Objects/Army.cs @ 414:3f297a60db1e
Re #101: Make army names and sizes modifiable after creation
* Add "size changed" event
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 29 Aug 2011 20:57:47 +0100 |
parents | 1a70ca80ef41 |
children | 314b8b8bf4f1 |
comparison
equal
deleted
inserted
replaced
413:48098a2d17d0 | 414:3f297a60db1e |
---|---|
25 private double pointsTotal; | 25 private double pointsTotal; |
26 private Dictionary<Category, ArmyCategory> categories; | 26 private Dictionary<Category, ArmyCategory> categories; |
27 | 27 |
28 public event ObjectAddDelegate UnitAdded; | 28 public event ObjectAddDelegate UnitAdded; |
29 public event ObjectRemoveDelegate UnitRemoved; | 29 public event ObjectRemoveDelegate UnitRemoved; |
30 public event IntValChangedDelegate MaxPointsValueChanged; | |
30 public event DoubleValChangedDelegate PointsValueChanged; | 31 public event DoubleValChangedDelegate PointsValueChanged; |
31 private DoubleValChangedDelegate PointsValueChangedMethod; | 32 private DoubleValChangedDelegate PointsValueChangedMethod; |
32 | 33 |
33 public Army(Race race, string armyName, int maxArmyPoints) : this(race, armyName, maxArmyPoints, null) | 34 public Army(Race race, string armyName, int maxArmyPoints) : this(race, armyName, maxArmyPoints, null) |
34 { | 35 { |
181 get { return maxPoints; } | 182 get { return maxPoints; } |
182 set | 183 set |
183 { | 184 { |
184 if (value > 0) | 185 if (value > 0) |
185 { | 186 { |
187 int oldPoints = maxPoints; | |
186 maxPoints = value; | 188 maxPoints = value; |
189 | |
190 if (MaxPointsValueChanged != null) | |
191 { | |
192 MaxPointsValueChanged(this, oldPoints, maxPoints); | |
193 } | |
187 } | 194 } |
188 } | 195 } |
189 } | 196 } |
190 | 197 |
191 private void PointsValueChangedHandler(WarFoundryObject obj, double oldVal, double newVal) | 198 private void PointsValueChangedHandler(WarFoundryObject obj, double oldVal, double newVal) |