Пример #1
0
 /// <summary>
 /// 设置血条数据,curBar为角标对应的数据,nextBar进行设置时需注意,应该判断,如果对应的角标已经越界,直接赋予黑色背景颜色
 /// </summary>
 /// <param name="index">血条数据角标</param>
 /// <param name="datas">血条数据</param>
 public void SetBarData(int index, List <LifeBarData> datas)
 {
     if (index < 0 || index >= datas.Count)
     {
         return;
     }
     _curBar.SetData(datas[index]);
     _nextBar.SetData((index + 1) >= datas.Count ? new LifeBarData(null, Color.black) : datas[index + 1]);
 }
Пример #2
0
 /// <summary>
 /// 设置数据
 /// </summary>
 public void SetData(LifeBarData data)
 {
     MyImage.color  = data.BarMainColor;
     myImage.sprite = data.BarSprite;
     if (_childItem != null)
     {
         _childItem.SetData(data);
     }
 }