Пример #1
0
 private bool CanPromptReceivedChallenge()
 {
     if (!this.IsChallengeTavernBrawl())
     {
         return(true);
     }
     if (!TavernBrawlManager.Get().HasUnlockedTavernBrawl)
     {
         DeclineReason notUnlocked = DeclineReason.NotUnlocked;
         BnetParty.SetPartyAttributeLong(this.m_partyId, "WTCG.Friendly.DeclineReason", (long)notUnlocked);
         this.DeclineChallenge();
         return(false);
     }
     TavernBrawlManager.Get().EnsureScenarioDataReady(new TavernBrawlManager.CallbackEnsureServerDataReady(this.TavernBrawl_ReceivedChallenge_OnEnsureServerDataReady));
     return(false);
 }
Пример #2
0
 private bool OnFindGameEvent(FindGameEventData eventData, object userData)
 {
     this.UpdateMyAvailability();
     if (eventData.m_state == FindGameState.BNET_ERROR)
     {
         if (this.DidSendChallenge())
         {
             BnetParty.SetPartyAttributeLong(this.m_partyId, "error", (long)GameMgr.Get().GetLastEnterGameError());
             BnetParty.SetPartyAttributeString(this.m_partyId, "s1", "deck");
         }
         else if (this.DidReceiveChallenge())
         {
             BnetParty.SetPartyAttributeString(this.m_partyId, "s2", "deck");
         }
     }
     return(false);
 }
Пример #3
0
    private void TavernBrawl_ReceivedChallenge_OnEnsureServerDataReady_OnDeckContentsReady(long deckId)
    {
        CollectionManager.Get().RemoveDeckContentsListener(new CollectionManager.DelOnDeckContents(this.TavernBrawl_ReceivedChallenge_OnEnsureServerDataReady_OnDeckContentsReady));
        TavernBrawlMission mission  = TavernBrawlManager.Get().CurrentMission();
        string             key      = null;
        DeclineReason?     nullable = null;

        if (mission == null)
        {
            nullable = 0;
        }
        if (((mission != null) && mission.canCreateDeck) && !TavernBrawlManager.Get().HasValidDeck())
        {
            nullable = 2;
            key      = "GLOBAL_FRIEND_CHALLENGE_TAVERN_BRAWL_RECIPIENT_NO_VALID_DECK_RECIPIENT";
        }
        if (key != null)
        {
            AlertPopup.PopupInfo info = new AlertPopup.PopupInfo {
                m_headerText = GameStrings.Get("GLOBAL_FRIEND_CHALLENGE_TAVERN_BRAWL_HEADER")
            };
            object[] args = new object[] { FriendUtils.GetUniqueName(this.m_challenger) };
            info.m_text            = GameStrings.Format(key, args);
            info.m_responseDisplay = AlertPopup.ResponseDisplay.OK;
            DialogManager.Get().ShowPopup(info);
        }
        if (nullable.HasValue)
        {
            BnetParty.SetPartyAttributeLong(this.m_partyId, "WTCG.Friendly.DeclineReason", (long)nullable.Value);
            this.DeclineChallenge();
        }
        else
        {
            if (this.IsChallengeTavernBrawl())
            {
                Enum[] enumArray1 = new Enum[] { PresenceStatus.TAVERN_BRAWL_FRIENDLY_WAITING };
                PresenceMgr.Get().SetStatus(enumArray1);
            }
            this.ShowIReceivedChallengeDialog(this.m_challenger);
        }
    }