Game over handling ready
This commit is contained in:
@ -4,8 +4,11 @@ namespace WinGreed
|
||||
{
|
||||
public partial class frmStart : Form
|
||||
{
|
||||
private bool GameOver = false;
|
||||
private GameOverCheck gocFirst = new GameOverCheck();
|
||||
private GameOverCheck gocSecond = new GameOverCheck();
|
||||
private frmPersonRound fPR = null;
|
||||
private int actPlayerNo=-1;
|
||||
private int actPlayerNo = -1;
|
||||
public frmStart()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -18,9 +21,45 @@ namespace WinGreed
|
||||
var nextLvInstance = lvMemberList.Items[NextLvItem()];
|
||||
var nextPlayerName = nextLvInstance.Text;
|
||||
fPR = new frmPersonRound(nextPlayerName);
|
||||
fPR.TotPoints = int.Parse( nextLvInstance.SubItems[2].Text);
|
||||
fPR.TotPoints = int.Parse(nextLvInstance.SubItems[2].Text);
|
||||
fPR.ShowDialog();
|
||||
nextLvInstance.SubItems[2].Text = fPR.TotPoints.ToString();
|
||||
if (GameOver)
|
||||
{
|
||||
if (nextLvInstance == gocFirst.lvsave)
|
||||
{
|
||||
PlaySomething();
|
||||
if (gocSecond.lvsave != null)
|
||||
{
|
||||
gocSecond.lvsave.SubItems[1].Text = (int.Parse(gocSecond.lvsave.SubItems[1].Text) + 1).ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
nextLvInstance.SubItems[1].Text = (int.Parse(nextLvInstance.SubItems[1].Text) + 1).ToString();
|
||||
}
|
||||
btnSpela.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(fPR.TotPoints > gocFirst.points && nextLvInstance != gocFirst.lvsave)
|
||||
{
|
||||
if(nextLvInstance != gocSecond.lvsave && fPR.TotPoints > gocSecond.points)
|
||||
{
|
||||
gocSecond.points = fPR.TotPoints;
|
||||
gocSecond.lvsave = nextLvInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fPR.TotPoints > 10000)
|
||||
{
|
||||
GameOver = true;
|
||||
gocFirst.points = fPR.TotPoints;
|
||||
gocFirst.lvsave = nextLvInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +69,7 @@ namespace WinGreed
|
||||
if (lvMemberList.Items.Count > 1)
|
||||
{
|
||||
actPlayerNo++;
|
||||
if(actPlayerNo > lvMemberList.Items.Count-1)
|
||||
if (actPlayerNo > lvMemberList.Items.Count - 1)
|
||||
{
|
||||
actPlayerNo = 0;
|
||||
}
|
||||
@ -42,12 +81,12 @@ namespace WinGreed
|
||||
private void btnAddPlayer_Click(object sender, EventArgs e)
|
||||
{
|
||||
txtNewName.Visible = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void btnAddOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
var item=lvMemberList.Items.Add(txtNewName.Text.Trim());
|
||||
var item = lvMemberList.Items.Add(txtNewName.Text.Trim());
|
||||
item.SubItems.Add("0");
|
||||
item.SubItems.Add("0");
|
||||
txtNewName.Text = "";
|
||||
|
||||
Reference in New Issue
Block a user