//OLD // void Start() { // levels = new Levels_Data (); // // Levels_Data data = Load2 (); // //// // x = data.x; // for (int i = 0; i < buildCount; i++) { // levels.levels [i] = new Level_Data (); // levels.levels [i].total_Points = data.levels [i].total_Points; // // } //// print (levels.levels [0].total_Points); // } public void LoadFunction() { levels = new Levels_Data(); player = new Player_Data(); player.settings = new Settings(); player.skins = new bool[7]; questions = new Questions_Data(); for (int i = 0; i < buildCount; i++) { levels.levels [i] = new Level_Data(); } All_Data data = Load2(); if (data != null) { player = data.player; player.currency = player.total_points - player.boughtPrice; for (int i = 0; i < data.player.skins.Length; i++) { player.skins [i] = data.player.skins [i]; } for (int i = 0; i < buildCount; i++) { levels.levels [i] = data.levels.levels [i]; // } // print (data.custom_Questions); if (data.custom_Questions != null && data.custom_Questions.questions != null) { if (data.custom_Questions.questions.Count > 0) { questions.questions = new List <Question_Data> (data.custom_Questions.questions); } // print ("Playing with new questions: "); } else { if (CreateCustomQuestions.static_questions != null) { List <QuestionObject> x = new List <QuestionObject> (CreateCustomQuestions.static_questions.CustomQuestions); questions.questions = new List <Question_Data> (); for (int i = 0; i < x.Count; i++) { Question_Data temp = x [i].CreateData(x [i]); questions.questions.Add(temp); } } // print ("Reset back to old questions: "); } } }
public void ClearData() { levels = new Levels_Data(); player = new Player_Data(); player.settings = new Settings(); player.skins = new bool[7]; questions = new Questions_Data(); for (int i = 0; i < buildCount; i++) { levels.levels [i] = new Level_Data(); } Save2(); LoadFunction(); }