GodotTicTacToe/scripts/Client.cs

30 lines
841 B
C#
Raw Normal View History

2017-11-21 18:33:48 +01:00
using Godot;
public class Client : Peer {
private PacketPeerUDP PacketPeer;
private Connection ServerConn;
private byte[] TempBuffer = {1};
public Client(PacketPeerUDP packetPeer) : base(packetPeer) {
PacketPeer = packetPeer;
}
public override void Initialize(string address, int port) {
GD.print("Start client.");
GD.print("Starting to send stuff to " + address + ":" + port);
2017-11-21 18:33:48 +01:00
ServerConn = new Connection(address, port);
StartListening(port, address);
2017-11-21 18:33:48 +01:00
}
2017-11-21 22:23:12 +01:00
public override void ReceivePacket(byte[] buffer, string address, int port) {
GD.print("Client received stuff from " + address + " : " + port + " :");
}
2017-11-21 18:33:48 +01:00
public override void Update(float delta) {
GD.print("Update client.");
SendBuffer(TempBuffer, ServerConn);
}
}