void LoadSlots()
    {
        //Load cannon slot data.
        int index = 0;

        foreach (EntityFactory.CannonTypes type in _cannonSlots)
        {
            //Grab the name
            string slotname = "Cannon_Slot_" + index.ToString();

            //if the key dont exist set to zebra!!!!!
            if (!FileFetch.HasKey(slotname))
            {
                _cannonSlots[index] = EntityFactory.CannonTypes.Zebra;
                index++;
                continue;
            }

            //Set the int.
            _cannonSlots[index] = (EntityFactory.CannonTypes)FileFetch.FetchInt(slotname);


            index++;
        }
    }
Ejemplo n.º 2
0
    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);
    }