private void UpdateNotificationsCounter()
    {
        //NOTE(Brian): If friends tab is already active, update and save this value instantly
        if (view.friendsList.gameObject.activeInHierarchy)
        {
            PlayerPrefsUtils.SetInt(PLAYER_PREFS_SEEN_FRIEND_COUNT, friendsController.friendCount);
            PlayerPrefsUtils.Save();
        }

        var pendingFriendRequestsSO = NotificationScriptableObjects.pendingFriendRequests;
        int receivedRequestsCount   = view.friendRequestsList.receivedRequestsList.Count();

        if (pendingFriendRequestsSO != null)
        {
            pendingFriendRequestsSO.Set(receivedRequestsCount);
        }

        int seenFriendsCount = PlayerPrefs.GetInt(PLAYER_PREFS_SEEN_FRIEND_COUNT, 0);
        int friendsCount     = friendsController.friendCount;

        int newFriends = friendsCount - seenFriendsCount;

        //NOTE(Brian): If someone deletes you, don't show badge notification
        if (newFriends < 0)
        {
            newFriends = 0;
        }

        var newApprovedFriendsSO = NotificationScriptableObjects.newApprovedFriends;

        if (newApprovedFriendsSO != null)
        {
            newApprovedFriendsSO.Set(newFriends);
        }
    }
    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 override void OnStepFinished()
        {
            base.OnStepFinished();

            // TODO (Santi): This a TEMPORAL fix. It will be removed when we refactorize the tutorial system in order to make it compatible with incremental features.
            PlayerPrefsUtils.SetInt(PLAYER_PREFS_VOICE_CHAT_FEATURE_SHOWED, 1);

            if (tutorialController != null &&
                tutorialController.hudController != null &&
                tutorialController.hudController.usersAroundListHud != null)
            {
                tutorialController.hudController.usersAroundListHud.OnOpen -= UsersAroundListHud_OnOpen;
            }
        }
    private void UpdateQuality(int newQualityIndex)
    {
        if (newQualityIndex == currentQualityIndex)
        {
            return;
        }

        if (newQualityIndex <= 0 || newQualityIndex >= qualitySettings.Length)
        {
            return;
        }

        PlayerPrefsUtils.SetInt(LAST_QUALITY_INDEX, currentQualityIndex);
        currentQualityIndex = newQualityIndex;
        Settings.i.ApplyAutoQualitySettings(currentQualityIndex);
    }
示例#5
0
 private void RefreshLanguageHandle(int type, object eventObject)
 {
     m_currentLanguageType = (LanguageType)eventObject;
     Debug.Log("RefreshLanguageHandle ---->" + m_currentLanguageType);
     PlayerPrefsUtils.SetInt(LocalDataName.CURRENTLANGUAGETYPEKEY, (int)m_currentLanguageType);
 }
示例#6
0
 protected override void Dismiss()
 {
     PlayerPrefsUtils.SetInt(DONT_SHOW_GRAPHIC_CARD_POPUP_KEY, dontShowAgain.isOn ? 1 : 0);
     base.Dismiss();
 }