comparison FrmUnit.cs @ 53:e6d0d9eababf

Fixes #163: Show unit cost on unit dialog * Add a quick label with the points cost of the unit - can be moved and repositioned based on user feedback
author IBBoard <dev@ibboard.co.uk>
date Wed, 16 Sep 2009 19:50:39 +0000
parents 4a56900936aa
children 346b4ac34997
comparison
equal deleted inserted replaced
52:4a56900936aa 53:e6d0d9eababf
38 private System.Windows.Forms.ListBox reqdList; 38 private System.Windows.Forms.ListBox reqdList;
39 private System.Windows.Forms.ListBox optList; 39 private System.Windows.Forms.ListBox optList;
40 private System.Windows.Forms.Label lblOptionalEquip; 40 private System.Windows.Forms.Label lblOptionalEquip;
41 private System.Windows.Forms.Button bttnReplaceWeapon; 41 private System.Windows.Forms.Button bttnReplaceWeapon;
42 private System.Windows.Forms.Button bttnEditReqdWeapon; 42 private System.Windows.Forms.Button bttnEditReqdWeapon;
43 private Label lblPoints;
43 /// <summary> 44 /// <summary>
44 /// Required designer variable. 45 /// Required designer variable.
45 /// </summary> 46 /// </summary>
46 private System.ComponentModel.Container components = null; 47 private System.ComponentModel.Container components = null;
47 48
57 tbUnitName.Text = unit.Name; 58 tbUnitName.Text = unit.Name;
58 Text = unit.Name; 59 Text = unit.Name;
59 unit.NameChanged += new StringValChangedDelegate(unit_NameChanged); 60 unit.NameChanged += new StringValChangedDelegate(unit_NameChanged);
60 unit.UnitSizeChanged += new IntValChangedDelegate(unit_UnitSizeChanged); 61 unit.UnitSizeChanged += new IntValChangedDelegate(unit_UnitSizeChanged);
61 unit.UnitEquipmentAmountChanged += new DoubleValChangedDelegate(unit_UnitEquipmentAmountChanged); 62 unit.UnitEquipmentAmountChanged += new DoubleValChangedDelegate(unit_UnitEquipmentAmountChanged);
63 unit.PointsValueChanged += new DoubleValChangedDelegate(unit_PointsValueChanged);
62 64
63 if (unit.UnitType.MaxSize == unit.UnitType.MinSize) 65 if (unit.UnitType.MaxSize == unit.UnitType.MinSize)
64 { 66 {
65 unitSize.Value = unit.UnitType.MaxSize; 67 unitSize.Value = unit.UnitType.MaxSize;
66 unitSize.Visible = false; 68 unitSize.Visible = false;
71 unitSize.Value = unit.Size; 73 unitSize.Value = unit.Size;
72 unitSize.Maximum = (unit.UnitType.MaxSize == WarFoundryCore.INFINITY ? int.MaxValue : unit.UnitType.MaxSize); 74 unitSize.Maximum = (unit.UnitType.MaxSize == WarFoundryCore.INFINITY ? int.MaxValue : unit.UnitType.MaxSize);
73 unitSize.Minimum = unit.UnitType.MinSize; 75 unitSize.Minimum = unit.UnitType.MinSize;
74 } 76 }
75 77
78 SetPointsValueText();
76 SetStats(); 79 SetStats();
77 SetWeapons(); 80 SetWeapons();
81 }
82
83 void unit_PointsValueChanged(WarFoundryObject obj, double oldValue, double newValue)
84 {
85 SetPointsValueText();
86 }
87
88 private void SetPointsValueText()
89 {
90 lblPoints.Text = "(" + unit.PointsValue + " pts)";
78 } 91 }
79 92
80 private void SetStats() 93 private void SetStats()
81 { 94 {
82 DataTable dt = new DataTable(); 95 DataTable dt = new DataTable();
186 this.bttnEditWeapon = new System.Windows.Forms.Button(); 199 this.bttnEditWeapon = new System.Windows.Forms.Button();
187 this.optList = new System.Windows.Forms.ListBox(); 200 this.optList = new System.Windows.Forms.ListBox();
188 this.lblOptionalEquip = new System.Windows.Forms.Label(); 201 this.lblOptionalEquip = new System.Windows.Forms.Label();
189 this.bttnReplaceWeapon = new System.Windows.Forms.Button(); 202 this.bttnReplaceWeapon = new System.Windows.Forms.Button();
190 this.bttnEditReqdWeapon = new System.Windows.Forms.Button(); 203 this.bttnEditReqdWeapon = new System.Windows.Forms.Button();
204 this.lblPoints = new System.Windows.Forms.Label();
191 ((System.ComponentModel.ISupportInitialize)(this.statsGrid)).BeginInit(); 205 ((System.ComponentModel.ISupportInitialize)(this.statsGrid)).BeginInit();
192 ((System.ComponentModel.ISupportInitialize)(this.unitSize)).BeginInit(); 206 ((System.ComponentModel.ISupportInitialize)(this.unitSize)).BeginInit();
193 this.SuspendLayout(); 207 this.SuspendLayout();
194 // 208 //
195 // statsGrid 209 // statsGrid
348 this.bttnEditReqdWeapon.Size = new System.Drawing.Size(88, 22); 362 this.bttnEditReqdWeapon.Size = new System.Drawing.Size(88, 22);
349 this.bttnEditReqdWeapon.TabIndex = 11; 363 this.bttnEditReqdWeapon.TabIndex = 11;
350 this.bttnEditReqdWeapon.Text = "edit"; 364 this.bttnEditReqdWeapon.Text = "edit";
351 this.bttnEditReqdWeapon.Click += new System.EventHandler(this.bttnEditReqdWeapon_Click); 365 this.bttnEditReqdWeapon.Click += new System.EventHandler(this.bttnEditReqdWeapon_Click);
352 // 366 //
367 // lblPoints
368 //
369 this.lblPoints.Location = new System.Drawing.Point(358, 8);
370 this.lblPoints.Name = "lblPoints";
371 this.lblPoints.Size = new System.Drawing.Size(100, 21);
372 this.lblPoints.TabIndex = 12;
373 //
353 // FrmUnit 374 // FrmUnit
354 // 375 //
355 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); 376 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
356 this.ClientSize = new System.Drawing.Size(616, 314); 377 this.ClientSize = new System.Drawing.Size(616, 314);
378 this.Controls.Add(this.lblPoints);
357 this.Controls.Add(this.bttnEditReqdWeapon); 379 this.Controls.Add(this.bttnEditReqdWeapon);
358 this.Controls.Add(this.bttnReplaceWeapon); 380 this.Controls.Add(this.bttnReplaceWeapon);
359 this.Controls.Add(this.optList); 381 this.Controls.Add(this.optList);
360 this.Controls.Add(this.lblOptionalEquip); 382 this.Controls.Add(this.lblOptionalEquip);
361 this.Controls.Add(this.bttnEditWeapon); 383 this.Controls.Add(this.bttnEditWeapon);