clear functionality

This commit is contained in:
HeshamTB 2018-08-15 11:46:05 +03:00
parent 7b9dc73085
commit 29805eb926
2 changed files with 9 additions and 8 deletions

View File

@ -115,6 +115,13 @@ namespace OWTrack
{ {
Wins.Text = tr.GetWins().ToString(); Wins.Text = tr.GetWins().ToString();
Losses.Text = tr.GetLosses().ToString(); Losses.Text = tr.GetLosses().ToString();
if (tr.newSR == 0)
{
if (tr.srDiff() < 1) { srLabel.Text = tr.startSR.ToString() + " - 0"; }
else srLabel.Text = tr.startSR.ToString() + " - " + tr.srDiff();
}
else srLabel.Text = tr.startSR.ToString() + " - " + tr.srDiff();
srTextBox.Text = null;
File.WriteAllText(Directory.GetCurrentDirectory() + "/data.json", JsonConvert.SerializeObject(tr)); File.WriteAllText(Directory.GetCurrentDirectory() + "/data.json", JsonConvert.SerializeObject(tr));
} }
@ -150,13 +157,7 @@ namespace OWTrack
} }
else tr.newSR = sr; else tr.newSR = sr;
} }
if (tr.newSR == 0) update();
{
if (tr.srDiff() < 1) { srLabel.Text = tr.startSR.ToString() + " - 0"; }
else srLabel.Text = tr.startSR.ToString() + " - " + tr.srDiff();
}
else srLabel.Text = tr.startSR.ToString() + " - " + tr.srDiff();
srTextBox.Text = null;
} }
} }
} }

View File

@ -10,7 +10,7 @@ namespace OWTrack
public int wins, losses, startSR, newSR = 0; public int wins, losses, startSR, newSR = 0;
public void Track() { } public void Track() { }
public void reset() { wins = 0; losses = 0; } public void reset() { wins = 0; losses = 0; startSR = 0; newSR = 0; }
public void addWin() { wins++; } public void addWin() { wins++; }
public void addLoss() { losses++; } public void addLoss() { losses++; }
public void reduceWin() { wins--; } public void reduceWin() { wins--; }