public static void ReadKeepAlive(Client client, PacketReader reader) { KeepAlivePacket ap = new KeepAlivePacket(); ap.Read(reader); if (!reader.Failed) { Client.HandleKeepAlive(client, ap); } }
public static void ReadEntitySpawn(Client client, PacketReader reader) { EntitySpawnPacket esp = new EntitySpawnPacket(); esp.Read(reader); if (!reader.Failed) { client.HandleEntitySpawn(esp); } }
public static void ReadHandshake(Client client, PacketReader reader) { HandshakePacket hp = new HandshakePacket(); hp.Read(reader); if (!reader.Failed) { Client.HandleHandshake(client, hp); } }
public static void HandleKeepAlive(Client client, KeepAlivePacket ap) { //Respond KeepAlive Packet to Server Console.WriteLine("Received Keep Alive"); client.SendPacket(new KeepAlivePacket {TimeStamp = ap.TimeStamp}); lock (client.WaitInitialPositionRequestLook) { if (client.WaitInitialPositionRequest) { client.WaitInitialPositionRequest = false; Monitor.PulseAll(client.WaitInitialPositionRequestLook); } } }
public override void Activate(bool instancePreserved) { base.Activate(instancePreserved); Engine = ScreenManager.Game as Engine; _client = new Client(this); AsyncLoadScene(); }
public static void ReadMovement(Client client, PacketReader reader) { MovePacket mp = new MovePacket(); mp.Read(reader); if (!reader.Failed) { Console.WriteLine("Received Move Packet"); client.Move( mp.EntityId, mp.Position, mp.Direction, mp.Speed); } }
public static void ReadPlayerPosition(Client client, PacketReader reader) { PlayerPositionPacket ppp = new PlayerPositionPacket(); ppp.Read(reader); if (!reader.Failed) { client.HandlePlayerPosition(ppp); } }
public static void ReadPlayerInfo(Client client, PacketReader reader) { PlayerInfoPacket pip = new PlayerInfoPacket(); Console.WriteLine("Player Info Packet size is {0}", reader.Size); pip.Read(reader); if (!reader.Failed) { client.HandlePlayerInfo(pip); } }
public static void ReadPattern(Client client, PacketReader reader) { PatternPacket pp = new PatternPacket(); pp.Read(reader); if (!reader.Failed) { Client.HandlePatternPacket(client, pp); } }
public ClientPlayer(Client client) { _client = client; }
public static void HandlePatternPacket(Client client, PatternPacket pp) { Console.WriteLine("Received Pattern Packet: " + client.DebugReceivedPattern++); //Retrieve Pattern Texture Pattern newPattern = new Pattern(new Vector3(pp.X, 0, pp.Y), client.GameScene.LoadPatternTexture(pp.TextureId)); client.GameScene.Pattern.Add(pp.PatternId, newPattern); }
public static void HandleHandshake(Client client, HandshakePacket hp) { //Handle Handshake Console.WriteLine("Received Handshake Packet back from Server :))"); }