Пример #1
0
 private void OnUserStatsReceived(UserStatsReceived_t pCallback)
 {
     if (!SteamManager.Initialized)
     {
         return;
     }
     if ((ulong)this.m_GameID == pCallback.m_nGameID)
     {
         if (pCallback.m_eResult == EResult.k_EResultOK)
         {
             Log.Info("Received stats and achievements from Steam\n");
             SteamHelper.Achievement_t[] achievements = SteamHelper.m_Achievements;
             for (int i = 0; i < achievements.Length; i++)
             {
                 SteamHelper.Achievement_t achievement_t = achievements[i];
                 bool achievement = SteamUserStats.GetAchievement(achievement_t.m_eAchievementID.ToString(), out achievement_t.m_bAchieved);
                 if (achievement)
                 {
                     achievement_t.m_strName        = SteamUserStats.GetAchievementDisplayAttribute(achievement_t.m_eAchievementID.ToString(), "name");
                     achievement_t.m_strDescription = SteamUserStats.GetAchievementDisplayAttribute(achievement_t.m_eAchievementID.ToString(), "desc");
                 }
                 else
                 {
                     Log.Error("SteamUserStats.GetAchievement failed for Achievement " + achievement_t.m_eAchievementID + "\nIs it registered in the Steam Partner site?");
                 }
             }
         }
         else
         {
             Log.Info("RequestStats - failed, " + pCallback.m_eResult);
         }
     }
 }
Пример #2
0
 private static void UnlockAchievement(SteamHelper.Achievement_t achievement)
 {
     if (!App.State.Ext.ImportedSaveFromKongToSteam && SteamManager.Initialized)
     {
         achievement.m_bAchieved = true;
         SteamUserStats.SetAchievement(achievement.m_eAchievementID.ToString());
     }
 }
Пример #3
0
        public static void CheckAchievements()
        {
            if (App.State == null || App.State.Ext.ImportedSaveFromKongToSteam || App.IsTimeTooOldForSteam || SteamHelper.IsQuitting || !SteamManager.Initialized)
            {
                return;
            }
            SteamHelper.Achievement_t[] achievements = SteamHelper.m_Achievements;
            for (int i = 0; i < achievements.Length; i++)
            {
                SteamHelper.Achievement_t achievement_t = achievements[i];
                if (!achievement_t.m_bAchieved)
                {
                    switch (achievement_t.m_eAchievementID)
                    {
                    case SteamAndroidAchievement.LightCreator:
                        if (App.State.Statistic.HighestGodDefeated > 0)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.UniverseCreator:
                        if (App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == Creation.CreationType.Universe).Count > 0)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.FirstMonument:
                        if (App.State.Statistic.MonumentsCreated > 0)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.BaalSlayer:
                        if (App.State.Statistic.HighestGodDefeated > 27)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.BestBurger:
                        if (App.State.AllFights.FirstOrDefault((Fight x) => x.TypeEnum == Fight.FightType.big_food).Level > 0)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.QueenSlayer:
                        if (App.State.AllFights.FirstOrDefault((Fight x) => x.TypeEnum == Fight.FightType.monster_queen).Level > 0)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.SlayerOfCreator:
                        if (App.State.Statistic.CreatorBeaten)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.DivinestBeing:
                    {
                        bool flag = true;
                        foreach (GeneratorUpgrade current in App.State.Generator.Upgrades)
                        {
                            if (current.Level < 33)
                            {
                                flag = false;
                            }
                        }
                        if (flag)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;
                    }

                    case SteamAndroidAchievement.EternalRebirther:
                        if (App.State.Statistic.TotalRebirths > 99)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.PetLover:
                        if (App.State.Statistic.TotalPetGrowth > 30000)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.MasterOfTBS:
                        if (App.State.Statistic.TBSScore > 1000)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.SlayerOfUltimate:
                        if (App.State.HomePlanet.UltimateBeings.FirstOrDefault((UltimateBeing x) => x.Tier == 1).TimesDefeated > 0)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.ITRTG:
                        if (App.State.HomePlanet.UltimateBeings.FirstOrDefault((UltimateBeing x) => x.Tier == 5).TimesDefeated > 0)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.PlanetEaterV2:
                        if (App.State.HomePlanet.UltimateBeingsV2.FirstOrDefault((UltimateBeingV2 x) => x.Tier == 1).TimesDefeated > 0)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.ITRTGV2:
                        if (App.State.HomePlanet.UltimateBeingsV2.FirstOrDefault((UltimateBeingV2 x) => x.Tier == 5).TimesDefeated > 0)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.UUC:
                        if (App.State.Statistic.UniverseChallengesFinished > 0)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.TAC:
                        if (App.State.Statistic.AchievementChallengesFinished > 0)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.UBC:
                        if (App.State.Statistic.UltimateBaalChallengesFinished > 0)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.UAC:
                        if (App.State.Statistic.ArtyChallengesFinished > 0)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.OnekC:
                        if (App.State.Statistic.OnekChallengesFinished > 0)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;

                    case SteamAndroidAchievement.DRC:
                        if (App.State.Statistic.DoubleRebirthChallengesFinished > 0)
                        {
                            SteamHelper.UnlockAchievement(achievement_t);
                        }
                        break;
                    }
                }
            }
        }