public SessionData() { Session = new MatchRecord(); Season = new MatchRecord(); Mythic = new MatchRecord(); CurrentRank = new RankData(); }
private RankData GetStartingRank() { RankData newRank = new RankData(); XDocument doc = XDocument.Load($"{Application.StartupPath}\\SeasonReset.xml"); XElement root = doc.Element("ranks"); XElement rank = root.Elements("rank").Where(r => r.Attribute("value").Value == sessionData.CurrentRank.Rank.ToString()) .Elements("levels") .Elements("level").Where(l => l.Attribute("value").Value == sessionData.CurrentRank.Level.ToString()).FirstOrDefault() .Element("newRank"); newRank.Rank = int.Parse(rank.Attribute("rank").Value); newRank.Level = int.Parse(rank.Attribute("level").Value); newRank.Wins = 0; return(newRank); }
private void ResetRank(bool resetSeason) { SaveUndoBuffer(); if (resetSeason) { RankData newRank = GetStartingRank(); using (RankDlog dlog = new RankDlog()) { dlog.Text = "Select Starting Rank"; dlog.WinsVisible = false; dlog.Rank = newRank.Rank; dlog.Level = newRank.Level; dlog.Wins = 0; if (dlog.ShowDialog() != DialogResult.OK) { return; } sessionData.CurrentRank.Rank = dlog.Rank; sessionData.CurrentRank.Level = dlog.Level; sessionData.CurrentRank.Wins = 0; } sessionData.Season.Win = 0; sessionData.Season.Loss = 0; seasonGamesStart = GetGamesRemaining(); } sessionData.Session.Win = 0; sessionData.Session.Loss = 0; sessionData.Streak = 0; sessionStart = DateTime.Now; sessionGamesStart = GetGamesRemaining(); DisplayRank(); }