private bool CanPickUpCard() { if (this.ShouldIgnoreAllInput()) { return(false); } if (CollectionManagerDisplay.Get().GetViewMode() != this.m_visualType) { return(false); } if (!CollectionDeckTray.Get().CanPickupCard()) { return(false); } if (this.m_visualType == CollectionManagerDisplay.ViewMode.CARDS) { if (!this.IsInCollection()) { return(false); } if (!this.IsUnlocked()) { return(false); } } return(true); }
public void EnterCraftMode(CollectionCardVisual cardToDisplay) { if (!this.m_cancellingCraftMode && !CollectionDeckTray.Get().IsWaitingToDeleteDeck()) { CollectionManagerDisplay.Get().HideAllTips(); this.m_arcaneDustBalance = NetCache.Get().GetNetObject <NetCache.NetCacheArcaneDustBalance>().Balance; this.m_offClickCatcher.enabled = true; KeywordHelpPanelManager.Get().HideKeywordHelp(); this.MoveCardToBigSpot(cardToDisplay, true); if (this.m_craftingUI == null) { string name = (UniversalInputManager.UsePhoneUI == null) ? "CraftingUI" : "CraftingUI_Phone"; this.m_craftingUI = AssetLoader.Get().LoadGameObject(name, true, false).GetComponent <CraftingUI>(); this.m_craftingUI.SetStartingActive(); GameUtils.SetParent(this.m_craftingUI, this.m_showCraftingUIBone.gameObject, false); } if ((this.m_cardInfoPane == null) && (UniversalInputManager.UsePhoneUI == null)) { this.m_cardInfoPane = AssetLoader.Get().LoadGameObject("CardInfoPane", true, false).GetComponent <CardInfoPane>(); } this.m_craftingUI.gameObject.SetActive(true); this.m_craftingUI.Enable(this.m_showCraftingUIBone.position, this.m_hideCraftingUIBone.position); this.FadeEffectsIn(); this.UpdateCardInfoPane(); Navigation.Push(new Navigation.NavigateBackHandler(this.CancelCraftMode)); } }
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); }
public override void SpecificHandle(IGameState previous, IGameState next) { var cdt = CollectionDeckTray.Get(); var collectionMgr = CollectionManager.Get(); var rdmDeck = collectionMgr.GetDecks().Values.First().GetDeckFillFromString(File.ReadAllText("H:\\deck.txt")); cdt.PopulateDeck(rdmDeck); }
private void OnMouseOnOrOffScreen(bool onScreen) { if (!onScreen && this.m_heldCardVisual.IsShown()) { this.DropCard(true, null); CollectionDeckTray.Get().GetDeckBigCard().ForceHide(); } }
public void ChooseThisCard() { KeywordHelpPanelManager.Get().HideKeywordHelp(); this.m_chosen = true; this.m_actor.GetSpell(SpellType.DEATHREVERSE).ActivateState(SpellStateType.BIRTH); CollectionDeckTray.Get().AddCard(this.m_actor.GetEntityDef(), this.m_actor.GetCardFlair(), null, false, this.m_actor); DeckHelper.Get().UpdateChoices(); }
public void HandleRelease() { if (this.m_deck != null) { CollectionDeckTray.Get().AddCard(this.m_entityDef, this.m_flair, null, false, null); this.UpdateDeckCount(); } }
public void UpdateCurrentPageCardLocks(bool playSound = false) { if (CollectionDeckTray.Get().GetCurrentContentType() != CollectionDeckTray.DeckContentTypes.Cards) { foreach (CollectionCardVisual visual in this.m_collectionCardVisuals) { if (visual.IsShown()) { visual.ShowLock(CollectionCardVisual.LockType.NONE); } } } else { CollectionDeck taggedDeck = CollectionManager.Get().GetTaggedDeck(CollectionManager.DeckTag.Editing); foreach (CollectionCardVisual visual2 in this.m_collectionCardVisuals) { if (visual2.GetVisualType() != CollectionManagerDisplay.ViewMode.CARD_BACKS) { if (!visual2.IsShown()) { visual2.ShowLock(CollectionCardVisual.LockType.NONE); } else { Actor actor = visual2.GetActor(); string cardId = actor.GetEntityDef().GetCardId(); CardFlair cardFlair = actor.GetCardFlair(); CollectionCardStack.ArtStack collectionArtStack = CollectionManager.Get().GetCollectionArtStack(cardId, cardFlair); if (collectionArtStack.Count <= 0) { visual2.ShowLock(CollectionCardVisual.LockType.NONE); } else { CollectionCardVisual.LockType nONE = CollectionCardVisual.LockType.NONE; if (taggedDeck != null) { if (CollectionDeckValidator.GetDeckViolationCardIdOverflow(taggedDeck, cardId, true) != null) { nONE = CollectionCardVisual.LockType.MAX_COPIES_IN_DECK; } if (((nONE == CollectionCardVisual.LockType.NONE) && (collectionArtStack.Count > 0)) && (taggedDeck.GetCardCount(cardId, cardFlair) >= collectionArtStack.Count)) { nONE = CollectionCardVisual.LockType.NO_MORE_INSTANCES; } } visual2.ShowLock(nONE, playSound); } } } else { visual2.ShowLock(CollectionCardVisual.LockType.NONE); } } } }
private void OnDeleteButtonConfirmationResponse(AlertPopup.Response response, object userData) { if (response != AlertPopup.Response.CANCEL) { CollectionDeckTray.Get().DeleteEditingDeck(true); if (CollectionManagerDisplay.Get() != null) { CollectionManagerDisplay.Get().OnDoneEditingDeck(); } } }
private void UpdateHeldCard() { RaycastHit hit; if (this.m_heldCardVisual.IsShown() && UniversalInputManager.Get().GetInputHitInfo(GameLayer.DragPlane.LayerBit(), out hit)) { this.m_heldCardVisual.transform.position = hit.point; this.m_mouseIsOverDeck = CollectionDeckTray.Get().MouseIsOver(); this.m_heldCardVisual.UpdateVisual(this.m_mouseIsOverDeck); if (Input.GetMouseButtonUp(0)) { this.DropCard(this.m_heldCardVisual.GetDeckTileToRemove()); } } }
protected override void OnRelease() { if (!this.IsTransactionPendingOnThisCard()) { if (UniversalInputManager.Get().IsTouchMode() || ((CraftingTray.Get() != null) && CraftingTray.Get().IsShown())) { this.CheckCardSeen(); this.m_actor.SetActorState(ActorStateType.CARD_IDLE); this.EnterCraftingMode(); } else { Spell spell = this.m_actor.GetSpell(SpellType.DEATHREVERSE); if (!this.CanPickUpCard()) { SoundManager.Get().LoadAndPlay("collection_manager_card_move_invalid_or_click"); if (spell != null) { spell.ActivateState(SpellStateType.BIRTH); } EntityDef entityDef = this.m_actor.GetEntityDef(); bool isHero = (entityDef != null) && entityDef.IsHero(); CollectionManagerDisplay.Get().ShowInnkeeeprLClickHelp(isHero); } else if (this.m_visualType == CollectionManagerDisplay.ViewMode.CARDS) { EntityDef cardEntityDef = this.m_actor.GetEntityDef(); if (cardEntityDef != null) { if (spell != null) { spell.ActivateState(SpellStateType.BIRTH); } CollectionDeckTray.Get().AddCard(cardEntityDef, this.m_actor.GetCardFlair(), null, false, this.m_actor); } } else if (this.m_visualType == CollectionManagerDisplay.ViewMode.CARD_BACKS) { CollectionDeckTray.Get().SetCardBack(this.m_actor); } else if (this.m_visualType == CollectionManagerDisplay.ViewMode.HERO_SKINS) { CollectionDeckTray.Get().SetHeroSkin(this.m_actor); } } } }
public override void SpecificHandle(IGameState previous, IGameState next) { var cardDef = DefLoader.Get().GetCardDef("EX1_383"); var entDef = DefLoader.Get().GetEntityDef("EX1_383"); var sourcePos = new Vector3(0, 0, 0); if (cardDef == null || entDef == null) { AlertPopup.PopupInfo popupInfo = new AlertPopup.PopupInfo(); popupInfo.m_headerText = GameStrings.Get("Error"); popupInfo.m_text = "Tirion CardDef or EntityDef havent been loaded yet"; popupInfo.m_responseDisplay = AlertPopup.ResponseDisplay.CONFIRM; DialogManager.Get().ShowPopup(popupInfo, null, null); } else { CollectionDeckTray.Get().GetDeckBigCard().Show(entDef, TAG_PREMIUM.GOLDEN, cardDef, sourcePos, GhostCard.Type.NONE); } }
public bool GrabCard(DeckTrayDeckTileVisual deckTileVisual) { Actor actor = deckTileVisual.GetActor(); if (!this.CanGrabItem(actor)) { return(false); } if (!this.m_heldCardVisual.ChangeActor(actor, CollectionManagerDisplay.ViewMode.CARDS)) { return(false); } this.m_scrollBar.Pause(true); PegCursor.Get().SetMode(PegCursor.Mode.DRAG); this.m_heldCardVisual.SetSlot(deckTileVisual.GetSlot()); this.m_heldCardVisual.transform.position = actor.transform.position; this.m_heldCardVisual.Show(this.m_mouseIsOverDeck); SoundManager.Get().LoadAndPlay("collection_manager_pick_up_card", this.m_heldCardVisual.gameObject); CollectionDeckTray.Get().RemoveCard(this.m_heldCardVisual.GetCardID(), this.m_heldCardVisual.GetCardFlair(), deckTileVisual.IsOwnedSlot()); return(true); }
private void DropCard(bool dragCanceled, DeckTrayDeckTileVisual deckTileToRemove) { PegCursor.Get().SetMode(PegCursor.Mode.STOPDRAG); if (!dragCanceled) { if (!this.m_mouseIsOverDeck) { SoundManager.Get().LoadAndPlay("collection_manager_drop_card", this.m_heldCardVisual.gameObject); } else { switch (this.m_heldCardVisual.GetVisualType()) { case CollectionManagerDisplay.ViewMode.CARDS: CollectionDeckTray.Get().AddCard(this.m_heldCardVisual.GetEntityDef(), this.m_heldCardVisual.GetCardFlair(), deckTileToRemove, true, null); break; case CollectionManagerDisplay.ViewMode.HERO_SKINS: CollectionDeckTray.Get().GetHeroSkinContent().UpdateHeroSkin(this.m_heldCardVisual.GetEntityDef(), this.m_heldCardVisual.GetCardFlair(), true); break; case CollectionManagerDisplay.ViewMode.CARD_BACKS: { object cardBackId = this.m_heldCardVisual.GetCardBackId(); if (cardBackId != null) { CollectionDeckTray.Get().GetCardBackContent().UpdateCardBack((int)cardBackId, true, null); break; } Debug.LogWarning("Cardback ID not set for dragging card back."); break; } } } } this.m_heldCardVisual.Hide(); this.m_scrollBar.Pause(false); }
private void EnterCraftingMode() { CollectionManagerDisplay.ViewMode viewMode = CollectionManagerDisplay.Get().GetViewMode(); if (this.m_visualType == viewMode) { switch (viewMode) { case CollectionManagerDisplay.ViewMode.CARDS: if (CraftingManager.Get() != null) { CraftingManager.Get().EnterCraftMode(this); } break; case CollectionManagerDisplay.ViewMode.HERO_SKINS: { HeroSkinInfoManager manager2 = HeroSkinInfoManager.Get(); if (manager2 != null) { manager2.EnterPreview(this); } break; } case CollectionManagerDisplay.ViewMode.CARD_BACKS: { CardBackInfoManager manager3 = CardBackInfoManager.Get(); if (manager3 != null) { manager3.EnterPreview(this); } break; } } CollectionDeckTray.Get().CancelRenamingDeck(); } }
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 OnRenameButtonPressed(UIEvent e) { CollectionDeckTray.Get().GetDecksContent().RenameCurrentlyEditingDeck(); }
internal static void smethod_4() { try { CollectionDeckTray tray = CollectionDeckTray.Get(); if (tray != null) { using (List <TraySection> .Enumerator enumerator = tray.m_decksContent.m_traySections.GetEnumerator()) { while (enumerator.MoveNext()) { CollectionDeckBoxVisual deckBox = enumerator.Current.m_deckBox; long deckID = deckBox.GetDeckID(); string text = deckBox.m_deckName.Text; if (((deckID == -1L) || !deckBox.IsValid()) || !smethod_2(deckID, text)) { continue; } CustomDeckCache item = null; bool flag = true; using (IEnumerator <CustomDeckCache> enumerator2 = MainSettings.Instance.CustomDecks.GetEnumerator()) { CustomDeckCache current; while (enumerator2.MoveNext()) { current = enumerator2.Current; if (current.DeckId == deckID) { goto Label_00A7; } } goto Label_00CC; Label_00A7: item = current; item.Name = text; item.Save(); flag = false; } Label_00CC: if (item == null) { item = new CustomDeckCache(deckID) { DeckId = deckID, HeroCardId = deckBox.m_heroCardID, Name = deckBox.GetDeckNameText().Text }; } CollectionDeck deck = CollectionManager.Get().GetDeck(deckID); if (!deck.m_netContentsLoaded) { if ((item.CardIds.Count == 30) && flag) { MainSettings.Instance.CustomDecks.Add(item); } } else { item.CardIds.Clear(); foreach (CollectionDeckSlot slot in deck.m_slots) { for (int i = 0; i < slot.Count; i++) { item.CardIds.Add(slot.CardID); } } item.Save(); if (flag) { MainSettings.Instance.CustomDecks.Add(item); MainSettings.Instance.Save(); } } } } } } catch (Exception) { MainSettings.Instance.CustomDecks.Clear(); MainSettings.Instance.Save(); throw; } }