Пример #1
0
    public void TaskbarNotificationBadgeHasCorrectValue()
    {
        PlayerPrefs.SetInt(FriendsHUDController.PLAYER_PREFS_SEEN_FRIEND_COUNT, 0);

        var friendsRequestBadge = GetBadge("NotificationBadge_FriendsRequestTab");
        var friendsTaskbarBadge = GetBadge("NotificationBadge_FriendsButton");

        controller.SetVisibility(false);

        TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-1");
        TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-2");
        TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-3");
        TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-4");
        TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-5", FriendshipAction.REQUESTED_FROM);

        Assert.AreEqual(1, friendsRequestBadge.finalValue);
        Assert.AreEqual(5, friendsTaskbarBadge.finalValue);

        controller.SetVisibility(true);

        Assert.AreEqual(1, friendsRequestBadge.finalValue);
        Assert.AreEqual(1, friendsTaskbarBadge.finalValue);

        TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-5", FriendshipAction.APPROVED);
        TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-6", FriendshipAction.REQUESTED_FROM);

        Assert.AreEqual(1, friendsRequestBadge.finalValue);
        Assert.AreEqual(1, friendsTaskbarBadge.finalValue);

        UnityEngine.Object.Destroy(friendsRequestBadge.gameObject);
        UnityEngine.Object.Destroy(friendsTaskbarBadge.gameObject);
    }
    public IEnumerator TaskbarNotificationBadgeHasCorrectValue()
    {
        PlayerPrefsUtils.SetInt(FriendsHUDController.PLAYER_PREFS_SEEN_FRIEND_COUNT, 0);

        var friendsRequestBadge = GetBadge("NotificationBadge_FriendsRequestTab");
        var friendsTaskbarBadge = GetBadge("NotificationBadge_FriendsButton");

        controller.SetVisibility(false);

        yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-1"));

        yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-2"));

        yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-3"));

        yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-4"));

        yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-5", FriendshipAction.REQUESTED_FROM));

        Assert.AreEqual(1, friendsRequestBadge.finalValue);
        Assert.AreEqual(5, friendsTaskbarBadge.finalValue);

        controller.SetVisibility(true);

        Assert.AreEqual(1, friendsRequestBadge.finalValue);
        Assert.AreEqual(1, friendsTaskbarBadge.finalValue);

        yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-5", FriendshipAction.APPROVED));

        yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-6", FriendshipAction.REQUESTED_FROM));

        Assert.AreEqual(1, friendsRequestBadge.finalValue);
        Assert.AreEqual(1, friendsTaskbarBadge.finalValue);
    }
Пример #3
0
 public void OnCloseButtonPressed()
 {
     controller.SetVisibility(false);
     OnClose?.Invoke();
 }
Пример #4
0
 private void View_OnFriendsToggleOn()
 {
     friendsHud.SetVisibility(true);
     OnAnyTaskbarButtonClicked?.Invoke();
 }