internal void UpdateScoreAchievements(int scoreAmount)
 {
     foreach (var achievementIDs in GPGSIds.score_achievement_IDs)
     {
         playGamesPlatform.IncrementAchievement(achievementIDs, scoreAmount, null);
     }
 }
Esempio n. 2
0
    void DoAchievementIncrement()
    {
        PlayGamesPlatform p = (PlayGamesPlatform)Social.Active;

        SetStandBy("Incrementing achievement...");
        p.IncrementAchievement(Settings.AchievementToIncrement, 1, (bool success) => {
            EndStandBy();
            mStatus = success ? "Incremented successfully." : "*** Failed to increment ach.";
            ShowEffect(success);
        });
    }
        public void AchievementIncrementForUnmappedId()
        {
            var mockClient = new AchievementClient();
            var platform   = new PlayGamesPlatform(mockClient);

            platform.IncrementAchievement("unmapped", 20, SentinelCallback);

            Assert.AreEqual("unmapped", mockClient.IncrementedId);
            Assert.AreEqual(20, mockClient.IncrementedSteps);
            Assert.AreSame(SentinelCallback, mockClient.IncrementedCallback);
        }
        public void AchievementIncrementRequiresAuthentication()
        {
            var mockClient        = new AchievementClient();
            var platform          = new PlayGamesPlatform(mockClient);
            var capturingCallback = new CapturingAction <bool>();

            mockClient.Authenticated = false;

            platform.IncrementAchievement("noAuth", 10, capturingCallback.invoke);

            Assert.IsFalse(capturingCallback.Captured);
        }
 public void FlushAchievements()
 {
     if (Authenticated)
     {
         foreach (string ach in mPendingIncrements.Keys)
         {
             // incrementing achievements by a delta is a feature
             // that's specific to the Play Games API and not part of the
             // ISocialPlatform spec, so we have to break the abstraction and
             // use the PlayGamesPlatform rather than ISocialPlatform
             PlayGamesPlatform p = (PlayGamesPlatform)Social.Active;
             p.IncrementAchievement(ach, mPendingIncrements[ach], (bool success) => {});
         }
         mPendingIncrements.Clear();
     }
 }