private void SetLevel() { bool hasNewLevel = false; if (levels != "" && levels != null) { string objs = ""; string[] levelsSplit = levels.Split(';'); for (int i = 0; i < levelsSplit.Length; i++) { string[] levelDescp = levelsSplit[i].Split(':'); int levelID = 0; try { levelID = int.Parse(levelDescp[0].Trim()); } catch (Exception e) { } if (level == levelID) { objs = levelDescp[1].Trim(); hasNewLevel = true; break; } } if (hasNewLevel) { string moves = PS.GetMoves().ToString(); string time = PS.GetTime(); string wrongAnswers = PS.GetWrongAnswers().ToString(); LM.SetLevelId(level); LM.SetObjective(objs); CheckNextObjectiveSetup(LM.GetNextObjective()); Invoke("NextLevelDisplay", 3f); newLevel = false; //log string[] info = new string[6] { level.ToString(), currentTask, moves, time, wrongAnswers, PS.GetPoints().ToString() }; Logs.EndLevel(fileName, info); } else { IM.SetFinalDisplay(PS.GetPoints()); string moves = PS.GetMoves().ToString(); string time = PS.GetTime(); string wrongAnswers = PS.GetWrongAnswers().ToString(); string[] info = new string[6] { level.ToString(), currentTask, moves, time, wrongAnswers, PS.GetPoints().ToString() }; Logs.EndLevel(fileName, info); newLevel = false; } } }