Пример #1
0
        public override void HandleMessage(INetPacketStream packet)
        {
            base.HandleMessage(packet);

            var photonPacket = new PhotonPacket(packet.Buffer);

            if (photonPacket.IsPingPacket.HasValue && photonPacket.IsPingPacket.Value)
            {
                SendPing();
            }
            else
            {
                if (photonPacket.PhotonPacketType.HasValue)
                {
                    switch (photonPacket.PhotonPacketType.Value)
                    {
                    case PhotonPacket.PhotonCode.InitResponse:

                        break;

                    default:
                        throw new InvalidOperationException("Unhandled PhotonCode!");
                    }
                }
                else
                {
                    throw new InvalidOperationException("Invalid Packet!");
                }
            }
        }
Пример #2
0
        protected override void OnConnected()
        {
            Console.WriteLine("Connected");

            using (var packet = new PhotonPacket())
            {
                var data = "fb000000300001f30001061e410106004c6f616442616c616e63696e6700000000000000000000000000000000000000".ToArray();
                packet.Write(data, 0, data.Length);
                Send(packet);
            }
        }
Пример #3
0
        public void SendPing()
        {
            using (var packet = PhotonPacket.PingTemplate())
            {
                var buf  = new byte[4];
                var offs = 0;
                Protocol.Serialize(Environment.TickCount, buf, ref offs);

                Send(packet);
            }
        }
Пример #4
0
        public override void HandleMessage(INetPacketStream packet)
        {
            base.HandleMessage(packet);

            var data = packet.Read <byte>(packet.Size);

            using (var p = new PhotonPacket())
            {
                var b = "fb000000720001f3060000010178000000605bc64a01ae3daf0a34bc84fe47a16f1bdf7a2744e9075317d236c483e807829908849fb713d3a8fd6f732066080634f8dcfb811d092b7fe489ffe71362c87df370c5eb47a4efa55dc833cfc0f746f1ed6013cc10b1967b1bd5451046f7bb96ac".ToArray();
                p.Write(b, 0, b.Length);
                Send(p);
            }
        }
Пример #5
0
        public override void HandleMessage(INetPacketStream packet)
        {
            base.HandleMessage(packet);

            var data = packet.Read <byte>(packet.Size);

            Console.WriteLine("Client -> Server | Size: {0}", data.Length);
            AConsole.WriteHexView(data);
            Console.WriteLine();

            using (var p = new PhotonPacket())
            {
                p.Write(data, 0, data.Length);
                AppContext.Instance.ProxyClient.Send(p);
            }
        }
Пример #6
0
 void FreePacket(PhotonPacket packet)
 {
     _packetPool.Enqueue(packet);
 }
Пример #7
0
 protected override void OnConnected()
 {
     Send(PhotonPacket.InitTemplate());
 }