コード例 #1
0
ファイル: LoginServerProxy.cs プロジェクト: mkawick/Gateway
 public void HandleNewConnection(PlayerConnectionState playerConnection)
 {
     playerConnection.tempId = tempLoginId++;
     lock (connectionLock)
     {
         newConnections.Add(playerConnection);
     }
 }
コード例 #2
0
 public GatewayPlayer(int _connectionId, GatewayMain _game, PlayerConnectionState _pcs, int _accountId)
 {
     connectionId    = _connectionId;
     Gateway         = _game;
     connection      = _pcs;
     accountId       = _accountId;
     outGoingPackets = new List <BasePacket>();
 }
コード例 #3
0
ファイル: GatewayMain.cs プロジェクト: mkawick/Gateway
        private void OnNewPlayerConnection(Socket s)
        {
            PlayerConnectionState state = new PlayerConnectionState(s);

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

            NotifyEndpoint_ServerId(state);
        }
コード例 #4
0
ファイル: LoginServerProxy.cs プロジェクト: mkawick/Gateway
        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);
            }
        }
コード例 #5
0
ファイル: GatewayMain.cs プロジェクト: mkawick/Gateway
        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);
        }