Esempio n. 1
0
 public Data(LevelHandler.PackList packList)
 {
     // Initialize PackTracker list to contain all packs
     packTrackerList = new List <PackTracker>();
     foreach (Pack pack in packList.GetList())
     {
         packTrackerList.Add(new PackTracker(pack));
     }
     lastPlayedPackID = Pack.PackID.PACK_1;
     soundOn          = true;
     musicOn          = true;
 }
Esempio n. 2
0
    private bool IsUpdateNeeded(LevelHandler.PackList packList)
    {
        // find out if playerdata file matches level data file
        // compare packlist length
        // foreach pack: compare packids, levellist length
        // foreach level in levellist: compare levelname

        if (data.packTrackerList.Count != packList.GetList().Count)
        {
            Debug.Log("PlayerData update needed: pack count difference");
            return(true);
        }

        for (int i = 0; i < packList.GetList().Count; i++)
        {
            if (packList.GetList()[i].packId != data.packTrackerList[i].packId ||
                packList.GetList()[i].levelList.Count != data.packTrackerList[i].levelTrackerList.Count)
            {
                Debug.Log("PlayerData update needed: pack order or level count difference");
                return(true);
            }
            for (int j = 0; j < packList.GetList()[i].levelList.Count; j++)
            {
                if (packList.GetList()[i].levelList[j].levelName != data.packTrackerList[i].levelTrackerList[j].levelName)
                {
                    Debug.Log("PlayerData update needed: level order difference " + i + " " + j + " ll:" + packList.GetList()[i].levelList[j].levelName + " pd:" + data.packTrackerList[i].levelTrackerList[j].levelName);
                    return(true);
                }
            }
        }
        return(false);
    }