private string GetPrefsKeyByType(ChatFilterType type)
        {
            string result = string.Empty;

            switch (type)
            {
            case ChatFilterType.Messages:
                result = "ChatFilterMessageCount";
                break;

            case ChatFilterType.Requests:
                result = "ChatFilterRequestCount";
                break;

            case ChatFilterType.Replays:
                result = "ChatFilterReplayCount";
                break;

            case ChatFilterType.Updates:
                result = "ChatFilterUpdateCount";
                break;

            case ChatFilterType.Videos:
                result = "ChatFilterVideoCount";
                break;
            }
            return(result);
        }
Example #2
0
 private void SetLastViewedTime(ChatFilterType type, uint data, bool forceUpdate)
 {
     if (this.screen.IsOpen() || this.screen.IsOpening() || forceUpdate)
     {
         string prefsKeyByType = this.GetPrefsKeyByType(type);
         this.SetSquadPlayerPref(prefsKeyByType, data);
     }
 }
Example #3
0
        private void HandleFilterSelection(ChatFilterType type, bool forceViewTimeUpdate)
        {
            SquadController squadController = Service.SquadController;

            squadController.StateManager.SetSquadScreenChatFilterType(type);
            this.SetSquadPlayerPref("ChatFilterType", (uint)type);
            this.RefreshView();
            uint unixTimestamp = ChatTimeConversionUtils.GetUnixTimestamp();

            if (type == ChatFilterType.ShowAll)
            {
                this.SetLastViewedTime(ChatFilterType.Messages, unixTimestamp, forceViewTimeUpdate);
                this.SetLastViewedTime(ChatFilterType.Requests, unixTimestamp, forceViewTimeUpdate);
                this.SetLastViewedTime(ChatFilterType.Replays, unixTimestamp, forceViewTimeUpdate);
                this.SetLastViewedTime(ChatFilterType.Updates, unixTimestamp, forceViewTimeUpdate);
            }
            this.SetLastViewedTime(type, unixTimestamp, forceViewTimeUpdate);
            this.UpdateBadges();
        }
        private uint GetLastViewedTimeByMessageType(SquadMsgType type)
        {
            ChatFilterType type2 = ChatFilterType.Invalid;

            switch (type)
            {
            case SquadMsgType.Chat:
                type2 = ChatFilterType.Messages;
                break;

            case SquadMsgType.Join:
            case SquadMsgType.JoinRequest:
            case SquadMsgType.JoinRequestAccepted:
            case SquadMsgType.JoinRequestRejected:
            case SquadMsgType.InviteAccepted:
            case SquadMsgType.Leave:
            case SquadMsgType.Ejected:
            case SquadMsgType.Promotion:
            case SquadMsgType.Demotion:
            case SquadMsgType.WarMatchMakingBegin:
                type2 = ChatFilterType.Updates;
                break;

            case SquadMsgType.ShareBattle:
                type2 = ChatFilterType.Replays;
                break;

            case SquadMsgType.ShareLink:
                type2 = ChatFilterType.Videos;
                break;

            case SquadMsgType.TroopRequest:
            case SquadMsgType.TroopDonation:
                type2 = ChatFilterType.Requests;
                break;
            }
            string prefsKeyByType = this.GetPrefsKeyByType(type2);

            return(this.GetSquadPlayerPref(prefsKeyByType, 0u));
        }
 public void SetSquadScreenChatFilterType(ChatFilterType type)
 {
     this.squadScreenChatFilterType = type;
     Service.Get <EventManager>().SendEvent(EventId.SquadChatFilterUpdated, this.squadScreenChatFilterType);
 }