KLUIPlayerInfoPanel.lua 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958
  1. ---@class KLUIPlayerInfoPanel:UIKmlLuaPanelBase
  2. ---@field view KLUIPlayerInfoPanelView
  3. ---@field exprienceTmeplateList table
  4. ---@field buffInfoTemplateList table
  5. ---@field KLUIBuffInfoListPanel KLUIBuffInfoListPanel
  6. local KLUIPlayerInfoPanel = class(UIKmlLuaPanelBase)
  7. ---创建时调用一次
  8. function KLUIPlayerInfoPanel:Init()
  9. local _, rootMinY = GUI:GetOffsetMin(self.view.root)
  10. local _, rootMaxY = GUI:GetOffsetMax(self.view.root)
  11. local _, sliderMinY = GUI:GetOffsetMin(self.view.sliderExperience)
  12. local _, sliderMaxY = GUI:GetOffsetMax(self.view.sliderExperience)
  13. local _, leftBgMinY = GUI:GetOffsetMin(self.view.leftBg)
  14. local _, leftBgMaxY = GUI:GetOffsetMax(self.view.leftBg)
  15. GUI:SetOffsetMin(self.view.root,0,rootMinY)
  16. GUI:SetOffsetMax(self.view.root,0,rootMaxY)
  17. GUI:SetOffsetMin(self.view.sliderExperience,0,sliderMinY)
  18. GUI:SetOffsetMax(self.view.sliderExperience,0,sliderMaxY)
  19. GUI:SetOffsetMin(self.view.leftBg,0,leftBgMinY)
  20. GUI:SetOffsetMax(self.view.leftBg,0,leftBgMaxY)
  21. self.experienceTemplateList = {}
  22. self.buffInfoTemplateList = {}
  23. self.buffInfoList = {}
  24. self.freeBuffInfo = {}
  25. self.pkModeTemplateList = {}
  26. -- local tbl = SL:GetConfigTable("cfg_free_buff")
  27. if false then
  28. ---@param v cfg_free_buff_column
  29. for i, v in pairs(tbl) do
  30. if v.showType == 1 then
  31. self.freeBuffInfo[v.id] = v
  32. end
  33. end
  34. end
  35. self.level = SL:GetMetaValue("LEVEL")
  36. self:RefreshFastItem()
  37. self.expEffects = TablePool()
  38. end
  39. ---创建或者刷新界面数据时调用
  40. function KLUIPlayerInfoPanel:Refresh()
  41. self:Clear()
  42. self:RefreshPlayerHp()
  43. self:RefreshPlayerMp()
  44. self:RefreshPlayerLevel()
  45. self:RefreshExperienceAdd()
  46. self:RefreshShield()
  47. --self:RefreshAgsto()
  48. self:InitPKMode()
  49. self:RefreshComboSkillValue()
  50. self:RefreshTotalExpGain()
  51. local power = SL:GetMetaValue(EMetaVarGetKey.BATTERY)
  52. GUI:SetLoadingbar_startper(self.view.sliderPower, power)
  53. self.timer = SL:Schedule(self.timer,0, 30, -1, function()
  54. local power = SL:GetMetaValue(EMetaVarGetKey.BATTERY)
  55. GUI:SetLoadingbar_startper(self.view.sliderPower, power)
  56. end)
  57. --[[ self.MonthTime = SL:Schedule(self.MonthTime,0, 1, -1, function()
  58. if InfoManager.monthCardInfo:IsHaveDayTime() then
  59. ---小于1天 大于0时才显示
  60. GUI:SetActive(self.view.MonthCardBtn, true)
  61. else
  62. GUI:SetActive(self.view.MonthCardBtn, false)
  63. end
  64. end)
  65. local index = 1
  66. self.UIWeekTime = SL:Schedule(self.UIWeekTime,0, 0.2, -1, function()
  67. if InfoManager.monthCardInfo:IsHaveDayTime() then
  68. ---闪烁
  69. if index <= 0.2 then
  70. index = 1
  71. end
  72. index = index - 0.15
  73. GUI:SetImageAlpha(self.view.MonthCardBtn, 1, 1, 1, index)
  74. end
  75. end)]]
  76. end
  77. ---注册UI事件和服务器消息
  78. function KLUIPlayerInfoPanel:RegistEvents()
  79. SL:RegisterLUAEvent(LUA_EVENT_LEVELCHANGE, self.LUA_EVENT_LEVELCHANGE, self)--主角等级改变事件
  80. SL:RegisterLUAEvent(LUA_EVENT_EXPCHANGE, self.OnExpUpdate, self)--主角经验改变事件
  81. SL:RegisterLUAEvent(LUA_EVENT_HPCHANGE, self.RefreshPlayerHp, self)--主角血量改变事件
  82. SL:RegisterLUAEvent(LUA_EVENT_SHIELDCHANGE, self.RefreshShield, self)--主角护盾值改变事件
  83. SL:RegisterLUAEvent(LUA_EVENT_MPCHANGE, self.RefreshPlayerMp, self)--主角蓝量改变事件
  84. SL:RegisterLUAEvent(LUA_EVENT_AGSTOCHANGE, self.RefreshAgsto, self)--主角技能值改变事件
  85. SL:RegisterLUAEvent(LUA_EVENT_BUFFCHANHE, self.RefreshBuff, self)--主角buff改变事件
  86. --SL:RegisterLUAEvent(LUA_EVENT_FREEBUFFCHANHE, self.RefreshFreeBuff, self)--主角免费buff改变事件
  87. SL:RegisterLUAEvent(LUA_EVENT_PKMODE_CHANGE, self.LUA_EVENT_PKMODE_CHANGE, self)
  88. SL:RegisterLUAEvent(LUA_EVENT_SWITCH_PKMODE, self.LUA_EVENT_SWITCH_PKMODE, self)
  89. SL:RegisterLUAEvent(LUA_EVENT_CROSS_SERVER_PK_MODE, self.LUA_EVENT_CROSS_SERVER_PK_MODE, self)
  90. SL:RegisterLUAEvent(LUA_EVENT_COMBOSKILL_PROGRESS, self.LUA_EVENT_COMBOSKILL_PROGRESS, self)
  91. SL:RegisterLUAEvent(LUA_EVENT_INIT_SHORT_CUT, self.InitShortcutAfter, self)
  92. SL:RegisterLUAEvent(LUA_EVENT_SELECT_ROLE, self.SelectAttackRole, self)
  93. SL:RegisterLUAEvent(LUA_EVENT_RESET_ATTACK_ROLE, self.ResetAttackRole, self)
  94. SL:RegisterLUAEvent(LUA_EVENT_PRIVILEGE_INFO_CHANGE, self.LUA_EVENT_PRIVILEGE_INFO_CHANGE, self)
  95. SL:RegisterLUAEvent(LUA_EVENT_EXPERIENCE_ADD_CHANGE, self.LUA_EVENT_EXPERIENCE_ADD_CHANGE, self)
  96. SL:RegisterLUAEvent(LUA_EVENT_MAIN_PLAYER_DIE, self.LUA_EVENT_MAIN_PLAYER_DIE, self)
  97. SL:RegisterLuaNetMsg(MessageDef.ResBagChangeMessage, self.ResBagChangeMessage,self)
  98. SL:RegisterLUAEvent(Event.BagInfo_Change, self.BagInfo_Change, self)
  99. SL:RegisterLUAEvent(LUA_EVENT_CLOSEWIN, self.LUA_EVENT_CLOSEWIN, self)
  100. GUI:AddOnClickEvent(self.view.buffMenufoldBtn, self, self.OnClickBuffMenufoldBtn)
  101. GUI:AddOnClickEvent(self.view.buffMenuexpandBtn, self, self.OnClickBuffMenuexpandBtn)
  102. GUI:AddOnClickEvent(self.view.atkModelMenuBtn, self, self.OnClickAtkModelMenuToggle)
  103. GUI:AddOnClickEvent(self.view.experienceMenufoldBtn, self, self.OnClickexperienceMenufoldBtn)
  104. GUI:AddOnClickEvent(self.view.experienceMenuexpandBtn, self, self.OnClickexperienceMenuexpandBtn)
  105. GUI:AddOnClickEvent(self.view.sliderSd, self, self.OnClickSdBtn)
  106. GUI:AddOnClickEvent(self.view.sliderShield, self, self.OnClickShieldBtn)
  107. GUI:AddOnClickEvent(self.view.experienceList, self, self.OnClickexperienceMenufoldBtn)
  108. --GUI:AddOnClickEvent(self.view.MonthCardBtn, self, self.MonthCardBtn)
  109. end
  110. --[[function KLUIPlayerInfoPanel:MonthCardBtn()
  111. local desc = "您的月卡剩余时间小于24小时,交易行交易税将\n提升至20%,是否购买增加月卡时间?"
  112. GUI:UIPanel_Open("dev/ui/Common/Panel/KLUICommonTips/KLUICommonTipsPanel", nil, nil,
  113. { showTips = desc,
  114. callback = self.btnCall, callbackData = nil, ui = self })
  115. end]]
  116. function KLUIPlayerInfoPanel:btnCall(callbackData)
  117. GUI:UIPanel_Open("dev/outui/MonthCard/Panel/KLUIMonthCardMain/KLUIMonthCardMainPanel")
  118. end
  119. function KLUIPlayerInfoPanel:RefreshFastItem()
  120. local fastItemList = SL:GetMetaValue(EMetaVarGetKey.FAST_ITEM_ID_LIST)
  121. self.fastData = table.copyFrom({},fastItemList)
  122. if not SL:HasConfig("cfg_item",self.fastData[1]) then
  123. self.fastData[1] = 30010022
  124. end
  125. if not SL:HasConfig("cfg_item",self.fastData[2]) then
  126. self.fastData[2] = 30010011
  127. end
  128. self.fastData_all_item = {}
  129. GUI:DataListInitData(self.view.fast_data_list, function()
  130. return self:FastDataListItemCountFunc()
  131. end, function(realIndex)
  132. return self:FastDataListItemGetFunc(realIndex)
  133. end, function(realIndex, kmlcontrol)
  134. return self:FastDataListItemInitFunc(realIndex, kmlcontrol)
  135. end, function(realIndex, kmlcontrol)
  136. return self:FastDataListItemUpdateFunc(realIndex, kmlcontrol)
  137. end)
  138. GUI:DataListUpdateData(self.view.fast_data_list)
  139. end
  140. --经验值变化回调
  141. function KLUIPlayerInfoPanel:OnExpUpdate()
  142. self:RefreshPlayerLevel()
  143. if self.effectTimer then
  144. SL:UnSchedule(self.effectTimer)
  145. self.effectTimer = nil
  146. end
  147. self.effectTimer = SL:ScheduleOnce(0.5, function()
  148. local x,y,z = GUI:GetWorldPosition(self.view.sliderExperience_ballEndPos)
  149. local effect = self:GetExpBallEffect()
  150. SL:UIEffectDoMove(effect, Vector3.New(x,y,z), 0.8, function()
  151. if not IsNil(effect.modelParent) then
  152. effect.modelParent:SetActive(false)
  153. self.expEffects:Push(effect)
  154. end
  155. end)
  156. end)
  157. end
  158. function KLUIPlayerInfoPanel:LUA_EVENT_LEVELCHANGE()
  159. self:RefreshPlayerLevel()
  160. self:RefreshExperienceAdd()
  161. end
  162. --刷新等级
  163. ---@param data RoleChangeData
  164. function KLUIPlayerInfoPanel:RefreshPlayerLevel(data)
  165. local tbl = SL:GetConfig("cfg_global", 10000, "id")
  166. local level = SL:GetMetaValue("LEVEL")
  167. if tbl and self.level ~= level and level == tonumber(tbl.value) then
  168. GUI:DataListUpdateData(self.view.fast_data_list)
  169. end
  170. self:OnClickexperienceMenufoldBtn()
  171. self:RefreshPlayerExp()
  172. end
  173. --刷新经验加成
  174. function KLUIPlayerInfoPanel:RefreshExperienceAdd()
  175. local expriencePercent = 0
  176. local freeBuffList = InfoManager.mainUIInfo.experienceAddInfoList
  177. local t = table.copyFrom({},freeBuffList)
  178. table.sort(t,function(a, b)
  179. if a.type > b.type then
  180. return true
  181. end
  182. return false
  183. end)
  184. local level = SL:GetMetaValue("LEVEL")
  185. for i, v in pairs(t) do
  186. if v.needLevel <= level then
  187. ---@type KLUIExperienceItem
  188. local exprienceTmeplate = self.experienceTemplateList[v.type]
  189. if not exprienceTmeplate then
  190. exprienceTmeplate = GUI:UIPanel_Open("dev/ui/MainUI/Item/KLUIExperience/KLUIExperienceItem", self.view.experience_list, self, v, true)
  191. self.experienceTemplateList[v.type] = exprienceTmeplate
  192. else
  193. exprienceTmeplate.args = v
  194. exprienceTmeplate:Refresh()
  195. end
  196. if v.endTime > Time.GetServerTime() or v.endTime <=0 then
  197. expriencePercent = expriencePercent + v.exp
  198. end
  199. if v.endTime > Time.GetServerTime() then
  200. self:UpdateBuff(0,v)
  201. else
  202. self:UpdateBuff(1,v)
  203. end
  204. if v.lastCfgId ~= 0 and v.lastCfgId ~= v.cfgId then
  205. self:UpdateBuff(1,{cfgId =v.lastCfgId})
  206. if InfoManager.mainUIInfo.experienceAddInfoList[v.type] then
  207. InfoManager.mainUIInfo.experienceAddInfoList[v.type].lastCfgId = 0
  208. end
  209. end
  210. end
  211. end
  212. GUI:setVisible(self.view.arrow1, #self.experienceTemplateList > 0)
  213. GUI:Text_setString(self.view.allExperienceTxt, expriencePercent .. "%")
  214. end
  215. --刷新经验条
  216. function KLUIPlayerInfoPanel:RefreshPlayerExp()
  217. ---@type MeData
  218. local level = SL:GetMetaValue("LEVEL")
  219. local name = SL:GetCurServerName()
  220. local exp = SL:GetMetaValue("EXP")
  221. local expandExp = SL:GetMetaValue("EXPANDEXP")
  222. local lvTbl = SL:GetConfig("cfg_level", level, "id")
  223. local precent = (exp + expandExp) / lvTbl.exp
  224. local str = string.format("%.2f", precent * 100)
  225. local percent_ = precent
  226. if precent >= 1 then
  227. str = 100.0
  228. percent_ = 1
  229. end
  230. if Mathf.IsNan(percent_) then
  231. percent_ = 1
  232. end
  233. if SL:HasConfig("cfg_level", level + 1, "id") then
  234. str = " <color=#BCB9B9>" .. str .. "%</color> "
  235. else
  236. str = " "
  237. precent = 1
  238. end
  239. precent = math.floor(precent * 100)
  240. GUI:Text_setString(self.view.level, "等级" .. level .. str .. "<color=#FFFFFF>[" .. name .. "]</color>")
  241. GUI:SetLoadingbar_startper(self.view.sliderExperience, precent)
  242. --设置经验球飞行的终点坐标
  243. local width = SL:GetMetaValue(EMetaVarGetKey.SCREEN_WIDTH)
  244. local endX = width * percent_
  245. local pos = GUI:GetAnchoredPosition(self.view.sliderExperience_ballEndPos)
  246. pos.x = endX
  247. --self.view.sliderExperience_ballEndPos.rectTransform.anchoredPosition = pos
  248. GUI:SetAnchoredPosition(self.view.sliderExperience_ballEndPos, pos)
  249. end
  250. --刷新血条
  251. ---@param data RoleChangeData
  252. function KLUIPlayerInfoPanel:RefreshPlayerHp(data)
  253. ---@type MeData
  254. local hp = SL:GetMetaValue("HP")
  255. local maxHp = SL:GetMetaValue("MAXHP")
  256. local precent = hp / maxHp
  257. precent = math.floor(precent * 100)
  258. GUI:Text_setString(self.view.hpTxt, tostring(hp))
  259. GUI:SetLoadingbar_startper(self.view.sliderHp, precent)
  260. end
  261. --刷新蓝条
  262. ---@param data RoleChangeData
  263. function KLUIPlayerInfoPanel:RefreshPlayerMp(data)
  264. ---@type MeData
  265. local mp = SL:GetMetaValue("MP")
  266. local maxMp = SL:GetMetaValue("MAXMP")
  267. local precent = mp / maxMp
  268. precent = math.floor(precent * 100)
  269. GUI:Text_setString(self.view.mpTxt, tostring(mp))
  270. GUI:SetLoadingbar_startper(self.view.sliderMp, precent)
  271. end
  272. --刷新护盾值
  273. ---@param data RoleChangeData
  274. function KLUIPlayerInfoPanel:RefreshShield(data)
  275. ---@type MeData
  276. local shield = SL:GetMetaValue("SHIELD")
  277. local maxShield = SL:GetMetaValue("MAXSHIELD")
  278. if maxShield ~= 0 then
  279. local precent = shield / maxShield
  280. precent = math.floor(precent * 100)
  281. GUI:Text_setString(self.view.sdTxt, tostring(shield))
  282. GUI:SetLoadingbar_startper(self.view.sliderSd, precent)
  283. end
  284. GUI:setVisible(self.view.sdContainer, maxShield ~= 0)
  285. end
  286. --刷新技能值
  287. ---@param data RoleChangeData
  288. function KLUIPlayerInfoPanel:RefreshAgsto(data)
  289. ---@type MeData
  290. local agsto = SL:GetMetaValue("AGSTO")
  291. local maxAgsto = SL:GetMetaValue("MAXAGSTO")
  292. if maxAgsto ~= 0 then
  293. local precent = agsto / maxAgsto
  294. precent = math.floor(precent * 100)
  295. GUI:Text_setString(self.view.shieldTxt, tostring(agsto))
  296. GUI:SetLoadingbar_startper(self.view.sliderShield, precent)
  297. end
  298. GUI:setVisible(self.view.shieldContainer, maxAgsto ~= 0)
  299. end
  300. --刷新buff
  301. ---@param eventId number
  302. ---@param eventData BuffChangeData
  303. function KLUIPlayerInfoPanel:RefreshBuff(eventId, eventData)
  304. if not eventData then
  305. return
  306. end
  307. local rid = SL:GetMetaValue("MAIN_ACTOR_ID")
  308. if eventData.roleId and rid ~= tostring(eventData.roleId) then
  309. return
  310. end
  311. --0:Add 1:Remove 2:Update
  312. if string.isNullOrEmpty(eventData.buff.buffTbl.showIcon) then
  313. -- 图标为空不显示
  314. return
  315. end
  316. self:UpdateBuff(eventData.updateType,{cfgId = eventData.buff.cfgId,endTime = eventData.buff.endTime,buffText=eventData.buff.buffText,bufferLayer = eventData.buff.layers})
  317. end
  318. function KLUIPlayerInfoPanel:UpdateBuff(updateType,data)
  319. if updateType == 0 and table.count(self.buffInfoTemplateList) < 4 then
  320. --添加
  321. self:AddOrRemoveBuff(data,true)
  322. ---@type KLBuffInfoItem
  323. local buffInfoTemplateItem = self.buffInfoTemplateList[data.cfgId]
  324. if not buffInfoTemplateItem then
  325. buffInfoTemplateItem = GUI:UIPanel_Open("dev/ui/MainUI/Item/KLBuffInfo/KLBuffInfoItem", self.view.buffs_list, self, data, true)
  326. self.buffInfoTemplateList[data.cfgId] = buffInfoTemplateItem
  327. else
  328. buffInfoTemplateItem.args = data
  329. buffInfoTemplateItem:Refresh()
  330. end
  331. elseif updateType == 1 then
  332. --移除
  333. ---@type KLBuffInfoItem
  334. local buffInfoTemplateItem = self.buffInfoTemplateList[data.cfgId]
  335. if buffInfoTemplateItem then
  336. GUI:UIPanel_Close(nil, buffInfoTemplateItem)
  337. end
  338. self.buffInfoTemplateList[data.cfgId] = nil
  339. self:AddOrRemoveBuff(data,false)
  340. --有移除的后要把原来隐藏的buff显示出来
  341. for i, v in ipairs(self.buffInfoList) do
  342. if not self.buffInfoTemplateList[v.cfgId] and table.count(self.buffInfoTemplateList) < 4 then
  343. buffInfoTemplateItem = GUI:UIPanel_Open("dev/ui/MainUI/Item/KLBuffInfo/KLBuffInfoItem", self.view.buffs_list, self, v, true)
  344. self.buffInfoTemplateList[v.cfgId] = buffInfoTemplateItem
  345. end
  346. end
  347. elseif updateType == 2 then
  348. --更新
  349. ---@type KLBuffInfoItem
  350. local buffInfoTemplateItem = self.buffInfoTemplateList[data.cfgId]
  351. if buffInfoTemplateItem then
  352. buffInfoTemplateItem.args = data
  353. buffInfoTemplateItem:Refresh()
  354. end
  355. self:AddOrRemoveBuff(data,true)
  356. end
  357. if table.count(self.buffInfoTemplateList) >= 4 then
  358. GUI:setVisible(self.view.buffMenuBtn, true)
  359. if data.cfgId ~= 0 and updateType == 0 then
  360. self:AddOrRemoveBuff(data,true)
  361. end
  362. else
  363. GUI:setVisible(self.view.buffMenuBtn, false)
  364. GUI:UIPanel_Close("dev/ui/MainUI/Panel/KLUIBuffInfoList/KLUIBuffInfoListPanel")
  365. end
  366. local panel = GUI:GetUI("dev/ui/MainUI/Panel/KLUIBuffInfoList/KLUIBuffInfoListPanel")
  367. if panel then
  368. panel.args = self.buffInfoList
  369. panel:Refresh()
  370. end
  371. end
  372. function KLUIPlayerInfoPanel:InitPKMode()
  373. local pkInfo = { 0,1,4,5,11,12}
  374. for i, pkMode in pairs(pkInfo) do
  375. local pkTemplateItem = GUI:UIPanel_Open("dev/ui/MainUI/Item/KLPk/KLPkItem", self.view.atkModelMenu, self, { pkMode = pkMode, pkName = EPKModeToUI_Out[pkMode] or "" }, true)
  376. table.insert(self.pkModeTemplateList, pkTemplateItem)
  377. end
  378. local pkMode = SL:GetMetaValue(EMetaVarGetKey.PKMODE)
  379. GUI:Button_setTitleText(self.view.atkModelname, EPKModeToUI_Out[pkMode] or "")
  380. self.expand = false
  381. GUI:setVisible(self.view.atkModelMenu,false)
  382. end
  383. ---刷新pk模式item显隐
  384. function KLUIPlayerInfoPanel:RefreshPKModeItem()
  385. ---显示的pk模式(是当前模式则不显示其他pk模式)
  386. local showPkModeList = {0,1,4,5}
  387. local pkMode = SL:GetMetaValue(EMetaVarGetKey.PKMODE)
  388. --罗兰攻城战
  389. if pkMode == EPKMode.Attack or pkMode == EPKMode.Defend then
  390. showPkModeList =
  391. {
  392. EPKMode.Attack,
  393. EPKMode.Defend,
  394. }
  395. end
  396. for i, v in ipairs(self.pkModeTemplateList) do
  397. local isShow = false
  398. local itemPkMode = v.args.pkMode
  399. if table.contains(showPkModeList,itemPkMode) then
  400. isShow = true
  401. end
  402. GUI:setVisible(v.view.root,isShow)
  403. end
  404. end
  405. function KLUIPlayerInfoPanel:LUA_EVENT_PKMODE_CHANGE(_, pkMode)
  406. GUI:Button_setTitleText(self.view.atkModelname, EPKModeToUI_Out[pkMode] or "")
  407. end
  408. function KLUIPlayerInfoPanel:LUA_EVENT_SWITCH_PKMODE(_, pkMode)
  409. self.expand = not self.expand
  410. GUI:setVisible(self.view.atkModelMenu, self.expand)
  411. local curr_pkMode = SL:GetMetaValue(EMetaVarGetKey.PKMODE)
  412. if curr_pkMode == EPKMode.Camp then
  413. SL:TipMessage("当前地图无法切换pk模式", 1, NoticeType.NoticeMid)
  414. return
  415. end
  416. if GlobalLuaEventManager.isCrossServer and GlobalLuaEventManager.isCrossServer == 1 then
  417. if not SL:MeData_GetUnionId() or SL:MeData_GetUnionId() == 0 then
  418. if pkMode ~= 0 then
  419. SL:TipMessage("当前地图无法切换pk模式", 1, NoticeType.NoticeMid)
  420. return
  421. end
  422. else
  423. if pkMode ~= 5 then
  424. SL:TipMessage("当前地图无法切换pk模式", 1, NoticeType.NoticeMid)
  425. return
  426. end
  427. end
  428. end
  429. local tip = SL:GetMetaValue(EMetaVarGetKey.PKMODE_CAN_USE, pkMode)
  430. if not string.isNullOrEmpty(tip) then
  431. SL:TipMessage(tip, 1, NoticeType.NoticeMid)
  432. return
  433. end
  434. SL:SetMetaValue(EMetaVarSetKey.SET_PKMODE, pkMode)
  435. end
  436. function KLUIPlayerInfoPanel:LUA_EVENT_CROSS_SERVER_PK_MODE(_, pkMode)
  437. self:RefreshPKModeItem()
  438. self.expand = false
  439. GUI:setVisible(self.view.atkModelMenu, self.expand)
  440. --SL:SetMetaValue(EMetaVarSetKey.SET_PKMODE, pkMode)
  441. end
  442. function KLUIPlayerInfoPanel:RefreshComboSkillValue()
  443. local comboSkillId = SL:GetComboSkillId()
  444. if comboSkillId and comboSkillId > 0 then
  445. --RoleManager.me.skillEngine.skillCombo:SetSkillAutoReleaseSwitch(true)
  446. SL:Skill_SetSkillAutoReleaseSwitch(true)
  447. end
  448. self:LUA_EVENT_COMBOSKILL_PROGRESS(_, 0)
  449. end
  450. function KLUIPlayerInfoPanel:RefreshTotalExpGain()
  451. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_GET_MONTH_PRIVILEGE_DATA)
  452. SL:SendLuaNetMsg(LuaMessageIdToSever.TRIPLE_INCOME_PANEL)
  453. end
  454. ---@param comboValue number -2,隐藏 -1,显示0 其他,正常显示
  455. function KLUIPlayerInfoPanel:LUA_EVENT_COMBOSKILL_PROGRESS(_, comboValue)
  456. local value, _ = math.modf(comboValue)
  457. if value >= 100 then
  458. value = 100
  459. end
  460. GUI:Text_setString(self.view.shieldTxt, tostring(value) .. "%")
  461. GUI:SetLoadingbar_startper(self.view.sliderShield, value)
  462. self.comboValue = value
  463. SL:onLUAEvent(LUA_EVENT_COMBOVALUE_CHANGE, value)
  464. end
  465. function KLUIPlayerInfoPanel:OnClickBuffMenufoldBtn()
  466. GUI:setVisible(self.view.buffMenufoldBtn, false)
  467. GUI:setVisible(self.view.buffMenuexpandBtn, true)
  468. local panel = GUI:GetUI("dev/ui/MainUI/Panel/KLUIBuffInfoList/KLUIBuffInfoListPanel")
  469. if not panel then
  470. panel = GUI:UIPanel_Open("dev/ui/MainUI/Panel/KLUIBuffInfoList/KLUIBuffInfoListPanel", nil, nil, self.buffInfoList)
  471. else
  472. panel.args = self.buffInfoList
  473. panel:Refresh()
  474. end
  475. end
  476. function KLUIPlayerInfoPanel:OnClickBuffMenuexpandBtn()
  477. GUI:setVisible(self.view.buffMenufoldBtn, true)
  478. GUI:setVisible(self.view.buffMenuexpandBtn, false)
  479. GUI:UIPanel_Close("dev/ui/MainUI/Panel/KLUIBuffInfoList/KLUIBuffInfoListPanel")
  480. end
  481. function KLUIPlayerInfoPanel:OnClickAtkModelMenuToggle()
  482. self:RefreshPKModeItem()
  483. self.expand = not self.expand
  484. GUI:setVisible(self.view.atkModelMenu, self.expand)
  485. end
  486. function KLUIPlayerInfoPanel:OnClickexperienceMenufoldBtn()
  487. GUI:setVisible(self.view.experienceList, false)
  488. GUI:setVisible(self.view.experienceMenuexpandBtn, true)
  489. GUI:setVisible(self.view.experienceMenufoldBtn, false)
  490. GUI:setRotation(self.view.arrow1, 0)
  491. end
  492. function KLUIPlayerInfoPanel:OnClickexperienceMenuexpandBtn()
  493. GUI:setVisible(self.view.experienceList, true)
  494. GUI:setVisible(self.view.experienceMenuexpandBtn, false)
  495. GUI:setVisible(self.view.experienceMenufoldBtn, true)
  496. GUI:setRotation(self.view.arrow1, 180)
  497. end
  498. function KLUIPlayerInfoPanel:OnClickSdBtn()
  499. local shield = SL:GetMetaValue("SHIELD")
  500. local maxShield = SL:GetMetaValue("MAXSHIELD")
  501. local des = "SD防护值 <color=#1ADD2FFF>" .. shield .. "/" .. maxShield .. "</color>\nPVP时受到的伤害,该伤害值以SD90%,血量10%的比例损耗\n若伤害值大于SD损耗,则剩余伤害仍从血量损耗\nSD最大值受人物等级和防御力影响"
  502. GUI:UIPanel_Open("dev/ui/MainUI/Panel/KLSDTip/KLSDTipPanel", nil, nil, { content = des, y = -237, width = 395, height = 90 })
  503. end
  504. function KLUIPlayerInfoPanel:OnClickShieldBtn()
  505. --local agsto = SL:GetMetaValue("AGSTO")
  506. --local maxAgsto = SL:GetMetaValue("MAXAGSTO")
  507. if not self.comboValue then
  508. self.comboValue = 0
  509. end
  510. local des = "连击技 <color=#1ADD2FFF>" .. self.comboValue .. "</color>%\n连击技会对周围目标造成伤害,且对主目标额外造成大量伤害\n连击能量达到100%后会自动施放连击技"
  511. GUI:UIPanel_Open("dev/ui/MainUI/Panel/KLSDTip/KLSDTipPanel", nil, nil, { content = des, x = 330, y = -258, width = 390, height = 70 })
  512. end
  513. function KLUIPlayerInfoPanel:Close()
  514. if self.timer then
  515. SL:UnSchedule(self.timer)
  516. self.timer = nil
  517. end
  518. if self.effectTimer then
  519. SL:UnSchedule(self.effectTimer)
  520. self.effectTimer = nil
  521. end
  522. --[[ if self.MonthTime then
  523. SL:UnSchedule(self.MonthTime)
  524. self.MonthTime = nil
  525. end
  526. if self.UIWeekTime then
  527. SL:UnSchedule(self.UIWeekTime)
  528. self.UIWeekTime = nil
  529. end]]
  530. --GUI:SetImageAlpha(self.view.MonthCardBtn, 1, 1, 1, 1)
  531. end
  532. ---清除数据
  533. function KLUIPlayerInfoPanel:Clear()
  534. ---@param exprienceTmeplate KLUIExperienceItem
  535. for i, exprienceTmeplate in pairs(self.experienceTemplateList) do
  536. GUI:UIPanel_Close(nil, exprienceTmeplate)
  537. end
  538. self.experienceTemplateList = {}
  539. ---@param buffInfoTemplateItem KLBuffInfoItem
  540. for i, buffInfoTemplateItem in pairs(self.buffInfoTemplateList) do
  541. GUI:UIPanel_Close(nil, buffInfoTemplateItem)
  542. end
  543. self.buffInfoTemplateList = {}
  544. GUI:UIPanel_Close("dev/ui/MainUI/Panel/KLUIBuffInfoList/KLUIBuffInfoListPanel")
  545. table.clear(self.buffInfoList)
  546. ---@param pkModeTemplate KLPkItem
  547. for i, pkModeTemplate in pairs(self.pkModeTemplateList) do
  548. GUI:UIPanel_Close(nil, pkModeTemplate)
  549. end
  550. self.pkModeTemplateList = {}
  551. end
  552. function KLUIPlayerInfoPanel:FastDataListItemCountFunc()
  553. local count = #self.fastData
  554. local maxShield = SL:GetMetaValue("MAXSHIELD")
  555. local maxAgsto = SL:GetMetaValue("MAXAGSTO")
  556. if maxShield == 0 or maxAgsto == 0 then
  557. GUI:setPositionX(self.view.left,25)
  558. GUI:setPositionX(self.view.right,18)
  559. else
  560. count = count - 1
  561. GUI:setPositionX(self.view.left,36)
  562. GUI:setPositionX(self.view.right,-22)
  563. end
  564. --local w = count * 70
  565. --local w2 = math.floor((self.view.root.kmlControl.rectTransform.rect.width - w)/2)
  566. --GUI:setContentSize(self.view.leftBg, w2, 41)
  567. --GUI:setContentSize(self.view.rightBg, w2, 41)
  568. GUI:setContentSize(self.view.fast_grid, count * 70, 64)
  569. return count
  570. end
  571. function KLUIPlayerInfoPanel:FastDataListItemGetFunc(realIndex)
  572. local data = self.fastData[realIndex + 1]
  573. local message = { cfgId = data, itemIndex = realIndex + 1 }
  574. local item = GUI:UIPanel_Open("dev/ui/MainUI/Item/KLFast/KLFastItem", self.view.fast_data_list, self, message, true)
  575. self.fastData_all_item[item.view.root] = item
  576. return item.view.root
  577. end
  578. function KLUIPlayerInfoPanel:FastDataListItemInitFunc(realIndex, kmlcontrol)
  579. end
  580. function KLUIPlayerInfoPanel:FastDataListItemUpdateFunc(realIndex, kmlcontrol)
  581. local data = self.fastData[realIndex + 1]
  582. local message = { cfgId = data, itemIndex = realIndex + 1 }
  583. self.fastData_all_item[kmlcontrol]:RefreshItem(message)
  584. end
  585. function KLUIPlayerInfoPanel:InitShortcutAfter()
  586. local fastItemList = SL:GetMetaValue(EMetaVarGetKey.FAST_ITEM_ID_LIST)
  587. self.fastData = table.copyFrom({},fastItemList)
  588. if not SL:HasConfig("cfg_item",self.fastData[1]) then
  589. self.fastData[1] = 30010022
  590. end
  591. if not SL:HasConfig("cfg_item",self.fastData[2]) then
  592. self.fastData[2] = 30010011
  593. end
  594. GUI:DataListUpdateData(self.view.fast_data_list)
  595. end
  596. function KLUIPlayerInfoPanel:SelectAttackRole(_id, select_id)
  597. --logError("SelectAttackRole-----"..select_id)
  598. local is_open = false
  599. local is_player = SL:GetMetaValue(EMetaVarGetKey.ACTOR_IS_PLAYER, select_id)
  600. if is_player then
  601. is_open = true
  602. else
  603. local is_monster = SL:GetMetaValue(EMetaVarGetKey.ACTOR_IS_MONSTER, select_id)
  604. if is_monster then
  605. local role = SL:GetRoleById(select_id)
  606. local cfgId = role.data.serverData.cfgId
  607. is_open = SL:MonsterIsShowHP(cfgId)
  608. end
  609. end
  610. if InfoManager.redFortInfo.isEnter then
  611. is_open = false
  612. end
  613. if is_open then
  614. SL:OpenBossHp(select_id)
  615. else
  616. --SL:CloseBossHp()
  617. end
  618. end
  619. function KLUIPlayerInfoPanel:ResetAttackRole()
  620. SL:CloseBossHp()
  621. end
  622. function KLUIPlayerInfoPanel:LUA_EVENT_PRIVILEGE_INFO_CHANGE()
  623. -----特权收益
  624. --local exp = PrivilegeCardManager.GetExperienceUp()
  625. -----三倍收益
  626. --if PrivilegeCardManager.tripleEarningsInfo then
  627. -- if PrivilegeCardManager.tripleEarningsInfo.effectSec > 0 then
  628. -- exp = (100 + exp) * 3 - 100
  629. -- end
  630. --end
  631. --GUI:Text_setString(self.view.allExperienceTxt, exp .. "%")
  632. end
  633. function KLUIPlayerInfoPanel:LUA_EVENT_EXPERIENCE_ADD_CHANGE()
  634. self:RefreshExperienceAdd()
  635. end
  636. function KLUIPlayerInfoPanel:LUA_EVENT_MAIN_PLAYER_DIE()
  637. ---@param buffInfoTemplateItem KLBuffInfoItem
  638. for i, buffInfoTemplateItem in pairs(self.buffInfoTemplateList) do
  639. GUI:UIPanel_Close(nil, buffInfoTemplateItem)
  640. end
  641. self.buffInfoTemplateList = {}
  642. GUI:UIPanel_Close("dev/ui/MainUI/Panel/KLUIBuffInfoList/KLUIBuffInfoListPanel")
  643. table.clear(self.buffInfoList)
  644. end
  645. ---@return UIModel
  646. function KLUIPlayerInfoPanel:GetExpBallEffect()
  647. local effect = self.expEffects:Pop()
  648. if next(effect) == nil then
  649. local obj = GUI:GetGameObject(self.view.root)
  650. ---@type UIModelData
  651. local t = { id = 148, tableName = "cfg_model_effect", parent = obj,
  652. selfRotate = false, resetPosition = true, pos = { 0, 0, 0 }, scale = { 100, 100, 100 } }
  653. t.diffuseFlowing = SL:GmInfo_GetDiffuseFlowing()
  654. effect = SL:AddModelEffect(t)
  655. end
  656. effect.modelParent:SetActive(true)
  657. local pos = effect.modelParent.transform.anchoredPosition
  658. pos.x = 0
  659. local _,ly,_ = GUI:GetLocalPosition(self.view.root)
  660. pos.y = -ly
  661. effect.modelParent.transform.anchoredPosition = pos
  662. return effect
  663. end
  664. ---获得药品后快捷栏自动选择
  665. function KLUIPlayerInfoPanel:ResBagChangeMessage(id, message)
  666. if not message.itemList or #message.itemList <= 0 then
  667. return
  668. end
  669. ---@type number[]
  670. local fastItems = SL:GetMetaValue(EMetaVarGetKey.FAST_ITEM_ID_LIST)
  671. local fast_list = {}
  672. local hp_pill_itemId = 0
  673. local mp_pill_itemId = 0
  674. for i, v in ipairs(message.itemList) do
  675. if v.item and v.item.cfgId and v.item.count and v.item.count > 0 then
  676. ---@type cfg_item_column
  677. local tbl1 = SL:GetConfig("cfg_item",v.item.cfgId)
  678. if tbl1.isFast and tbl1.isFast == 1 then
  679. local isInsert = true
  680. --蓝药
  681. if tbl1.type==3 and tbl1.subType==1 and tbl1.id>=30010012 and tbl1.id<=30010022 then
  682. if not SL:HasConfig("cfg_item",fastItems[1]) then
  683. mp_pill_itemId = v.item.cfgId
  684. else
  685. local tbl2 = SL:GetConfig("cfg_item", fastItems[1])
  686. if tbl1.rank > tbl2.rank then
  687. mp_pill_itemId = v.item.cfgId
  688. end
  689. end
  690. isInsert = false
  691. end
  692. --血药
  693. if tbl1.type==3 and tbl1.subType==1 and tbl1.id>=30010001 and tbl1.id<=30010011 then
  694. if not SL:HasConfig("cfg_item",fastItems[2]) then
  695. hp_pill_itemId = v.item.cfgId
  696. else
  697. local tbl2 = SL:GetConfig("cfg_item", fastItems[2])
  698. if tbl1.rank > tbl2.rank then
  699. hp_pill_itemId = v.item.cfgId
  700. end
  701. end
  702. isInsert = false
  703. end
  704. if isInsert then
  705. table.insert(fast_list,{cfgId=v.item.cfgId,index=v.index,id=v.item.id,isJoin = 0})
  706. end
  707. end
  708. end
  709. end
  710. if #fast_list > 0 then
  711. local current_fast_list = {}
  712. for i=1,#self.fastData,1 do
  713. table.insert(current_fast_list,{cfgId=self.fastData[i],idx=i,is_new=false})
  714. end
  715. for i=1,#current_fast_list,1 do
  716. local current_cfgId = current_fast_list[i].cfgId
  717. if current_cfgId ~= 0 then
  718. local tbl1 = SL:GetConfig("cfg_item", current_cfgId)
  719. current_fast_list[i].Group = tbl1.Group
  720. current_fast_list[i].rank = tbl1.rank
  721. else
  722. current_fast_list[i].Group = 0
  723. current_fast_list[i].rank = 0
  724. end
  725. end
  726. table.sort(current_fast_list, function(a, b)
  727. if a.Group ~= b.Group then
  728. return a.Group < b.Group
  729. else
  730. return a.rank < b.rank
  731. end
  732. end)
  733. for i=1,#fast_list,1 do
  734. local current_cfgId = fast_list[i].cfgId
  735. local tbl1 = SL:GetConfig("cfg_item", current_cfgId)
  736. fast_list[i].Group = tbl1.Group
  737. fast_list[i].rank = tbl1.rank
  738. end
  739. table.sort(fast_list, function(a, b)
  740. if a.Group ~= b.Group then
  741. return a.Group < b.Group
  742. else
  743. return a.rank > b.rank
  744. end
  745. end)
  746. for i=1,#current_fast_list,1 do
  747. local current_cfgId = current_fast_list[i].cfgId
  748. if current_cfgId ~= 0 then
  749. for j=1,#fast_list,1 do
  750. local data = fast_list[j]
  751. if current_cfgId == data.cfgId then
  752. fast_list[j].isJoin = 2
  753. end
  754. end
  755. end
  756. end
  757. for i=1,#current_fast_list,1 do
  758. if not current_fast_list[i].is_new then
  759. local current_cfgId = current_fast_list[i].cfgId
  760. if current_cfgId ~= 0 then
  761. for j=1,#fast_list,1 do
  762. local data = fast_list[j]
  763. if data.isJoin == 0 and current_fast_list[i].Group == data.Group then
  764. if data.rank > current_fast_list[i].rank then
  765. current_fast_list[i].cfgId = data.cfgId
  766. current_fast_list[i].is_new = true
  767. fast_list[j].isJoin = 1
  768. break
  769. end
  770. end
  771. end
  772. end
  773. end
  774. end
  775. table.sort(current_fast_list, function(a, b)
  776. return a.idx < b.idx
  777. end)
  778. for i=1,#current_fast_list,1 do
  779. if not current_fast_list[i].is_new then
  780. local current_cfgId = current_fast_list[i].cfgId
  781. if current_cfgId == 0 then
  782. for j=1,#fast_list,1 do
  783. local data = fast_list[j]
  784. if data.isJoin == 0 then
  785. current_fast_list[i].cfgId = data.cfgId
  786. current_fast_list[i].is_new = true
  787. fast_list[j].isJoin = 1
  788. break
  789. end
  790. end
  791. end
  792. end
  793. end
  794. for i=1,#current_fast_list,1 do
  795. if current_fast_list[i].is_new and current_fast_list[i].idx >2 then
  796. SL:SetMetaValue(EMetaVarGetKey.FAST_ITEM_ID_LIST, current_fast_list[i].idx, current_fast_list[i].cfgId, 0)
  797. end
  798. end
  799. end
  800. if mp_pill_itemId ~= 0 then
  801. SL:SetMetaValue(EMetaVarGetKey.FAST_ITEM_ID_LIST, 1, mp_pill_itemId, 0)
  802. end
  803. if hp_pill_itemId ~= 0 then
  804. SL:SetMetaValue(EMetaVarGetKey.FAST_ITEM_ID_LIST, 2, hp_pill_itemId, 0)
  805. end
  806. end
  807. function KLUIPlayerInfoPanel:BagInfo_Change(id,message)
  808. local hp_pill_itemId = -1
  809. local mp_pill_itemId = -1
  810. local itemList_ = SL:GetIsFastItemList()
  811. ---@type number[]
  812. local fastItems = SL:GetMetaValue(EMetaVarGetKey.FAST_ITEM_ID_LIST)
  813. for i, item in pairs(itemList_) do
  814. ---@type cfg_item_column
  815. local tbl1 = SL:GetConfig("cfg_item",item.cfgId)
  816. --蓝药
  817. if tbl1.type==3 and tbl1.subType==1 and tbl1.id>=30010012 and tbl1.id<=30010022 then
  818. local cfgId = fastItems[1]
  819. if mp_pill_itemId ~= -1 then
  820. cfgId = mp_pill_itemId
  821. end
  822. local ownerCount = SL:GetBagItemCount(cfgId)
  823. if not SL:HasConfig("cfg_item",fastItems[1]) or ownerCount <=0 then
  824. mp_pill_itemId = item.cfgId
  825. else
  826. local tbl2 = SL:GetConfig("cfg_item", cfgId)
  827. if tbl1.rank > tbl2.rank then
  828. mp_pill_itemId = item.cfgId
  829. end
  830. end
  831. end
  832. --血药
  833. if tbl1.type==3 and tbl1.subType==1 and tbl1.id>=30010001 and tbl1.id<=30010011 then
  834. local cfgId = fastItems[1]
  835. if hp_pill_itemId ~= -1 then
  836. cfgId = hp_pill_itemId
  837. end
  838. local ownerCount = SL:GetBagItemCount(cfgId)
  839. if not SL:HasConfig("cfg_item",cfgId) or ownerCount <=0 then
  840. hp_pill_itemId = item.cfgId
  841. else
  842. local tbl2 = SL:GetConfig("cfg_item", cfgId)
  843. if tbl1.rank > tbl2.rank then
  844. hp_pill_itemId = item.cfgId
  845. end
  846. end
  847. end
  848. end
  849. local ownerCount = SL:GetBagItemCount(fastItems[1])
  850. mp_pill_itemId = (mp_pill_itemId == -1 and ownerCount <= 0) and 0 or mp_pill_itemId
  851. if mp_pill_itemId ~= -1 and fastItems[1] ~= mp_pill_itemId then
  852. SL:SetMetaValue(EMetaVarGetKey.FAST_ITEM_ID_LIST, 1, mp_pill_itemId, 0)
  853. end
  854. ownerCount = SL:GetBagItemCount(fastItems[2])
  855. hp_pill_itemId = (hp_pill_itemId == -1 and ownerCount <= 0) and 0 or hp_pill_itemId
  856. if hp_pill_itemId ~= -1 and fastItems[2] ~= hp_pill_itemId then
  857. SL:SetMetaValue(EMetaVarGetKey.FAST_ITEM_ID_LIST, 2, hp_pill_itemId, 0)
  858. end
  859. SL:onLUAEvent(LUA_EVENT_FASTITEM_CHANGE)
  860. end
  861. function KLUIPlayerInfoPanel:LUA_EVENT_CLOSEWIN(id,panelName)
  862. if panelName == "KLUIBuffInfoListPanel" then
  863. self:OnClickBuffMenuexpandBtn()
  864. end
  865. end
  866. function KLUIPlayerInfoPanel:AddOrRemoveBuff(data,isAdd)
  867. local isContains = false
  868. local pos
  869. for i, v in pairs(self.buffInfoList) do
  870. if v.cfgId == data.cfgId then
  871. isContains = true
  872. pos = i
  873. end
  874. end
  875. if isContains and pos and not isAdd then
  876. table.remove(self.buffInfoList,pos)
  877. end
  878. if isAdd then
  879. if isContains then
  880. self.buffInfoList[pos] = data
  881. else
  882. table.insert(self.buffInfoList,data)
  883. end
  884. end
  885. end
  886. return KLUIPlayerInfoPanel