コード例 #1
0
    public void ShowerSkills(List <SkillData> skillDatas)
    {
        if (skillDatas == null)
        {
            return;
        }

        for (int i = 0; i < skillDatas.Count; i++)
        {
            GameObject item = null;
            if (i < skillItemContent.childCount)
            {
                item = skillItemContent.GetChild(i).gameObject;
            }
            else
            {
                item = PoolManager.Instance.GetObj("Prafebs/UI/skillItem");
                item.transform.SetParent(skillItemContent);
                (item.transform as RectTransform).localScale = Vector3.one;
            }

            SkillItemController si = item.GetComponent <SkillItemController>();
            si.Init(skillDatas[i]);
        }

        int num = skillItemContent.childCount;

        for (int i = skillDatas.Count; i < num; i++)
        {
            PoolManager.Instance.PushObj(skillItemContent.GetChild(skillDatas.Count).gameObject);
        }
    }
コード例 #2
0
    public void populateSkillSetList(string tag)
    {
        skillItems = new List <SkillItem>();
        cleanUp();

        switch (tag)
        {
        case "MindBtn":
            print("MIND SKILLS POPULATED");
            skillItems.Add(new SkillItem("Night Owel"));
            skillItems.Add(new SkillItem("Straight Shooter"));
            skillItems.Add(new SkillItem("Super Scientist"));
            skillItems.Add(new SkillItem("Developing Mind"));
            skillItems.Add(new SkillItem("Professional Autuer"));
            skillItems.Add(new SkillItem("Energetic Engineer"));
            break;

        case "CharmBtn":
            print("CHARM SKILLS POPULATED");
            skillItems.Add(new SkillItem("Charming Charmer"));
            skillItems.Add(new SkillItem("Artful Nature"));
            break;

        case "CourageBtn":
            print("CHARM SKILLS POPULATED");
            skillItems.Add(new SkillItem("Double Integrity"));
            skillItems.Add(new SkillItem("Wild Card"));
            skillItems.Add(new SkillItem("Chance Encounter"));
            skillItems.Add(new SkillItem("Arrogant Consistency"));
            skillItems.Add(new SkillItem("Prophetic Dreamer"));
            break;

        case "StrengthBtn":
            print("STRENGTH SKILLS POPULATED");
            skillItems.Add(new SkillItem("Punctual Person"));
            break;
        }

        foreach (SkillItem item in skillItems)
        {
            GameObject          newItem    = Instantiate(skillSetItemPrefab) as GameObject;
            SkillItemController controller = newItem.GetComponent <SkillItemController>();
            controller.Name.text = item.Name;
            newItem.transform.SetParent(ContentPanel.transform);
            newItem.transform.localScale = Vector3.one;
            newItems.Add(newItem);
        }
    }