示例#1
0
 public static void RemovePlayer(NetClient.Info client)
 {
     for (int i = 0; i < Players.Count; i++)
     {
         if (client.IP.ToString() == Players[i].IP.ToString())
         {
             Players.RemoveAt(i);
             Debug.Log("RemovePlayer:" + i);
         }
     }
 }
示例#2
0
        public static void AddPlayer(NetClient.Info client)
        {
            PlayerInfo p = new PlayerInfo();

            p.ID = 0;
            for (int i = 0; i < Players.Count; i++)
            {
                if (p.ID == Players[i].ID)
                {
                    p.ID++;
                }
            }
            p.Name = client.PlayerName;
            p.IP   = client.IP;
            Players.Add(p);
            Debug.Log("AddPlayer:" + p.ID + "  name:" + p.Name);
        }