UIGuildInfoCtr.lua 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. local UIGuildInfoCtr = class("UIGuildInfoCtr", require("UICtrBase"))
  2. function UIGuildInfoCtr:Init(view)
  3. self.view = view
  4. end
  5. function UIGuildInfoCtr:SetData(data)
  6. self.asyncIdx = 0
  7. self.data = data
  8. self.guildData = nil
  9. end
  10. function UIGuildInfoCtr:GetAsyncIdx()
  11. self.asyncIdx = self.asyncIdx + 1
  12. return self.asyncIdx
  13. end
  14. function UIGuildInfoCtr:GetData()
  15. return self.data
  16. end
  17. function UIGuildInfoCtr:OnDispose()
  18. self.data = nil
  19. self.view = nil
  20. self.guildData = nil
  21. ManagerContainer.DataMgr.GuildDataMgr:ClearCheckGuildData()
  22. end
  23. function UIGuildInfoCtr:IsInGuild()
  24. return ManagerContainer.DataMgr.GuildDataMgr:HasGuild()
  25. end
  26. function UIGuildInfoCtr:GetId()
  27. return self.data or 0
  28. end
  29. function UIGuildInfoCtr:RefreshGuildData()
  30. local guildData = ManagerContainer.DataMgr.GuildDataMgr:GetCheckGuildData()
  31. local brief = guildData:GetBriefData()
  32. if brief then
  33. if self:GetId() == brief.id then
  34. self.guildData = guildData
  35. return true
  36. end
  37. end
  38. return false
  39. end
  40. function UIGuildInfoCtr:GetGuildData()
  41. return self.guildData
  42. end
  43. function UIGuildInfoCtr:GetGuildBriefData()
  44. return self.guildData and self.guildData:GetBriefData() or nil
  45. end
  46. function UIGuildInfoCtr:GetGuildMoreInfoData()
  47. return self.guildData and self.guildData:GetBaseData() or nil
  48. end
  49. function UIGuildInfoCtr:GetGuildMemberNum()
  50. return self.guildData and self.guildData:GetGuildMemberNum() or 0
  51. end
  52. function UIGuildInfoCtr:GetGuildMemberLimit()
  53. return self.guildData and self.guildData:GetGuildMemberLimit() or 0
  54. end
  55. function UIGuildInfoCtr:GetNextLoadMemberUids()
  56. return self.guildData and self.guildData:GetNextLoadMemberUid(10) or nil
  57. end
  58. function UIGuildInfoCtr:GetValidMemberNum()
  59. return self.guildData and self.guildData:GetValidMemberNum() or 0
  60. end
  61. function UIGuildInfoCtr:GetMemberMoreInfoByItemidx(itemIdx)
  62. return self.guildData and self.guildData:GetMemberMoreInfoByidx(itemIdx + 1) or nil
  63. end
  64. function UIGuildInfoCtr:GetMemberMoreInfoByUid(uid)
  65. return self.guildData and self.guildData:GetMemberMoreInfoByUid(uid) or nil
  66. end
  67. function UIGuildInfoCtr:GetIsSubmitApply()
  68. return self.guildData and self.guildData:GetIsSubmitApply() or false
  69. end
  70. function UIGuildInfoCtr:GetNextCDTime()
  71. local guildData = ManagerContainer.DataMgr.GuildDataMgr:GetCurGuildData()
  72. return guildData and guildData:GetNextCDTime() or nil
  73. end
  74. function UIGuildInfoCtr:SendGetGuildMoreInfoReq()
  75. if not ManagerContainer.DataMgr.GuildDataMgr:SendGetGuildMoreInfoReq(self:GetId()) then
  76. return 100007
  77. end
  78. return 0
  79. end
  80. function UIGuildInfoCtr:SendGetGuildMemberInfoReq()
  81. local uids = self:GetNextLoadMemberUids(10)
  82. if not uids or #uids == 0 then
  83. return 1
  84. end
  85. if not ManagerContainer.DataMgr.GuildDataMgr:SendGetGuildMemberInfoReq(self:GetId(), uids) then
  86. return 100007
  87. end
  88. return 0
  89. end
  90. function UIGuildInfoCtr:SendSubmitApplyReq()
  91. if not ManagerContainer.DataMgr.GuildDataMgr:SendGuildApplyReq(self:GetId(), true) then
  92. return 100007
  93. end
  94. return 0
  95. end
  96. function UIGuildInfoCtr:SendCancelApplyReq()
  97. if not ManagerContainer.DataMgr.GuildDataMgr:SendGuildApplyReq(self:GetId(), false) then
  98. return 100007
  99. end
  100. return 0
  101. end
  102. return UIGuildInfoCtr