| | |
| | | public float PopUpInterval = 0.2f; |
| | | |
| | | |
| | | // public List<BattleBuffCell> buffCells = new List<BattleBuffCell>(); |
| | | [SerializeField] public List<BattleBuffCell> buffCells = new List<BattleBuffCell>(); |
| | | |
| | | protected List<string> messages = new List<string>(); |
| | | |
| | |
| | | |
| | | protected List<HB428_tagSCBuffRefresh> buffList = new List<HB428_tagSCBuffRefresh>(); |
| | | |
| | | public ScrollerController scroller; |
| | | |
| | | public void SetBattleObject(BattleObject _battleObject) |
| | | { |
| | | battleObject = _battleObject; |
| | | heroInfoContainer.SetHeroInfo(battleObject.teamHero); |
| | | RefreshBuff(buffList); |
| | | RefreshBuff(battleObject.buffMgr.GetBuffList()); |
| | | UpdateHP(battleObject.teamHero.curHp, battleObject.teamHero.curHp, battleObject.teamHero.maxHp, false); |
| | | UpdateXP(battleObject.teamHero.rage, battleObject.teamHero.rage, 100, false); |
| | | } |
| | | |
| | | public void RefreshBuff(List<HB428_tagSCBuffRefresh> datas) |
| | | { |
| | | buffList = datas; |
| | | // 更新buff图标 or 创建新的buff图标 |
| | | scroller.Refresh(); |
| | | for (int i = 0; i < buffList.Count; i++) |
| | | if (buffCells.IsNullOrEmpty()) |
| | | return; |
| | | |
| | | |
| | | for (int i = 0; i < buffCells.Count; i++) |
| | | { |
| | | if (i % 5 == 0) |
| | | if (i < datas.Count) |
| | | { |
| | | scroller.AddCell(ScrollerDataType.Header, i); |
| | | buffCells[i].SetActive(true); |
| | | HB428_tagSCBuffRefresh buffData = datas[i]; |
| | | buffCells[i].Init(buffData, () => |
| | | { |
| | | // 点击buff图标 显示buff描述/当前身上所有buff |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | buffCells[i].SetActive(false); |
| | | } |
| | | } |
| | | scroller.Restart(); |
| | | } |
| | | |
| | | protected void OnEnable() |
| | | { |
| | | scroller.OnRefreshCell += OnRefreshCell; |
| | | } |
| | | |
| | | protected void OnDisable() |
| | | { |
| | | scroller.OnRefreshCell -= OnRefreshCell; |
| | | // TODO YYL 考虑池化 |
| | | messages.Clear(); |
| | | for (int i = 0; i < tipsList.Count; i++) |
| | |
| | | } |
| | | tipsList.Clear(); |
| | | } |
| | | |
| | | protected void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | var _cell = cell as BattleBuffLineCell; |
| | | _cell.Display(buffList, cell.index); |
| | | } |
| | | |
| | | public void ShowTips(string message) |
| | | { |
| | | messages.Add(message); |