コード例 #1
0
ファイル: SkillUIContainer.cs プロジェクト: atom-chen/tianyu
    /// <summary>
    /// 刷新表现
    /// </summary>
    public void RefreshItems()
    {
        if (this == null)
        {
            return;
        }
        Object skillprefab = null;

        if (skillprefab == null)
        {
            skillprefab = exResources.GetResource(ResourceType.GUI, "Player_information/Single_skillbar");
        }
        if (skillprefab == null)
        {
            GameSys.LogError("找不到预制:Player_information/Single_skillbar");
            return;
        }
        for (int i = 0; i < skillList.Count; i++)
        {
            if (!SkillContainers.ContainsKey(i))
            {
                GameObject obj          = Instantiate(skillprefab) as GameObject;
                Transform  parentTransf = this.gameObject.transform;
                obj.transform.parent        = parentTransf;
                obj.transform.localPosition = Vector3.zero;
                obj.transform.localScale    = Vector3.one;
                SkillUI skillUI = obj.GetComponent <SkillUI>();
                skillUI.FillInfo(skillList[i]);
                skillUI.OnSelectEvent += OnSelectSkillUI;
                SkillContainers[i]     = skillUI;
//                if (firstRun && skillList[i].SkillLv>0)
//                {
//                    firstRun = false;
//                    selectSkillUI = skillUI;
//                    UIToggle tog = obj.GetComponent<UIToggle>();
//                    tog.value = true;
//                    if (OnSelectItemEvent != null)
//                    {
//                        OnSelectItemEvent(selectSkillUI);
//                    }
//                }
            }
            else
            {
                SkillContainers[i].FillInfo(skillList[i]);
            }
        }
        if (grid != null)
        {
            grid.Reposition();
        }
    }
コード例 #2
0
ファイル: SkillUIContainer.cs プロジェクト: atom-chen/tianyu
 /// <summary>
 /// 升级刷新当前技能单元
 /// </summary>
 /// <param name="_info"></param>
 public void RefreshItem(SkillInfo _info)
 {
     selectSkillUI.FillInfo(_info);
 }