Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
annotate FrmUnit.cs @ 5:26fc79eeda37
Fixes #31 - Add log4net logging to WinForms interface
* Reference IBBoard.Log4Net project
* Register notify handler in main form
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 01 Mar 2009 15:27:12 +0000 |
parents | 8935971e307c |
children | 755e60be28be |
rev | line source |
---|---|
3
8935971e307c
Fixes #1 - Correctly license code
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
1 // This file (FrmUnit.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2009 IBBoard. |
8935971e307c
Fixes #1 - Correctly license code
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
2 // |
8935971e307c
Fixes #1 - Correctly license code
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
3 // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. |
8935971e307c
Fixes #1 - Correctly license code
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
4 |
0 | 5 using System; |
6 using System.Drawing; | |
7 using System.Data; | |
8 using System.Collections; | |
9 using System.ComponentModel; | |
10 using System.Windows.Forms; | |
11 using IBBoard.Commands; | |
12 using IBBoard.Windows.Forms; | |
13 using IBBoard.WarFoundry.API; | |
14 using IBBoard.WarFoundry.API.Commands; | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
15 using IBBoard.WarFoundry.API.Objects; |
0 | 16 |
17 namespace IBBoard.WarFoundry | |
18 { | |
19 ///TODO: Separate weapons out into optional and required, where required only has button for replacing | |
20 | |
21 /// <summary> | |
22 /// Summary description for FrmUnit. | |
23 /// </summary> | |
24 public class FrmUnit : IBBoard.Windows.Forms.IBBForm | |
25 { | |
26 private Unit unit; | |
27 private CommandStack commandStack; | |
28 private System.Windows.Forms.DataGrid statsGrid; | |
29 private System.Windows.Forms.TextBox tbUnitName; | |
30 private System.Windows.Forms.NumericUpDown unitSize; | |
31 private System.Windows.Forms.Label lblUnitSize; | |
32 private System.Windows.Forms.Button bttnAddWeapon; | |
33 private System.Windows.Forms.Button bttnRemoveWeapon; | |
34 private System.Windows.Forms.Button bttnEditWeapon; | |
35 private System.Windows.Forms.Label lblRequiredEquip; | |
36 private System.Windows.Forms.ListBox reqdList; | |
37 private System.Windows.Forms.ListBox optList; | |
38 private System.Windows.Forms.Label lblOptionalEquip; | |
39 private System.Windows.Forms.Button bttnReplaceWeapon; | |
40 private System.Windows.Forms.Button bttnEditReqdWeapon; | |
41 /// <summary> | |
42 /// Required designer variable. | |
43 /// </summary> | |
44 private System.ComponentModel.Container components = null; | |
45 | |
46 public FrmUnit(Unit toDisplay, CommandStack cmdStack) | |
47 { | |
48 unit = toDisplay; | |
49 commandStack = cmdStack; | |
50 // | |
51 // Required for Windows Form Designer support | |
52 // | |
53 InitializeComponent(); | |
54 | |
55 tbUnitName.Text = unit.Name; | |
56 Text = unit.Name; | |
57 unit.NameChanged+=new StringValChangedDelegate(unit_NameChanged); | |
58 unit.UnitSizeChanged+= new IntValChangedDelegate(unit_UnitSizeChanged); | |
59 unit.UnitEquipmentAmountChanged+=new FloatValChangedDelegate(unit_UnitEquipmentAmountChanged); | |
60 | |
61 if (unit.UnitType.MaxSize==unit.UnitType.MinSize) | |
62 { | |
63 unitSize.Value = unit.UnitType.MaxSize; | |
64 unitSize.Visible = false; | |
65 lblUnitSize.Visible = false; | |
66 } | |
67 else | |
68 { | |
69 unitSize.Value = unit.Size; | |
70 unitSize.Maximum = (unit.UnitType.MaxSize == -1 ? int.MaxValue : unit.UnitType.MaxSize); | |
71 unitSize.Minimum = unit.UnitType.MinSize; | |
72 } | |
73 | |
74 setStats(); | |
75 setWeapons(); | |
76 } | |
77 | |
78 private void setStats() | |
79 { | |
80 GameSystem system = unit.Army.GameSystem; | |
81 SystemStats stats = system.StandardSystemStats; | |
82 | |
83 DataTable dt = new DataTable(); | |
84 DataColumn[] dc = new DataColumn[stats.SlotCount+1]; | |
85 dc[0] = new DataColumn("name"); | |
86 | |
87 DataGridTableStyle dgStyle = new DataGridTableStyle(); | |
88 dgStyle.RowHeadersVisible = false; | |
89 | |
90 DataGridTextBoxColumn colStyle = new DataGridTextBoxColumn(); | |
91 colStyle.Width = statsGrid.ClientSize.Width - (stats.SlotCount * 40) - 4; | |
92 colStyle.MappingName = "name"; | |
93 colStyle.HeaderText = "name"; | |
94 colStyle.ReadOnly = true; | |
95 dgStyle.GridColumnStyles.Add(colStyle); | |
96 | |
97 DataColumn tempCol; | |
98 int i = 1; | |
99 | |
100 foreach (StatSlot stat in stats.StatSlots) | |
101 { | |
102 tempCol = new DataColumn(stat.Name); | |
103 dc[i] = tempCol; | |
104 colStyle = new DataGridTextBoxColumn(); | |
105 colStyle.Alignment = HorizontalAlignment.Center; | |
106 colStyle.Width = 40; | |
107 colStyle.MappingName = stat.Name; | |
108 colStyle.HeaderText = stat.Name; | |
109 colStyle.ReadOnly = true; | |
110 dgStyle.GridColumnStyles.Add(colStyle); | |
111 i++; | |
112 } | |
113 | |
114 dt.Columns.AddRange(dc); | |
115 | |
116 DataRow dr = dt.NewRow(); | |
117 dr.ItemArray = unit.UnitStats.StatsArray; | |
118 dt.Rows.Add(dr); | |
119 statsGrid.DataSource = dt; | |
120 statsGrid.TableStyles.Add(dgStyle); | |
121 } | |
122 | |
123 private void setWeapons() | |
124 { | |
125 foreach(UnitEquipmentItem item in unit.GetEquipment()) | |
126 { | |
127 if (item.IsRequired) | |
128 { | |
129 reqdList.Items.Add(UnitEquipmentItemObj.GetEquipObj(Unit, item)); | |
130 } | |
131 else | |
132 { | |
133 optList.Items.Add(UnitEquipmentItemObj.GetEquipObj(Unit, item)); | |
134 } | |
135 } | |
136 } | |
137 | |
138 /// <summary> | |
139 /// Clean up any resources being used. | |
140 /// </summary> | |
141 protected override void Dispose( bool disposing ) | |
142 { | |
143 //remove our leave events so that disposing doesn't trigger them | |
144 tbUnitName.Leave-= new System.EventHandler(this.tbUnitName_Leave); | |
145 unitSize.Leave-= new System.EventHandler(this.unitSize_Leave); | |
146 | |
147 if( disposing ) | |
148 { | |
149 if(components != null) | |
150 { | |
151 components.Dispose(); | |
152 } | |
153 } | |
154 base.Dispose( disposing ); | |
155 } | |
156 | |
157 #region Windows Form Designer generated code | |
158 /// <summary> | |
159 /// Required method for Designer support - do not modify | |
160 /// the contents of this method with the code editor. | |
161 /// </summary> | |
162 private void InitializeComponent() | |
163 { | |
164 this.statsGrid = new System.Windows.Forms.DataGrid(); | |
165 this.tbUnitName = new System.Windows.Forms.TextBox(); | |
166 this.unitSize = new System.Windows.Forms.NumericUpDown(); | |
167 this.lblUnitSize = new System.Windows.Forms.Label(); | |
168 this.lblRequiredEquip = new System.Windows.Forms.Label(); | |
169 this.bttnAddWeapon = new System.Windows.Forms.Button(); | |
170 this.bttnRemoveWeapon = new System.Windows.Forms.Button(); | |
171 this.reqdList = new System.Windows.Forms.ListBox(); | |
172 this.bttnEditWeapon = new System.Windows.Forms.Button(); | |
173 this.optList = new System.Windows.Forms.ListBox(); | |
174 this.lblOptionalEquip = new System.Windows.Forms.Label(); | |
175 this.bttnReplaceWeapon = new System.Windows.Forms.Button(); | |
176 this.bttnEditReqdWeapon = new System.Windows.Forms.Button(); | |
177 ((System.ComponentModel.ISupportInitialize)(this.statsGrid)).BeginInit(); | |
178 ((System.ComponentModel.ISupportInitialize)(this.unitSize)).BeginInit(); | |
179 this.SuspendLayout(); | |
180 // | |
181 // statsGrid | |
182 // | |
183 this.statsGrid.AllowNavigation = false; | |
184 this.statsGrid.AllowSorting = false; | |
185 this.statsGrid.AlternatingBackColor = System.Drawing.SystemColors.Control; | |
186 this.statsGrid.BackgroundColor = System.Drawing.SystemColors.Control; | |
187 this.statsGrid.CaptionVisible = false; | |
188 this.statsGrid.DataMember = ""; | |
189 this.statsGrid.GridLineColor = System.Drawing.SystemColors.ControlDarkDark; | |
190 this.statsGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText; | |
191 this.statsGrid.Location = new System.Drawing.Point(8, 32); | |
192 this.statsGrid.Name = "statsGrid"; | |
193 this.statsGrid.PreferredColumnWidth = 40; | |
194 this.statsGrid.ReadOnly = true; | |
195 this.statsGrid.RowHeadersVisible = false; | |
196 this.statsGrid.SelectionBackColor = System.Drawing.SystemColors.Control; | |
197 this.statsGrid.SelectionForeColor = System.Drawing.SystemColors.WindowText; | |
198 this.statsGrid.Size = new System.Drawing.Size(600, 88); | |
199 this.statsGrid.TabIndex = 0; | |
200 this.statsGrid.TabStop = false; | |
201 // | |
202 // tbUnitName | |
203 // | |
204 this.tbUnitName.Location = new System.Drawing.Point(8, 8); | |
205 this.tbUnitName.Name = "tbUnitName"; | |
206 this.tbUnitName.Size = new System.Drawing.Size(344, 20); | |
207 this.tbUnitName.TabIndex = 1; | |
208 this.tbUnitName.Text = ""; | |
209 this.tbUnitName.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbUnitName_KeyDown); | |
210 this.tbUnitName.Leave += new System.EventHandler(this.tbUnitName_Leave); | |
211 // | |
212 // unitSize | |
213 // | |
214 this.unitSize.Location = new System.Drawing.Point(528, 8); | |
215 this.unitSize.Name = "unitSize"; | |
216 this.unitSize.Size = new System.Drawing.Size(80, 20); | |
217 this.unitSize.TabIndex = 1; | |
218 this.unitSize.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; | |
219 this.unitSize.Value = new System.Decimal(new int[] { | |
220 1, | |
221 0, | |
222 0, | |
223 0}); | |
224 this.unitSize.KeyDown += new System.Windows.Forms.KeyEventHandler(this.unitSize_KeyDown); | |
225 this.unitSize.Leave += new System.EventHandler(this.unitSize_Leave); | |
226 // | |
227 // lblUnitSize | |
228 // | |
229 this.lblUnitSize.Location = new System.Drawing.Point(424, 8); | |
230 this.lblUnitSize.Name = "lblUnitSize"; | |
231 this.lblUnitSize.TabIndex = 0; | |
232 this.lblUnitSize.Text = "unit size"; | |
233 this.lblUnitSize.TextAlign = System.Drawing.ContentAlignment.TopRight; | |
234 // | |
235 // lblRequiredEquip | |
236 // | |
237 this.lblRequiredEquip.Location = new System.Drawing.Point(8, 128); | |
238 this.lblRequiredEquip.Name = "lblRequiredEquip"; | |
239 this.lblRequiredEquip.Size = new System.Drawing.Size(88, 32); | |
240 this.lblRequiredEquip.TabIndex = 3; | |
241 this.lblRequiredEquip.Text = "reqd equipment"; | |
242 this.lblRequiredEquip.TextAlign = System.Drawing.ContentAlignment.TopRight; | |
243 // | |
244 // bttnAddWeapon | |
245 // | |
246 this.bttnAddWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; | |
247 this.bttnAddWeapon.Location = new System.Drawing.Point(520, 200); | |
248 this.bttnAddWeapon.Name = "bttnAddWeapon"; | |
249 this.bttnAddWeapon.Size = new System.Drawing.Size(88, 22); | |
250 this.bttnAddWeapon.TabIndex = 4; | |
251 this.bttnAddWeapon.Text = "add"; | |
252 this.bttnAddWeapon.Click += new System.EventHandler(this.bttnAddWeapon_Click); | |
253 // | |
254 // bttnRemoveWeapon | |
255 // | |
256 this.bttnRemoveWeapon.Enabled = false; | |
257 this.bttnRemoveWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; | |
258 this.bttnRemoveWeapon.Location = new System.Drawing.Point(520, 248); | |
259 this.bttnRemoveWeapon.Name = "bttnRemoveWeapon"; | |
260 this.bttnRemoveWeapon.Size = new System.Drawing.Size(88, 22); | |
261 this.bttnRemoveWeapon.TabIndex = 5; | |
262 this.bttnRemoveWeapon.Text = "remove"; | |
263 this.bttnRemoveWeapon.Click += new System.EventHandler(this.bttnRemoveWeapon_Click); | |
264 // | |
265 // reqdList | |
266 // | |
267 this.reqdList.Location = new System.Drawing.Point(104, 128); | |
268 this.reqdList.Name = "reqdList"; | |
269 this.reqdList.Size = new System.Drawing.Size(408, 69); | |
270 this.reqdList.TabIndex = 6; | |
271 this.reqdList.DoubleClick += new System.EventHandler(this.reqdList_DoubleClick); | |
272 this.reqdList.SelectedIndexChanged += new System.EventHandler(this.reqdList_SelectedIndexChanged); | |
273 // | |
274 // bttnEditWeapon | |
275 // | |
276 this.bttnEditWeapon.Enabled = false; | |
277 this.bttnEditWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; | |
278 this.bttnEditWeapon.Location = new System.Drawing.Point(520, 224); | |
279 this.bttnEditWeapon.Name = "bttnEditWeapon"; | |
280 this.bttnEditWeapon.Size = new System.Drawing.Size(88, 22); | |
281 this.bttnEditWeapon.TabIndex = 7; | |
282 this.bttnEditWeapon.Text = "edit"; | |
283 this.bttnEditWeapon.Click += new System.EventHandler(this.bttnEditWeapon_Click); | |
284 // | |
285 // optList | |
286 // | |
287 this.optList.Location = new System.Drawing.Point(104, 200); | |
288 this.optList.Name = "optList"; | |
289 this.optList.Size = new System.Drawing.Size(408, 69); | |
290 this.optList.TabIndex = 9; | |
291 this.optList.DoubleClick += new System.EventHandler(this.optList_DoubleClick); | |
292 this.optList.SelectedIndexChanged += new System.EventHandler(this.optList_SelectedIndexChanged); | |
293 // | |
294 // lblOptionalEquip | |
295 // | |
296 this.lblOptionalEquip.Location = new System.Drawing.Point(8, 200); | |
297 this.lblOptionalEquip.Name = "lblOptionalEquip"; | |
298 this.lblOptionalEquip.Size = new System.Drawing.Size(88, 32); | |
299 this.lblOptionalEquip.TabIndex = 8; | |
300 this.lblOptionalEquip.Text = "opt equipment"; | |
301 this.lblOptionalEquip.TextAlign = System.Drawing.ContentAlignment.TopRight; | |
302 // | |
303 // bttnReplaceWeapon | |
304 // | |
305 this.bttnReplaceWeapon.Enabled = false; | |
306 this.bttnReplaceWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; | |
307 this.bttnReplaceWeapon.Location = new System.Drawing.Point(520, 128); | |
308 this.bttnReplaceWeapon.Name = "bttnReplaceWeapon"; | |
309 this.bttnReplaceWeapon.Size = new System.Drawing.Size(88, 22); | |
310 this.bttnReplaceWeapon.TabIndex = 10; | |
311 this.bttnReplaceWeapon.Text = "replace"; | |
312 this.bttnReplaceWeapon.Click += new System.EventHandler(this.bttnReplaceWeapon_Click); | |
313 // | |
314 // bttnEditReqdWeapon | |
315 // | |
316 this.bttnEditReqdWeapon.Enabled = false; | |
317 this.bttnEditReqdWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; | |
318 this.bttnEditReqdWeapon.Location = new System.Drawing.Point(520, 152); | |
319 this.bttnEditReqdWeapon.Name = "bttnEditReqdWeapon"; | |
320 this.bttnEditReqdWeapon.Size = new System.Drawing.Size(88, 22); | |
321 this.bttnEditReqdWeapon.TabIndex = 11; | |
322 this.bttnEditReqdWeapon.Text = "edit"; | |
323 this.bttnEditReqdWeapon.Click += new System.EventHandler(this.bttnEditReqdWeapon_Click); | |
324 // | |
325 // FrmUnit | |
326 // | |
327 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); | |
328 this.ClientSize = new System.Drawing.Size(616, 314); | |
329 this.Controls.Add(this.bttnEditReqdWeapon); | |
330 this.Controls.Add(this.bttnReplaceWeapon); | |
331 this.Controls.Add(this.optList); | |
332 this.Controls.Add(this.lblOptionalEquip); | |
333 this.Controls.Add(this.bttnEditWeapon); | |
334 this.Controls.Add(this.reqdList); | |
335 this.Controls.Add(this.bttnRemoveWeapon); | |
336 this.Controls.Add(this.bttnAddWeapon); | |
337 this.Controls.Add(this.lblRequiredEquip); | |
338 this.Controls.Add(this.lblUnitSize); | |
339 this.Controls.Add(this.unitSize); | |
340 this.Controls.Add(this.tbUnitName); | |
341 this.Controls.Add(this.statsGrid); | |
342 this.Name = "FrmUnit"; | |
343 this.ShowInTaskbar = false; | |
344 this.Text = "FrmUnit"; | |
345 ((System.ComponentModel.ISupportInitialize)(this.statsGrid)).EndInit(); | |
346 ((System.ComponentModel.ISupportInitialize)(this.unitSize)).EndInit(); | |
347 this.ResumeLayout(false); | |
348 | |
349 } | |
350 #endregion | |
351 | |
352 public Unit Unit | |
353 { | |
354 get { return unit; } | |
355 } | |
356 | |
357 private void tbUnitName_Leave(object sender, System.EventArgs e) | |
358 { | |
359 updateUnitName(); | |
360 } | |
361 | |
362 private void tbUnitName_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) | |
363 { | |
364 if (e.KeyCode == Keys.Enter) | |
365 { | |
366 updateUnitName(); | |
367 } | |
368 } | |
369 | |
370 private void updateUnitName() | |
371 { | |
372 if (unit.Name!=tbUnitName.Text) | |
373 { | |
374 commandStack.Execute(new SetNameCommand(unit, tbUnitName.Text)); | |
375 } | |
376 } | |
377 | |
378 private void unitSize_Leave(object sender, System.EventArgs e) | |
379 { | |
380 updateUnitSize(); | |
381 } | |
382 | |
383 private void unitSize_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) | |
384 { | |
385 if (e.KeyCode == Keys.Enter) | |
386 { | |
387 updateUnitSize(); | |
388 } | |
389 } | |
390 | |
391 private void updateUnitSize() | |
392 { | |
393 if (unit.Size!=unitSize.Value) | |
394 { | |
395 commandStack.Execute(new SetUnitSizeCommand(unit, (int)unitSize.Value)); | |
396 } | |
397 } | |
398 | |
399 private void unit_NameChanged(WarFoundryObject obj, string oldValue, string newValue) | |
400 { | |
401 if (obj is Unit && obj.Equals(unit)) | |
402 { | |
403 Unit u = (Unit)obj; | |
404 tbUnitName.Text = obj.Name; | |
405 Text = obj.Name; | |
406 } | |
407 } | |
408 | |
409 private void unit_UnitSizeChanged(WarFoundryObject obj, int oldValue, int newValue) | |
410 { | |
411 if (obj is Unit && obj.Equals(unit)) | |
412 { | |
413 unitSize.Value = newValue; | |
414 } | |
415 } | |
416 | |
417 private void reqdList_SelectedIndexChanged(object sender, System.EventArgs e) | |
418 { | |
419 bttnReplaceWeapon.Enabled = (reqdList.SelectedIndex>-1 && ((UnitEquipmentItemObj)reqdList.SelectedItem).Item.HasAlternatives()); | |
420 bttnEditReqdWeapon.Enabled = (reqdList.SelectedIndex>-1); | |
421 } | |
422 | |
423 private void optList_SelectedIndexChanged(object sender, System.EventArgs e) | |
424 { | |
425 bttnEditWeapon.Enabled = optList.SelectedIndex>-1; | |
426 bttnRemoveWeapon.Enabled = bttnEditWeapon.Enabled; | |
427 } | |
428 | |
429 private void unit_UnitEquipmentAmountChanged(WarFoundryObject obj, float oldValue, float newValue) | |
430 { | |
431 if (obj is UnitEquipmentItem) | |
432 { | |
433 UnitEquipmentItem equip = (UnitEquipmentItem)obj; | |
434 ListBox weaponList = (equip.IsRequired ? reqdList : optList); | |
435 | |
436 if (newValue==0) | |
437 { | |
438 weaponList.Items.Remove(UnitEquipmentItemObj.GetEquipObj(Unit, equip)); | |
439 } | |
440 else | |
441 { | |
442 UnitEquipmentItemObj equipObj = UnitEquipmentItemObj.GetEquipObj(Unit, equip); | |
443 int idx = weaponList.Items.IndexOf(equipObj); | |
444 | |
445 if (idx>-1) | |
446 { | |
447 weaponList.Items[idx] = equipObj; | |
448 } | |
449 else | |
450 { | |
451 weaponList.Items.Add(equipObj); | |
452 } | |
453 } | |
454 } | |
455 } | |
456 | |
457 private void editWeapon(ListBox list) | |
458 { | |
459 FrmEditUnitEquipment editEquip = new FrmEditUnitEquipment(Unit, ((UnitEquipmentItemObj)list.SelectedItem).Item, commandStack); | |
460 editEquip.ShowDialog(this); | |
461 } | |
462 | |
463 private void bttnEditWeapon_Click(object sender, System.EventArgs e) | |
464 { | |
465 editWeapon(optList); | |
466 } | |
467 | |
468 private void optList_DoubleClick(object sender, System.EventArgs e) | |
469 { | |
470 editWeapon(optList); | |
471 } | |
472 | |
473 private void reqdList_DoubleClick(object sender, System.EventArgs e) | |
474 { | |
475 editWeapon(reqdList); | |
476 } | |
477 | |
478 private void addWeapon() | |
479 { | |
480 FrmNewUnitEquipment newEquip = new FrmNewUnitEquipment(Unit, commandStack); | |
481 newEquip.ShowDialog(this); | |
482 } | |
483 | |
484 private void bttnAddWeapon_Click(object sender, System.EventArgs e) | |
485 { | |
486 addWeapon(); | |
487 } | |
488 | |
489 private void removeWeapon() | |
490 { | |
491 commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, unit.UnitType.GetEquipmentItem(((UnitEquipmentItemObj)optList.SelectedItem).Item.ID).EquipmentItem, 0)); | |
492 } | |
493 | |
494 private void bttnRemoveWeapon_Click(object sender, System.EventArgs e) | |
495 { | |
496 removeWeapon(); | |
497 } | |
498 | |
499 private void bttnEditReqdWeapon_Click(object sender, System.EventArgs e) | |
500 { | |
501 editWeapon(reqdList); | |
502 } | |
503 | |
504 private void bttnReplaceWeapon_Click(object sender, System.EventArgs e) | |
505 { | |
506 FrmReplaceUnitEquipment replace = new FrmReplaceUnitEquipment(unit, ((UnitEquipmentItemObj)reqdList.SelectedItem).Item, commandStack); | |
507 replace.ShowDialog(this); | |
508 } | |
509 } | |
510 } |