UITipsCtr.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. local UITipsCtr = class("UITipsCtr", require("UICtrBase"))
  2. local ConditionJudge = require("Common/ConditionJudge")
  3. function UITipsCtr:Init(view)
  4. self.view = view
  5. end
  6. function UITipsCtr:SetData(data)
  7. self.asyncIdx = 0
  8. if data == nil then return end
  9. self.data = data
  10. end
  11. function UITipsCtr:GetAsyncIdx()
  12. self.asyncIdx = self.asyncIdx + 1
  13. return self.asyncIdx
  14. end
  15. function UITipsCtr:GetData()
  16. return self.data
  17. end
  18. function UITipsCtr:GetCfgId()
  19. return self.data.cfgId
  20. end
  21. function UITipsCtr:SendDecomposeMsg()
  22. ManagerContainer.NetManager:SendMessage(ProtoMsgId.CS_FASHION_PAPER_DECOMPOSE_REQ, {paper_cfg_id = self:GetCfgId()})
  23. end
  24. function UITipsCtr:CanEquipCard()
  25. local cardData = ManagerContainer.CfgMgr:GetCardDataById(self:GetCfgId())
  26. local slotType = cardData.CardLocation
  27. local slotsRoot = ManagerContainer.DataMgr.UserData:GetAllSlotInfos()
  28. for _,v in pairs(slotsRoot) do
  29. if #v.slot_list > 0 then
  30. local slot = v.slot_list[slotType]
  31. if slot.equip_id > 0 then
  32. for j = 1, Constant.CARD_SLOT_LIMIT do
  33. local id = slot.card_id_list[j] or 0
  34. local condition = ManagerContainer.CfgMgr:GetCardUnlockConditionById(slotType * 100 + j)
  35. if condition ~= nil then
  36. local result = ConditionJudge:ConditionPassResult1(condition.UnlockingCondition[1])
  37. if result then
  38. return true
  39. end
  40. end
  41. end
  42. end
  43. end
  44. end
  45. return false
  46. end
  47. function UITipsCtr:OnDispose()
  48. self.data = nil
  49. self.view = nil
  50. end
  51. return UITipsCtr