Example #1
0
 public void AddFriend(string GuideKey)
 {
     foreach (ClientTCP player in Global.clientList)
     {
         if (player.accountData.GuideKey.Equals(GuideKey))
         {
             List <string> Friends = accountData.Friends.ToList();
             if (!Friends.Contains(GuideKey))
             {
                 Friends.Add(GuideKey);
                 accountData.Friends = Friends.AsEnumerable();
                 Global.data.SaveAccount(accountData);
                 SendDataTCP.SendFriendInfo(this, player);
                 break;
             }
             break;
         }
     }
 }
Example #2
0
 public void LogIn(string username)
 {
     accountData = Global.data.GetAccount(username);
     nickname    = accountData.Nickname;
     playerState = NetPlayerState.InMainLobby;
     clientState = ClientTCPState.MainLobby;
     foreach (string guideKey in accountData.Friends.ToArray())
     {
         foreach (ClientTCP friend in Global.clientList)
         {
             if (friend.accountData.GuideKey.Equals(guideKey))
             {
                 friends.Add(friend);
                 friend.friends.Add(this);
                 SendDataTCP.SendFriendInfo(friend, this);
                 break;
             }
         }
     }
     SendDataTCP.SendLoginOk(nickname, this);
 }