|
5 | 5 |
|
6 | 6 | namespace EliteVA.Variables; |
7 | 7 |
|
8 | | -public class VoiceAttackVariables |
| 8 | +public class VoiceAttackVariables(dynamic vaProxy) |
9 | 9 | { |
10 | | - private readonly dynamic _proxy; |
11 | | - |
12 | 10 | public record Variable(string Name, dynamic Value, TypeCode Type); |
13 | 11 |
|
14 | | - private List<Variable> _setVariables; |
| 12 | + private List<Variable> _setVariables = []; |
15 | 13 |
|
16 | 14 | public IReadOnlyList<Variable> SetVariables => _setVariables.ToList(); |
17 | 15 |
|
18 | 16 | public event EventHandler? OnVariablesSet; |
19 | 17 |
|
20 | | - public VoiceAttackVariables(dynamic vaProxy) |
21 | | - { |
22 | | - _proxy = vaProxy; |
23 | | - _setVariables = []; |
24 | | - } |
25 | | - |
26 | 18 | public void ClearStartingWith(string name) |
27 | 19 | { |
28 | 20 | var variablesToClear = _setVariables.Where(x => x.Name.StartsWith(name)).ToList(); |
@@ -169,104 +161,104 @@ public void Clear(string name, TypeCode code) |
169 | 161 |
|
170 | 162 | private short? GetShort(string name) |
171 | 163 | { |
172 | | - return _proxy.GetSmallInt(name); |
| 164 | + return vaProxy.GetSmallInt(name); |
173 | 165 | } |
174 | 166 |
|
175 | 167 | private int? GetInt(string name) |
176 | 168 | { |
177 | | - return _proxy.GetInt(name); |
| 169 | + return vaProxy.GetInt(name); |
178 | 170 | } |
179 | 171 |
|
180 | 172 | private string GetText(string name) |
181 | 173 | { |
182 | | - return _proxy.GetText(name); |
| 174 | + return vaProxy.GetText(name); |
183 | 175 | } |
184 | 176 |
|
185 | 177 | private decimal? GetDecimal(string name) |
186 | 178 | { |
187 | | - return _proxy.GetDecimal(name); |
| 179 | + return vaProxy.GetDecimal(name); |
188 | 180 | } |
189 | 181 |
|
190 | 182 | private bool? GetBoolean(string name) |
191 | 183 | { |
192 | | - return _proxy.GetBoolean(name); |
| 184 | + return vaProxy.GetBoolean(name); |
193 | 185 | } |
194 | 186 |
|
195 | 187 | private DateTime? GetDate(string name) |
196 | 188 | { |
197 | | - return _proxy.GetDate(name); |
| 189 | + return vaProxy.GetDate(name); |
198 | 190 | } |
199 | 191 |
|
200 | 192 | private void SetShort(string name, short? value) |
201 | 193 | { |
202 | 194 | SetVariable(name, value, TypeCode.Int16); |
203 | | - _proxy.SetSmallInt(name, value); |
| 195 | + vaProxy.SetSmallInt(name, value); |
204 | 196 | } |
205 | 197 |
|
206 | 198 | private void ClearShort(string name) |
207 | 199 | { |
208 | 200 | ClearVariable(name); |
209 | | - _proxy.SetSmallInt(name, null); |
| 201 | + vaProxy.SetSmallInt(name, null); |
210 | 202 | } |
211 | 203 |
|
212 | 204 | private void SetInt(string name, int? value) |
213 | 205 | { |
214 | 206 | SetVariable(name, value, TypeCode.Int32); |
215 | | - _proxy.SetInt(name, value); |
| 207 | + vaProxy.SetInt(name, value); |
216 | 208 | } |
217 | 209 |
|
218 | 210 | private void ClearInt(string name) |
219 | 211 | { |
220 | 212 | ClearVariable(name); |
221 | | - _proxy.SetInt(name, null); |
| 213 | + vaProxy.SetInt(name, null); |
222 | 214 | } |
223 | 215 |
|
224 | 216 | private void SetText(string name, string value) |
225 | 217 | { |
226 | 218 | SetVariable(name, value, TypeCode.String); |
227 | | - _proxy.SetText(name, value); |
| 219 | + vaProxy.SetText(name, value); |
228 | 220 | } |
229 | 221 |
|
230 | 222 | private void ClearText(string name) |
231 | 223 | { |
232 | 224 | ClearVariable(name); |
233 | | - _proxy.SetText(name, null); |
| 225 | + vaProxy.SetText(name, null); |
234 | 226 | } |
235 | 227 |
|
236 | 228 | private void SetDecimal(string name, decimal? value) |
237 | 229 | { |
238 | 230 | SetVariable(name, value, TypeCode.Decimal); |
239 | | - _proxy.SetDecimal(name, value); |
| 231 | + vaProxy.SetDecimal(name, value); |
240 | 232 | } |
241 | 233 |
|
242 | 234 | private void ClearDecimal(string name) |
243 | 235 | { |
244 | 236 | ClearVariable(name); |
245 | | - _proxy.SetDecimal(name, null); |
| 237 | + vaProxy.SetDecimal(name, null); |
246 | 238 | } |
247 | 239 |
|
248 | 240 | private void SetBoolean(string name, bool? value) |
249 | 241 | { |
250 | 242 | SetVariable(name, value, TypeCode.Boolean); |
251 | | - _proxy.SetBoolean(name, value); |
| 243 | + vaProxy.SetBoolean(name, value); |
252 | 244 | } |
253 | 245 |
|
254 | 246 | private void ClearBoolean(string name) |
255 | 247 | { |
256 | 248 | ClearVariable(name); |
257 | | - _proxy.SetBoolean(name, null); |
| 249 | + vaProxy.SetBoolean(name, null); |
258 | 250 | } |
259 | 251 |
|
260 | 252 | private void SetDate(string name, DateTime? value) |
261 | 253 | { |
262 | 254 | SetVariable(name, value, TypeCode.DateTime); |
263 | | - _proxy.SetDate(name, value); |
| 255 | + vaProxy.SetDate(name, value); |
264 | 256 | } |
265 | 257 |
|
266 | 258 | private void ClearDate(string name) |
267 | 259 | { |
268 | 260 | ClearVariable(name); |
269 | | - _proxy.SetDate(name, null); |
| 261 | + vaProxy.SetDate(name, null); |
270 | 262 | } |
271 | 263 |
|
272 | 264 | private void SetVariable(string name, dynamic? value, TypeCode type) |
|
0 commit comments