I am having a hard time trying to figure out how to show my wins and loses and their totals. Can you advice please?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace RPS_Game
{
publicpartialclassForm1 :Form
{
public Form1()
{
InitializeComponent();
}
int wins;
int draws;
int loses;
privatevoid Form1_Load(object sender, EventArgs e)
{
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
}
privatevoid buttonRock_Click(object sender, EventArgs e)
{
pictureBox1.Visible = false;
pictureBox2.Visible = true;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
Random RandomNumber =newRandom();
int x = RandomNumber.Next(0, 3);
if (x == 0)
{
pictureBox4.Visible = true;
label7.Text = "You Win!";
label6 = wins;
}
if (x == 1)
{
pictureBox5.Visible = true;
label7.Text = "Draw!";
label5 = draws;
}
if (x == 2)
{
pictureBox6.Visible = true;
label7.Text = "You Lose!";
label4 = loses;
}
}
privatevoid buttonPaper_Click(object sender, EventArgs e)
{
pictureBox1.Visible = true;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
Random RandomNumber =newRandom();
int x = RandomNumber.Next(0, 3);
if (x == 0)
{
pictureBox5.Visible = true;
label7.Text = "You Win!";
}
if (x == 1)
{
pictureBox6.Visible = true;
label7.Text = "Draw!";
}
if (x == 2)
{
pictureBox4.Visible = true;
label7.Text = "You Lose!";
}
}
privatevoid buttonScissors_Click(object sender, EventArgs e)
{
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = true;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
Random RandomNumber =newRandom();
int x = RandomNumber.Next(0, 3);
if (x == 0)
{
pictureBox6.Visible = true;
label7.Text = "You Win!";
}
if (x == 1)
{
pictureBox4.Visible = true;
label7.Text = "Draw!";
}
if (x == 2)
{
pictureBox5.Visible = true;
label7.Text = "You Lose!";
}
}
privatevoid buttonClear_Click(object sender, EventArgs e)
{
}
privatevoid buttonExit_Click(object sender, EventArgs e)
{
conststring message ="Want to close the form?";
conststring caption ="CLOSE FORM NOW?!?";
var result =MessageBox.Show(message, caption,
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (result ==DialogResult.Yes)
{
this.Close();
}
}
}
}