Beispiel #1
0
        internal static void OnAchievementsUnlockedV2(IntPtr address)
        {
            OnAchievementsUnlockedCallbackV2     callback     = null;
            OnAchievementsUnlockedCallbackV2Info callbackInfo = null;

            if (Helper.TryGetAndRemoveCallback <OnAchievementsUnlockedCallbackV2, OnAchievementsUnlockedCallbackV2InfoInternal, OnAchievementsUnlockedCallbackV2Info>(address, out callback, out callbackInfo))
            {
                callback(callbackInfo);
            }
        }
        /// <summary>
        /// Register to receive achievement unlocked notifications.
        /// @note must call <see cref="RemoveNotifyAchievementsUnlocked" /> to remove the notification
        /// <seealso cref="RemoveNotifyAchievementsUnlocked" />
        /// </summary>
        /// <param name="options">Structure containing information about the achievement unlocked notification</param>
        /// <param name="clientData">Arbitrary data that is passed back to you in the CompletionDelegate</param>
        /// <param name="notificationFn">A callback that is fired when an achievement unlocked notification for a user has been received</param>
        /// <returns>
        /// handle representing the registered callback
        /// </returns>
        public ulong AddNotifyAchievementsUnlockedV2(AddNotifyAchievementsUnlockedV2Options options, object clientData, OnAchievementsUnlockedCallbackV2 notificationFn)
        {
            System.IntPtr optionsAddress = new System.IntPtr();
            Helper.TryMarshalSet <AddNotifyAchievementsUnlockedV2OptionsInternal, AddNotifyAchievementsUnlockedV2Options>(ref optionsAddress, options);

            var clientDataAddress = System.IntPtr.Zero;

            var notificationFnInternal = new OnAchievementsUnlockedCallbackV2Internal(OnAchievementsUnlockedCallbackV2InternalImplementation);

            Helper.AddCallback(ref clientDataAddress, clientData, notificationFn, notificationFnInternal);

            var funcResult = EOS_Achievements_AddNotifyAchievementsUnlockedV2(InnerHandle, optionsAddress, clientDataAddress, notificationFnInternal);

            Helper.TryMarshalDispose(ref optionsAddress);

            Helper.TryAssignNotificationIdToCallback(clientDataAddress, funcResult);

            return(funcResult);
        }
Beispiel #3
0
        /// <summary>
        /// Register to receive achievement unlocked notifications.
        /// @note must call <see cref="RemoveNotifyAchievementsUnlocked" /> to remove the notification
        /// <seealso cref="RemoveNotifyAchievementsUnlocked" />
        /// <seealso cref="Achievements" />
        /// </summary>
        /// <param name="options">Structure containing information about the achievement unlocked notification</param>
        /// <param name="clientData">Arbitrary data that is passed back to you in the CompletionDelegate</param>
        /// <param name="notificationFn">A callback that is fired when an achievement unlocked notification for a user has been received</param>
        /// <returns>
        /// handle representing the registered callback
        /// </returns>
        public ulong AddNotifyAchievementsUnlockedV2(AddNotifyAchievementsUnlockedV2Options options, object clientData, OnAchievementsUnlockedCallbackV2 notificationFn)
        {
            var optionsInternal = Helper.CopyProperties <AddNotifyAchievementsUnlockedV2OptionsInternal>(options);

            var notificationFnInternal = new OnAchievementsUnlockedCallbackV2Internal(OnAchievementsUnlockedV2);
            var clientDataAddress      = IntPtr.Zero;

            Helper.AddCallback(ref clientDataAddress, clientData, notificationFn, notificationFnInternal);

            var funcResult = EOS_Achievements_AddNotifyAchievementsUnlockedV2(InnerHandle, ref optionsInternal, clientDataAddress, notificationFnInternal);

            Helper.TryMarshalDispose(ref optionsInternal);

            Helper.TryAssignNotificationIdToCallback(clientDataAddress, funcResult);

            var funcResultReturn = Helper.GetDefault <ulong>();

            Helper.TryMarshalGet(funcResult, out funcResultReturn);
            return(funcResultReturn);
        }