private void HandleGameStartupFailure() { if (!TavernBrawlManager.Get().SelectHeroBeforeMission()) { this.EnablePlayButton(); } }
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); } }
public void UpdateButton() { if (!this.UpdateEditModeButtonState()) { if (((this.m_player == null) || !this.m_player.IsOnline()) || (this.m_player.GetBestProgramId() != BnetProgramId.HEARTHSTONE)) { base.gameObject.SetActive(false); } else { base.gameObject.SetActive(true); if (!this.UpdateSpectateButtonState()) { bool flag = false; bool flag2 = false; if (this.CanChallenge()) { flag = true; } else { flag2 = true; } bool flag3 = TavernBrawlManager.Get().ShouldNewFriendlyChallengeBeTavernBrawl(); this.m_AvailableIcon.SetActive(flag && !flag3); this.m_BusyIcon.SetActive(flag2 && !flag3); this.m_TavernBrawlChallengeIcon.SetActive(flag && flag3); this.m_TavernBrawlBusyIcon.SetActive(flag2 && flag3); this.UpdateTooltip(); } } } }
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 OnDeckCreated(long deckID) { CollectionDeck deck = TavernBrawlManager.Get().CurrentDeck(); if ((deck != null) && (deckID == deck.ID)) { this.SwitchToEditDeckMode(deck); } }
private void OnDeckContents(long deckID) { CollectionDeck deck = TavernBrawlManager.Get().CurrentDeck(); if (((deck != null) && (deckID == deck.ID)) && IsTavernBrawlOpen()) { this.ValidateDeck(); } }
private void NetCache_OnTavernBrawlRecord() { this.m_numWins.Text = TavernBrawlManager.Get().GamesWon().ToString(); if (TavernBrawlManager.Get().RewardProgress() > 0) { this.m_rewardChest.GetComponent <Renderer>().material = this.m_chestOpenMaterial; this.m_rewardHighlight.ChangeState(ActorStateType.HIGHLIGHT_OFF); this.m_rewardChest.SetEnabled(false); } }
private void OnFriendChallengeWaitingForOpponentDialogResponse(AlertPopup.Response response, object userData) { if (response == AlertPopup.Response.CANCEL) { FriendlyChallengeHelper.Get().StopWaitingForFriendChallenge(); if (!TavernBrawlManager.Get().SelectHeroBeforeMission()) { this.EnablePlayButton(); } } }
public void EnablePlayButton() { TavernBrawlMission mission = TavernBrawlManager.Get().CurrentMission(); if ((mission == null) || mission.canCreateDeck) { this.ValidateDeck(); } else { this.m_playButton.Enable(); } }
private void BnetParty_OnJoined(OnlineEventType evt, PartyInfo party, LeaveReason?reason) { if ((party.Type == PartyType.FRIENDLY_CHALLENGE) && (evt == OnlineEventType.ADDED)) { long?partyAttributeLong = BnetParty.GetPartyAttributeLong(party.Id, "WTCG.Game.ScenarioId"); if (partyAttributeLong.HasValue) { this.m_scenarioId = (int)partyAttributeLong.Value; TavernBrawlMission mission = TavernBrawlManager.Get().CurrentMission(); this.m_isChallengeTavernBrawl = (mission != null) && (this.m_scenarioId == mission.missionId); } } }
private void RefreshTavernBrawlInfo(float animDelay) { this.UpdateEditOrCreate(); TavernBrawlMission mission = TavernBrawlManager.Get().CurrentMission(); if ((mission == null) || (mission.missionId < 0)) { AlertPopup.PopupInfo info = new AlertPopup.PopupInfo { m_headerText = GameStrings.Get("GLUE_TAVERN_BRAWL_HAS_ENDED_HEADER"), m_text = GameStrings.Get("GLUE_TAVERN_BRAWL_HAS_ENDED_TEXT"), m_responseDisplay = AlertPopup.ResponseDisplay.OK, m_responseCallback = new AlertPopup.ResponseCallback(this.RefreshTavernBrawlInfo_ConfirmEnded), m_offset = new Vector3(0f, 104f, 0f) }; DialogManager.Get().ShowPopup(info); } else { DbfRecord record = GameDbf.Scenario.GetRecord(mission.missionId); this.m_chalkboardHeader.Text = record.GetLocString("NAME"); this.m_chalkboardInfo.Text = record.GetLocString("DESCRIPTION"); base.CancelInvoke("UpdateTimeText"); base.InvokeRepeating("UpdateTimeText", 0.1f, 0.1f); this.UpdateTimeText(); if (((this.m_chalkboard != null) && (this.m_chalkboard.GetComponent <MeshRenderer>() != null)) && (this.m_chalkboard.GetComponent <MeshRenderer>().material != null)) { Material material = this.m_chalkboard.GetComponent <MeshRenderer>().material; string name = record.GetString("TB_TEXTURE"); UnityEngine.Vector2 zero = UnityEngine.Vector2.zero; if (PlatformSettings.Screen == ScreenCategory.Phone) { name = record.GetString("TB_TEXTURE_PHONE"); zero.y = record.GetFloat("TB_TEXTURE_PHONE_OFFSET_Y"); } Texture texture = (name != null) ? AssetLoader.Get().LoadTexture(name, false) : null; if (texture == null) { bool canCreateDeck = TavernBrawlManager.Get().CurrentMission().canCreateDeck; name = !canCreateDeck ? ((string)DEFAULT_CHALKBOARD_TEXTURE_NAME_NO_DECK) : ((string)DEFAULT_CHALKBOARD_TEXTURE_NAME_WITH_DECK); zero = !canCreateDeck ? ((UnityEngine.Vector2)DEFAULT_CHALKBOARD_TEXTURE_OFFSET_NO_DECK) : ((UnityEngine.Vector2)DEFAULT_CHALKBOARD_TEXTURE_OFFSET_WITH_DECK); texture = AssetLoader.Get().LoadTexture(name, false); } if (texture != null) { material.SetTexture("_TopTex", texture); material.SetTextureOffset("_MainTex", zero); } base.StartCoroutine(this.WaitThenPlayWipeAnim(!this.m_doWipeAnimation ? 0f : animDelay)); } } }
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 EditOrDeleteDeck(UIEvent e) { if (this.IsInDeckEditMode()) { this.OnDeleteButtonPressed(); } else { Enum[] args = new Enum[] { PresenceStatus.TAVERN_BRAWL_DECKEDITOR }; PresenceMgr.Get().SetStatus(args); if (this.SwitchToEditDeckMode(TavernBrawlManager.Get().CurrentDeck())) { } } }
private void SetUIForFriendlyChallenge(bool isTavernBrawlChallenge) { string key = "GLUE_BRAWL"; if (TavernBrawlManager.Get().SelectHeroBeforeMission()) { key = "GLUE_CHOOSE"; } else if (isTavernBrawlChallenge) { key = "GLUE_BRAWL_FRIEND"; } this.m_playButton.SetText(GameStrings.Get(key)); this.m_rewardChest.gameObject.SetActive(!isTavernBrawlChallenge); this.m_winsBanner.SetActive(!isTavernBrawlChallenge); if (this.m_editDeckButton != null) { if (!this.m_originalEditTextColor.HasValue) { this.m_originalEditTextColor = new Color?(this.m_editText.TextColor); } if (isTavernBrawlChallenge) { this.m_editText.TextColor = this.m_disabledTextColor; this.m_editDeckButton.SetEnabled(false); } else { this.m_editText.TextColor = this.m_originalEditTextColor.Value; this.m_editDeckButton.SetEnabled(true); } if (this.m_editIcon != null) { if (!this.m_originalEditIconColor.HasValue) { this.m_originalEditIconColor = new Color?(this.m_editIcon.GetComponent <Renderer>().material.color); } if (isTavernBrawlChallenge) { this.m_editIcon.GetComponent <Renderer>().material.color = this.m_disabledTextColor; } else { this.m_editIcon.GetComponent <Renderer>().material.color = this.m_originalEditIconColor.Value; } } } }
public bool CanChallenge(BnetPlayer player) { if (player == null) { return(false); } BnetPlayer myPlayer = BnetPresenceMgr.Get().GetMyPlayer(); if (player == myPlayer) { return(false); } if (!this.AmIAvailable()) { return(false); } if ((TavernBrawlManager.Get().ShouldNewFriendlyChallengeBeTavernBrawl() && TavernBrawlManager.Get().CurrentMission().canCreateDeck) && !TavernBrawlManager.Get().HasValidDeck()) { return(false); } BnetGameAccount hearthstoneGameAccount = player.GetHearthstoneGameAccount(); if (hearthstoneGameAccount == null) { return(false); } if (!hearthstoneGameAccount.IsOnline()) { return(false); } if (!hearthstoneGameAccount.CanBeInvitedToGame()) { return(false); } if (ApplicationMgr.IsPublic()) { BnetGameAccount account2 = myPlayer.GetHearthstoneGameAccount(); if (string.Compare(hearthstoneGameAccount.GetClientVersion(), account2.GetClientVersion()) != 0) { return(false); } if (string.Compare(hearthstoneGameAccount.GetClientEnv(), account2.GetClientEnv()) != 0) { return(false); } } return(true); }
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); }
private void TavernBrawl_ReceivedChallenge_OnEnsureServerDataReady() { TavernBrawlMission mission = TavernBrawlManager.Get().CurrentMission(); if ((mission != null) && mission.canCreateDeck) { CollectionDeck deck = TavernBrawlManager.Get().CurrentDeck(); if ((deck != null) && !deck.NetworkContentsLoaded()) { CollectionManager.Get().RegisterDeckContentsListener(new CollectionManager.DelOnDeckContents(this.TavernBrawl_ReceivedChallenge_OnEnsureServerDataReady_OnDeckContentsReady)); CollectionManager.Get().RequestDeckContents(deck.ID); return; } } this.TavernBrawl_ReceivedChallenge_OnEnsureServerDataReady_OnDeckContentsReady(0L); }
private void Start() { this.m_tavernBrawlTray.ToggleTraySlider(true, null, false); Enum[] status = PresenceMgr.Get().GetStatus(); if (((status == null) || (status.Length <= 0)) || (((PresenceStatus)status[0]) != PresenceStatus.TAVERN_BRAWL_FRIENDLY_WAITING)) { Enum[] args = new Enum[] { PresenceStatus.TAVERN_BRAWL_SCREEN }; PresenceMgr.Get().SetStatus(args); } this.RefreshStateBasedUI(false); this.RefreshDataBasedUI(this.m_wipeAnimStartDelay); MusicManager.Get().StartPlaylist(MusicPlaylistType.UI_TavernBrawl); if (TavernBrawlManager.Get().CurrentMission() != null) { int @int = Options.Get().GetInt(Option.LATEST_SEEN_TAVERNBRAWL_SEASON_CHALKBOARD); if (@int == 0) { this.m_doWipeAnimation = true; if (!NotificationManager.Get().HasSoundPlayedThisSession("VO_INNKEEPER_TAVERNBRAWL_WELCOME1_27")) { NotificationManager.Get().CreateInnkeeperQuote(GameStrings.Get("VO_INNKEEPER_TAVERNBRAWL_WELCOME1_27"), "VO_INNKEEPER_TAVERNBRAWL_WELCOME1_27", 0f, null); NotificationManager.Get().ForceAddSoundToPlayedList("VO_INNKEEPER_TAVERNBRAWL_WELCOME1_27"); } } else if (@int < TavernBrawlManager.Get().CurrentMission().seasonId) { this.m_doWipeAnimation = true; int val = Options.Get().GetInt(Option.TIMES_SEEN_TAVERNBRAWL_CRAZY_RULES_QUOTE); if (!NotificationManager.Get().HasSoundPlayedThisSession("VO_INNKEEPER_TAVERNBRAWL_DESC2_30") && (val < 3)) { NotificationManager.Get().CreateInnkeeperQuote(GameStrings.Get("VO_INNKEEPER_TAVERNBRAWL_DESC2_30"), "VO_INNKEEPER_TAVERNBRAWL_DESC2_30", 0f, null); NotificationManager.Get().ForceAddSoundToPlayedList("VO_INNKEEPER_TAVERNBRAWL_DESC2_30"); val++; Options.Get().SetInt(Option.TIMES_SEEN_TAVERNBRAWL_CRAZY_RULES_QUOTE, val); } } if (@int != TavernBrawlManager.Get().CurrentMission().seasonId) { Options.Get().SetInt(Option.LATEST_SEEN_TAVERNBRAWL_SEASON_CHALKBOARD, TavernBrawlManager.Get().CurrentMission().seasonId); } } if (TavernBrawlManager.Get().RewardProgress() == 0) { this.m_rewardHighlight.ChangeState(ActorStateType.HIGHLIGHT_PRIMARY_ACTIVE); } base.StartCoroutine(this.UpdateQuestsWhenReady()); }
private void UpdateEditOrCreate() { TavernBrawlMission mission = TavernBrawlManager.Get().CurrentMission(); bool flag = (mission != null) && mission.canCreateDeck; bool flag2 = (mission != null) && mission.canEditDeck; bool flag3 = TavernBrawlManager.Get().HasCreatedDeck(); bool flag4 = flag && !flag3; bool flag5 = (flag2 && flag) && flag3; if (this.m_editDeckButton != null) { this.m_editDeckButton.gameObject.SetActive(flag5); if (this.m_editIcon != null) { this.m_editIcon.SetActive(true); } } if (UniversalInputManager.UsePhoneUI != null) { if (this.m_createDeckButton != null) { this.m_createDeckButton.gameObject.SetActive(flag4); } } else { if (this.m_panelWithCreateDeck != null) { this.m_panelWithCreateDeck.SetActive(flag4); } if (this.m_fullPanel != null) { this.m_fullPanel.SetActive(!flag4); } } if (this.m_createDeckHighlight != null) { if (!this.m_createDeckHighlight.gameObject.activeInHierarchy && flag4) { UnityEngine.Debug.LogWarning("Attempting to activate m_createDeckHighlight, but it is inactive! This will not behave correctly!"); } this.m_createDeckHighlight.ChangeState(!flag4 ? ActorStateType.HIGHLIGHT_OFF : ActorStateType.HIGHLIGHT_PRIMARY_ACTIVE); } }
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); } }
public void SendChallenge(BnetPlayer player) { if (this.CanChallenge(player)) { this.m_challenger = BnetPresenceMgr.Get().GetMyPlayer(); this.m_challengerId = this.m_challenger.GetHearthstoneGameAccount().GetId(); this.m_challengee = player; this.m_hasSeenDeclinedReason = false; this.m_scenarioId = 2; this.m_isChallengeTavernBrawl = false; if (TavernBrawlManager.Get().ShouldNewFriendlyChallengeBeTavernBrawl()) { this.m_scenarioId = TavernBrawlManager.Get().CurrentMission().missionId; Enum[] args = new Enum[] { PresenceStatus.TAVERN_BRAWL_FRIENDLY_WAITING }; PresenceMgr.Get().SetStatus(args); this.m_isChallengeTavernBrawl = true; } Network.SendFriendChallenge(player.GetHearthstoneGameAccount().GetId(), this.m_scenarioId); this.UpdateMyAvailability(); this.FireChangedEvent(FriendChallengeEvent.I_SENT_CHALLENGE, player); } }
public void ValidateDeck() { TavernBrawlMission mission = TavernBrawlManager.Get().CurrentMission(); if (mission == null) { this.m_playButton.Disable(); } else if (mission.canCreateDeck) { if (TavernBrawlManager.Get().HasValidDeck()) { this.m_playButton.Enable(); this.m_editDeckHighlight.ChangeState(ActorStateType.HIGHLIGHT_OFF); } else { this.m_playButton.Disable(); this.m_editDeckHighlight.ChangeState(ActorStateType.HIGHLIGHT_PRIMARY_ACTIVE); } } }
private void UpdateTimeText() { int seconds = (TavernBrawlManager.Get().CurrentMission() != null) ? TavernBrawlManager.Get().CurrentTavernBrawlSeasonEnd : -1; if (seconds < 0) { base.CancelInvoke("UpdateTimeText"); } else { TimeUtils.ElapsedStringSet stringSet = new TimeUtils.ElapsedStringSet { m_seconds = "GLUE_TAVERN_BRAWL_LABEL_ENDING_SECONDS", m_minutes = "GLUE_TAVERN_BRAWL_LABEL_ENDING_MINUTES", m_hours = "GLUE_TAVERN_BRAWL_LABEL_ENDING_HOURS", m_days = "GLUE_TAVERN_BRAWL_LABEL_ENDING_DAYS", m_weeks = "GLUE_TAVERN_BRAWL_LABEL_ENDING_WEEKS", m_monthAgo = "GLUE_TAVERN_BRAWL_LABEL_ENDING_OVER_1_MONTH" }; string elapsedTimeString = TimeUtils.GetElapsedTimeString(seconds, stringSet); this.m_chalkboardEndInfo.Text = elapsedTimeString; } }
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 UpdateDeckPanels(bool animate = true) { TavernBrawlMission mission = TavernBrawlManager.Get().CurrentMission(); this.UpdateDeckPanels(((mission != null) && mission.canCreateDeck) && TavernBrawlManager.Get().HasCreatedDeck(), animate); }
private void ShowReward(UIEvent e) { if (TavernBrawlManager.Get().CurrentMission() != null) { RewardType rewardType = TavernBrawlManager.Get().CurrentMission().rewardType; if (rewardType != RewardType.REWARD_BOOSTER_PACKS) { if (rewardType != RewardType.REWARD_CARD_BACK) { object[] objArray4 = new object[] { TavernBrawlManager.Get().CurrentMission().rewardType }; UnityEngine.Debug.LogErrorFormat("Tavern Brawl reward type currently not supported! Add type {0} to TaverBrawlDisplay.ShowReward().", objArray4); return; } if (this.m_rewardObject == null) { int cardBackIdx = (int)TavernBrawlManager.Get().CurrentMission().RewardData1; CardBackManager.LoadCardBackData data = CardBackManager.Get().LoadCardBackByIndex(cardBackIdx, false, "Card_Hidden"); if (data == null) { object[] objArray3 = new object[] { cardBackIdx }; UnityEngine.Debug.LogErrorFormat("TavernBrawlDisplay.ShowReward() - Could not load cardback ID {0}!", objArray3); return; } this.m_rewardObject = data.m_GameObject; GameUtils.SetParent(this.m_rewardObject, this.m_rewardContainer, false); this.m_rewardObject.transform.localScale = (Vector3)(Vector3.one * 5.92f); } } else if (this.m_rewardObject == null) { int id = (int)TavernBrawlManager.Get().CurrentMission().RewardData1; DbfRecord record = GameDbf.Booster.GetRecord(id); if (record == null) { object[] objArray1 = new object[] { id }; UnityEngine.Debug.LogErrorFormat("TavernBrawlDisplay.ShowReward() - no record found for booster {0}!", objArray1); return; } string assetName = record.GetAssetName("PACK_OPENING_PREFAB"); if (string.IsNullOrEmpty(assetName)) { object[] objArray2 = new object[] { id }; UnityEngine.Debug.LogErrorFormat("TavernBrawlDisplay.ShowReward() - no prefab found for booster {0}!", objArray2); return; } GameObject obj2 = AssetLoader.Get().LoadActor(assetName, false, false); if (obj2 == null) { UnityEngine.Debug.LogError(string.Format("TavernBrawlDisplay.ShowReward() - failed to load prefab {0} for booster {1}!", assetName, id)); return; } this.m_rewardObject = obj2; UnopenedPack component = obj2.GetComponent <UnopenedPack>(); if (component == null) { UnityEngine.Debug.LogError(string.Format("TavernBrawlDisplay.ShowReward() - No UnopenedPack script found on prefab {0} for booster {1}!", assetName, id)); return; } GameUtils.SetParent(this.m_rewardObject, this.m_rewardContainer, false); component.AddBooster(); } this.m_rewardsPreview.SetActive(true); iTween.Stop(this.m_rewardsPreview); object[] args = new object[] { "scale", this.m_rewardsScale, "time", 0.15f }; iTween.ScaleTo(this.m_rewardsPreview, iTween.Hash(args)); } }
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)); } }