コード例 #1
0
 public static bool IsWorldUnlocked(byte worldIndex)
 {
     lock (staticMutationLock) {
         var unlockCriteria = LevelDatabase.GetWorldUnlockCriteria(worldIndex);
         return(totalBronzeStars >= unlockCriteria.BronzeStarsRequired &&
                totalSilverStars >= unlockCriteria.SilverStarsRequired &&
                totalGoldStars >= unlockCriteria.GoldStarsRequired &&
                totalTakenCoins >= unlockCriteria.CoinsRequired);
     }
 }
コード例 #2
0
        private static void RecalculateSecondHandState()
        {
            totalTakenCoins  = 0;
            totalGoldenEggs  = 0;
            totalGoldStars   = 0;
            totalSilverStars = 0;
            totalBronzeStars = 0;
            for (int w = 0; w < 11; ++w)
            {
                for (int l = 0; l < 10; ++l)
                {
                    var lcd = GetDetails(w, l);
                    totalTakenCoins += lcd.CoinIndicesCollected.Count();
                    if (lcd.GoldenEggClaimed)
                    {
                        ++totalGoldenEggs;
                    }
                    if (lcd.BestTimeRemainingMs.HasValue)
                    {
                        LevelID lid = new LevelID((byte)w, (byte)l);
                        if (lcd.BestTimeRemainingMs >= LevelDatabase.GetLevelGoldTime(lid))
                        {
                            stars[w * 10 + l] = Star.Gold;
                        }
                        else if (lcd.BestTimeRemainingMs >= LevelDatabase.GetLevelSilverTime(lid))
                        {
                            stars[w * 10 + l] = Star.Silver;
                        }
                        else if (lcd.BestTimeRemainingMs >= LevelDatabase.GetLevelBronzeTime(lid))
                        {
                            stars[w * 10 + l] = Star.Bronze;
                        }
                        else
                        {
                            stars[w * 10 + l] = Star.None;
                        }

                        switch (stars[w * 10 + l])
                        {
                        case Star.Gold:
                            ++totalGoldStars;
                            goto case Star.Silver;

                        case Star.Silver:
                            ++totalSilverStars;
                            goto case Star.Bronze;

                        case Star.Bronze:
                            ++totalBronzeStars;
                            break;
                        }
                    }
                }
            }
        }