////////////////////////////////////////////////////////// // Utility function for updating tracked level info. public void SetChallengeStats(string name, int score, bool onlyIncrease = true) { for (int i = 0; i < challenges.Count; ++i) { if (challenges[i].name.Equals(name)) { if (!onlyIncrease || score > challenges[i].stars) { challenges[i] = new DataChallenge(score, name); } return; } } }
public List <DataChallenge> ListFromString(string toRead) { List <DataChallenge> parsed = new List <DataChallenge>(); if (string.IsNullOrEmpty(toRead)) { return(parsed); } string[] split = toRead.Split(valueSeparator); for (int i = 0; i < split.Length; ++i) { DataChallenge dataChallenge = new DataChallenge(); dataChallenge.FromString(split[i]); parsed.Add(dataChallenge); } return(parsed); }
public DataChallenge(DataChallenge other) { this.stars = other.stars; this.name = other.name; }