CardIconBigItemCtr.lua 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. local CardIconBigItemCtr = {}
  2. function CardIconBigItemCtr:SetData(wnd, item, logicData, enterType, needName)
  3. local cfgId = logicData == nil and 0 or (logicData.cfgId or 0)
  4. item.level:SetActive(cfgId > 0)
  5. item.name:SetActive(needName and cfgId > 0)
  6. item.iconCard:SetActive(false)
  7. item.cardLabel:SetActive(false)
  8. if cfgId > 0 then
  9. local cardData = ManagerContainer.CfgMgr:GetCardDataById(cfgId)
  10. if cardData == nil then
  11. LogError("next lv card isnt exist")
  12. return
  13. end
  14. local itemData = ManagerContainer.CfgMgr:GetItemById(cfgId)
  15. CommonUtil.LoadIcon(wnd, cardData.CardImg, function (sprite)
  16. item.iconCard.image.sprite = sprite
  17. item.iconCard:SetActive(true)
  18. end)
  19. CommonUtil.LoadIcon(wnd, Constant.Quality_CardBg_Icons[itemData.Quality], function (sprite)
  20. item.frame.image.sprite = sprite
  21. end)
  22. CommonUtil.LoadIcon(wnd, Constant.Quality_Equip_LV_Icons[cardData.CardLevel], function (sprite)
  23. item.level.image.sprite = sprite
  24. end)
  25. local needCardType = cardData.CardType > Enum.CardType.NORMAL
  26. item.cardLabel:SetActive(needCardType)
  27. if needCardType then
  28. CommonUtil.LoadIcon(wnd, Constant.Quality_CardType_Icons[cardData.CardType], function (sprite)
  29. item.cardLabel.image.sprite = sprite
  30. end)
  31. end
  32. item.name.text.uILocalizeScript:SetContent(cardData.CardName)
  33. else
  34. item.iconCard.image.sprite = nil
  35. CommonUtil.LoadIcon(wnd, Constant.Quality_White_Frame_Icon, function (sprite)
  36. item.frame.image.sprite = sprite
  37. end)
  38. item.name.text.uILocalizeScript:SetContent("None")
  39. end
  40. end
  41. return CardIconBigItemCtr