Changeset 146 for IBBoard.WarFoundry.API/trunk/api/Objects/ArmyCategory.cs
- Timestamp:
- 06/27/09 14:39:04 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
IBBoard.WarFoundry.API/trunk/api/Objects/ArmyCategory.cs
r143 r146 23 23 public event ObjectAddDelegate UnitAdded; 24 24 public event ObjectRemoveDelegate UnitRemoved; 25 public event FailedUnitRequirementDelegate FailedRequirement; 25 26 26 27 public ArmyCategory(Army army, Category cat) : base() … … 75 76 unitTypes[unit.UnitType.ID] = (int)unitTypeCount + 1; 76 77 TotalPoints+= unit.PointsValue; 77 OnUnitAdded(unit );78 OnUnitAdded(unit, failedReqs); 78 79 } 79 80 80 81 internal void RemoveUnit(Unit unit) 81 82 { 83 List<FailedUnitRequirement> failedReqs = ParentArmy.CanRemoveUnit(unit); 82 84 units.Remove(unit); 83 85 unitTypes[unit.UnitType.ID] = ((int)unitTypes[unit.UnitType.ID])-1; 84 86 TotalPoints-= unit.PointsValue; 85 87 unit.PointsValueChanged-= PointsValueChangedMethod; 86 OnUnitRemoved(unit );88 OnUnitRemoved(unit, failedReqs); 87 89 } 88 90 … … 126 128 } 127 129 128 pr ivatevoid OnUnitAdded(Unit unit)130 protected void OnUnitAdded(Unit unit) 129 131 { 130 if (UnitAdded!=null) 132 OnUnitAdded(unit, null); 133 } 134 135 protected void OnUnitAdded(Unit unit, List<FailedUnitRequirement> failedReqs) 136 { 137 if (UnitAdded != null) 131 138 { 132 139 UnitAdded(unit); 133 140 } 141 142 if (FailedRequirement != null && failedReqs != null && failedReqs.Count > 0) 143 { 144 FailedRequirement(failedReqs); 145 } 134 146 } 135 147 136 pr ivatevoid OnUnitRemoved(Unit unit)148 protected void OnUnitRemoved(Unit unit) 137 149 { 138 if (UnitRemoved!=null) 150 OnUnitRemoved(unit, null); 151 } 152 153 protected void OnUnitRemoved(Unit unit, List<FailedUnitRequirement> failedReqs) 154 { 155 if (UnitRemoved != null) 139 156 { 140 157 UnitRemoved(unit); 158 } 159 160 if (FailedRequirement != null && failedReqs != null && failedReqs.Count > 0) 161 { 162 FailedRequirement(failedReqs); 141 163 } 142 164 }
WarFoundry - Development