public void RemovePlayer(Client client) { lock (characterSlots) { for (int i = 0; i < characterSlots.Length; i++) { if (characterSlots[i].Remove(client)) { break; } } Broadcast(PacketMaker.MakeDestroy(client.GetId())); } }
public void ChangeCharacter(Client client, int index) { lock (characterSlots) { Broadcast(PacketMaker.MakeChCharacter(client.GetId(), (byte)index)); for (int i = 0; i < characterSlots.Length; i++) { if (characterSlots[i].Remove(client)) { break; } } characterSlots[index].Add(client); } }
public void PlayerOK() { lock (characterSlots) { for (int i = 0; i < characterSlots.Length; i++) { if (characterSlots[i].Exists(x => !x.IsOK())) { break; } } Console.WriteLine("Game starting..."); Broadcast(PacketMaker.MakeReady()); } }
public byte[] GetInitPacket() { return(PacketMaker.MakeInit(id, name)); }
public byte[] GetCharacterPacket() { return(PacketMaker.MakeChCharacter(id, character)); }