Exemplo n.º 1
0
    private void InitTalentTree()
    {
        this.m_needsFullInit = false;
        Sprite sprite = this.LoadTalengBGForClass(GarrisonStatus.CharacterClassID());

        if (sprite != null)
        {
            this.m_classBG.sprite = sprite;
        }
        TalentTreeItem[] componentsInChildren = this.m_talentTreeItemRoot.GetComponentsInChildren <TalentTreeItem>(true);
        foreach (TalentTreeItem talentTreeItem in componentsInChildren)
        {
            Object.DestroyImmediate(talentTreeItem.gameObject);
        }
        Image[] componentsInChildren2 = this.m_romanNumeralRoot.GetComponentsInChildren <Image>(true);
        foreach (Image image in componentsInChildren2)
        {
            Object.DestroyImmediate(image.gameObject);
        }
        GarrTalentTreeRec treeRec = null;

        StaticDB.garrTalentTreeDB.EnumRecords(delegate(GarrTalentTreeRec garrTalentTreeRec)
        {
            if (garrTalentTreeRec.ClassID == GarrisonStatus.CharacterClassID())
            {
                treeRec = garrTalentTreeRec;
                return(false);
            }
            return(true);
        });
        if (treeRec == null)
        {
            Debug.LogError("No GarrTalentTree record found for class " + GarrisonStatus.CharacterClassID());
            return;
        }
        this.m_talentTreeItems = new List <TalentTreeItem>();
        for (int k = 0; k < treeRec.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;
            }
        }
        StaticDB.garrTalentDB.EnumRecordsByParentID(treeRec.ID, delegate(GarrTalentRec garrTalentRec)
        {
            this.m_talentTreeItems[garrTalentRec.Tier].SetTalent(garrTalentRec);
            MobilePlayerCanResearchGarrisonTalent mobilePlayerCanResearchGarrisonTalent = new MobilePlayerCanResearchGarrisonTalent();
            mobilePlayerCanResearchGarrisonTalent.GarrTalentID = garrTalentRec.ID;
            Login.instance.SendToMobileServer(mobilePlayerCanResearchGarrisonTalent);
            return(true);
        });
        foreach (TalentTreeItem talentTreeItem2 in this.m_talentTreeItems)
        {
            talentTreeItem2.UpdateVisualStates();
        }
    }
Exemplo n.º 2
0
        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();
            }
        }
Exemplo n.º 3
0
    private void InitTalentTree()
    {
        this.m_needsFullInit = false;
        Sprite sprite = this.LoadTalengBGForClass(GarrisonStatus.CharacterClassID());

        if (sprite != null)
        {
            this.m_classBG.set_sprite(sprite);
        }
        TalentTreeItem[] componentsInChildren = this.m_talentTreeItemRoot.GetComponentsInChildren <TalentTreeItem>(true);
        TalentTreeItem[] array = componentsInChildren;
        for (int i = 0; i < array.Length; i++)
        {
            TalentTreeItem talentTreeItem = array[i];
            Object.DestroyImmediate(talentTreeItem.get_gameObject());
        }
        Image[] componentsInChildren2 = this.m_romanNumeralRoot.GetComponentsInChildren <Image>(true);
        Image[] array2 = componentsInChildren2;
        for (int j = 0; j < array2.Length; j++)
        {
            Image image = array2[j];
            Object.DestroyImmediate(image.get_gameObject());
        }
        GarrTalentTreeRec treeRec = null;

        StaticDB.garrTalentTreeDB.EnumRecords(delegate(GarrTalentTreeRec garrTalentTreeRec)
        {
            if (garrTalentTreeRec.ClassID == GarrisonStatus.CharacterClassID())
            {
                treeRec = garrTalentTreeRec;
                return(false);
            }
            return(true);
        });
        if (treeRec == null)
        {
            Debug.LogError("No GarrTalentTree record found for class " + GarrisonStatus.CharacterClassID());
            return;
        }
        this.m_talentTreeItems = new List <TalentTreeItem>();
        for (int k = 0; k < treeRec.MaxTiers; k++)
        {
            GameObject gameObject = Object.Instantiate <GameObject>(this.m_talentTreeItemPrefab);
            gameObject.get_transform().SetParent(this.m_talentTreeItemRoot.get_transform(), false);
            TalentTreeItem component = gameObject.GetComponent <TalentTreeItem>();
            this.m_talentTreeItems.Add(component);
            if (k < this.m_romanNumeralPrefabs.Length)
            {
                GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_romanNumeralPrefabs[k]);
                gameObject2.get_transform().SetParent(this.m_romanNumeralRoot.get_transform(), false);
            }
        }
        StaticDB.garrTalentDB.EnumRecordsByParentID(treeRec.ID, delegate(GarrTalentRec garrTalentRec)
        {
            this.m_talentTreeItems.get_Item(garrTalentRec.Tier).SetTalent(garrTalentRec);
            MobilePlayerCanResearchGarrisonTalent mobilePlayerCanResearchGarrisonTalent = new MobilePlayerCanResearchGarrisonTalent();
            mobilePlayerCanResearchGarrisonTalent.GarrTalentID = garrTalentRec.ID;
            Login.instance.SendToMobileServer(mobilePlayerCanResearchGarrisonTalent);
            return(true);
        });
        using (List <TalentTreeItem> .Enumerator enumerator = this.m_talentTreeItems.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                TalentTreeItem current = enumerator.get_Current();
                current.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();
            }
        }