comparison api/Objects/Category.cs @ 0:520818033bb6

Initial commit of WarFoundry code
author IBBoard <dev@ibboard.co.uk>
date Fri, 19 Dec 2008 15:57:51 +0000
parents
children 613bc5eaac59
comparison
equal deleted inserted replaced
-1:000000000000 0:520818033bb6
1 using System;
2 using System.Xml;
3
4 namespace IBBoard.WarFoundry.API.Objects
5 {
6 /// <summary>
7 /// Summary description for Category.
8 /// </summary>
9 public class Category : WarFoundryObject
10 {
11 private int minPts, maxPts, minPc, maxPc, minChoice, maxChoice, baseVal, incVal, incAmount;
12 /*private GameSystem system;*/
13
14 public Category(string id, string name, int minPoints, int maxPoints, int minPercent, int maxPercent, int minChoices, int maxChoices, int baseValue, int incrementValue, int incrementAmount) : base(id, name)
15 {
16 minPts = minPoints;
17 maxPts = maxPoints;
18 minPc = minPercent;
19 maxPc = maxPercent;
20 baseVal = baseValue;
21 incVal = incrementValue;
22 incAmount = incrementAmount;
23 }
24
25 /*public Category(XmlElement node, GameSystem gameSystem, AbstractNativeWarFoundryFactory factory) : base(factory)
26 {
27 //system = gameSystem;
28 ID = node.GetAttribute("id");
29 Name = node.GetAttribute("name");
30
31 try
32 {
33 min = int.Parse(node.GetAttribute("minimum"));
34 }
35 catch(FormatException)
36 {
37 throw new FormatException("Attribute 'minimum' of category "+id+" was not a valid number");
38 }
39
40 try
41 {
42 max = int.Parse(node.GetAttribute("maximum"));
43 }
44 catch(FormatException)
45 {
46 throw new FormatException("Attribute 'maximum' of category "+id+" was not a valid number");
47 }
48
49 string val = "";
50 val = node.GetAttribute("baseValue");
51
52 if (val!="")
53 {
54 try
55 {
56 baseValue = int.Parse(val);
57
58 }
59 catch(FormatException)
60 {
61 throw new FormatException("Attribute 'baseValue' of category "+id+" was not a valid number");
62 }
63 }
64
65 val = node.GetAttribute("incValue");
66
67 if (val!="")
68 {
69 try
70 {
71 incValue = int.Parse(val);
72 }
73 catch(FormatException)
74 {
75 throw new FormatException("Attribute 'incValue' of category "+id+" was not a valid number");
76 }
77 }
78
79 val = node.GetAttribute("incAmount");
80
81 if (val!="")
82 {
83 try
84 {
85 incAmount = int.Parse(val);
86 }
87 catch(FormatException)
88 {
89 throw new FormatException("Attribute 'incAmount' of category "+id+" was not a valid number");
90 }
91 }
92 }*/
93
94 protected override string DefaultName()
95 {
96 return "";
97 }
98
99 /*public GameSystem GameSystem
100 {
101 get { return system; }
102 }*/
103
104 public int MinimumPoints
105 {
106 get { return minPts; }
107 set { minPts = value; }
108 }
109
110 public int MaximumPoints
111 {
112 get { return maxPts; }
113 set { maxPts = value; }
114 }
115
116 public int MinimumPercentage
117 {
118 get { return minPc; }
119 set { minPc = value; }
120 }
121
122 public int MaximumPercentage
123 {
124 get { return maxPc; }
125 set { maxPc = value; }
126 }
127
128 public int MinimumChoices
129 {
130 get { return minChoice; }
131 set { minChoice = value; }
132 }
133
134 public int MaximumChoices
135 {
136 get { return maxChoice; }
137 set { maxChoice = value; }
138 }
139
140 public int BaseValue
141 {
142 get { return baseVal; }
143 set { baseVal = value; }
144 }
145
146 public int IncrementValue
147 {
148 get { return incVal; }
149 set { incVal = value; }
150 }
151
152 public int IncrementAmount
153 {
154 get { return incAmount; }
155 set { incAmount = value; }
156 }
157 }
158 }