예제 #1
0
 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()));
     }
 }
예제 #2
0
 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);
     }
 }
예제 #3
0
 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());
     }
 }
예제 #4
0
 public byte[] GetInitPacket()
 {
     return(PacketMaker.MakeInit(id, name));
 }
예제 #5
0
 public byte[] GetCharacterPacket()
 {
     return(PacketMaker.MakeChCharacter(id, character));
 }