Inheritance: Aegis.Network.Packet
コード例 #1
0
ファイル: ServerSession.cs プロジェクト: digshock/Examples
        private void OnSS_Register_Req(PacketRequest reqPacket)
        {
            PacketResponse resPacket = new PacketResponse(reqPacket);
            Int32 serverUid = reqPacket.GetInt32();

            _svrInfo = ServerCatalog.Items.Find(v => v.Uid == serverUid);
            if (_svrInfo == null)
                resPacket.ResultCodeNo = ResultCode.InvalidUid;
            else
            {
                resPacket.ResultCodeNo = ResultCode.Ok;
                _svrInfo.Status = ServerStatus.Activate;

                Logger.Write(LogType.Info, 2, "GameServer({0}) registered.", serverUid);
            }

            SendPacket(resPacket);
        }
コード例 #2
0
ファイル: AuthSession.cs プロジェクト: digshock/Examples
        private void SendAndResponse(PacketRequest reqPacket, Action<PacketResponse> actionOnReceived)
        {
            SendPacket(reqPacket,
            (p) =>
            {
                return reqPacket.SeqNo == PacketResponse.GetSeqNo(p);
            },
            (s, p) =>
            {
                PacketResponse packet = new PacketResponse(p);
                packet.SkipHeader();

                actionOnReceived(packet);
            });
        }
コード例 #3
0
ファイル: PacketResponse.cs プロジェクト: digshock/Examples
        public override StreamBuffer Clone()
        {
            PacketResponse packet = new PacketResponse();
            packet.Write(Buffer);

            packet.ResetReadIndex();
            packet.ResetWriteIndex();
            packet.Read(ReadBytes);

            return packet;
        }