UIFashionGotCtr.lua 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. local UIFashionGotCtr = class("UIFashionGotCtr", require("UICtrBase"))
  2. function UIFashionGotCtr:Init(view)
  3. self.view = view
  4. end
  5. function UIFashionGotCtr:SetData(data)
  6. self.asyncIdx = 0
  7. if data == nil then return end
  8. self.data = data
  9. end
  10. function UIFashionGotCtr:GetAsyncIdx()
  11. self.asyncIdx = self.asyncIdx + 1
  12. return self.asyncIdx
  13. end
  14. function UIFashionGotCtr:GetData()
  15. return self.data
  16. end
  17. function UIFashionGotCtr:OnDispose()
  18. self.data = nil
  19. self.view = nil
  20. end
  21. function UIFashionGotCtr:GetCfgId()
  22. return self.data[1].cfgId
  23. end
  24. function UIFashionGotCtr:GetFashionLogicData(cfgId)
  25. return ManagerContainer.DataMgr.FashionData:GetFashionById(cfgId)
  26. end
  27. function UIFashionGotCtr:GetJobTypeName(jobType)
  28. if not jobType then return "" end
  29. local colorStr = "<color=%s>%s</color>"
  30. local leaderColor = GlobalConfig.Instance:GetConfigStrValue(306)
  31. local name = string.format(colorStr, leaderColor, I18N.T("protagonist"))
  32. if jobType > 0 then
  33. --伙伴
  34. local name1, color = ManagerContainer.CfgMgr:GetPartnerCfgDataByJobType(jobType)
  35. name = string.format(colorStr, color, I18N.T(name1))
  36. end
  37. return name
  38. end
  39. function UIFashionGotCtr:SendEquip()
  40. local fashionCfgData = ManagerContainer.CfgMgr:GetFashionById(self:GetCfgId())
  41. local viewData = ManagerContainer.DataMgr.UserData:GetViewData()
  42. local fashionLocation = fashionCfgData.FashionLocation
  43. local curFahsionCfgId = viewData.fashionData[fashionLocation]
  44. if curFahsionCfgId then
  45. ManagerContainer.NetManager:SendMessage(ProtoMsgId.CS_FASHION_DOWN_REQ, { fashion_cfg_id = {curFahsionCfgId} })
  46. end
  47. ManagerContainer.NetManager:SendMessage(ProtoMsgId.CS_FASHION_UP_REQ, { fashion_cfg_id = {self:GetCfgId()} })
  48. end
  49. return UIFashionGotCtr