AttrItemCtr.lua 1.2 KB

123456789101112131415161718192021222324252627
  1. local AttrItemCtr = {}
  2. function AttrItemCtr:SetData(wnd, item, logicData, enterType)
  3. local id = logicData[1]
  4. local val = logicData[2]
  5. if enterType == Enum.ItemIEnterType.Attr then
  6. item.nameText.text.text = I18N.T("Attr_" .. id)
  7. item.numberText.text.text = CommonUtil.HeroAttrFormatValue(id, val)
  8. elseif enterType == Enum.ItemIEnterType.SkillPveBenediction then
  9. item.nameText.text.text = I18N.T("SkillSuitNew_" .. id)
  10. item.numberText.text.text = (SDataUtil.IsGreater(val, 0) and '+' or (SDataUtil.IsLess(val, 0) and '-'or '')) .. val .. "%"
  11. elseif enterType == Enum.ItemIEnterType.CostMat then
  12. local itemCfgData = ManagerContainer.CfgMgr:GetItemById(id)
  13. if itemCfgData == nil then
  14. return
  15. end
  16. item.nameText.text.text = I18N.T(itemCfgData.Name)
  17. local ownCost = CommonUtil.GetOwnResCountByItemId(id)
  18. item.numberText.text.text = ownCost.."/"..val
  19. CommonUtil.SetTextColor(item.nameText.text, Constant.ColorTextArray[itemCfgData.Quality])
  20. CommonUtil.SetTextColor(item.numberText.text, ownCost >= val and Constant.GreenColorText or Constant.RedColorText)
  21. end
  22. end
  23. return AttrItemCtr