private void HandleGarrisonDataResetFinished() { if (this.m_needsFullInit) { this.InitTalentTree(); } else { TalentTreeItem[] componentsInChildren = this.m_talentTreeItemRoot.GetComponentsInChildren <TalentTreeItem>(true); foreach (TalentTreeItem talentTreeItem in componentsInChildren) { talentTreeItem.HandleGarrisonDataResetFinished(); LegionCompanionWrapper.RequestCanResearchGarrisonTalent(talentTreeItem.m_talentButtonLeft.GetTalentID()); LegionCompanionWrapper.RequestCanResearchGarrisonTalent(talentTreeItem.m_talentButtonRight.GetTalentID()); } } }
private void HandleGarrisonDataResetFinished() { if (!this.m_needsFullInit) { TalentTreeItem[] componentsInChildren = this.m_talentTreeItemRoot.GetComponentsInChildren <TalentTreeItem>(true); for (int i = 0; i < (int)componentsInChildren.Length; i++) { TalentTreeItem talentTreeItem = componentsInChildren[i]; talentTreeItem.HandleGarrisonDataResetFinished(); LegionCompanionWrapper.RequestCanResearchGarrisonTalent(talentTreeItem.m_talentButtonLeft.GetTalentID()); LegionCompanionWrapper.RequestCanResearchGarrisonTalent(talentTreeItem.m_talentButtonRight.GetTalentID()); } } else { this.InitTalentTree(); } }
private void InitTalentTree() { if (this.m_needsFullInit) { this.m_needsFullInit = false; if (GarrisonStatus.Faction() == PVP_FACTION.HORDE) { this.m_hordeBG.gameObject.SetActive(true); this.m_allianceBG.gameObject.SetActive(false); } else if (GarrisonStatus.Faction() == PVP_FACTION.ALLIANCE) { this.m_hordeBG.gameObject.SetActive(false); this.m_allianceBG.gameObject.SetActive(true); } TalentTreeItem[] componentsInChildren = this.m_talentTreeItemRoot.GetComponentsInChildren <TalentTreeItem>(true); foreach (TalentTreeItem talentTreeItem in componentsInChildren) { talentTreeItem.transform.SetParent(null); Object.Destroy(talentTreeItem.gameObject); } Image[] componentsInChildren2 = this.m_romanNumeralRoot.GetComponentsInChildren <Image>(true); foreach (Image image in componentsInChildren2) { image.transform.SetParent(null); Object.Destroy(image.gameObject); } this.m_talentTreeItems.Clear(); int lookupId = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? 153 : 152; GarrTalentTreeRec recordFirstOrDefault = StaticDB.garrTalentTreeDB.GetRecordFirstOrDefault((GarrTalentTreeRec garrTalentTreeRec) => garrTalentTreeRec.ID == lookupId); if (recordFirstOrDefault == null) { Debug.LogError("No GarrTalentTree record found for class " + GarrisonStatus.CharacterClassID()); return; } for (int k = 0; k < (int)recordFirstOrDefault.MaxTiers; k++) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_talentTreeItemPrefab); gameObject.transform.SetParent(this.m_talentTreeItemRoot.transform, false); TalentTreeItem component = gameObject.GetComponent <TalentTreeItem>(); this.m_talentTreeItems.Add(component); switch (k) { case 0: component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-One"); break; case 1: component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Two"); break; case 2: component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Three"); break; case 3: component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Four"); break; case 4: component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Five"); break; case 5: component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Six"); break; case 6: component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Seven"); break; case 7: component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Eight"); break; } } foreach (GarrTalentRec garrTalentRec in StaticDB.garrTalentDB.GetRecordsByParentID(recordFirstOrDefault.ID)) { this.m_talentTreeItems[(int)garrTalentRec.Tier].SetTalent(garrTalentRec); LegionCompanionWrapper.RequestCanResearchGarrisonTalent(garrTalentRec.ID); } } foreach (TalentTreeItem talentTreeItem2 in this.m_talentTreeItems) { talentTreeItem2.UpdateVisualStates(); } }
private void InitTalentTree() { this.m_needsFullInit = false; if (GarrisonStatus.Faction() == PVP_FACTION.HORDE) { this.m_hordeBG.gameObject.SetActive(true); this.m_allianceBG.gameObject.SetActive(false); } else if (GarrisonStatus.Faction() == PVP_FACTION.ALLIANCE) { this.m_hordeBG.gameObject.SetActive(false); this.m_allianceBG.gameObject.SetActive(true); } TalentTreeItem[] componentsInChildren = this.m_talentTreeItemRoot.GetComponentsInChildren <TalentTreeItem>(true); for (int i = 0; i < (int)componentsInChildren.Length; i++) { TalentTreeItem talentTreeItem = componentsInChildren[i]; talentTreeItem.transform.SetParent(null); UnityEngine.Object.Destroy(talentTreeItem.gameObject); } Image[] imageArray = this.m_romanNumeralRoot.GetComponentsInChildren <Image>(true); for (int j = 0; j < (int)imageArray.Length; j++) { Image image = imageArray[j]; image.transform.SetParent(null); UnityEngine.Object.Destroy(image.gameObject); } this.m_talentTreeItems.Clear(); int num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? 153 : 152); GarrTalentTreeRec recordFirstOrDefault = StaticDB.garrTalentTreeDB.GetRecordFirstOrDefault((GarrTalentTreeRec garrTalentTreeRec) => garrTalentTreeRec.ID == num); if (recordFirstOrDefault == null) { Debug.LogError(string.Concat("No GarrTalentTree record found for class ", GarrisonStatus.CharacterClassID())); return; } for (int k = 0; k < recordFirstOrDefault.MaxTiers; k++) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_talentTreeItemPrefab); gameObject.transform.SetParent(this.m_talentTreeItemRoot.transform, false); TalentTreeItem component = gameObject.GetComponent <TalentTreeItem>(); this.m_talentTreeItems.Add(component); switch (k) { case 0: { component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-One"); break; } case 1: { component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Two"); break; } case 2: { component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Three"); break; } case 3: { component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Four"); break; } case 4: { component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Five"); break; } case 5: { component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Six"); break; } case 6: { component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Seven"); break; } case 7: { component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Eight"); break; } } } foreach (GarrTalentRec recordsByParentID in StaticDB.garrTalentDB.GetRecordsByParentID(recordFirstOrDefault.ID)) { this.m_talentTreeItems[recordsByParentID.Tier].SetTalent(recordsByParentID); LegionCompanionWrapper.RequestCanResearchGarrisonTalent(recordsByParentID.ID); } foreach (TalentTreeItem mTalentTreeItem in this.m_talentTreeItems) { mTalentTreeItem.UpdateVisualStates(); } }