private void FriendsController_OnUpdateFriendship(string id, FriendshipAction action) { if (action != FriendshipAction.NONE) { return; } RemoveChatHead(id); }
void OnFriendActionUpdate(string userId, FriendshipAction action) { if (profile.userId != userId) { return; } friendLabel.SetActive(action == FriendshipAction.APPROVED); }
private void OnFriendStatusUpdated(string userId, FriendshipAction action) { if (currentUserProfile == null) { return; } UpdateFriendButton(); }
private void OnUpdateFriendship(string userId, FriendshipAction friendshipAction) { if (!friendsController.isInitialized) { return; } if (friendshipAction == FriendshipAction.APPROVED) { isFriendlistDirty = true; return; } if (friendshipAction == FriendshipAction.DELETED) { isFriendlistDirty = true; OnFriendRemoved?.Invoke(userId); } }
public void RaiseUpdateFriendship(string id, FriendshipAction action) { if (action == FriendshipAction.NONE) { if (friends.ContainsKey(id)) { friends.Remove(id); } } if (action == FriendshipAction.APPROVED) { if (!friends.ContainsKey(id)) { friends.Add(id, new FriendsController.UserStatus()); } } OnUpdateFriendship?.Invoke(id, action); }
private void OnFriendActionUpdate(string userId, FriendshipAction action) { if (this.userId != userId) { return; } if (action == FriendshipAction.APPROVED) { SetupFriendship(FriendshipStatus.FRIEND); } else if (action == FriendshipAction.REQUESTED_TO) { SetupFriendship(FriendshipStatus.REQUESTED_TO); } else if (action == FriendshipAction.DELETED || action == FriendshipAction.CANCELLED || action == FriendshipAction.REJECTED) { SetupFriendship(FriendshipStatus.NONE); } }
void OnUpdateFriendship(string userId, FriendshipAction status) { if (!userElementDictionary.TryGetValue(userId, out UsersAroundListHUDListElementView elementView)) { return; } bool isFriend = IsFriend(status); bool isInFriendsList = IsInFriendsList(elementView); if (isFriend && !isInFriendsList) { ModifyListCount(friendList: false, -1); ModifyListCount(friendList: true, 1); elementView.transform.SetParent(contentFriends); } else if (!isFriend && isInFriendsList) { ModifyListCount(friendList: true, -1); ModifyListCount(friendList: false, 1); elementView.transform.SetParent(contentPlayers); } }
private void OnUpdateFriendship(string userId, FriendshipAction friendshipAction) { var userProfile = UserProfileController.userProfilesCatalog.Get(userId); if (userProfile == null) { Debug.LogError($"UserProfile is null for {userId}! ... friendshipAction {friendshipAction}"); return; } var friendEntryModel = new FriendEntry.Model(); FriendEntryBase entry = view.friendsList.GetEntry(userId) ?? view.friendRequestsList.GetEntry(userId); if (entry != null) { friendEntryModel = entry.model; } friendEntryModel.userName = userProfile.userName; friendEntryModel.avatarImage = userProfile.faceSnapshot; userProfile.OnFaceSnapshotReadyEvent -= friendEntryModel.OnSpriteUpdate; userProfile.OnFaceSnapshotReadyEvent += friendEntryModel.OnSpriteUpdate; if (ownUserProfile != null && ownUserProfile.blocked != null) { friendEntryModel.blocked = ownUserProfile.blocked.Contains(userId); } switch (friendshipAction) { case FriendshipAction.NONE: userProfile.OnFaceSnapshotReadyEvent -= friendEntryModel.OnSpriteUpdate; view.friendRequestsList.RemoveEntry(userId); view.friendsList.RemoveEntry(userId); break; case FriendshipAction.APPROVED: view.friendRequestsList.RemoveEntry(userId); view.friendsList.CreateOrUpdateEntryDeferred(userId, friendEntryModel); break; case FriendshipAction.REJECTED: userProfile.OnFaceSnapshotReadyEvent -= friendEntryModel.OnSpriteUpdate; view.friendRequestsList.RemoveEntry(userId); break; case FriendshipAction.CANCELLED: userProfile.OnFaceSnapshotReadyEvent -= friendEntryModel.OnSpriteUpdate; view.friendRequestsList.RemoveEntry(userId); break; case FriendshipAction.REQUESTED_FROM: view.friendRequestsList.CreateOrUpdateEntry(userId, friendEntryModel, true); break; case FriendshipAction.REQUESTED_TO: view.friendRequestsList.CreateOrUpdateEntry(userId, friendEntryModel, false); break; case FriendshipAction.DELETED: userProfile.OnFaceSnapshotReadyEvent -= friendEntryModel.OnSpriteUpdate; view.friendRequestsList.RemoveEntry(userId); view.friendsList.RemoveEntry(userId); break; } UpdateNotificationsCounter(); }
public static FriendEntry FakeAddFriend(FriendsController_Mock controller, FriendsHUDView hudView, string id, FriendshipAction action = FriendshipAction.APPROVED) { UserProfileModel model = new UserProfileModel() { userId = id, name = id, }; UserProfileController.i.AddUserProfileToCatalog(model); controller.RaiseUpdateFriendship(id, action); return(hudView.friendsList.GetEntry(id) as FriendEntry); }
bool IsFriend(FriendshipAction status) { return(status == FriendshipAction.APPROVED); }
public static IEnumerator FakeAddFriend(FriendsController_Mock controller, FriendsHUDView hudView, string id, FriendshipAction action = FriendshipAction.APPROVED) { UserProfileModel model = new UserProfileModel() { userId = id, name = id, }; UserProfileController.i.AddUserProfileToCatalog(model); controller.RaiseUpdateFriendship(id, action); yield return(new WaitUntil(() => hudView.friendsList.creationQueue.Count == 0)); }
public FriendshipRejectedState(FriendshipStateInfo info) { _lastReceiverKey = info.Sender.Key; _lastSenderKey = info.Receiver.Key; _lastAction = info.Action; }