public void LoadCard(CardRewardData cardData, GameLayer layer = 0x13) { this.m_layer = layer; this.m_CardID = cardData.CardID; this.m_cardFlair = new CardFlair(cardData.Premium); DefLoader.Get().LoadFullDef(this.m_CardID, new DefLoader.LoadDefCallback <FullDef>(this.OnFullDefLoaded)); }
private void SetHeroPowerInfo(string heroPowerCardID, FullDef def, CardFlair cardFlair) { if (heroPowerCardID.Equals(this.m_heroPowerID)) { EntityDef entityDef = def.GetEntityDef(); if (cardFlair.Premium == TAG_PREMIUM.GOLDEN) { this.m_heroPowerActor.Hide(); this.m_goldenHeroPowerActor.Show(); this.m_goldenHeroPowerActor.SetEntityDef(def.GetEntityDef()); this.m_goldenHeroPowerActor.SetCardDef(def.GetCardDef()); this.m_goldenHeroPowerActor.SetUnlit(); this.m_goldenHeroPowerActor.SetCardFlair(cardFlair); this.m_goldenHeroPowerActor.UpdateAllComponents(); } else { this.m_heroPowerActor.Show(); this.m_goldenHeroPowerActor.Hide(); this.m_heroPowerActor.SetEntityDef(def.GetEntityDef()); this.m_heroPowerActor.SetCardDef(def.GetCardDef()); this.m_heroPowerActor.SetUnlit(); this.m_heroPowerActor.UpdateAllComponents(); } string name = entityDef.GetName(); this.m_heroPowerName.Text = name; string cardTextInHand = entityDef.GetCardTextInHand(); this.m_heroPowerDescription.Text = cardTextInHand; } }
private void UpdateFrameMaterial() { Material ghostedFrameMaterial = null; if (this.m_ghosted) { ghostedFrameMaterial = this.m_ghostedFrameMaterial; } else { CardFlair cardFlair = base.GetCardFlair(); if (cardFlair != null) { if (cardFlair.Premium == TAG_PREMIUM.GOLDEN) { ghostedFrameMaterial = this.m_premiumFrameMaterial; } else { ghostedFrameMaterial = this.m_standardFrameMaterial; } } } if (ghostedFrameMaterial != null) { this.m_frame.GetComponent <Renderer>().material = ghostedFrameMaterial; } }
public void Hide(EntityDef entityDef, CardFlair flair) { if ((this.m_entityDef == entityDef) && this.m_flair.Equals(flair)) { this.Hide(); } }
public void Show(CollectionDeck deck, EntityDef entity, CardFlair flair) { this.m_deck = deck; this.m_entityDef = entity; this.m_flair = flair; this.UpdateDeckCount(); base.gameObject.SetActive(true); }
public ArtStack(string cardID, CardFlair cardFlair, DateTime newestInsertDate, int count, int numSeen) { this.m_cardID = cardID; this.m_cardFlair = cardFlair; this.m_newestInsertDate = newestInsertDate; this.m_count = count; this.m_numSeen = numSeen; }
public static TAG_PREMIUM GetPremiumType(CardFlair flair) { if (flair == null) { return(TAG_PREMIUM.NORMAL); } return(flair.Premium); }
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); } } } }
public void UpdateDisplay(FullDef def, CardFlair cardFlair) { this.m_heroClass = def.GetEntityDef().GetClass(); this.SetFullDef(def); this.SetClassname(GameStrings.GetClassName(this.m_heroClass)); this.SetClassIcon(this.GetClassIconMaterial(this.m_heroClass)); this.SetBasicSetProgress(this.m_heroClass); this.SetCardFlair(cardFlair); }
public bool AddCard(EntityDef cardEntityDef, CardFlair cardFlair, DeckTrayDeckTileVisual deckTileToRemove, bool playSound, Actor animateFromActor = null) { if (!base.IsModeActive()) { return(false); } if (cardEntityDef == null) { UnityEngine.Debug.LogError("Trying to add card EntityDef that is null."); return(false); } string cardId = cardEntityDef.GetCardId(); CollectionDeck taggedDeck = CollectionManager.Get().GetTaggedDeck(this.m_deckType); if (taggedDeck == null) { return(false); } if (playSound) { SoundManager.Get().LoadAndPlay("collection_manager_place_card_in_deck", base.gameObject); } if (taggedDeck.GetTotalCardCount() == 30) { if (deckTileToRemove == null) { UnityEngine.Debug.LogWarning(string.Format("CollectionDeckTray.AddCard(): Cannot add card {0} (flair {1}) without removing one first.", cardEntityDef.GetCardId(), cardFlair)); return(false); } string cardID = deckTileToRemove.GetCardID(); CardFlair flair = deckTileToRemove.GetCardFlair(); if (!taggedDeck.RemoveCard(cardID, flair.Premium, deckTileToRemove.IsOwnedSlot())) { object[] args = new object[] { cardId, cardFlair, cardID, flair }; UnityEngine.Debug.LogWarning(string.Format("CollectionDeckTray.AddCard({0},{1}): Tried to remove card {2} with flair {3}, but it failed!", args)); return(false); } } if (!taggedDeck.AddCard(cardEntityDef, cardFlair.Premium)) { UnityEngine.Debug.LogWarning(string.Format("CollectionDeckTray.AddCard({0},{1}): deck.AddCard failed!", cardId, cardFlair)); return(false); } if (taggedDeck.GetTotalOwnedCardCount() == 30) { DeckHelper.Get().Hide(); } this.UpdateCardList(cardEntityDef, true, animateFromActor); CollectionManagerDisplay.Get().UpdateCurrentPageCardLocks(true); if ((!Options.Get().GetBool(Option.HAS_ADDED_CARDS_TO_DECK, false) && (taggedDeck.GetTotalCardCount() >= 2)) && (!DeckHelper.Get().IsActive() && (taggedDeck.GetTotalCardCount() < 15))) { NotificationManager.Get().CreateInnkeeperQuote(GameStrings.Get("VO_INNKEEPER_CM_PAGEFLIP_28"), "VO_INNKEEPER_CM_PAGEFLIP_28", 0f, null); Options.Get().SetBool(Option.HAS_ADDED_CARDS_TO_DECK, true); } return(true); }
public ArtStack GetArtStack(CardFlair cardFlair) { ArtStack stack; if (this.m_artStacks.TryGetValue(cardFlair, out stack)) { return(stack); } return(new ArtStack(this.CardID, cardFlair, new DateTime(), 0, 0)); }
public override bool Equals(object obj) { if (!(obj is CardFlair)) { return(false); } CardFlair flair = obj as CardFlair; return(this.Premium == flair.Premium); }
public Actor GetActor(EntityDef entityDef, CardFlair cardFlair) { Actor actor; ActorKey key = this.MakeActorKey(entityDef, cardFlair); if (!this.m_actorMap.TryGetValue(key, out actor)) { Debug.LogError(string.Format("HandActorCache.GetActor() - FAILED to get actor with cardType={0} premiumType={1}", entityDef.GetCardType(), CardFlair.GetPremiumType(cardFlair))); return(null); } return(actor); }
public bool GetShownCardInfo(out EntityDef entityDef, out CardFlair cardFlair) { if (this.m_currentBigActor == null) { entityDef = null; cardFlair = null; return(false); } entityDef = this.m_currentBigActor.GetEntityDef(); cardFlair = this.m_currentBigActor.GetCardFlair(); return((entityDef != null) && (cardFlair != null)); }
public ArtStack AddCards(CardFlair cardFlair, DateTime newestInsertDate, int count, int numSeen) { ArtStack artStack; if (this.ContainsArtStack(cardFlair)) { artStack = this.GetArtStack(cardFlair); artStack.AddCards(newestInsertDate, count, numSeen); return(artStack); } artStack = new ArtStack(this.CardID, cardFlair, newestInsertDate, count, numSeen); this.m_artStacks.Add(cardFlair, artStack); return(artStack); }
public bool ChangeActor(Actor actor, CollectionManagerDisplay.ViewMode vtype) { if (!this.m_actorCacheInit) { this.m_actorCacheInit = true; this.m_actorCache.AddActorLoadedListener(new HandActorCache.ActorLoadedCallback(this.OnCardActorLoaded)); this.m_actorCache.Initialize(); } if (!this.m_actorCache.IsInitializing()) { this.m_visualType = vtype; if (this.m_visualType != CollectionManagerDisplay.ViewMode.CARD_BACKS) { EntityDef entityDef = actor.GetEntityDef(); CardFlair cardFlair = actor.GetCardFlair(); bool flag = entityDef != this.m_entityDef; bool flag2 = !cardFlair.Equals(this.m_cardFlair); if (flag || flag2) { this.m_entityDef = entityDef; this.m_cardFlair = cardFlair; this.m_cardActor = this.m_actorCache.GetActor(entityDef, cardFlair); if (this.m_cardActor == null) { return(false); } if (flag) { CollectionCardCache.Get().LoadCardDef(this.m_entityDef.GetCardId(), new CollectionCardCache.LoadCardDefCallback(this.OnCardDefLoaded), new CardPortraitQuality(1, this.m_cardFlair.Premium), null); } else { this.InitDeckTileActor(); this.InitCardActor(); } } return(true); } if (actor != null) { this.m_entityDef = null; this.m_cardFlair = null; this.m_currentCardBack = actor.GetComponentInChildren <CardBack>(); this.m_cardActor = this.m_cardBackActor; this.m_cardBackActor.SetCardbackUpdateIgnore(true); return(true); } } return(false); }
public CollectionCardVisual GetCardVisual(string cardID, CardFlair cardFlair) { foreach (CollectionCardVisual visual in this.m_collectionCardVisuals) { if (visual.IsShown()) { Actor actor = visual.GetActor(); if (actor.GetEntityDef().GetCardId().Equals(cardID) && actor.GetCardFlair().Equals(cardFlair)) { return(visual); } } } return(null); }
public static RDM_Deck ConvertCollectionDeckToRDMDeck(CollectionDeck deck) { RDM_Deck deck2 = new RDM_Deck(DefLoader.Get().GetEntityDef(deck.HeroCardID)); foreach (CollectionDeckSlot slot in deck.GetSlots()) { EntityDef entityDef = DefLoader.Get().GetEntityDef(slot.CardID); CardFlair cardFlair = new CardFlair(slot.Premium); for (int i = 0; i < slot.Count; i++) { RDMDeckEntry item = new RDMDeckEntry(entityDef, cardFlair); deck2.deckList.Add(item); } } return(deck2); }
public RDM_Deck CreateRDMFromDeckString(string deckString) { RDM_Deck deck = new RDM_Deck(); char[] separator = new char[] { '\n' }; foreach (string str in deckString.Split(separator)) { string str2 = str.Trim(); if (!str2.StartsWith("#")) { try { char[] chArray2 = new char[] { ';' }; foreach (string str3 in str2.Split(chArray2)) { try { int num3; char[] chArray3 = new char[] { ',' }; string[] strArray4 = str3.Split(chArray3); if ((int.TryParse(strArray4[0], out num3) && (num3 >= 0)) && (num3 <= 10)) { string cardId = strArray4[1]; EntityDef entityDef = DefLoader.Get().GetEntityDef(cardId); if (entityDef != null) { CardFlair cardFlair = new CardFlair(TAG_PREMIUM.NORMAL); for (int i = 0; i < num3; i++) { RDMDeckEntry item = new RDMDeckEntry(entityDef, cardFlair); deck.deckList.Add(item); } } } } catch { } } } catch { } } } return(deck); }
public ArtStack RemoveCards(CardFlair cardFlair, int count) { ArtStack artStack = this.GetArtStack(cardFlair); if (artStack == null) { Debug.LogWarning(string.Format("CollectionCardStack.RemoveCards() - cannot remove {0} copies of {1} with card flair {2} - art stack does not exist.", count, this.CardID, cardFlair)); return(artStack); } artStack.RemoveCards(count); if (artStack.Count == 0) { this.m_artStacks.Remove(cardFlair); artStack = new ArtStack(this.CardID, cardFlair, new DateTime(), 0, 0); } return(artStack); }
public void AttachBoosterCard(NetCache.BoosterCard boosterCard) { if ((this.m_boosterCard != null) || (boosterCard != null)) { this.m_boosterCard = boosterCard; this.m_cardFlair = new CardFlair(this.m_boosterCard.Def.Premium); this.Destroy(); if (this.m_boosterCard == null) { this.BecomeReady(); } else { DefLoader.Get().LoadFullDef(this.m_boosterCard.Def.Name, new DefLoader.LoadDefCallback <FullDef>(this.OnFullDefLoaded)); } } }
public void CopyFrom(CollectionDeck otherDeck) { this.ID = otherDeck.ID; this.Type = otherDeck.Type; this.m_name = otherDeck.m_name; this.HeroCardID = otherDeck.HeroCardID; this.HeroCardFlair = otherDeck.HeroCardFlair; this.HeroOverridden = otherDeck.HeroOverridden; this.CardBackID = otherDeck.CardBackID; this.CardBackOverridden = otherDeck.CardBackOverridden; this.IsTourneyValid = otherDeck.IsTourneyValid; this.SeasonId = otherDeck.SeasonId; this.m_slots.Clear(); for (int i = 0; i < otherDeck.GetSlotCount(); i++) { CollectionDeckSlot slotByIndex = otherDeck.GetSlotByIndex(i); CollectionDeckSlot item = new CollectionDeckSlot(); item.CopyFrom(slotByIndex); this.m_slots.Add(item); } }
private List <string> GetPostDisenchantInvalidDeckNames() { Actor shownActor = CraftingManager.Get().GetShownActor(); string cardId = shownActor.GetEntityDef().GetCardId(); CardFlair cardFlair = shownActor.GetCardFlair(); CollectionCardStack.ArtStack collectionArtStack = CollectionManager.Get().GetCollectionArtStack(cardId, cardFlair); int num = Mathf.Max(0, collectionArtStack.Count - 1); SortedDictionary <long, CollectionDeck> decks = CollectionManager.Get().GetDecks(); List <string> list = new List <string>(); foreach (CollectionDeck deck in decks.Values) { if (deck.GetCardCount(cardId, cardFlair) > num) { list.Add(deck.Name); Log.Rachelle.Print(string.Format("Disenchanting will invalidate deck '{0}'", deck.Name), new object[0]); } } return(list); }
private void OnActorLoaded(string name, GameObject go, object callbackData) { if (go == null) { UnityEngine.Debug.LogWarning(string.Format("DeckHelper.OnActorLoaded() - FAILED to load actor \"{0}\"", name)); } else { Actor component = go.GetComponent <Actor>(); if (component == null) { UnityEngine.Debug.LogWarning(string.Format("DeckHelper.OnActorLoaded() - ERROR actor \"{0}\" has no Actor component", name)); } else { component.transform.parent = base.transform; SceneUtils.SetLayer(component, base.gameObject.layer); ActorLoadCallback callback = (ActorLoadCallback)callbackData; RDMDeckEntry choice = callback.choice; EntityDef entityDef = choice.EntityDef; CardDef cardDef = callback.cardDef; CardFlair cardFlair = choice.Flair; component.SetEntityDef(entityDef); component.SetCardDef(cardDef); component.SetCardFlair(cardFlair); component.UpdateAllComponents(); component.gameObject.name = cardDef.name + "_actor"; component.GetCollider().gameObject.AddComponent <DeckHelperVisual>().SetActor(component); this.m_actors.Add(component); if (this.HaveActorsForAllChoices()) { this.PositionAndShowChoices(); } else { component.Hide(); } } } }
public bool AcquireActor(EntityDef entityDef, CardFlair flair, AcquireActorCallback callback, object callbackData) { if (entityDef == null) { Debug.LogError("Cannot acquire actor; entityDef is null!"); return(false); } bool owned = CollectionManager.Get().IsCardInCollection(entityDef.GetCardId(), flair); ActorKey key = this.MakeActorKey(entityDef, flair, owned); string heroSkinOrHandActor = ActorNames.GetHeroSkinOrHandActor(entityDef.GetCardType(), flair.Premium); ActorLoadCallbackData data = new ActorLoadCallbackData { m_key = key, m_owned = owned, m_entityDef = entityDef, m_cardFlair = flair, m_callback = callback, m_callbackData = callbackData }; AssetLoader.Get().LoadActor(heroSkinOrHandActor, new AssetLoader.GameObjectCallback(this.OnActorLoaded), data, false); return(true); }
public void SetDeck(CollectionDeck deck) { if (deck == null) { UnityEngine.Debug.LogWarning(string.Format("CollectionDeckInfo.SetDeckID(): deck is null", new object[0])); } else { this.UpdateManaCurve(deck); string heroPowerCardIdFromHero = GameUtils.GetHeroPowerCardIdFromHero(deck.HeroCardID); if (string.IsNullOrEmpty(heroPowerCardIdFromHero)) { UnityEngine.Debug.LogWarning("CollectionDeckInfo.UpdateInfo(): invalid hero power ID"); this.m_heroPowerID = string.Empty; } else if (!heroPowerCardIdFromHero.Equals(this.m_heroPowerID)) { this.m_heroPowerID = heroPowerCardIdFromHero; string vanillaHeroCardIDFromClass = CollectionManager.Get().GetVanillaHeroCardIDFromClass(deck.GetClass()); CardFlair bestHeroFlairOwned = CollectionManager.Get().GetBestHeroFlairOwned(vanillaHeroCardIDFromClass); DefLoader.Get().LoadFullDef(this.m_heroPowerID, new DefLoader.LoadDefCallback <FullDef>(this.OnHeroPowerFullDefLoaded), (bestHeroFlairOwned == null) ? new CardFlair(TAG_PREMIUM.NORMAL) : bestHeroFlairOwned); } } }
private ActorKey MakeActorKey(EntityDef entityDef, CardFlair flair, bool owned) { return(this.MakeActorKey(entityDef.GetCardType(), CardFlair.GetPremiumType(flair), owned)); }
public void SetCardFlair(CardFlair cardFlair) { this.m_cardFlair = cardFlair; this.UpdatePortrait(); }
public void Show(EntityDef entityDef, CardFlair flair, CardDef cardDef, Vector3 sourcePosition, bool ghosted, float delay = 0) {
public void Show() { this.m_shown = true; base.SetEnabled(true); base.GetComponent <Collider>().enabled = true; if (this.m_actor != null) { bool show = false; if (this.m_visualType == CollectionManagerDisplay.ViewMode.CARDS) { string cardId = this.m_actor.GetEntityDef().GetCardId(); CardFlair cardFlair = this.m_actor.GetCardFlair(); show = CollectionManagerDisplay.Get().ShouldShowNewCardGlow(cardId, cardFlair); if (!show) { CollectionManager.Get().MarkAllInstancesAsSeen(cardId, cardFlair); } } else if ((this.m_visualType != CollectionManagerDisplay.ViewMode.HERO_SKINS) && (this.m_visualType == CollectionManagerDisplay.ViewMode.CARD_BACKS)) { } this.ShowNewItemCallout(show); this.m_actor.Show(); ActorStateType stateType = !show ? ActorStateType.CARD_IDLE : ActorStateType.CARD_RECENTLY_ACQUIRED; this.m_actor.SetActorState(stateType); Renderer[] componentsInChildren = this.m_actor.gameObject.GetComponentsInChildren <Renderer>(); if (componentsInChildren != null) { foreach (Renderer renderer in componentsInChildren) { renderer.shadowCastingMode = ShadowCastingMode.Off; } } EntityDef entityDef = this.m_actor.GetEntityDef(); if (entityDef != null) { string tag = "FakeShadow"; string str3 = "FakeShadowUnique"; GameObject obj2 = SceneUtils.FindChildByTag(this.m_actor.gameObject, tag); GameObject obj3 = SceneUtils.FindChildByTag(this.m_actor.gameObject, str3); if (CollectionManager.Get().IsCardInCollection(entityDef.GetCardId(), this.m_actor.GetCardFlair())) { if (entityDef.IsElite()) { if (obj2 != null) { obj2.GetComponent <Renderer>().enabled = false; } if (obj3 != null) { obj3.GetComponent <Renderer>().enabled = true; } } else { if (obj2 != null) { obj2.GetComponent <Renderer>().enabled = true; } if (obj3 != null) { obj3.GetComponent <Renderer>().enabled = false; } } } else { if (obj2 != null) { obj2.GetComponent <Renderer>().enabled = false; } if (obj3 != null) { obj3.GetComponent <Renderer>().enabled = false; } } } } }