private static void CreateLobbyCallbackImpl(IntPtr ptr, Result result, ref Lobby lobby) { GCHandle h = GCHandle.FromIntPtr(ptr); CreateLobbyHandler callback = (CreateLobbyHandler)h.Target; h.Free(); callback(result, ref lobby); }
/// <summary> /// Creates a lobby. Creating a lobby auto-joins the connected user to it. Do not call SetOwner() in the transaction /// for this method. /// </summary> /// <param name="transaction"></param> /// <param name="callback"></param> public void CreateLobby(LobbyTransaction transaction, CreateLobbyHandler callback) { GCHandle wrapped = GCHandle.Alloc(callback); Methods.CreateLobby(methodsPtr, transaction.MethodsPtr, GCHandle.ToIntPtr(wrapped), CreateLobbyCallbackImpl); transaction.MethodsPtr = IntPtr.Zero; }