public void Load() { //If we dont have one of the keys we dont have both so set manually and return! if (!FileFetch.HasKey("OPTIONS_SFX")) { SoundFXLevel = 0.63f; MusicLevel = 1.0f; return; } SoundFXLevel = FileFetch.FetchFloat("OPTIONS_SFX"); MusicLevel = FileFetch.FetchFloat("OPTIONS_MUSIC"); }
//Returns false if entry is not found. public bool LoadFromPlayerPrefs() { //Check if we have somthing to load if (!FileFetch.HasKey(name)) { return(false); } //Here we create a ductionary to fill up from the iDictionary. Dictionary <string, int> load = new Dictionary <string, int>(); IDictionary dict = FileFetch.FetchDictonary(name); //Transfer the data. foreach (DictionaryEntry data in dict) { load.Add(data.Key as string, int.Parse(string.Format("{0}", data.Value))); } //Get the data from the files. foreach (DataEntry data in _statisticsEntries) { //data.ReadFromPlayerPrefs(this.name); data.LoadFromDictionary(load); } //Get the total time player. TimeAmount = FileFetch.FetchFloat(name + "_TotalTime"); //Write the score //StatsScore = FileFetch.FetchInt(name + "_StatsScore"); StatsScore = load[name + "_StatsScore"]; //Save the multiplier as well.... just incase. //StatsValueModifier = FileFetch.FetchInt(name + "_Modifier"); StatsValueModifier = load[name + "_Modifier"]; return(true); }
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"); }