示例#1
0
        public int HandlePacket(ClientBase client, GamePacket packet)
        {
            string account = packet.ReadUTF();

            ValidateLoginPacket pkg = new ValidateLoginPacket();

            pkg.ClientID = ((GatewayClient)client).ClientID;
            pkg.Account  = account;

            GatewayGlobal.Send2CacheServer(pkg);

            return(0);
        }
示例#2
0
        public int HandlePacket(ClientBase client, GamePacket packet)
        {
            CenterPlayer player = CenterGlobal.PlayerMgr[packet.PlayerID];

            if (player != null)
            {
                ValidateLoginPacket pkg = new ValidateLoginPacket();
                pkg.PlayerID = player.PlayerID;
                pkg.ClientID = player.ClientID;
                player.SendTcp(pkg);
            }

            return(0);
        }
示例#3
0
        public static void SendLoginPacket(ClientBase client, int clientID, string account, int playerID)
        {
            if (playerID != 0)
            {
                LoginInfo info = new LoginInfo();

                info.PlayerID = playerID;
                info.Account  = account;

                CenterPlayer player = new CenterPlayer(info, client);
                player.ClientID = clientID;
                player.Logined();

                if (CenterGlobal.PlayerMgr.Contains(playerID))
                {
                    //TODO: 发送踢下线通知 并在保存到数据库后通知中心服务器进行登陆后续操作

                    CenterPlayer player2 = CenterGlobal.PlayerMgr[playerID];

                    player2.Logout();

                    CenterGlobal.PlayerMgr.Remove(playerID);

                    CenterGlobal.PlayerMgr.Add(playerID, player);

                    KitPlayerPacket p = new KitPlayerPacket();
                    p.PlayerID = playerID;
                    player2.SendTcp(p);
                }
                else
                {
                    CenterGlobal.PlayerMgr.Add(playerID, player);

                    ValidateLoginPacket pkg = new ValidateLoginPacket();
                    pkg.PlayerID = playerID;
                    pkg.ClientID = clientID;
                    player.SendTcp(pkg);
                }
            }
            else
            {
                //TODO: 无此玩家 发送注册包到客户端进行注册

                NoticeRegistePacket pkg = new NoticeRegistePacket();

                pkg.ClientID = clientID;

                client.SendTcp(pkg);
            }
        }
示例#4
0
        public int HandlePacket(ClientBase client, GamePacket packet)
        {
            GatewayClient gc = client as GatewayClient;

            gc.LogicServer = GatewayGlobal.GetFreeLogicServer(gc);

            if (gc.LogicServer == null)
            {
                return(0);
            }

            string account = packet.ReadUTF();

            gc.Account = account;

            ValidateLoginPacket pkg = new ValidateLoginPacket();

            pkg.ClientID = gc.ClientID;
            pkg.Account  = account;

            GatewayGlobal.Send2Center(pkg, client);

            return(0);
        }