예제 #1
0
    public void LoadCardItem()
    {
        //Debug.Log(this.name + "StartLoad");

        //load all the Missions.
//		foreach(BaseMission m in Missions)
//		{
//			m.LoadMissionStatus();
//		}
//


        //Load other data.
        int unlockedBool = FileFetch.FetchInt(this.name + "_Unlocked");

        if (unlockedBool == 1 || unlockedBool == 0)
        {
            _unlocked = false;
        }
        else
        {
            _unlocked = true;
        }


        //	Debug.Log(this.name + "EndLoad");
    }
    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++;
        }
    }
    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");
    }
 public void ReadFromPlayerPrefs(string statsName)
 {
     EntryValue = FileFetch.FetchInt(statsName + "_EntryDataValue_" + DataLabel);
     EntryType  = (Statistics.EntryTypes)FileFetch.FetchInt(statsName + "_EntryType_" + DataLabel);
     ValueData  = FileFetch.FetchInt(statsName + "_EntryData_" + DataLabel);
 }