Beispiel #1
0
 public Pack GetPack(Pack.PackID packId)
 {
     foreach (Pack pack in packList)
     {
         if (packId == pack.packId)
         {
             return(pack);
         }
     }
     return(null);
 }
Beispiel #2
0
 public void PackButtonClick(Pack.PackID packId)
 {
     SoundManager.instance.PlaySingle(menuClickClip, true);
     foreach (Transform child in levelGroup.transform)
     {
         Destroy(child.gameObject);
     }
     mainController.SetCurrentPack(packId);
     colorManager.SetPackIndex(packId);
     InitLevelButtons();
 }
Beispiel #3
0
 public int GetPackIndex(Pack.PackID packId)
 {
     for (int i = 0; i < packList.Count(); i++)
     {
         if (packList.GetList()[i].packId == packId)
         {
             return(i);
         }
     }
     return(-1);
 }
Beispiel #4
0
 public int GetLevelIndex(Pack.PackID packId, string levelName)
 {
     for (int i = 0; i < packList.GetPack(packId).levelList.Count; i++)
     {
         if (packList.GetPack(packId).levelList[i].levelName == levelName)
         {
             return(i);
         }
     }
     return(-1);
 }
Beispiel #5
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;
 }
Beispiel #6
0
 // For tracking which packs have been unlocked
 public bool IsPackUnlocked(Pack.PackID packId)
 {
     //return packIndex < data.levelPackUnlockedList.Count && data.levelPackUnlockedList[packIndex];
     foreach (PackTracker packTracker in data.packTrackerList)
     {
         if (packId == packTracker.packId)
         {
             return(packTracker.isUnlocked);
         }
     }
     return(false);
 }
Beispiel #7
0
 public PackTracker(Pack pack)
 {
     // Initialize tracker for all levels in Pack
     packId = pack.packId;
     // Check if first pack, unlocked by default
     if (packId == Pack.PackID.PACK_1)
     {
         isUnlocked = true;
     }
     levelTrackerList = new List <LevelTracker>();
     foreach (Pack.Level level in pack.levelList)
     {
         levelTrackerList.Add(new LevelTracker(level.levelName));
     }
 }
Beispiel #8
0
 // For tracking stars gained for each level
 public LevelProgress GetLevelProgress(Pack.PackID packId, int levelNumber)
 {
     foreach (PackTracker packTracker in data.packTrackerList)
     {
         if (packId == packTracker.packId)
         {
             if (packTracker.levelTrackerList.Count > levelNumber)
             {
                 return(packTracker.levelTrackerList[levelNumber].levelProgress);
             }
             else
             {
                 break;
             }
         }
     }
     return(LevelProgress.NONE);
 }
Beispiel #9
0
 public void SetLevelProgress(Pack.PackID packId, string levelName, int stars)
 {
     foreach (PackTracker packTracker in data.packTrackerList)
     {
         if (packId == packTracker.packId)
         {
             foreach (LevelTracker levelTracker in packTracker.levelTrackerList)
             {
                 //Debug.Log(levelTracker.ToString() + " " + levelName);
                 if (levelName == levelTracker.levelName)
                 {
                     levelTracker.levelProgress = (LevelProgress)stars;
                     Save();
                     break;
                 }
             }
             break;
         }
     }
 }
Beispiel #10
0
    public void Init(Pack pack, bool unlocked, Color color)
    {
        packId        = pack.packId;
        packText.text = pack.title;

        packText.color        = color;
        outerIconImage.color  = color;
        centerIconImage.color = color;

        if (!unlocked)
        {
            Color dimmedColor = color;
            dimmedColor.a         = dimmedAlpha;
            packText.color        = dimmedColor;
            outerIconImage.color  = dimmedColor;
            centerIconImage.color = dimmedColor;
            lockImage.color       = dimmedColor;
        }
        else
        {
            lockImage.gameObject.SetActive(false);
        }
        this.unlocked = unlocked;
    }
Beispiel #11
0
 public void SetCurrentPack(Pack.PackID packId)
 {
     levelHandler.SetCurrentPack(packId);
 }
Beispiel #12
0
 public void SetCurrentPack(Pack.PackID packId)
 {
     CurrentPack = packList.GetPack(packId);
 }
Beispiel #13
0
 public void SetPackIndex(Pack.PackID packId)
 {
     packIndex = FindObjectOfType <LevelHandler>().GetPackIndex(packId);
 }