Ejemplo n.º 1
0
    private void ChangeTab(int index)
    {
        Tools.ClearChildFromParent(scrollRect.content);
        List <SkillVo> skillList = new List <SkillVo>();

        barList.Clear();
        nowTab = index;
        int count = 0;

        if (index == 1)
        {
            for (int i = 0; i < DataManager.Instance.skillModel._dataList.Count; i++)
            {
                StaticSkillVo staticVo = StaticDataPool.Instance.staticSkillPool.GetStaticDataVo(DataManager.Instance.skillModel._dataList[i].id);
                if (staticVo.type == 1)
                {
                    GameObject obj = Tools.CreateGameObject("UI/SkillPanel/SkillBar", scrollRect.content);
                    SkillBar   bar = obj.GetComponent <SkillBar>();
                    barList.Add(bar);
                    bar.Create(DataManager.Instance.skillModel._dataList[i], ChangeSelect);
                    count++;
                }
            }
        }
        else if (index == 2)
        {
            for (int i = 0; i < DataManager.Instance.skillModel._dataList.Count; i++)
            {
                StaticSkillVo staticVo = StaticDataPool.Instance.staticSkillPool.GetStaticDataVo(DataManager.Instance.skillModel._dataList[i].id);
                if (staticVo.type == 2)
                {
                    GameObject obj = Tools.CreateGameObject("UI/SkillPanel/SkillBar", scrollRect.content);
                    SkillBar   bar = obj.GetComponent <SkillBar>();
                    barList.Add(bar);
                    bar.Create(DataManager.Instance.skillModel._dataList[i], ChangeSelect);
                    count++;
                }
            }
        }
        scrollRect.content.sizeDelta     = new Vector2(scrollRect.content.sizeDelta.x, 150 * count);
        scrollRect.content.localPosition = Vector3.zero;
    }