Example #1
0
        internal static void OnIngestStatComplete(IntPtr address)
        {
            OnIngestStatCompleteCallback   callback     = null;
            IngestStatCompleteCallbackInfo callbackInfo = null;

            if (Helper.TryGetAndRemoveCallback <OnIngestStatCompleteCallback, IngestStatCompleteCallbackInfoInternal, IngestStatCompleteCallbackInfo>(address, out callback, out callbackInfo))
            {
                callback(callbackInfo);
            }
        }
Example #2
0
        /// <summary>
        /// Ingest a stat by the amount specified in Options.
        /// When the operation is complete and the delegate is triggered the stat will be uploaded to the backend to be processed.
        /// The stat may not be updated immediately and an achievement using the stat may take a while to be unlocked once the stat has been uploaded.
        /// </summary>
        /// <param name="options">Structure containing information about the stat we're ingesting.</param>
        /// <param name="clientData">Arbitrary data that is passed back to you in the CompletionDelegate.</param>
        /// <param name="completionDelegate">This function is called when the ingest stat operation completes.</param>
        /// <returns>
        /// <see cref="Result.Success" /> if the operation completes successfully
        /// <see cref="Result.InvalidParameters" /> if any of the options are incorrect
        /// </returns>
        public void IngestStat(IngestStatOptions options, object clientData, OnIngestStatCompleteCallback completionDelegate)
        {
            var optionsInternal = Helper.CopyProperties <IngestStatOptionsInternal>(options);

            var completionDelegateInternal = new OnIngestStatCompleteCallbackInternal(OnIngestStatComplete);
            var clientDataAddress          = IntPtr.Zero;

            Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);

            EOS_Stats_IngestStat(InnerHandle, ref optionsInternal, clientDataAddress, completionDelegateInternal);
            Helper.TryMarshalDispose(ref optionsInternal);
        }
Example #3
0
        /// <summary>
        /// Ingest a stat by the amount specified in Options.
        /// When the operation is complete and the delegate is triggered the stat will be uploaded to the backend to be processed.
        /// The stat may not be updated immediately and an achievement using the stat may take a while to be unlocked once the stat has been uploaded.
        /// </summary>
        /// <param name="options">Structure containing information about the stat we're ingesting.</param>
        /// <param name="clientData">Arbitrary data that is passed back to you in the CompletionDelegate.</param>
        /// <param name="completionDelegate">This function is called when the ingest stat operation completes.</param>
        /// <returns>
        /// <see cref="Result.Success" /> if the operation completes successfully
        /// <see cref="Result.InvalidParameters" /> if any of the options are incorrect
        /// <see cref="Result.InvalidUser" /> if target user ID is missing or incorrect
        /// </returns>
        public void IngestStat(IngestStatOptions options, object clientData, OnIngestStatCompleteCallback completionDelegate)
        {
            System.IntPtr optionsAddress = new System.IntPtr();
            Helper.TryMarshalSet <IngestStatOptionsInternal, IngestStatOptions>(ref optionsAddress, options);

            var clientDataAddress = System.IntPtr.Zero;

            var completionDelegateInternal = new OnIngestStatCompleteCallbackInternal(OnIngestStatCompleteCallbackInternalImplementation);

            Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);

            EOS_Stats_IngestStat(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);

            Helper.TryMarshalDispose(ref optionsAddress);
        }