Exemplo n.º 1
0
        private static void SendInviteCallbackImpl(IntPtr ptr, Result result)
        {
            GCHandle          h        = GCHandle.FromIntPtr(ptr);
            SendInviteHandler callback = (SendInviteHandler)h.Target;

            h.Free();
            callback(result);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Sends a game invite to a given user. If you do not have a valid activity with all the required fields, this call
        ///     will error.
        ///     See
        ///     <a href="https://discord.com/developers/docs/game-sdk/activities#activity-action-field-requirements">
        ///         Activity
        ///         Action Field Requirement
        ///     </a>
        ///     for the fields required to have join and spectate invites function properly.
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="type"></param>
        /// <param name="content"></param>
        /// <param name="callback"></param>
        public void SendInvite(long userId, ActivityActionType type, string content, SendInviteHandler callback)
        {
            GCHandle wrapped = GCHandle.Alloc(callback);

            Methods.SendInvite(methodsPtr, userId, type, content, GCHandle.ToIntPtr(wrapped), SendInviteCallbackImpl);
        }