private void StartChallengeProcess() { if (this.m_challengeDialog != null) { this.m_challengeDialog.Hide(); this.m_challengeDialog = null; } GameMgr.Get().SetPendingAutoConcede(true); if (this.IsChallengeTavernBrawl() && !TavernBrawlManager.Get().SelectHeroBeforeMission()) { if (TavernBrawlManager.Get().CurrentMission().canCreateDeck) { if (!TavernBrawlManager.Get().HasValidDeck()) { Debug.LogError("Attempting to start a Tavern Brawl challenge without a valid deck! How did this happen?"); return; } this.SelectDeck(TavernBrawlManager.Get().CurrentDeck().ID); } else { this.SkipDeckSelection(); } FriendlyChallengeHelper.Get().WaitForFriendChallengeToStart(); } else { Navigation.Clear(); SceneMgr.Get().SetNextMode(SceneMgr.Mode.FRIENDLY); } }
private void OnFriendChallengeWaitingForOpponentDialogResponse(AlertPopup.Response response, object userData) { if (response == AlertPopup.Response.CANCEL) { FriendlyChallengeHelper.Get().StopWaitingForFriendChallenge(); if (!TavernBrawlManager.Get().SelectHeroBeforeMission()) { this.EnablePlayButton(); } } }
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); } }
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(); } }