ExchangeItemCtr.lua 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. local ExchangegItemCtr = {}
  2. local ExchangegItemCtr = require("Common/IconItemCtr")
  3. function PetRelationItemCtr:SetData(wnd, item, logicData, enterType, onClickOwner, onClickCB)
  4. -- local cfgData = logicData
  5. -- item.textName.text.text = I18N.T(cfgData.Name)
  6. -- local relationData = ManagerContainer.DataMgr.PetDataMgr:GetPetRelationDataByCfgId(cfgData.Id)
  7. -- local cfgIds = {}
  8. -- for j = 3, 1, -1 do
  9. -- local condition = cfgData['Condition'..j]
  10. -- local state
  11. -- if condition then
  12. -- local advance = 0
  13. -- for k,v in pairs(condition) do
  14. -- cfgIds[#cfgIds + 1] = v[1]
  15. -- advance = v[2]
  16. -- end
  17. -- local curCount = 0
  18. -- if relationData and relationData.relationPets then
  19. -- for k,v1 in pairs(relationData.relationPets) do
  20. -- local cfgId = condition[k][1]
  21. -- local num = condition[k][2]
  22. -- if v1.cfgId == cfgId and v1.advanceLevel >= num and v1.petId > 0 then
  23. -- curCount = curCount + 1
  24. -- end
  25. -- end
  26. -- end
  27. -- if item.grid.activeSelf and relationData and relationData.newActived == j then
  28. -- if item['relationAttr'..j].uIEffectCfg and not item['relationAttr'..j].uIEffectCfg.Ready then
  29. -- item['relationAttr'..j].uIEffectCfg:LoadEffect()
  30. -- end
  31. -- if item['relationAttr'..j].uIEffectCfg then
  32. -- item['relationAttr'..j].uIEffectCfg:ShowEffect("FX_UI_TuPo_New",item['relationAttr'..j].fx.transform)
  33. -- end
  34. -- end
  35. -- item['relationAttr'..j].count.text.text = curCount .."/3"
  36. -- state = curCount >= 3
  37. -- item['relationAttr'..j].activedState:SetActive(state)
  38. -- item['relationAttr'..j].unactivatedState:SetActive(not state)
  39. -- local color = Constant.GrayColor
  40. -- if j == 1 then
  41. -- color = state and Constant.BlueColor or color
  42. -- elseif j == 2 then
  43. -- color = state and Constant.PurpleColor or color
  44. -- elseif j == 3 then
  45. -- color = state and Constant.GoldColor or color
  46. -- end
  47. -- item['relationAttr'..j].bgActivedState.image.color = Color(color[1], color[2], color[3], color[4])
  48. -- item['relationAttr'..j].attrDsc.text.text = I18N.SetLanguageValue("Petadfetter_001", advance)
  49. -- end
  50. -- local attribute = cfgData['attribute'..j]
  51. -- for i = 1, 3 do
  52. -- item['relationAttr'..j]["attr"..i]:SetActive(false)
  53. -- end
  54. -- if attribute then
  55. -- for i = 1,#attribute do
  56. -- if item['relationAttr'..j]["attr"..i] then
  57. -- item['relationAttr'..j]["attr"..i]:SetActive(attribute[i] ~= nil)
  58. -- if attribute[i] then
  59. -- local key = attribute[i][1]
  60. -- local val = key > 21 and CommonUtil.GetPreciseDecimal(attribute[i][2]*0.0001, 3) or math.floor(attribute[i][2])
  61. -- item['relationAttr'..j]["attr"..i].text.text = I18N.T("Attr_"..attribute[i][1]).." "..CommonUtil.HeroAttrFormatValue(key, val, true)
  62. -- local color = state and Constant.GreenColor or Constant.GrayColor
  63. -- item['relationAttr'..j]["attr"..i].text.color = Color(color[1], color[2], color[3], color[4])
  64. -- item['relationAttr'..j]["attr"..i]:SetActive(true)
  65. -- end
  66. -- end
  67. -- end
  68. -- end
  69. -- end
  70. -- if relationData then
  71. -- for k,v in pairs(relationData.relationPets) do
  72. -- local cfgId = cfgIds[k]
  73. -- local advanceLv = v.advanceLevel
  74. -- if v.petId == 0 then
  75. -- advanceLv = 0
  76. -- end
  77. -- local data = {cfgId = cfgId, advanceLevel = advanceLv}
  78. -- IconPetItemCtr:SetData(wnd,item['item'..k].iconPetItem, data, Enum.ItemIEnterType.PetRelation, onClickOwner, onClickCB, {cfgData.Id, k})
  79. -- CommonUtil.SetTotalChildrenGray(item['item'..k].iconPetItem.gameObject, v.petId == 0)
  80. -- item['item'..k].iconPetItem.nameBg:SetActive(v.petId > 0)
  81. -- item['item'..k].iconPetItem.qualityFX:SetActive(v.petId > 0)
  82. -- if v.petId > 0 then
  83. -- local uid = v.uid
  84. -- local nickname = uid == 0 and ManagerContainer.DataMgr.UserData:GetUserNickname() or ManagerContainer.DataMgr.PetDataMgr:GetRelationPlayerNameByUid(uid)
  85. -- item['item'..k].iconPetItem.petName.text.text = CommonUtil.GetShortVaildNickName(nickname)
  86. -- end
  87. -- end
  88. -- else
  89. -- for i = 1, 3 do
  90. -- local cfgId = cfgIds[i]
  91. -- local data = {cfgId = cfgId, advanceLevel = 0}
  92. -- IconPetItemCtr:SetData(wnd,item['item'..i].iconPetItem, data, Enum.ItemIEnterType.PetRelation, onClickOwner, onClickCB, {cfgData.Id, i})
  93. -- CommonUtil.SetTotalChildrenGray(item['item'..i].iconPetItem.gameObject, true)
  94. -- item['item'..i].iconPetItem.nameBg:SetActive(false)
  95. -- item['item'..i].iconPetItem.qualityFX:SetActive(false)
  96. -- end
  97. -- end
  98. -- local rpIdxList = ManagerContainer.RedPointMgr.PetRPCtr:RefresgPetRelationState(cfgData.Id)
  99. -- for i = 1, 3 do
  100. -- local parent = item['item'..i].transform
  101. -- local redPoint = parent:Find("redPoint")
  102. -- local isIn = CommonUtil.EleInTable(i, rpIdxList)
  103. -- if redPoint then
  104. -- redPoint.gameObject:SetActive(isIn)
  105. -- else
  106. -- if isIn and rpIdxList and next(rpIdxList) then
  107. -- local go = ManagerContainer.ResMgr:GetGoFromPool(Constants.UIPath, "Common/UIRedPointRP")
  108. -- if go then
  109. -- redPoint = go.transform
  110. -- redPoint:SetParent(parent)
  111. -- redPoint.localRotation = Quaternion.identity
  112. -- redPoint.localScale = Vector3.one
  113. -- local rectTransform = redPoint:GetComponent(Enum.TypeInfo.RectTransform)
  114. -- rectTransform.anchoredPosition3D = Vector3(60, 60, 0)
  115. -- go.name = "redPoint"
  116. -- end
  117. -- end
  118. -- end
  119. -- end
  120. --item.grid:SetActive(false)
  121. --item.down:SetActive(true)
  122. --item.up:SetActive(false)
  123. end
  124. return ExchangegItemCtr