Ejemplo n.º 1
0
        protected virtual async UniTaskVoid HandleEnterGameRequest(
            RequestHandlerData requestHandler,
            EnterGameRequestMessage request,
            RequestProceedResultDelegate <EnterGameResponseMessage> result)
        {
            AckResponseCode          responseCode = AckResponseCode.Error;
            EnterGameResponseMessage response     = new EnterGameResponseMessage();

            if (request.packetVersion == PacketVersion() &&
                await DeserializeEnterGameData(requestHandler.ConnectionId, requestHandler.Reader))
            {
                responseCode             = AckResponseCode.Success;
                response.connectionId    = requestHandler.ConnectionId;
                response.serverSceneName = ServerSceneName;
            }
            result.Invoke(responseCode, response);
        }
Ejemplo n.º 2
0
 protected virtual UniTaskVoid HandleEnterGameResponse(
     ResponseHandlerData responseHandler,
     AckResponseCode responseCode,
     EnterGameResponseMessage response)
 {
     if (responseCode == AckResponseCode.Success)
     {
         ClientConnectionId = response.connectionId;
         if (!IsServer || !IsClientConnected)
         {
             HandleServerSceneChange(response.serverSceneName);
         }
     }
     else
     {
         if (LogError)
         {
             Logging.LogError(LogTag, "Enter game request was refused by server, disconnecting...");
         }
         StopClient();
     }
     return(default);
Ejemplo n.º 3
0
 protected virtual void HandleEnterGameResponse(
     ResponseHandlerData responseHandler,
     AckResponseCode responseCode,
     EnterGameResponseMessage response)
 {
     if (responseCode == AckResponseCode.Success)
     {
         ClientConnectionId = response.connectionId;
         if (IsClientConnected)
         {
             HandleServerSceneChange(response.serverSceneName);
         }
     }
     else
     {
         if (LogError)
         {
             Logging.LogError(LogTag, "Enter game request was refused by server, disconnecting...");
         }
         OnClientConnectionRefused();
     }
 }