Logging added points

This commit is contained in:
2022-07-14 16:52:42 +02:00
parent 903a9f99ce
commit 8aa46c3176
3 changed files with 41 additions and 8 deletions

View File

@ -23,6 +23,8 @@ namespace WinGreed
private HandleThrow _ht; private HandleThrow _ht;
public string Player { get; set; } public string Player { get; set; }
public int TotPoints { get; set; } public int TotPoints { get; set; }
public int AddedPoints { get; set; }
List<int> Points = new List<int>(); List<int> Points = new List<int>();
public frmPersonRound(string player) public frmPersonRound(string player)
{ {
@ -193,6 +195,7 @@ namespace WinGreed
actTxtBox.Refresh(); actTxtBox.Refresh();
tempChsn += outPut.NumSum; tempChsn += outPut.NumSum;
txtChosenPoints.Text = tempChsn.ToString(); txtChosenPoints.Text = tempChsn.ToString();
AddedPoints = tempChsn;
if (((TextBox)this.Controls.Find($"txtMaxValue{row}", true).FirstOrDefault()).Text == actTxtBox.Text if (((TextBox)this.Controls.Find($"txtMaxValue{row}", true).FirstOrDefault()).Text == actTxtBox.Text
&& int.Parse(actTxtBox.Text.Trim()) > 0 && int.Parse(actTxtBox.Text.Trim()) > 0
&& _ht.Dices.Count(x => x.Chosen == true) == _ht.Dices.Count) && _ht.Dices.Count(x => x.Chosen == true) == _ht.Dices.Count)
@ -202,8 +205,8 @@ namespace WinGreed
} }
} }
numbers.ForEach(x => Debug.Write($"{x}, ")); //numbers.ForEach(x => Debug.Write($"{x}, "));
Debug.WriteLine(" -"); //Debug.WriteLine(" -");
return result; return result;
} }

View File

@ -38,6 +38,8 @@
this.txtNewName = new System.Windows.Forms.TextBox(); this.txtNewName = new System.Windows.Forms.TextBox();
this.btnAddOk = new System.Windows.Forms.Button(); this.btnAddOk = new System.Windows.Forms.Button();
this.btnSound = new System.Windows.Forms.Button(); this.btnSound = new System.Windows.Forms.Button();
this.lstLogBox = new System.Windows.Forms.ListBox();
this.lblLog = new System.Windows.Forms.Label();
this.SuspendLayout(); this.SuspendLayout();
// //
// label1 // label1
@ -72,7 +74,7 @@
this.lvMemberList.HoverSelection = true; this.lvMemberList.HoverSelection = true;
this.lvMemberList.Location = new System.Drawing.Point(387, 97); this.lvMemberList.Location = new System.Drawing.Point(387, 97);
this.lvMemberList.Name = "lvMemberList"; this.lvMemberList.Name = "lvMemberList";
this.lvMemberList.Size = new System.Drawing.Size(302, 166); this.lvMemberList.Size = new System.Drawing.Size(302, 315);
this.lvMemberList.TabIndex = 2; this.lvMemberList.TabIndex = 2;
this.lvMemberList.UseCompatibleStateImageBehavior = false; this.lvMemberList.UseCompatibleStateImageBehavior = false;
this.lvMemberList.View = System.Windows.Forms.View.Details; this.lvMemberList.View = System.Windows.Forms.View.Details;
@ -134,11 +136,31 @@
this.btnSound.Visible = false; this.btnSound.Visible = false;
this.btnSound.Click += new System.EventHandler(this.btnSound_Click); this.btnSound.Click += new System.EventHandler(this.btnSound_Click);
// //
// lstLogBox
//
this.lstLogBox.FormattingEnabled = true;
this.lstLogBox.ItemHeight = 15;
this.lstLogBox.Location = new System.Drawing.Point(707, 97);
this.lstLogBox.Name = "lstLogBox";
this.lstLogBox.Size = new System.Drawing.Size(120, 319);
this.lstLogBox.TabIndex = 7;
//
// lblLog
//
this.lblLog.AutoSize = true;
this.lblLog.Location = new System.Drawing.Point(707, 66);
this.lblLog.Name = "lblLog";
this.lblLog.Size = new System.Drawing.Size(68, 15);
this.lblLog.TabIndex = 8;
this.lblLog.Text = "PoängLogg";
//
// frmStart // frmStart
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450); this.ClientSize = new System.Drawing.Size(897, 450);
this.Controls.Add(this.lblLog);
this.Controls.Add(this.lstLogBox);
this.Controls.Add(this.btnSound); this.Controls.Add(this.btnSound);
this.Controls.Add(this.btnAddOk); this.Controls.Add(this.btnAddOk);
this.Controls.Add(this.txtNewName); this.Controls.Add(this.txtNewName);
@ -166,5 +188,7 @@
private TextBox txtNewName; private TextBox txtNewName;
private Button btnAddOk; private Button btnAddOk;
private Button btnSound; private Button btnSound;
private ListBox lstLogBox;
private Label lblLog;
} }
} }

View File

@ -20,10 +20,16 @@ namespace WinGreed
{ {
var nextLvInstance = lvMemberList.Items[NextLvItem()]; var nextLvInstance = lvMemberList.Items[NextLvItem()];
var nextPlayerName = nextLvInstance.Text; var nextPlayerName = nextLvInstance.Text;
if (!GameOver || (GameOver && nextLvInstance != gocFirst.lvsave))
{
fPR = new frmPersonRound(nextPlayerName); fPR = new frmPersonRound(nextPlayerName);
fPR.TotPoints = int.Parse(nextLvInstance.SubItems[2].Text); fPR.TotPoints = int.Parse(nextLvInstance.SubItems[2].Text);
fPR.ShowDialog(); fPR.ShowDialog();
nextLvInstance.SubItems[2].Text = fPR.TotPoints.ToString(); nextLvInstance.SubItems[2].Text = fPR.TotPoints.ToString();
lstLogBox.Items.Add($"{nextPlayerName} -> {fPR.AddedPoints} po<70>ng.");
}
if (GameOver) if (GameOver)
{ {
if (nextLvInstance == gocFirst.lvsave) if (nextLvInstance == gocFirst.lvsave)