Exemple #1
0
 public void HandleNewConnection(PlayerConnectionState playerConnection)
 {
     playerConnection.tempId = tempLoginId++;
     lock (connectionLock)
     {
         newConnections.Add(playerConnection);
     }
 }
Exemple #2
0
 public GatewayPlayer(int _connectionId, GatewayMain _game, PlayerConnectionState _pcs, int _accountId)
 {
     connectionId    = _connectionId;
     Gateway         = _game;
     connection      = _pcs;
     accountId       = _accountId;
     outGoingPackets = new List <BasePacket>();
 }
Exemple #3
0
        private void OnNewPlayerConnection(Socket s)
        {
            PlayerConnectionState state = new PlayerConnectionState(s);

            lock (connectedLock)
            {
                newPlayersAwaitingConfirmation.Add(state);
            }

            NotifyEndpoint_ServerId(state);
        }
Exemple #4
0
        void ProcessUnprocessedLoginServerResponses()
        {
            List <BasePacket> tempPacketList;

            lock (responsesLock)
            {
                tempPacketList = unprocessedLoginServerResponses;
                unprocessedLoginServerResponses = new List <BasePacket>();
            }

            foreach (BasePacket packet in tempPacketList)
            {
                UserAccountResponse uar = packet as UserAccountResponse;
                if (uar == null)
                {
                    IntrepidSerialize.ReturnToPool(packet);
                    continue;
                }

                //List<PlayerConnectionState> validConnections;
                // the pending users should be a tiny list
                PlayerConnectionState foundPlayer = null;
                int indexOfFoundPlayer            = -1;
                foreach (PlayerConnectionState player in limboConnections)
                {
                    indexOfFoundPlayer++;
                    if (player.tempId == uar.connectionId)
                    {
                        foundPlayer = player;
                        break;
                    }
                }
                if (foundPlayer != null)
                {
                    limboConnections.RemoveAt(indexOfFoundPlayer);
                    foundPlayer.finishedLoginSuccessfully = uar.isValidAccount;
                    if (uar.isValidAccount == false)
                    {
                        invalidPlayers.Add(foundPlayer);
                    }
                    else
                    {
                        loggedInPlayers.Add(foundPlayer);
                    }

                    OnNewPlayerLoggedIn?.Invoke(foundPlayer, uar.isValidAccount, uar.state);
                }
                IntrepidSerialize.ReturnToPool(uar);
            }
        }
Exemple #5
0
        public void NewPlayerLoginResult(PlayerConnectionState playerConnection, bool success, PlayerSaveState save)
        {
            if (success == true)
            {
                int connectionId = nextGateWayPlayerConnectionId++;

                GatewayPlayer gp = new GatewayPlayer(connectionId, this, playerConnection, save.accountId);
                playerConnection.finishedLoginSuccessfully = success;

                // Get the server instance id
                lock (connectedLock)
                {
                    players.Add(gp);
                }

                PassSaveStateToGameServer(playerConnection.gameId, connectionId, save);
                gp.HasNotifiedGameServer = true;
            }
            LoginCredentialValid lcv = (LoginCredentialValid)IntrepidSerialize.TakeFromPool(PacketType.LoginCredentialValid);

            lcv.isValid = success;

            playerConnection.Send(lcv);
        }