Example #1
0
        public bool LoginGS(string gsHost, int gsPort, int callback, long accountID, int areadId, string token, List <TableVersion> everyTableVersions)
        {
            IPEndPoint remoteAddress = new IPEndPoint(NetUtil.GetIPV4Address(gsHost), gsPort);

            long num  = 0L;
            long num2 = 0L;

            if (connection != null)
            {
                num  = connection.SendAmount;
                num2 = connection.ReceiveAmount;
                LoggerManager.Instance.Info("LoginGs found lastConnection Amount send {0} receive {1} then call disconnect", num, num2);
                connection.Disconnect();
                connection = null;
            }

            connection = NetworkManager.GetInstance().CreateConnection(type, 0);
            connection.SetNetworkInitializer(networkInitializer, ConnectionType.Game);
            connection.ConnectAsync(new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0), remoteAddress);
            LoggerManager.Instance.Debug("LoginGS host {0} port {1} send {2} receive {3}", gsHost, gsPort, num, num2);

            CGLoginGameMessage cgLoginGameMessage = new CGLoginGameMessage();

            cgLoginGameMessage.CallBackId                  = callback;
            cgLoginGameMessage.Protocol.accountId          = accountID;
            cgLoginGameMessage.Protocol.areaId             = areadId;
            cgLoginGameMessage.Protocol.token              = token;
            cgLoginGameMessage.Protocol.sendProtocolAmount = num;
            cgLoginGameMessage.Protocol.recvProtocolAmount = num2;
            cgLoginGameMessage.Protocol.datas.AddRange(everyTableVersions);

            GSConnectionHandler connectionActiveHandler = new GSConnectionHandler(cgLoginGameMessage);

            messageInitializer.SetConnectionActiveHandler(connectionActiveHandler);

            return(true);
        }
Example #2
0
 public GSConnectionHandler(CGLoginGameMessage message)
 {
     req = message;
 }