Merge branch 'reset-on-restart' into develop-laptop

This commit is contained in:
HeshamTB 2018-12-31 06:31:43 +03:00
commit 417e364595
2 changed files with 21 additions and 9 deletions

View File

@ -71,7 +71,6 @@ namespace OWTrack
}
}
//Move to saveManeger.cs ?
private void loadSave()
{
try
@ -172,7 +171,8 @@ namespace OWTrack
newSR = tr.newSR,
ChangeInSR = tr.srDiff(),
dateTime = DateTime.Now.Date,
DateTimeSting = DateTime.Now.ToString("hh:mm tt")
DateTimeSting = DateTime.Now.ToString("hh:mm tt"),
LastMatchSR = tr.GetCurrentSession().GetLastMatch().newSR,
};
tr.GetCurrentSession().AddMatch(match);
}
@ -235,12 +235,6 @@ namespace OWTrack
}
finally
{
//if (!SRonce)
//{
// tr.startSR = sr;
// SRonce = true;
//}
//else tr.newSR = sr;
if (tr.GetCurrentSession().IsNewSession())
tr.startSR = sr;
else

View File

@ -158,6 +158,7 @@ namespace OWTrack
class Session
{
public int wins, losses = 0;
public int TotalMatches;
public int SkillChange;
public int StartSR;
@ -165,7 +166,7 @@ namespace OWTrack
public List<Match> Matches = new List<Match>();
/// <summary>
/// Start a new session with a starting Skill Rating
/// Start a new session
///</summary>
public Session(int StartSR)
{
@ -174,22 +175,38 @@ namespace OWTrack
TotalMatches = 0;
}
/// <summary>
/// Check if session does not have any matches
/// </summary>
/// <returns>Booelan</returns>
public bool IsNewSession()
{
if (Matches.Count == 0) return true;
else return false;
}
/// <summary>
/// Get last match in Matchs list
/// </summary>
/// <returns>Match</returns>
public Match GetLastMatch()
{
return Matches.Last();
}
/// <summary>
/// Add Match to list
/// </summary>
/// <param name="match"></param>
public void AddMatch(Match match)
{
match.LastMatchSR = this.Matches.Last().newSR;
this.Matches.Add(match);
this.TotalMatches = Matches.Count();
if (match.IsWin)
wins++;
else
losses++;
}
}
@ -197,6 +214,7 @@ namespace OWTrack
{
public Match() { }
public DateTime dateTime { get; set; }
public bool IsWin;
public string DateTimeSting;
public int StartSR;
public int LastMatchSR;