private bool SwitchToEditDeckMode(CollectionDeck deck)
 {
     if ((CollectionManagerDisplay.Get() == null) || (deck == null))
     {
         return(false);
     }
     this.m_tavernBrawlTray.HideTray();
     this.UpdateDeckPanels(true, true);
     if (UniversalInputManager.UsePhoneUI == null)
     {
         this.m_editDeckButton.gameObject.SetActive(TavernBrawlManager.Get().CurrentMission().canEditDeck);
         this.m_editDeckButton.SetText(GameStrings.Get("GLUE_COLLECTION_DECK_DELETE"));
         if (this.m_editIcon != null)
         {
             this.m_editIcon.SetActive(false);
         }
         if (this.m_deleteIcon != null)
         {
             this.m_deleteIcon.SetActive(true);
         }
         this.m_editDeckHighlight.ChangeState(ActorStateType.HIGHLIGHT_OFF);
     }
     this.m_deckBeingEdited = deck.ID;
     BnetBar.Get().m_currencyFrame.RefreshContents();
     CollectionDeckTray.Get().EnterEditDeckModeForTavernBrawl();
     FriendChallengeMgr.Get().UpdateMyAvailability();
     return(true);
 }
 private void Awake()
 {
     s_instance = this;
     AssetLoader.Get().LoadActor((UniversalInputManager.UsePhoneUI == null) ? "DeckPickerTray" : "DeckPickerTray_phone", delegate(string name, GameObject go, object data) {
         if (go == null)
         {
             Debug.LogError("Unable to load DeckPickerTray.");
         }
         else
         {
             this.m_deckPickerTray = go.GetComponent <DeckPickerTrayDisplay>();
             if (this.m_deckPickerTray == null)
             {
                 Debug.LogError("DeckPickerTrayDisplay component not found in DeckPickerTray object.");
             }
             else
             {
                 GameUtils.SetParent(this.m_deckPickerTray, this.m_deckPickerTrayContainer, false);
                 this.m_deckPickerTray.SetHeaderText(GameStrings.Get(!FriendChallengeMgr.Get().IsChallengeTavernBrawl() ? "GLOBAL_FRIEND_CHALLENGE_TITLE" : "GLOBAL_TAVERN_BRAWL"));
                 this.m_deckPickerTray.Init();
                 this.DisableOtherModeStuff();
                 NetCache.Get().RegisterScreenFriendly(new NetCache.NetCacheCallback(this.OnNetCacheReady));
                 MusicManager.Get().StartPlaylist(!FriendChallengeMgr.Get().IsChallengeTavernBrawl() ? MusicPlaylistType.UI_Friendly : MusicPlaylistType.UI_TavernBrawl);
             }
         }
     }, null, false);
 }
 public static void OnPlayerChallengeButtonPressed(FriendListChallengeButton challengeButton, BnetPlayer player)
 {
     SoundManager.Get().LoadAndPlay("Small_Click");
     if (ChatMgr.Get().FriendListFrame.IsInEditMode)
     {
         ChatMgr.Get().FriendListFrame.ShowRemoveFriendPopup(player);
     }
     else
     {
         BnetGameAccountId hearthstoneGameAccountId = player.GetHearthstoneGameAccountId();
         SpectatorManager  manager = SpectatorManager.Get();
         if (manager.CanSpectate(player))
         {
             manager.SpectatePlayer(player);
         }
         else if (manager.IsSpectatingMe(hearthstoneGameAccountId))
         {
             AlertPopup.PopupInfo info = new AlertPopup.PopupInfo {
                 m_headerText = GameStrings.Get("GLOBAL_SPECTATOR_KICK_PROMPT_HEADER")
             };
             object[] args = new object[] { FriendUtils.GetUniqueName(player) };
             info.m_text             = GameStrings.Format("GLOBAL_SPECTATOR_KICK_PROMPT_TEXT", args);
             info.m_showAlertIcon    = true;
             info.m_responseDisplay  = AlertPopup.ResponseDisplay.CONFIRM_CANCEL;
             info.m_responseCallback = new AlertPopup.ResponseCallback(FriendListFriendFrame.OnKickSpectatorDialogResponse);
             info.m_responseUserData = player;
             DialogManager.Get().ShowPopup(info);
         }
         else if (manager.CanInviteToSpectateMyGame(hearthstoneGameAccountId))
         {
             manager.InviteToSpectateMe(player);
         }
         else if (manager.IsSpectatingPlayer(hearthstoneGameAccountId))
         {
             if ((GameMgr.Get().IsFindingGame() || SceneMgr.Get().IsTransitioning()) || GameMgr.Get().IsTransitionPopupShown())
             {
                 return;
             }
             AlertPopup.PopupInfo info2 = new AlertPopup.PopupInfo {
                 m_headerText       = GameStrings.Get("GLOBAL_SPECTATOR_LEAVE_PROMPT_HEADER"),
                 m_text             = GameStrings.Get("GLOBAL_SPECTATOR_LEAVE_PROMPT_TEXT"),
                 m_showAlertIcon    = true,
                 m_responseDisplay  = AlertPopup.ResponseDisplay.CONFIRM_CANCEL,
                 m_responseCallback = new AlertPopup.ResponseCallback(FriendListFriendFrame.OnLeaveSpectatingDialogResponse)
             };
             DialogManager.Get().ShowPopup(info2);
         }
         else if (!manager.IsInvitedToSpectateMyGame(hearthstoneGameAccountId) && challengeButton.CanChallenge())
         {
             FriendChallengeMgr.Get().SendChallenge(player);
         }
         else
         {
             return;
         }
         challengeButton.UpdateButton();
         ChatMgr.Get().CloseChatUI();
     }
 }
Ejemplo n.º 4
0
        // Found at: DeckPickerTrayDisplay search for RankedMatch
        private void tournament_mode(bool ranked)
        {
            if (just_joined)
            {
                return;
            }

            // Don't do this, if we're currently in a game, or matching a game
            // TODO: Change to an assertion
            if (SceneMgr.Get().IsInGame() || Network.IsMatching())
            {
                return;
            }
            // Delay 5 seconds for loading and such
            // TODO: Smarter delaying
            Delay(5000);

            // If we're not set to the right mode, now is the time to do so
            // Note; This does not update the GUI, only the internal state
            bool is_ranked = Options.Get().GetBool(Option.IN_RANKED_PLAY_MODE);

            if (is_ranked != ranked)
            {
                Options.Get().SetBool(Option.IN_RANKED_PLAY_MODE, ranked);
                return;
            }

            Log.log("Joining game in tournament mode, ranked = " + ranked);

            // Get the ID of the current Deck
            long selectedDeckID = DeckPickerTrayDisplay.Get().GetSelectedDeckID();
            // We want to play vs other players
            MissionID missionID = MissionID.MULTIPLAYER_1v1;
            // Ranked or unranked?
            GameMode mode = ranked ? GameMode.RANKED_PLAY : GameMode.UNRANKED_PLAY;

            // Setup up the game
            GameMgr.Get().SetNextGame(mode, missionID);
            // Do network join
            if (ranked)
            {
                Network.TrackClient(Network.TrackLevel.LEVEL_INFO,
                                    Network.TrackWhat.TRACK_PLAY_TOURNAMENT_WITH_CUSTOM_DECK);
                Network.RankedMatch(selectedDeckID);
            }
            else
            {
                Network.TrackClient(Network.TrackLevel.LEVEL_INFO,
                                    Network.TrackWhat.TRACK_PLAY_CASUAL_WITH_CUSTOM_DECK);
                Network.UnrankedMatch(selectedDeckID);
            }
            // Set status
            FriendChallengeMgr.Get().OnEnteredMatchmakerQueue();
            GameMgr.Get().UpdatePresence();

            just_joined = true;
        }
Ejemplo n.º 5
0
 public void StartChallengeOrWaitForOpponent(string waitingDialogText, AlertPopup.ResponseCallback waitingCallback)
 {
     if (FriendChallengeMgr.Get().DidOpponentSelectDeck())
     {
         this.WaitForFriendChallengeToStart();
     }
     else
     {
         this.ShowFriendChallengeWaitingForOpponentDialog(waitingDialogText, waitingCallback);
     }
 }
Ejemplo n.º 6
0
    private void ShowFriendChallengeWaitingForOpponentDialog(string dialogText, AlertPopup.ResponseCallback callback)
    {
        BnetPlayer myOpponent = FriendChallengeMgr.Get().GetMyOpponent();

        AlertPopup.PopupInfo info = new AlertPopup.PopupInfo();
        object[]             args = new object[] { FriendUtils.GetUniqueName(myOpponent) };
        info.m_text             = GameStrings.Format(dialogText, args);
        info.m_showAlertIcon    = false;
        info.m_responseDisplay  = AlertPopup.ResponseDisplay.CANCEL;
        info.m_responseCallback = callback;
        DialogManager.Get().ShowPopup(info, new DialogManager.DialogProcessCallback(this.OnFriendChallengeWaitingForOpponentDialogProcessed));
    }
Ejemplo n.º 7
0
 private bool OnFriendChallengeWaitingForOpponentDialogProcessed(DialogBase dialog, object userData)
 {
     if (!FriendChallengeMgr.Get().HasChallenge())
     {
         return(false);
     }
     if (FriendChallengeMgr.Get().DidOpponentSelectDeck())
     {
         this.WaitForFriendChallengeToStart();
         return(false);
     }
     this.m_friendChallengeWaitingPopup = (AlertPopup)dialog;
     return(true);
 }
    private void StartGame(UIEvent e)
    {
        TavernBrawlMission mission = TavernBrawlManager.Get().CurrentMission();

        if (mission == null)
        {
            this.RefreshDataBasedUI(0f);
        }
        else
        {
            if (TavernBrawlManager.Get().SelectHeroBeforeMission())
            {
                if (HeroPickerDisplay.Get() != null)
                {
                    Log.JMac.PrintWarning("Attempting to load HeroPickerDisplay a second time!", new object[0]);
                    return;
                }
                AssetLoader.Get().LoadActor("HeroPicker", false, false);
            }
            else if (mission.canCreateDeck)
            {
                if (!TavernBrawlManager.Get().HasValidDeck())
                {
                    UnityEngine.Debug.LogError("Attempting to start a Tavern Brawl game without having a valid deck!");
                    return;
                }
                CollectionDeck deck = TavernBrawlManager.Get().CurrentDeck();
                if (FriendChallengeMgr.Get().IsChallengeTavernBrawl())
                {
                    FriendChallengeMgr.Get().SelectDeck(deck.ID);
                    FriendlyChallengeHelper.Get().StartChallengeOrWaitForOpponent("GLOBAL_FRIEND_CHALLENGE_TAVERN_BRAWL_OPPONENT_WAITING_READY", new AlertPopup.ResponseCallback(this.OnFriendChallengeWaitingForOpponentDialogResponse));
                }
                else
                {
                    TavernBrawlManager.Get().StartGame(deck.ID);
                }
            }
            else if (FriendChallengeMgr.Get().IsChallengeTavernBrawl())
            {
                FriendChallengeMgr.Get().SkipDeckSelection();
                FriendlyChallengeHelper.Get().StartChallengeOrWaitForOpponent("GLOBAL_FRIEND_CHALLENGE_TAVERN_BRAWL_OPPONENT_WAITING_READY", new AlertPopup.ResponseCallback(this.OnFriendChallengeWaitingForOpponentDialogResponse));
            }
            else
            {
                TavernBrawlManager.Get().StartGame(0L);
            }
            this.m_playButton.SetEnabled(false);
        }
    }
Ejemplo n.º 9
0
    public void SetInfo(Info info)
    {
        string key = "GLOBAL_FRIEND_CHALLENGE_BODY1";

        if (FriendChallengeMgr.Get().IsChallengeTavernBrawl())
        {
            key = "GLOBAL_FRIEND_CHALLENGE_TAVERN_BRAWL_BODY1";
        }
        this.m_challengeText1.Text = GameStrings.Get(key);
        this.m_challengeText2.Text = GameStrings.Get("GLOBAL_FRIEND_CHALLENGE_BODY2");
        this.m_challengerName.Text = FriendUtils.GetUniqueName(info.m_challenger);
        this.m_responseCallback    = info.m_callback;
        bool flag = BnetNearbyPlayerMgr.Get().IsNearbyStranger(info.m_challenger);

        this.m_nearbyPlayerNote.gameObject.SetActive(flag);
    }
    private bool OnFindGameEvent(FindGameEventData eventData, object userData)
    {
        switch (eventData.m_state)
        {
        case FindGameState.CLIENT_CANCELED:
        case FindGameState.CLIENT_ERROR:
        case FindGameState.BNET_ERROR:
        case FindGameState.SERVER_GAME_CANCELED:
            this.HandleGameStartupFailure();
            break;

        case FindGameState.SERVER_GAME_STARTED:
            FriendChallengeMgr.Get().RemoveChangedListener(new FriendChallengeMgr.ChangedCallback(this.OnFriendChallengeChanged));
            break;
        }
        return(false);
    }
 public void Unload()
 {
     CollectionManager.Get().RemoveDeckCreatedListener(new CollectionManager.DelOnDeckCreated(this.OnDeckCreated));
     CollectionManager.Get().RemoveDeckDeletedListener(new CollectionManager.DelOnDeckDeleted(this.OnDeckDeleted));
     CollectionManager.Get().RemoveDeckContentsListener(new CollectionManager.DelOnDeckContents(this.OnDeckContents));
     FriendChallengeMgr.Get().RemoveChangedListener(new FriendChallengeMgr.ChangedCallback(this.OnFriendChallengeChanged));
     NetCache.Get().RemoveUpdatedListener(typeof(NetCache.NetCacheTavernBrawlRecord), new System.Action(this.NetCache_OnTavernBrawlRecord));
     GameMgr.Get().UnregisterFindGameEvent(new GameMgr.FindGameCallback(this.OnFindGameEvent));
     if ((FriendChallengeMgr.Get().IsChallengeTavernBrawl() && !SceneMgr.Get().IsInGame()) && !SceneMgr.Get().IsModeRequested(SceneMgr.Mode.FRIENDLY))
     {
         FriendChallengeMgr.Get().CancelChallenge();
     }
     if (this.IsInDeckEditMode())
     {
         Navigation.Pop();
     }
 }
 public bool BackFromDeckEdit(bool animate)
 {
     if (!this.IsInDeckEditMode())
     {
         return(false);
     }
     if (animate)
     {
         PresenceMgr.Get().SetPrevStatus();
     }
     if (CollectionManagerDisplay.Get().GetViewMode() != CollectionManagerDisplay.ViewMode.CARDS)
     {
         TAG_CLASS pageClass = (TavernBrawlManager.Get().CurrentDeck() != null) ? TavernBrawlManager.Get().CurrentDeck().GetClass() : TAG_CLASS.DRUID;
         CollectionManagerDisplay.Get().m_pageManager.JumpToCollectionClassPage(pageClass);
     }
     this.m_tavernBrawlTray.ToggleTraySlider(true, null, animate);
     this.RefreshStateBasedUI(animate);
     this.m_deckBeingEdited = 0L;
     BnetBar.Get().m_currencyFrame.RefreshContents();
     FriendChallengeMgr.Get().UpdateMyAvailability();
     this.UpdateEditOrCreate();
     if (UniversalInputManager.UsePhoneUI == null)
     {
         this.m_editDeckButton.SetText(GameStrings.Get("GLUE_EDIT"));
         if (this.m_editIcon != null)
         {
             this.m_editIcon.SetActive(true);
         }
         if (this.m_deleteIcon != null)
         {
             this.m_deleteIcon.SetActive(false);
         }
     }
     CollectionDeckTray.Get().ExitEditDeckModeForTavernBrawl();
     return(true);
 }
 private void OnFriendChallengeChanged(FriendChallengeEvent challengeEvent, BnetPlayer player, object userData)
 {
     if ((challengeEvent == FriendChallengeEvent.OPPONENT_ACCEPTED_CHALLENGE) || (challengeEvent == FriendChallengeEvent.I_ACCEPTED_CHALLENGE))
     {
         this.SetUIForFriendlyChallenge(true);
     }
     else if (challengeEvent == FriendChallengeEvent.SELECTED_DECK)
     {
         if ((player != BnetPresenceMgr.Get().GetMyPlayer()) && FriendChallengeMgr.Get().DidISelectDeck())
         {
             FriendlyChallengeHelper.Get().HideFriendChallengeWaitingForOpponentDialog();
             FriendlyChallengeHelper.Get().WaitForFriendChallengeToStart();
         }
     }
     else if (((challengeEvent == FriendChallengeEvent.I_RESCINDED_CHALLENGE) || (challengeEvent == FriendChallengeEvent.OPPONENT_DECLINED_CHALLENGE)) || (challengeEvent == FriendChallengeEvent.OPPONENT_RESCINDED_CHALLENGE))
     {
         this.SetUIForFriendlyChallenge(false);
     }
     else if ((challengeEvent == FriendChallengeEvent.OPPONENT_CANCELED_CHALLENGE) || (challengeEvent == FriendChallengeEvent.OPPONENT_REMOVED_FROM_FRIENDS))
     {
         this.SetUIForFriendlyChallenge(false);
         FriendlyChallengeHelper.Get().StopWaitingForFriendChallenge();
     }
 }
Ejemplo n.º 14
0
 private void AssetsVersionCheckCompleted()
 {
     if (!string.IsNullOrEmpty(UpdateManager.Get().GetError()) && UpdateManager.Get().UpdateIsRequired())
     {
         Error.AddFatalLoc("GLUE_PATCHING_ERROR", new object[0]);
     }
     else
     {
         if (Network.ShouldBeConnectedToAurora())
         {
             BnetPresenceMgr.Get().Initialize();
             BnetFriendMgr.Get().Initialize();
             BnetChallengeMgr.Get().Initialize();
             BnetWhisperMgr.Get().Initialize();
             BnetNearbyPlayerMgr.Get().Initialize();
             FriendChallengeMgr.Get().OnLoggedIn();
             SpectatorManager.Get().Initialize();
             if (!Options.Get().GetBool(Option.CONNECT_TO_AURORA))
             {
                 Options.Get().SetBool(Option.CONNECT_TO_AURORA, true);
             }
             TutorialProgress progress = Options.Get().GetEnum <TutorialProgress>(Option.LOCAL_TUTORIAL_PROGRESS);
             if (progress > TutorialProgress.NOTHING_COMPLETE)
             {
                 this.m_waitingForSetProgress = true;
                 ConnectAPI.SetProgress((long)progress);
             }
             if (WebAuth.GetIsNewCreatedAccount())
             {
                 AdTrackingManager.Get().TrackAccountCreated();
                 WebAuth.SetIsNewCreatedAccount(false);
             }
         }
         ConnectAPI.RequestAccountLicenses();
         ConnectAPI.RequestGameLicenses();
         Box.Get().OnLoggedIn();
         BaseUI.Get().OnLoggedIn();
         InactivePlayerKicker.Get().OnLoggedIn();
         HealthyGamingMgr.Get().OnLoggedIn();
         DefLoader.Get().Initialize();
         CollectionManager.Init();
         AdventureProgressMgr.Init();
         Tournament.Init();
         GameMgr.Get().OnLoggedIn();
         if (Network.ShouldBeConnectedToAurora())
         {
             StoreManager.Get().Init();
         }
         Network.TrackClient(Network.TrackLevel.LEVEL_INFO, Network.TrackWhat.TRACK_LOGIN_FINISHED);
         Network.ResetConnectionFailureCount();
         if (Network.ShouldBeConnectedToAurora())
         {
             ConnectAPI.DoLoginUpdate();
         }
         else
         {
             this.m_waitingForUpdateLoginComplete = false;
         }
         Enum[] args = new Enum[] { PresenceStatus.LOGIN };
         PresenceMgr.Get().SetStatus(args);
         if (SplashScreen.Get() != null)
         {
             SplashScreen.Get().StopPatching();
             SplashScreen.Get().ShowRatings();
         }
         this.PreloadActors();
         if (!Network.ShouldBeConnectedToAurora())
         {
             base.StartCoroutine(this.RegisterScreenWhenReady());
         }
         SceneMgr.Get().LoadShaderPreCompiler();
     }
 }
Ejemplo n.º 15
0
 public void WaitForFriendChallengeToStart()
 {
     GameMgr.Get().WaitForFriendChallengeToStart(FriendChallengeMgr.Get().GetScenarioId());
 }
 public bool CanChallenge()
 {
     return(FriendChallengeMgr.Get().CanChallenge(this.m_player));
 }
 private void OnChallengeButtonReleased(UIEvent e)
 {
     FriendChallengeMgr.Get().SendChallenge(this.m_receiver);
 }
    private void ShowTooltip()
    {
        string            str;
        string            str2;
        BnetGameAccountId hearthstoneGameAccountId = this.m_player.GetHearthstoneGameAccountId();
        SpectatorManager  manager = SpectatorManager.Get();

        if (manager.HasInvitedMeToSpectate(hearthstoneGameAccountId))
        {
            str  = "GLOBAL_FRIENDLIST_SPECTATE_TOOLTIP_AVAILABLE_HEADER";
            str2 = "GLOBAL_FRIENDLIST_SPECTATE_TOOLTIP_RECEIVED_INVITE_TEXT";
        }
        else if (manager.CanSpectate(this.m_player))
        {
            str  = "GLOBAL_FRIENDLIST_SPECTATE_TOOLTIP_AVAILABLE_HEADER";
            str2 = "GLOBAL_FRIENDLIST_SPECTATE_TOOLTIP_AVAILABLE_TEXT";
        }
        else if (manager.IsSpectatingMe(hearthstoneGameAccountId))
        {
            str  = "GLOBAL_FRIENDLIST_SPECTATE_TOOLTIP_KICK_HEADER";
            str2 = "GLOBAL_FRIENDLIST_SPECTATE_TOOLTIP_KICK_TEXT";
        }
        else if (manager.CanInviteToSpectateMyGame(hearthstoneGameAccountId))
        {
            if (manager.IsPlayerSpectatingMyGamesOpposingSide(hearthstoneGameAccountId))
            {
                str  = "GLOBAL_FRIENDLIST_SPECTATE_TOOLTIP_INVITE_OTHER_SIDE_HEADER";
                str2 = "GLOBAL_FRIENDLIST_SPECTATE_TOOLTIP_INVITE_OTHER_SIDE_TEXT";
            }
            else
            {
                str  = "GLOBAL_FRIENDLIST_SPECTATE_TOOLTIP_INVITE_HEADER";
                str2 = "GLOBAL_FRIENDLIST_SPECTATE_TOOLTIP_INVITE_TEXT";
            }
        }
        else if (manager.IsInvitedToSpectateMyGame(hearthstoneGameAccountId))
        {
            str  = "GLOBAL_FRIENDLIST_SPECTATE_TOOLTIP_INVITED_HEADER";
            str2 = "GLOBAL_FRIENDLIST_SPECTATE_TOOLTIP_INVITED_TEXT";
        }
        else if (manager.IsSpectatingPlayer(hearthstoneGameAccountId))
        {
            str  = "GLOBAL_FRIENDLIST_SPECTATE_TOOLTIP_SPECTATING_HEADER";
            str2 = "GLOBAL_FRIENDLIST_SPECTATE_TOOLTIP_SPECTATING_TEXT";
        }
        else if (manager.HasPreviouslyKickedMeFromGame(hearthstoneGameAccountId))
        {
            str  = "GLOBAL_FRIENDLIST_SPECTATE_TOOLTIP_PREVIOUSLY_KICKED_HEADER";
            str2 = "GLOBAL_FRIENDLIST_SPECTATE_TOOLTIP_PREVIOUSLY_KICKED_TEXT";
        }
        else
        {
            bool flag = TavernBrawlManager.Get().ShouldNewFriendlyChallengeBeTavernBrawl();
            if (flag)
            {
                str = "GLOBAL_FRIENDLIST_TAVERN_BRAWL_CHALLENGE_BUTTON_HEADER";
            }
            else
            {
                str = "GLOBAL_FRIENDLIST_CHALLENGE_BUTTON_HEADER";
            }
            if (!FriendChallengeMgr.Get().AmIAvailable())
            {
                str2 = "GLOBAL_FRIENDLIST_CHALLENGE_BUTTON_IM_UNAVAILABLE";
            }
            else if (!FriendChallengeMgr.Get().CanChallenge(this.m_player))
            {
                str2 = null;
                TavernBrawlMission mission = TavernBrawlManager.Get().CurrentMission();
                if ((flag && mission.canCreateDeck) && !TavernBrawlManager.Get().HasValidDeck())
                {
                    str2 = "GLOBAL_FRIENDLIST_CHALLENGE_BUTTON_TAVERN_BRAWL_MUST_CREATE_DECK";
                }
                if (str2 == null)
                {
                    str2 = "GLOBAL_FRIENDLIST_CHALLENGE_BUTTON_THEYRE_UNAVAILABLE";
                }
            }
            else if (flag)
            {
                str2 = "GLOBAL_FRIENDLIST_TAVERN_BRAWL_CHALLENGE_BUTTON_AVAILABLE";
            }
            else
            {
                str2 = "GLOBAL_FRIENDLIST_CHALLENGE_BUTTON_AVAILABLE";
            }
        }
        if (UniversalInputManager.Get().IsTouchMode())
        {
            if (GameStrings.HasKey(str + "_TOUCH"))
            {
                str = str + "_TOUCH";
            }
            if (GameStrings.HasKey(str2 + "_TOUCH"))
            {
                str2 = str2 + "_TOUCH";
            }
        }
        string headline = GameStrings.Get(str);

        object[] args     = new object[] { this.m_player.GetBestName() };
        string   bodytext = GameStrings.Format(str2, args);

        this.m_TooltipZone.ShowSocialTooltip(this, headline, bodytext, 75f, GameLayer.BattleNetDialog);
    }
    private void Awake()
    {
        RewardTrigger rewardTrigger;

        s_instance = this;
        base.gameObject.transform.position   = Vector3.zero;
        base.gameObject.transform.localScale = Vector3.one;
        TavernBrawlMission mission    = TavernBrawlManager.Get().CurrentMission();
        RewardType         rewardType = mission.rewardType;

        if ((rewardType != RewardType.REWARD_BOOSTER_PACKS) && (rewardType == RewardType.REWARD_CARD_BACK))
        {
            rewardTrigger = mission.rewardTrigger;
            if ((rewardTrigger != RewardTrigger.REWARD_TRIGGER_WIN_GAME) && (rewardTrigger == RewardTrigger.REWARD_TRIGGER_FINISH_GAME))
            {
                this.m_rewardsText.Text = GameStrings.Get("GLUE_TAVERN_BRAWL_REWARD_DESC_FINISH_CARDBACK");
            }
            else
            {
                this.m_rewardsText.Text = GameStrings.Get("GLUE_TAVERN_BRAWL_REWARD_DESC_CARDBACK");
            }
        }
        else
        {
            rewardTrigger = mission.rewardTrigger;
            if ((rewardTrigger != RewardTrigger.REWARD_TRIGGER_WIN_GAME) && (rewardTrigger == RewardTrigger.REWARD_TRIGGER_FINISH_GAME))
            {
                this.m_rewardsText.Text = GameStrings.Get("GLUE_TAVERN_BRAWL_REWARD_DESC_FINISH");
            }
            else
            {
                this.m_rewardsText.Text = GameStrings.Get("GLUE_TAVERN_BRAWL_REWARD_DESC");
            }
        }
        this.m_rewardsScale = this.m_rewardsPreview.transform.localScale;
        this.m_rewardsPreview.transform.localScale = (Vector3)(Vector3.one * 0.01f);
        if (this.m_editDeckButton != null)
        {
            this.m_editDeckButton.AddEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.EditOrDeleteDeck));
        }
        if (this.m_createDeckButton != null)
        {
            this.m_createDeckButton.AddEventListener(UIEventType.RELEASE, e => this.CreateDeck());
        }
        if (this.m_rewardOffClickCatcher != null)
        {
            this.m_rewardChest.AddEventListener(UIEventType.PRESS, new UIEvent.Handler(this.ShowReward));
            this.m_rewardOffClickCatcher.AddEventListener(UIEventType.PRESS, new UIEvent.Handler(this.HideReward));
        }
        else
        {
            this.m_rewardChest.AddEventListener(UIEventType.ROLLOVER, new UIEvent.Handler(this.ShowReward));
            this.m_rewardChest.AddEventListener(UIEventType.ROLLOUT, new UIEvent.Handler(this.HideReward));
        }
        this.m_playButton.AddEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.StartGame));
        CollectionManager.Get().RegisterDeckCreatedListener(new CollectionManager.DelOnDeckCreated(this.OnDeckCreated));
        CollectionManager.Get().RegisterDeckDeletedListener(new CollectionManager.DelOnDeckDeleted(this.OnDeckDeleted));
        CollectionManager.Get().RegisterDeckContentsListener(new CollectionManager.DelOnDeckContents(this.OnDeckContents));
        FriendChallengeMgr.Get().AddChangedListener(new FriendChallengeMgr.ChangedCallback(this.OnFriendChallengeChanged));
        NetCache.Get().RegisterUpdatedListener(typeof(NetCache.NetCacheTavernBrawlRecord), new System.Action(this.NetCache_OnTavernBrawlRecord));
        GameMgr.Get().RegisterFindGameEvent(new GameMgr.FindGameCallback(this.OnFindGameEvent));
        this.SetUIForFriendlyChallenge(FriendChallengeMgr.Get().IsChallengeTavernBrawl());
        if (this.m_backButton != null)
        {
            this.m_backButton.AddEventListener(UIEventType.RELEASE, e => this.OnBackButton());
        }
        if ((mission == null) || !mission.canEditDeck)
        {
            Navigation.Push(new Navigation.NavigateBackHandler(this.OnNavigateBack));
        }
    }