public void OpenRoom(Room room, bool open) { if (open) { RoomOpened?.Invoke(room); } }
public async Task Initialize() { if (!_initialized) { _hubConnection = new HubConnectionBuilder() .WithUrl(_hubUrl) .Build(); _hubConnection.On <string, string>("ReceiveMessage", (user, message) => MessageReceived?.Invoke(user, message)); _hubConnection.On <Room>("UpdatePlayerState", (room) => PlayerStateUpdated?.Invoke(room)); _hubConnection.On <Room>("RoomOpened", (room) => RoomOpened?.Invoke(room)); _hubConnection.On <Room>("UpdateRoom", (room) => RoomUpdated?.Invoke(room)); await _hubConnection.StartAsync(); _initialized = true; } }