changeset 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 d6ff354a5d84
files FrmUnit.cs
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/FrmUnit.cs	Wed Sep 16 19:41:27 2009 +0000
     1.2 +++ b/FrmUnit.cs	Wed Sep 16 19:50:39 2009 +0000
     1.3 @@ -40,6 +40,7 @@
     1.4  		private System.Windows.Forms.Label lblOptionalEquip;
     1.5  		private System.Windows.Forms.Button bttnReplaceWeapon;
     1.6  		private System.Windows.Forms.Button bttnEditReqdWeapon;
     1.7 +		private Label lblPoints;
     1.8  		/// <summary>
     1.9  		/// Required designer variable.
    1.10  		/// </summary>
    1.11 @@ -59,6 +60,7 @@
    1.12  			unit.NameChanged += new StringValChangedDelegate(unit_NameChanged);
    1.13  			unit.UnitSizeChanged += new IntValChangedDelegate(unit_UnitSizeChanged);
    1.14  			unit.UnitEquipmentAmountChanged += new DoubleValChangedDelegate(unit_UnitEquipmentAmountChanged);
    1.15 +			unit.PointsValueChanged += new DoubleValChangedDelegate(unit_PointsValueChanged);
    1.16  
    1.17  			if (unit.UnitType.MaxSize == unit.UnitType.MinSize)
    1.18  			{
    1.19 @@ -73,10 +75,21 @@
    1.20  				unitSize.Minimum = unit.UnitType.MinSize;
    1.21  			}
    1.22  
    1.23 +			SetPointsValueText();
    1.24  			SetStats();
    1.25  			SetWeapons();
    1.26  		}
    1.27  
    1.28 +		void unit_PointsValueChanged(WarFoundryObject obj, double oldValue, double newValue)
    1.29 +		{
    1.30 +			SetPointsValueText();
    1.31 +		}
    1.32 +
    1.33 +		private void SetPointsValueText()
    1.34 +		{
    1.35 +			lblPoints.Text = "(" + unit.PointsValue + " pts)";
    1.36 +		}
    1.37 +
    1.38  		private void SetStats()
    1.39  		{
    1.40  			DataTable dt = new DataTable();
    1.41 @@ -188,6 +201,7 @@
    1.42  			this.lblOptionalEquip = new System.Windows.Forms.Label();
    1.43  			this.bttnReplaceWeapon = new System.Windows.Forms.Button();
    1.44  			this.bttnEditReqdWeapon = new System.Windows.Forms.Button();
    1.45 +			this.lblPoints = new System.Windows.Forms.Label();
    1.46  			((System.ComponentModel.ISupportInitialize)(this.statsGrid)).BeginInit();
    1.47  			((System.ComponentModel.ISupportInitialize)(this.unitSize)).BeginInit();
    1.48  			this.SuspendLayout();
    1.49 @@ -350,10 +364,18 @@
    1.50  			this.bttnEditReqdWeapon.Text = "edit";
    1.51  			this.bttnEditReqdWeapon.Click += new System.EventHandler(this.bttnEditReqdWeapon_Click);
    1.52  			// 
    1.53 +			// lblPoints
    1.54 +			// 
    1.55 +			this.lblPoints.Location = new System.Drawing.Point(358, 8);
    1.56 +			this.lblPoints.Name = "lblPoints";
    1.57 +			this.lblPoints.Size = new System.Drawing.Size(100, 21);
    1.58 +			this.lblPoints.TabIndex = 12;
    1.59 +			// 
    1.60  			// FrmUnit
    1.61  			// 
    1.62  			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    1.63  			this.ClientSize = new System.Drawing.Size(616, 314);
    1.64 +			this.Controls.Add(this.lblPoints);
    1.65  			this.Controls.Add(this.bttnEditReqdWeapon);
    1.66  			this.Controls.Add(this.bttnReplaceWeapon);
    1.67  			this.Controls.Add(this.optList);