public void DeleteAllData() { //Delete from the file system. FileFetch.ClearAllKeys(); //Set the file version upon deleting. FileFetch.SetFloat("VERSION", FileVersion); //We have to delete the stats in memory. if (_gameStatistics) { DestroyObject(_gameStatistics.gameObject); } int index = 0; foreach (EntityFactory.CannonTypes type in _cannonSlots) { //Set to default cannons. ToyBox.GetPandora().AssignSlot(EntityFactory.CannonTypes.Zebra, index); index++; } LoadAllDataFromFileSystem(); //Go through each card and recalculate the trophies earned //Recalculate trophies. CalculateTrophiesEarned(); print("All Data Deleted :(((( "); }
public void LoadAllDataFromFileSystem() { if (FileFetch.FetchFloat("VERSION") < FileVersion) { FileFetch.ClearAllKeys(); } //Destroy the old if we have one if (_gameStatistics != null) { Destroy(_gameStatistics.gameObject); } //Instantuate the player statistics. _gameStatistics = Instantiate(BlankStatistics) as Statistics; _gameStatistics.transform.parent = transform; _gameStatistics.gameObject.name = "TotalGameStatistics"; _gameStatistics.ContainerLabel = "All Game Stats"; _gameStatistics.LoadFromPlayerPrefs(); DontDestroyOnLoad(_gameStatistics.gameObject); //Load the gem bank _gemBank = FileFetch.FetchInt("GEMBANK"); //Load the total xp _totalXP = FileFetch.FetchInt("TOTALXP"); //_totalXP = 0; //Set the total xp into the leveling system to calculate. if (!MyPTPLevel) { //Create the level object. _myLeveling = Instantiate(PTPLevelingPrefab) as PlayerLevelSystem; _myLeveling.transform.parent = transform; DontDestroyOnLoad(_myLeveling.gameObject); } TotalXP = _totalXP; foreach (BaseItemCard card in CardDeck) { //Only go through missions for dirty cards. card.LoadCardItem(); } //Load slots here //LoadSlots(); ClearGameSlots(); //Handle options and other data here. Options.Load(); //SocialCenter.Instance.LoadLeaderboard("Highscore_PPS"); }