/// <summary> /// Fires when room server send message about access validation result /// </summary> /// <param name="conn"></param> /// <param name="msg"></param> protected virtual void ValidateRoomAccessResultHandler(ValidateRoomAccessResultMessage msg) { if (msg.Status != ResponseStatus.Success) { logger.Error(msg.Error); OnAccessDenied(); OnAccessDiniedEvent?.Invoke(); return; } logger.Debug("Access to server room is successfully validated"); OnAccessGranted(); OnAccessGrantedEvent?.Invoke(); }
/// <summary> /// Fires when client connected to room server /// </summary> protected virtual void OnClientConnectedToRoomServer() { logger.Info("We have successfully connected to the room server"); roomServerConnection.RemoveConnectionListener(OnClientConnectedToRoomServer); roomServerConnection.SendMessage((short)MstMessageCodes.ValidateRoomAccessRequest, roomServerAccessInfo.Token, (status, response) => { // If access denied if (status != ResponseStatus.Success) { logger.Error(response.AsString()); OnAccessDiniedEvent?.Invoke(); return; } // If access granted OnAccessGrantedEvent?.Invoke(); }); }