Beispiel #1
0
 private void PacketReceived(WunderPacket packet)
 {
     if (packet != null && PacketCallbacks.ContainsKey(packet.Name))
     {
         PacketCallbacks[packet.Name]?.Invoke(packet);
     }
 }
Beispiel #2
0
 public void WunderPacketClientReceived(ClientHandler client, WunderPacket packet)
 {
     if (packet != null && PacketCallbacks.ContainsKey(packet.Name))
     {
         PacketCallbacks[packet.Name]?.Invoke(client, packet);
     }
 }
Beispiel #3
0
        static void ServerMessage(ClientHandler client, WunderPacket packet)
        {
            Console.WriteLine(packet.Get("MessageData"));
            var resp = ws.GetNewPacket("Message");

            resp.Set("MessageData", "I'm the Server Responding to the Client Message");
            client.Send(resp);
            ws.Disconnect();
        }
Beispiel #4
0
        static void ClientMessage(WunderPacket packet)
        {
            Console.WriteLine(packet.Get("MessageData"));

            var lotsofdata = wc.GetNewPacket("WorldInfo");

            for (int i = 0; i < 100; i++)
            {
                lotsofdata.Set("Width", i * 10);
                wc.Send(lotsofdata);
            }


            var resp = wc.GetNewPacket("Message");

            resp.Set("MessageData", "I'm a client responding to the server!");
            wc.Send(resp);
        }
Beispiel #5
0
        static void ClientMessage(WunderPacket packet)
        {
            Console.WriteLine(packet.ToString());
            var toSend = wc.GetNewPacket("VariableLengthPacket");
            var resp   = wc.GetNewPacket("Message");

            for (int i = 0; i < 50; i++)
            {
                toSend.Set("FieldOne", 42);
                toSend.Clear("FieldString");
                wc.Send(toSend);


                resp.Set("MessageData", "I'm The Client Sending a lot of data!");
                wc.Send(resp);

                toSend.Set("FieldOne", 37);
                toSend.Set("FieldString", "A Variable Packet");
                wc.Send(toSend);
            }
        }
Beispiel #6
0
 private void PacketReceived(WunderPacket wp)
 {
     WunderPacketReceived?.Invoke(this, wp);
 }
Beispiel #7
0
 public async void Send(WunderPacket p)
 {
     await _processor.WriteData(p.GetBytes());
 }
Beispiel #8
0
 static void ServerWorldInfo(ClientHandler client, WunderPacket packet)
 {
     Console.WriteLine(packet.Get("Width"));
 }
Beispiel #9
0
 static void ServerMessage(ClientHandler client, WunderPacket packet)
 {
     Console.WriteLine(packet.ToString());
 }