Example #1
0
 public void CreateFriendButtons()
 {
     //foreach (Player player in FindObjectsOfType<Player>())
     //{
     //    if (GUILayout.Button(player.name + (FriendList.Contains(player.name) ? "(Friend)" : "(Enemy)")))
     //    {
     //        if (FriendList.Contains(player.name))
     //        {
     //            FriendList.Replace(" " + player.name, "");
     //        }
     //        else
     //        {
     //            FriendList += " " + player.name;
     //        }
     //    }
     //}
     foreach (SteamPlayer sp in Provider.clients.ToArray())
     {
         if (!isFriend(sp) && sp.player != MiscFunctions.getLocalPlayer())
         {
             if (GUILayout.Button(sp.playerID.playerName))
             {
                 addFriend(sp);
             }
         }
     }
     GUILayout.Space(50f);
     foreach (Friend f in friends)
     {
         if (GUILayout.Button(f.displayName))
         {
             removeFriend(f);
         }
     }
 }
Example #2
0
 public bool isFriend(Player player)
 {
     return(Array.Exists(friends.ToArray(), a => a.ID == MiscFunctions.getPlayerID(player)));
 }