Exemple #1
0
            public static bool Prefix(string achievement_id)
            {
                if (DebugHandler.InstantBuildMode)
                {
                    Debug.LogWarningFormat("UnlockPlatformAchievement {0} skipping: instant build mode", (object)achievement_id);
                }
                else if (SaveGame.Instance.sandboxEnabled)
                {
                    Debug.LogWarningFormat("UnlockPlatformAchievement {0} skipping: sandbox mode", (object)achievement_id);
                }
                //else if (Game.Instance.debugWasUsed)
                //{
                //	Debug.LogWarningFormat("UnlockPlatformAchievement {0} skipping: debug was used.", (object)achievement_id);
                //}
                else
                {
                    ColonyAchievement colonyAchievement = Db.Get().ColonyAchievements.Get(achievement_id);
                    if (colonyAchievement == null || string.IsNullOrEmpty(colonyAchievement.steamAchievementId))
                    {
                        return(false);
                    }
                    if ((bool)SteamAchievementService.Instance)
                    {
                        SteamAchievementService.Instance.Unlock(colonyAchievement.steamAchievementId);
                    }
                    else
                    {
                        Debug.LogWarningFormat("Steam achievement [{0}] was achieved, but achievement service was null",
                                               (object)colonyAchievement.steamAchievementId);
                    }
                }

                return(false);
            }
Exemple #2
0
 /// <summary>
 /// Adds a colony achievement to the colony summary screen. Must be invoked after the
 /// database is initialized (Db.Initialize() postfix recommended).
 ///
 /// Note that achievement structures significantly changed from Vanilla to the DLC.
 /// </summary>
 /// <param name="achievement">The achievement to add.</param>
 public static void AddColonyAchievement(ColonyAchievement achievement)
 {
     if (achievement == null)
     {
         throw new ArgumentNullException(nameof(achievement));
     }
     Db.Get()?.ColonyAchievements?.resources?.Add(achievement);
 }
Exemple #3
0
        /// <summary>
        /// Applied before IsAchievementUnlocked runs.
        /// </summary>
        internal static bool Prefix(ColonyAchievementTracker __instance, ref bool __result,
                                    ColonyAchievement achievement)
        {
            bool achieved = false;

            if (__instance.achievements.TryGetValue(achievement.Id, out ColonyAchievementStatus
                                                    status))
            {
                achieved = status.success;
                if (!achieved)
                {
                    status.UpdateAchievement();
                    achieved = status.success;
                }
            }
            __result = achieved;
            return(false);
        }
Exemple #4
0
            public static void getAchId(string achievement)
            {
                ColonyAchievement colonyAchievement = Db.Get().ColonyAchievements.Get(achievement);

                Ach = achName.getName(colonyAchievement);
            }
Exemple #5
0
 public static string getDescription(ColonyAchievement colonyAchievement)
 {
     return(colonyAchievement.description);
 }
Exemple #6
0
 public static string getName(ColonyAchievement colonyAchievement)
 {
     return(colonyAchievement.Name);
 }