Advertisement
Guest User

Untitled

a guest
Apr 6th, 2025
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1.         /// <summary>
  2.         /// Called when the Hosts creates a game.
  3.         /// </summary>
  4.         /// <returns></returns>
  5.         public async Task CreateGame()
  6.         {
  7.             string codeRoom = GeneratorHelper.GenerateRoomNumber();
  8.  
  9.             await Groups.AddToGroupAsync(Context.ConnectionId, codeRoom);
  10.  
  11.             await Clients.Caller.SendAsync("GameCodeSent", codeRoom);
  12.         }
  13.  
  14.         /// <summary>
  15.         /// Called when the Hosts quits a game they created.
  16.         /// </summary>
  17.         /// <returns></returns>
  18.         public async Task LeavesCreatedGame(string codeRoom)
  19.         {
  20.             await Groups.RemoveFromGroupAsync(Context.ConnectionId, codeRoom);
  21.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement