UIPlayerInfoController.lua 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. ---@class UIPlayerInfoController
  2. ---@field isHideAllSystemFunction boolean @是否隐藏所有系统功能
  3. UIPlayerInfoController = class()
  4. local this = UIPlayerInfoController
  5. --Begin以下部分为编辑器自动生成,不要修改,预制改了可以重新生成
  6. --End上面部分为编辑器自动生成,不要修改,预制改了可以重新生成
  7. function this.Init()
  8. this.eventContainer = EventContainer(EventManager)
  9. this.RegisterEvent()
  10. this.isHideAllSystemFunction = false
  11. this.hpProgressType = EHpProgressType.Number
  12. this.isHideTeamPanel = false
  13. this.isHideTaskPanel = false
  14. this.isFindRoadRideMount = false
  15. this.curRideMount = -1
  16. this.popoverDatas = {}
  17. this.BlockedFunctionList = {}
  18. this.systemFunction = {}
  19. this.isExpandSystemFunction = false
  20. end
  21. ---@return void @数据清理
  22. function this.Reset()
  23. this.ClearFreeBuffAdd()
  24. this.isHideTeamPanel = false
  25. this.isHideTaskPanel = false
  26. this.isFindRoadRideMount = false
  27. this.curRideMount = -1
  28. this.popoverDatas = {}
  29. this.BlockedFunctionList = {}
  30. this.isExpandSystemFunction = false
  31. end
  32. function this.RegisterEvent()
  33. this.eventContainer:Regist(Event.OpenSystemFunction, this.OpenSystemFunction)
  34. end
  35. function this.ClearFreeBuffAdd()
  36. this.freeBuffAdd = nil
  37. this.freeInfo = nil
  38. end
  39. ---@param message BufferProtos.FreeBuffRes
  40. function this.RefreshFreeBuffAdd(message)
  41. if not this.freeBuffAdd then
  42. this.freeBuffAdd = {}
  43. this.freeInfo = {}
  44. end
  45. table.clear(this.freeBuffAdd)
  46. end
  47. ---@param type EFreeBuffAddType
  48. ---@param message BufferProtos.FreeBuff
  49. function this.AddFreeBuffData(name, valueList, panel, showType, message)
  50. local value
  51. if type(valueList) == "table" then
  52. value = #valueList >= 1 and valueList[1] or 0
  53. else
  54. value = valueList
  55. end
  56. local data = {
  57. name = name,
  58. value = value,
  59. panel = panel,
  60. showType = showType,
  61. message = message,
  62. }
  63. this.freeBuffAdd[message.cfgId] = data
  64. end
  65. ---是否隐藏所有系统功能
  66. function this.SetIsHideAllSystemFunction(isHideAllSystemFunction)
  67. this.isHideAllSystemFunction = isHideAllSystemFunction
  68. end
  69. function this.ReviseHpProgressType(hpProgressType)
  70. this.hpProgressType = tonumber(hpProgressType)
  71. end
  72. function this.SetIsHideTeamPanel(isHide)
  73. this.isHideTeamPanel = isHide
  74. end
  75. function this.SetIsHideTaskPanel(isHide)
  76. this.isHideTaskPanel = isHide
  77. end
  78. ---寻路自动自动骑乘坐骑
  79. function this.SetIsFindRoadRideMount(isRide)
  80. this.isFindRoadRideMount = isRide
  81. end
  82. ---寻路自动自动骑乘坐骑
  83. function this.SetCurRideMount(mountId)
  84. this.curRideMount = mountId
  85. end
  86. ---设置气泡数据
  87. function this.SetPopoverData(data)
  88. local id = data[2]
  89. if not this.popoverDatas[id] then
  90. this.popoverDatas[id] = {}
  91. end
  92. this.popoverDatas[id].id = id
  93. if data.Length >= 3 then
  94. this.popoverDatas[id].icon = data[3]
  95. else
  96. this.popoverDatas[id].icon = "common"
  97. end
  98. if data.Length >= 4 then
  99. this.popoverDatas[id].disappeartype = tonumber(data[4])
  100. else
  101. this.popoverDatas[id].disappeartype = 0
  102. end
  103. if data.Length >= 5 then
  104. this.popoverDatas[id].disappeartype2 = tonumber(data[5])
  105. else
  106. this.popoverDatas[id].disappeartype2 = 0
  107. end
  108. this.popoverDatas[id].isKml = true
  109. EventManager.Dispatch(Event.SetPopoverData, this.popoverDatas[id])
  110. end
  111. ---关闭气泡
  112. function this.ClosePopover(data)
  113. local id = data[2]
  114. this.popoverDatas[id] = nil
  115. EventManager.Dispatch(Event.ClosePopover, id)
  116. end
  117. ---设置屏蔽的功能
  118. function this.SetBlockedFunction(param)
  119. for i = 2, param.Length - 1 do
  120. local systemName = param[i]
  121. this.BlockedFunctionList[systemName] = true
  122. end
  123. end
  124. ---设置屏蔽的功能
  125. function this.KLSetBlockedFunction(param)
  126. for i = 2, #param - 1 do
  127. local systemName = param[i]
  128. this.BlockedFunctionList[systemName] = true
  129. end
  130. end
  131. ---开启系统功能界面
  132. function this.OpenSystemFunction(id, data)
  133. if this.systemFunction[data] then
  134. this.systemFunction[data]()
  135. end
  136. end
  137. ---展开系统功能
  138. function this.ExpandSystemFunction(isExpand)
  139. this.isExpandSystemFunction = isExpand
  140. if isExpand then
  141. -- GUI:UIPanel_Close("dev/ui/MainUI/Panel/KLMainAttack/KLMainAttackPanel")
  142. this.isExpandSystemFunction = true
  143. else
  144. this.isExpandSystemFunction = false
  145. -- GUI:UIPanel_Open("dev/ui/MainUI/Panel/KLMainAttack/KLMainAttackPanel")
  146. end
  147. end
  148. return this