Exemplo n.º 1
0
        private void StartConnect(string matchMakerAddress, ushort matchMakerPort, Guid sessionId,
                                  Dictionary <byte, object> matchMakingProperties, Dictionary <byte, object> joinGameProperties,
                                  Action <ShamanConnectionStatus, JoinInfo> statusCallback)
        {
            try
            {
                _matchMakingProperties = matchMakingProperties;
                _joinGameProperties    = joinGameProperties;
                _statusCallback        = statusCallback;
                SessionId = sessionId;
                //waiting for join Info
                _joinInfoEventId = RegisterShamanOperationHandler <JoinInfoEvent>(OnJoinInfoEvent);

                SetAndReportStatus(ShamanClientStatus.ConnectingMatchMaking, statusCallback);
                RegisterShamanOperationHandler <ConnectedEvent>(OnConnectedToMatchMaker, true);
                RegisterShamanOperationHandler <ErrorResponse>(
                    errorResponse =>
                {
                    SetAndReportStatus(ShamanClientStatus.ErrorReceived, _statusCallback, false,
                                       errorResponse.ErrorCode.ToString());
                }, false);

                _clientPeer.Connect(matchMakerAddress, matchMakerPort);
            }
            catch (Exception ex)
            {
                _logger.Error($"JoinGame error: {ex}");
                throw new ShamanClientException("JoinGame error", ex);
            }
        }
Exemplo n.º 2
0
 public void Connect(string address, ushort port)
 {
     _clientPeer.Connect(address, port);
 }