Mercurial > repos > IBDev-IBBoard.WarFoundry.API
comparison api/Objects/Race.cs @ 54:3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
* Remove min/max from EquipmentItem and add description
* Add min/max numbers and percentages to UnitEquipmentItem
* Make Race schema define min/max number without the ratio (which is the percentage)
* Replace use of EquipmentItem with UnitEquipmentItem because of increased use of UnitEquipmentItem for unit-specific data
* Use doubles instead of floats for equipment amounts
* Distinguish between ratio and absolute limits
* Delete UnitEquipmentItemObj helper class that was purely used for UI
Re #9 - Use smaller methods
* Deprecate long Race and EquipmentItem constructors and ensure all getters/setters exist
Also:
* Migrate Unit to using genericed collections
* Always use GameSystem object for Race, not ID string
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 05 Apr 2009 13:45:23 +0000 |
parents | 85f2b9c3609c |
children | 9080366031c0 |
comparison
equal
deleted
inserted
replaced
53:1b35eed503ef | 54:3a90f70dac73 |
---|---|
14 public class Race : WarFoundryStagedLoadingObject | 14 public class Race : WarFoundryStagedLoadingObject |
15 { | 15 { |
16 public static string SYSTEM_DEFAULT_RACE_ID = "GameDefault"; | 16 public static string SYSTEM_DEFAULT_RACE_ID = "GameDefault"; |
17 | 17 |
18 private string subID; | 18 private string subID; |
19 private string systemID; | |
20 private GameSystem system; | 19 private GameSystem system; |
21 private Dictionary<Category, Dictionary<string, UnitType>> unitTypesByCat; | 20 private Dictionary<Category, Dictionary<string, UnitType>> unitTypesByCat; |
22 private Dictionary<string, UnitType> unitTypes = new Dictionary<string,UnitType>(); | 21 private Dictionary<string, UnitType> unitTypes = new Dictionary<string,UnitType>(); |
23 private Dictionary<string, EquipmentItem> equipment = new Dictionary<string,EquipmentItem>(); | 22 private Dictionary<string, EquipmentItem> equipment = new Dictionary<string,EquipmentItem>(); |
24 private Dictionary<string, Ability> abilities = new Dictionary<string,Ability>(); | 23 private Dictionary<string, Ability> abilities = new Dictionary<string,Ability>(); |
25 private Dictionary<string, Category> categories = new Dictionary<string,Category>(); | 24 private Dictionary<string, Category> categories = new Dictionary<string,Category>(); |
26 | 25 |
27 public Race(string raceID, string raceName, string gameSystemID, IWarFoundryFactory creatingFactory) : this(raceID, "", raceName, gameSystemID, creatingFactory) | 26 public Race(string raceID, string raceName, GameSystem gameSystem, IWarFoundryFactory creatingFactory) : this(raceID, "", raceName, gameSystem, creatingFactory) |
28 { | 27 { |
29 } | 28 } |
30 | 29 |
31 public Race(string raceID, string raceSubID, string raceName, string gameSystemID, IWarFoundryFactory creatingFactory) : base(raceID + (raceSubID!="" ? "_"+raceSubID : ""), raceName, creatingFactory) | 30 public Race(string raceID, string raceSubID, string raceName, GameSystem gameSystem, IWarFoundryFactory creatingFactory) : base(raceID + (raceSubID!="" ? "_"+raceSubID : ""), raceName, creatingFactory) |
32 { | 31 { |
33 subID = (raceSubID == null ? "" : raceSubID); | 32 subID = (raceSubID == null ? "" : raceSubID); |
34 systemID = gameSystemID; | 33 system = gameSystem; |
34 } | |
35 | |
36 [Obsolete("Use constructor with GameSystem argument instead")] | |
37 public Race(string raceID, string raceName, string gameSystemID, IWarFoundryFactory creatingFactory) : this(raceID, "", raceName, WarFoundryLoader.GetDefault().GetGameSystem(gameSystemID), creatingFactory) | |
38 { | |
39 } | |
40 | |
41 [Obsolete("Use constructor with GameSystem argument instead")] | |
42 public Race(string raceID, string raceSubID, string raceName, string gameSystemID, IWarFoundryFactory creatingFactory) : this(raceID, raceSubID, raceName, WarFoundryLoader.GetDefault().GetGameSystem(gameSystemID), creatingFactory) | |
43 { | |
35 } | 44 } |
36 | 45 |
37 public string SubID | 46 public string SubID |
38 { | 47 { |
39 get { return subID; } | 48 get { return subID; } |
40 set { subID = (value == null ? "" : value.Trim()); } | 49 set { subID = (value == null ? "" : value.Trim()); } |
41 } | 50 } |
42 | 51 |
43 public GameSystem GameSystem | 52 public GameSystem GameSystem |
44 { | 53 { |
45 get | 54 get { return system; } |
46 { | |
47 if (system == null) | |
48 { | |
49 system = WarFoundryLoader.GetDefault().GetGameSystem(systemID); | |
50 } | |
51 | |
52 return system; | |
53 } | |
54 set | 55 set |
55 { | 56 { |
56 if (value == null) | 57 if (value == null) |
57 { | 58 { |
58 throw new ArgumentException("Game system for a race cannot be null"); | 59 throw new ArgumentException("Game system for a race cannot be null"); |