Пример #1
0
        /// <summary>
        ///     Updates the current user's status for a given achievement. If <see cref="percentComplete" /> is set to 100, the
        ///     UnlockedAt field will be automatically updated with the current timestamp.
        /// </summary>
        /// <param name="achievementId"></param>
        /// <param name="percentComplete"></param>
        /// <param name="callback"></param>
        public void SetUserAchievement(long achievementId, byte percentComplete, SetUserAchievementHandler callback)
        {
            GCHandle wrapped = GCHandle.Alloc(callback);

            Methods.SetUserAchievement(methodsPtr, achievementId, percentComplete, GCHandle.ToIntPtr(wrapped),
                                       SetUserAchievementCallbackImpl);
        }
Пример #2
0
        private static void SetUserAchievementCallbackImpl(IntPtr ptr, Result result)
        {
            GCHandle h = GCHandle.FromIntPtr(ptr);
            SetUserAchievementHandler callback = (SetUserAchievementHandler)h.Target;

            h.Free();
            callback(result);
        }