private void CheckForCardOpened(BnetGameAccount oldPlayerAccount, BnetGameAccount newPlayerAccount, BnetPlayer newPlayer) { if (newPlayerAccount.GetCardsOpened() != oldPlayerAccount.GetCardsOpened()) { string cardsOpened = newPlayerAccount.GetCardsOpened(); if (!string.IsNullOrEmpty(cardsOpened)) { char[] separator = new char[] { ',' }; string[] strArray = cardsOpened.Split(separator); if (strArray.Length == 2) { EntityDef entityDef = DefLoader.Get().GetEntityDef(strArray[0]); if (entityDef != null) { if (strArray[1] == "1") { object[] args = new object[] { "5ecaf0ff", newPlayer.GetBestName(), entityDef.GetName(), "ffd200" }; this.AddToast(GameStrings.Format("GLOBAL_SOCIAL_TOAST_FRIEND_GOLDEN_LEGENDARY", args)); } else { object[] objArray2 = new object[] { "5ecaf0ff", newPlayer.GetBestName(), entityDef.GetName(), "ff9c00" }; this.AddToast(GameStrings.Format("GLOBAL_SOCIAL_TOAST_FRIEND_LEGENDARY", objArray2)); } } } } } }
public ItemController() { _defs = DefLoader.LoadDefCatalog <ItemDef>("Village.Core.Items.Defs.ItemDefs.json"); _items = new Dictionary <string, IItemInstance>(); _inventories = new Dictionary <string, IInventory>(); _filters = new Dictionary <string, IItemFilter>(); }
public int CompareTo(object obj) { if (!(obj is CollectionCardStack.ArtStack)) { throw new ArgumentException("Object is not an ArtStack."); } CollectionCardStack.ArtStack stack = obj as CollectionCardStack.ArtStack; EntityDef entityDef = DefLoader.Get().GetEntityDef(this.CardID); EntityDef def2 = DefLoader.Get().GetEntityDef(stack.CardID); if (!entityDef.Equals(def2)) { return(CollectionManager.Get().EntityDefSortComparison(entityDef, def2)); } if (!this.Flair.Equals(stack.Flair)) { return(GameUtils.CardFlairSortComparisonAsc(this.Flair, stack.Flair)); } if (!this.NewestInsertDate.Equals(stack.NewestInsertDate)) { return(this.NewestInsertDate.CompareTo(stack.NewestInsertDate)); } if (this.Count != stack.Count) { return(this.Count - stack.Count); } return(this.NumSeen - stack.NumSeen); }
internal ArenaDraftData() { this.Deck = new List <Triton.Game.Abstraction.EntityDef>(); DraftDisplay display = DraftDisplay.Get(); if (display.m_chosenHero != null) { this.Hero = new Triton.Game.Abstraction.Actor(display.m_chosenHero); } this.Choices = new List <Triton.Game.Abstraction.Actor>(); foreach (DraftDisplay.DraftChoice choice in display.m_choices) { this.Choices.Add(new Triton.Game.Abstraction.Actor(choice.m_actor)); } DefLoader loader = DefLoader.Get(); DraftManager manager = DraftManager.Get(); foreach (CollectionDeckSlot slot in manager.m_draftDeck.m_slots) { for (int i = 0; i < slot.Count; i++) { this.Deck.Add(new Triton.Game.Abstraction.EntityDef(loader.GetEntityDef(slot.CardID))); } } this.Wins = manager.m_wins; this.Losses = manager.m_losses; }
private void SetUpActor() { if (((this.m_actor != null) && (this.m_slot != null)) && !string.IsNullOrEmpty(this.m_slot.CardID)) { EntityDef entityDef = DefLoader.Get().GetEntityDef(this.m_slot.CardID); bool flag = SceneMgr.Get().GetMode() == SceneMgr.Mode.COLLECTIONMANAGER; this.m_actor.SetDisablePremiumPortrait(true); this.m_actor.SetGhosted(flag && !this.m_slot.Owned); this.m_actor.SetEntityDef(entityDef); this.m_actor.SetCardFlair(new CardFlair(this.m_slot.Premium)); bool cardIsUnique = (entityDef != null) ? entityDef.IsElite() : false; if ((cardIsUnique && this.m_inArena) && (this.m_slot.Count > 1)) { cardIsUnique = false; } this.m_actor.UpdateDeckCardProperties(cardIsUnique, this.m_slot.Count, this.m_useSliderAnimations); CollectionCardCache.Get().LoadCardDef(entityDef.GetCardId(), delegate(string cardID, CardDef cardDef, object data) { if ((this.m_actor != null) && cardID.Equals(this.m_actor.GetEntityDef().GetCardId())) { this.m_actor.SetCardDef(cardDef); this.m_actor.UpdateAllComponents(); this.m_actor.UpdateMaterial(cardDef.GetDeckCardBarPortrait()); this.m_actor.UpdateGhostTileEffect(); } }, null, new CardPortraitQuality(1, this.m_slot.Premium)); } }
private void LoadVanillaHeroCardDef() { Player player = null; foreach (Player player2 in GameState.Get().GetPlayerMap().Values) { if (player2.GetSide() == Player.Side.FRIENDLY) { player = player2; break; } } if (player == null) { Debug.LogWarning("GoldenHeroEvent.LoadVanillaHeroCardDef() - currentPlayer == null"); } else { EntityDef entityDef = player.GetEntityDef(); if (entityDef.GetCardSet() == TAG_CARD_SET.HERO_SKINS) { string vanillaHeroCardID = CollectionManager.Get().GetVanillaHeroCardID(entityDef); CardPortraitQuality quality = new CardPortraitQuality(3, TAG_PREMIUM.NORMAL); DefLoader.Get().LoadCardDef(vanillaHeroCardID, new DefLoader.LoadDefCallback <CardDef>(this.OnVanillaHeroCardDefLoaded), new object(), quality); } } }
private void CleanCache() { int num = this.m_cardCache.Count - 60; if (num > 0) { CollectionDeck currentlyOpenDeck = null; if (CollectionManager.Get() != null) { currentlyOpenDeck = CollectionManager.Get().GetTaggedDeck(CollectionManager.DeckTag.Editing); } List <string> deckHelperCardChoices = (DeckHelper.Get() != null) ? DeckHelper.Get().GetCardIDChoices() : null; List <string> names = new List <string>(); int index = 0; while (index < this.m_cardCache.Count) { CardCacheItem item = this.m_cardCache[index]; if (!this.CanClearItem(item, currentlyOpenDeck, deckHelperCardChoices)) { index++; } else { names.Add(item.m_cardId); this.m_cardCache.RemoveAt(index); DefLoader.Get().ClearCardDef(item.m_cardId); if (names.Count == num) { break; } } } AssetCache.ClearCardPrefabs(names); } }
private void Start() { DbfRecord record = GameDbf.Scenario.GetRecord(this.m_missionId); if (record == null) { object[] messageArgs = new object[] { this.m_missionId }; Error.AddDevWarning("Error", "scenario {0} does not exist in the DBF", messageArgs); } else { if (this.m_name != null) { this.m_name.Text = record.GetLocString("SHORT_NAME"); } int @int = record.GetInt("CLIENT_PLAYER2_HERO_CARD_ID"); if (@int == 0) { @int = record.GetInt("PLAYER2_HERO_CARD_ID"); } string cardId = GameUtils.TranslateDbIdToCardId(@int); if (cardId != null) { DefLoader.Get().LoadCardDef(cardId, new DefLoader.LoadDefCallback <CardDef>(this.OnCardDefLoaded), null, null); } } }
public void SetEnchantment(Entity enchantment) { this.m_enchantment = enchantment; string cardId = this.m_enchantment.GetCardId(); DefLoader.Get().LoadCardDef(cardId, new DefLoader.LoadDefCallback <CardDef>(this.OnCardDefLoaded), null, new CardPortraitQuality(1, this.m_enchantment.GetPremiumType())); }
private void Awake() { s_instance = this; this.InitMissionRecords(); foreach (Transform transform in base.gameObject.GetComponents <Transform>()) { transform.gameObject.SetActive(false); } base.gameObject.SetActive(true); if (this.m_backButton != null) { this.m_backButton.SetText(GameStrings.Get("GLOBAL_BACK")); this.m_backButton.AddEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.BackButtonReleased)); } this.m_trayLabel.Text = GameStrings.Get("GLUE_CHOOSE_OPPONENT"); this.m_playButton.AddEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.PlayGameButtonRelease)); this.m_heroDefsToLoad = this.m_sortedMissionRecords.Count; foreach (DbfRecord record in this.m_sortedMissionRecords) { string missionHeroCardId = GameUtils.GetMissionHeroCardId(record.GetId()); DefLoader.Get().LoadFullDef(missionHeroCardId, new DefLoader.LoadDefCallback <FullDef>(this.OnFullDefLoaded)); } SoundManager.Get().Load("choose_opponent_panel_slide_on"); SoundManager.Get().Load("choose_opponent_panel_slide_off"); this.SetupHeroAchieves(); base.StartCoroutine(this.NotifyWhenTrayLoaded()); GameMgr.Get().RegisterFindGameEvent(new GameMgr.FindGameCallback(this.OnFindGameEvent)); }
private void DoShowCardRewards(List <string> cardIds, Vector3?finalPosition, Vector3?origin, bool disableFullscreen) { int index = 0; int count = cardIds.Count; foreach (string str in cardIds) { FullDef fullDef = DefLoader.Get().GetFullDef(str, null); GameObject obj2 = AssetLoader.Get().LoadActor(ActorNames.GetHandActor(fullDef.GetEntityDef(), TAG_PREMIUM.NORMAL), false, false); Actor component = obj2.GetComponent <Actor>(); component.SetCardDef(fullDef.GetCardDef()); component.SetEntityDef(fullDef.GetEntityDef()); if (component.m_cardMesh != null) { BoxCollider collider = component.m_cardMesh.GetComponent <BoxCollider>(); if (collider != null) { collider.enabled = false; } } this.m_CurrentCardRewards.Add(component); GameUtils.SetParent(component, this.m_RewardsCardArea, false); this.ShowCardRewardsObject(obj2, finalPosition, origin, index, count); index++; } this.EnableFullscreen(disableFullscreen); }
private FilteredArtStack RunFilters_MustPassAll(CollectionCardStack.ArtStack artStack) { if (this.FiltersExist()) { EntityDef entityDef = DefLoader.Get().GetEntityDef(artStack.CardID); if (entityDef == null) { Log.Rachelle.Print(string.Format("WARNING CollectionFilter.RunFilters_MustPassAll() - entityDef for {0} is null", artStack.CardID), new object[0]); return(null); } foreach (CollectionFilter <GAME_TAG> filter in this.m_gameFilters) { if (!this.RunGameFilter(entityDef, filter)) { return(null); } } foreach (CollectionFilter <ACCOUNT_TAG> filter2 in this.m_accountFilters) { if (!this.RunAccountFilter(artStack, filter2)) { return(null); } } if (((this.m_textFilter != null) && this.m_textFilter.ShouldRunFilter()) && !this.RunTextFilter(entityDef, artStack, this.m_textFilter)) { return(null); } } return(new FilteredArtStack(artStack)); }
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)); }
public override string ToString() { EntityDef entityDef = DefLoader.Get().GetEntityDef(this.CardID); string str = (entityDef != null) ? entityDef.GetName() : "[UNKNOWN]"; object[] args = new object[] { str, this.CardID, this.Premium, this.Count, base.Origin, base.OriginData }; return(string.Format("[CardRewardData: cardName={0} CardID={1}, Premium={2} Count={3} Origin={4} OriginData={5}]", args)); }
protected override void OnOver(PegUIElement.InteractionState oldState) { this.m_mousedOver = true; base.OnOver(oldState); if (!string.IsNullOrEmpty(GameUtils.GetMissionHeroPowerCardId(this.m_missionId))) { DefLoader.Get().LoadFullDef(GameUtils.GetMissionHeroPowerCardId(this.m_missionId), new DefLoader.LoadDefCallback <FullDef>(this.OnHeroPowerDefLoaded)); } }
public IItemInstance CreateNewInstanceLike(IItemInstance item, IInventory inventory, int count) { var newItem = DefLoader.CreateInstanct <IItemInstance>(item.ItemDef, this, inventory); (newItem as BaseItem).SetCount(count); _items.Add(newItem.Id, newItem); (inventory as BaseInventory).AddItemInstance(newItem); return(newItem); }
public static TAG_CARD_SET GetCardSetFromCardID(string cardID) { EntityDef entityDef = DefLoader.Get().GetEntityDef(cardID); if (entityDef == null) { UnityEngine.Debug.LogError(string.Format("Null EntityDef in GetCardSetFromCardID() for {0}", cardID)); return(TAG_CARD_SET.INVALID); } return(entityDef.GetCardSet()); }
public bool TryAddBuilding(MapSpot anchor, string defName) { var def = _defs[defName]; var building = DefLoader.CreateInstanct <IBuilding>(def, "GROUND", anchor, _mapController, MapRotation.Default); if (_mapController.CanAddMapStructure(building.MapLayerName, building.MapStructDef, anchor, building.Rotation)) { _mapController.AddMapStructure(building); _buildings.Add(building.Id, building); } return(true); }
public static DefLoader Get() { if (s_instance == null) { s_instance = new DefLoader(); if (ApplicationMgr.Get() != null) { ApplicationMgr.Get().WillReset += new System.Action(s_instance.WillReset); } } return(s_instance); }
private void InitRewardText() { CardRewardData data = base.Data as CardRewardData; EntityDef entityDef = DefLoader.Get().GetEntityDef(data.CardID); if (!entityDef.IsHero()) { string headline = GameStrings.Get("GLOBAL_REWARD_CARD_HEADLINE"); string details = string.Empty; string source = string.Empty; TAG_CARD_SET cardSet = entityDef.GetCardSet(); TAG_CLASS tag = entityDef.GetClass(); string className = GameStrings.GetClassName(tag); if (GameMgr.Get().IsTutorial()) { details = GameUtils.GetCurrentTutorialCardRewardDetails(); } else if (cardSet == TAG_CARD_SET.CORE) { int num = 20; int basicCardsIOwn = CollectionManager.Get().GetBasicCardsIOwn(tag); if (data.Premium == TAG_PREMIUM.GOLDEN) { details = string.Empty; } else { if (num == basicCardsIOwn) { data.InnKeeperLine = CardRewardData.InnKeeperTrigger.CORE_CLASS_SET_COMPLETE; } else if (basicCardsIOwn == 4) { data.InnKeeperLine = CardRewardData.InnKeeperTrigger.SECOND_REWARD_EVER; } object[] args = new object[] { basicCardsIOwn, num, className }; details = GameStrings.Format("GLOBAL_REWARD_CORE_CARD_DETAILS", args); } } if (base.Data.Origin == NetCache.ProfileNotice.NoticeOrigin.LEVEL_UP) { TAG_CLASS originData = (TAG_CLASS)((int)base.Data.OriginData); NetCache.HeroLevel heroLevel = GameUtils.GetHeroLevel(originData); object[] objArray2 = new object[] { heroLevel.CurrentLevel.Level.ToString(), GameStrings.GetClassName(originData) }; source = GameStrings.Format("GLOBAL_REWARD_CARD_LEVEL_UP", objArray2); } else { source = string.Empty; } base.SetRewardText(headline, details, source); } }
private void LoadCards() { GameDbf.Load(); List <string> allCardIds = GameUtils.GetAllCardIds(); this.m_cardsToLoad = allCardIds.Count; foreach (string str in allCardIds) { CardPortraitQuality quality = new CardPortraitQuality(3, TAG_PREMIUM.GOLDEN); DefLoader.Get().LoadCardDef(str, new DefLoader.LoadDefCallback <CardDef>(this.OnCardDefLoaded), null, quality); } }
private void LoadAllTutorialHeroEntities() { for (int i = 0; i < this.m_sortedMissionRecords.Count; i++) { string missionHeroCardId = GameUtils.GetMissionHeroCardId(this.m_sortedMissionRecords[i].GetId()); if (DefLoader.Get().GetEntityDef(missionHeroCardId) == null) { UnityEngine.Debug.LogError(string.Format("TutorialProgress.OnTutorialHeroEntityDefLoaded() - failed to load {0}", missionHeroCardId)); } } this.SetupCoins(); this.Show(); }
public static int CountNonHeroCollectibleCards() { int num = 0; foreach (string str in GetAllCollectibleCardIds()) { EntityDef entityDef = DefLoader.Get().GetEntityDef(str); if ((entityDef != null) && (entityDef.GetCardType() != TAG_CARDTYPE.HERO)) { num++; } } return(num); }
public static TAG_CLASS GetClassChallengeHeroClass(DbfRecord rec) { if (rec.GetInt("MODE_ID") != 4) { return(TAG_CLASS.INVALID); } int @int = rec.GetInt("PLAYER1_HERO_CARD_ID"); EntityDef entityDef = DefLoader.Get().GetEntityDef(@int); if (entityDef == null) { return(TAG_CLASS.INVALID); } return(entityDef.GetClass()); }
protected override bool JustEarnedGoldenHero() { if (!this.m_hasParsedCompletedQuests) { string goldenHeroCardID = this.GetGoldenHeroCardID(); if (goldenHeroCardID != "none") { CardPortraitQuality quality = new CardPortraitQuality(3, TAG_PREMIUM.GOLDEN); DefLoader.Get().LoadCardDef(goldenHeroCardID, new DefLoader.LoadDefCallback <CardDef>(this.OnGoldenHeroCardDefLoaded), new object(), quality); } this.m_hasParsedCompletedQuests = true; this.m_showGoldenHeroEvent = goldenHeroCardID != "none"; } return(this.m_showGoldenHeroEvent); }
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 static void SetName(int entityId, string cardID) { var edef = DefLoader.Get().GetEntityDef(cardID); if (edef != null) { Names[entityId] = edef.GetName(); } else { DefLoader.Get().LoadFullDef(cardID, (cardId, def, data) => { Names[entityId] = def.GetEntityDef().GetName(); }); } }
private void OnActorLoaded(string name, GameObject go, object callbackData) { EntityDef entityDef = (EntityDef)callbackData; Actor component = go.GetComponent <Actor>(); this.StartSettingUpNonHeroActor(component, entityDef, this.m_cardParent.transform); CardRewardData data = base.Data as CardRewardData; this.m_cardCount.SetCount(data.Count); if (data.Count > 1) { Actor actor = UnityEngine.Object.Instantiate <Actor>(component); this.StartSettingUpNonHeroActor(actor, entityDef, this.m_duplicateCardParent.transform); } DefLoader.Get().LoadCardDef(entityDef.GetCardId(), new DefLoader.LoadDefCallback <CardDef>(this.OnCardDefLoaded), entityDef, new CardPortraitQuality(3, true)); }
private void OnHeroActorLoaded(string name, GameObject go, object callbackData) { EntityDef entityDef = (EntityDef)callbackData; Actor component = go.GetComponent <Actor>(); component.SetEntityDef(entityDef); component.transform.parent = this.m_heroCardRoot.transform; component.transform.localScale = Vector3.one; component.transform.localPosition = Vector3.zero; component.transform.localRotation = Quaternion.identity; component.TurnOffCollider(); component.m_healthObject.SetActive(false); SceneUtils.SetLayer(component.gameObject, GameLayer.IgnoreFullScreenEffects); this.m_actors.Add(component); DefLoader.Get().LoadCardDef(entityDef.GetCardId(), new DefLoader.LoadDefCallback <CardDef>(this.OnCardDefLoaded), new CardPortraitQuality(3, true), null); }
public int Compare(TileWrapper x, TileWrapper y) { if (x == null || y == null) { Logger.AppendLine("TileWrapper was null"); return(0); } else { Logger.AppendLine("TileWrapper was not null"); } string xcardId = x.Tile.GetCardID(); string ycardId = y.Tile.GetCardID(); if (xcardId == null || ycardId == null) { Logger.AppendLine("GetCardID was null"); return(0); } else { Logger.AppendLine("GetCardID was not null"); } var xEntityDef = DefLoader.Get().GetEntityDef(xcardId); var yEntityDef = DefLoader.Get().GetEntityDef(ycardId); if (xEntityDef == null || yEntityDef == null) { Logger.AppendLine("Tile Sorter getting def was null"); return(0); } else { Logger.AppendLine("Tile Sorter getting def was not null"); } var xCost = xEntityDef.GetCost(); var yCost = yEntityDef.GetCost(); if (xCost != yCost) { return(xCost.CompareTo(yCost)); } return(string.Compare(xEntityDef.GetName(), yEntityDef.GetName(), StringComparison.Ordinal)); }