/// <summary> /// This method is sending request to database for blocking a friend. Return value indicates whether operation succeed or failed. /// Blocking user who is on the friends list/sent friend requests list is automatically deleted from these lists and added to banned users list. /// </summary> /// <returns></returns> public static async Task <bool> BlockFriendAsync(IApiFriend friend, IClient client, ISession session) { try { string[] ids = new[] { friend.User.Id }; await client.BlockFriendsAsync(session, ids); return(true); } catch (Exception e) { Debug.Log("Blocking friend failed (" + e.Message + ")"); //catching exception, if program entered this code blocking friend operation was not successfully completed return(false); } }
/// <summary> /// Initializes panel /// </summary> /// <param name="friendsList"></param> /// <param name="friend"></param> public void Init(IApiFriend friend) { //Setting variables _friend = friend; _nicknameText.text = friend.User.Username; //connecting methods to buttons clicks _friendButton.onClick.AddListener(TogglePanel); _friendButton.onClick.AddListener(OnSelected_Handler); _removeFriendButton.onClick.AddListener(RemoveThisFriend); _blockFriendButton.onClick.AddListener(BlockOrUnblockThisFriend); _acceptInviteButton.onClick.AddListener(AcceptInviteFromThisFriend); _startChatButton.onClick.AddListener(StartChatWithThisFriend); //setting current panel state based on friend state ActualizeFriendState(); }
/// <summary> /// Adding new friend using information from previously loaded IApiFriend object. Return value indicates whether operation succeed or failed. /// </summary> /// <returns></returns> public static async Task <bool> AddFriendAsync(IApiFriend friend, IClient client, ISession session) { bool success = await AddFriendByIDAsync(friend.User.Id, client, session); return(success); }
private void FetchHistoricMessages(IApiFriend user) { var topic = StateManager.Instance.Topics[user.User.Id]; NakamaManager.Instance.TopicMessageList(topic, 100, true, true, 500); }