KLArchangelGrailPanel.lua 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049
  1. ---@class KLArchangelGrailPanel:UIKmlLuaPanelBase
  2. ---@field view KLArchangelGrailPanelView
  3. ---@field isStrengthInfo boolean @
  4. ---@field isStrength boolean @注:由于强化成功有两个协议,考虑两个均返回后刷新
  5. local KLArchangelGrailPanel = class(UIKmlLuaPanelBase)
  6. local this = KLArchangelGrailPanel
  7. function this:AsyncLoadUI()
  8. end
  9. local SendType = {
  10. UnFusion = enum(),
  11. Equip = enum(),
  12. Fusion = enum(),
  13. Strength = enum(),
  14. }
  15. ---创建时调用一次
  16. function this:Init()
  17. GUI:setVisible(self.view.equipatt_panel, false)
  18. self.strengthChange = {}
  19. self.isStrengthInfo = false
  20. self.isStrength = false
  21. self.equipGrailInfo = {}
  22. self.type = SendType.Equip
  23. self.isOther = self.args and self.args.isOther or false
  24. if self.isOther then
  25. else
  26. --GUI:UIPanel_Open("dev/outui/Archangel/Panel/KLArchangelGroup/KLArchangelGroupPanel")
  27. local equipPanel = GUI:GetUI("dev/ui/Equip/Panel/KLEquipUI/KLEquipUIPanel")
  28. if equipPanel then
  29. ---@type KLEquipUIPanel
  30. self.equipPanel = equipPanel
  31. else
  32. self.equipPanel = GUI:UIPanel_Open("dev/ui/Equip/Panel/KLEquipUI/KLEquipUIPanel", nil, nil,
  33. { x = -465, hideTips = true, callBack = self.ClosePanel, })
  34. end
  35. self.equipPanel:SetSelfWearBarType(EEquipWearBarType.Archange)
  36. end
  37. self:InitDataList()
  38. end
  39. ---注册UI事件和服务器消息
  40. function this:RegistEvents()
  41. GUI:AddOnClickEvent(self.view.CloseButton, self, self.ClosePanel)
  42. GUI:AddOnClickEvent(self.view.item8, self, self.OpenEquip)
  43. GUI:AddOnClickEvent(self.view.strengthenBtn, self, self.Strengthen)
  44. GUI:AddOnClickEvent(self.view.btn_tips, self, self.BtnHelpOnClick)
  45. GUI:AddOnClickEvent(self.view.detail_bg, self, self.BtnHideSuitDetail)
  46. GUI:AddOnClickEvent(self.view.item_grail_tips, self, self.BtnGrailTipsOnClick)
  47. SL:RegisterLUAEvent(LUA_EVENT_EQUIP_GRID_CLICK, self.LUA_EVENT_EQUIP_GRID_CLICK, self)
  48. --SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_GRAIL_FUSIBLE_INFO, self.RES_GRAIL_FUSIBLE_INFO, self)
  49. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_GRAIL_ENTRY_INFO, self.RES_GRAIL_ENTRY_INFO, self)
  50. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_EQUIP_ALL_ENTRY_INFO, self.RES_EQUIP_ALL_ENTRY_INFO, self)
  51. SL:RegisterLUAEvent(LUA_EVENT_BAG_CHANGE_AFTER, self.LUA_EVENT_BAG_CHANGE_AFTER, self)
  52. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_GRAIL_ENTRY_STRENGTHEN_RESULT, self.RES_GRAIL_ENTRY_STRENGTHEN_RESULT, self)
  53. SL:RegisterLUAEvent(LUA_EVENT_GRAIL_INFO_CHANGE, self.LUA_EVENT_GRAIL_INFO_CHANGE, self)
  54. end
  55. function this:RES_GRAIL_ENTRY_INFO(_, message)
  56. local attid = 0
  57. for i, v in pairs(self.equipGrailInfo) do
  58. if message[tostring(v.itemId)] then
  59. if self.type ~= SendType.UnFusion then
  60. v.attrInfo = message[tostring(v.itemId)]
  61. break
  62. end
  63. break
  64. end
  65. end
  66. if self.type == SendType.Fusion then
  67. -- 融合后的响应
  68. local data = self.equipGrailInfo[self.selectGrailIndex]
  69. --self.grailItemList[data.position]:UpdateUI({ itemCfgId = data.itemConfigId, id = data.itemId, holeIndex = data.position, isGray = false })
  70. self:RefreshGrail()
  71. self:GrailSelect(data.position, data.itemConfigId, data.itemId)
  72. elseif self.type == SendType.UnFusion then
  73. --self.grailItemList[self.unFusionHole]:UpdateUI({ holeIndex = self.unFusionHole, isGray = false })
  74. self.equipGrailInfo[self.unFusionHole] = nil
  75. GUI:setVisible(self.view.strength_panel, false)
  76. self:ShowEquipAtt()
  77. self:RefreshGrail()
  78. self:GrailSelect(self.unFusionHole)
  79. else
  80. self.isStrengthInfo = true
  81. self.strengthChange = {}
  82. if self.type == SendType.Strength then
  83. for _, v in pairs(message) do
  84. for _, k in pairs(v.secondary) do
  85. for _, info in pairs(k) do
  86. if info.attrId == "200011" then
  87. if info.value ~= self.strengthQian["mAtt"].min then
  88. table.insert(self.strengthChange, "200011")
  89. end
  90. elseif info.attrId == "200021" then
  91. if info.value ~= self.strengthQian["mAtt"].max then
  92. table.insert(self.strengthChange, "200021")
  93. end
  94. else
  95. if info.value ~= self.strengthQian[info.id] then
  96. table.insert(self.strengthChange, info.id)
  97. end
  98. end
  99. end
  100. end
  101. end
  102. end
  103. if self.isStrength then
  104. -- 刷新UI
  105. self:GrailSelect(self.selectGrailIndex, self.selectGrail.cfgId, self.selectGrail.id)
  106. end
  107. end
  108. InfoManager.archangeEquipInfo:CheckEquipRed()
  109. InfoManager.archangeEquipInfo:CanStrengthGrail()
  110. local group = GUI:GetUI("dev/outui/Archangel/Panel/KLArchangelGroup/KLArchangelGroupPanel")
  111. if group then
  112. group:RefreshRed()
  113. end
  114. self:RefreshEquipWear()
  115. SL:onLUAEvent(LUA_EVENT_GRAIL_STRENGTH_SUCCESS_REFRESH_REDPOINT)
  116. end
  117. ---界面显示时调用一次
  118. function this:Show()
  119. end
  120. ---创建或者刷新界面数据时调用
  121. function this:Refresh()
  122. self:IsSelectEquip(false)
  123. ---@type KLGrailItem[]
  124. self.grailItemList = {}
  125. self:RefreshUI()
  126. end
  127. function this:RefreshUI()
  128. ---刷新全部属性
  129. GUI:Image_loadTexture(self.view.img_attr_title, "equip_attr_suit", "Atlas/UIArchangelGrail.spriteatlas")
  130. GUI:setVisible(self.view.equip_top, false)
  131. GUI:setVisible(self.view.warning_img, false)
  132. self.equipAttinfo = {}
  133. local data = {}
  134. GUI:setVisible(self.view.equipatt_panel, true)
  135. GUI:setPositionY(self.view.equipatt_panel, 100)
  136. local attr_list
  137. if self.isOther then
  138. attr_list = InfoManager.archangeEquipInfo.otherGrailAllAttrList
  139. else
  140. attr_list = InfoManager.archangeEquipInfo:RefreshAllGrailAttrInfo()
  141. end
  142. if attr_list then
  143. for i, v in pairs(attr_list) do
  144. if data[tonumber(i)] then
  145. data[tonumber(i)].att = data[tonumber(i)].att + v
  146. else
  147. data[tonumber(i)] = {}
  148. data[tonumber(i)].att = v
  149. end
  150. end
  151. local minAtt, maxAtt
  152. for i, v in pairs(data) do
  153. if i == 200011 then
  154. minAtt = v.att
  155. if maxAtt then
  156. table.insert(self.equipAttinfo, { key = "mAtt", id = i, max = maxAtt, min = minAtt, color = v.color })
  157. minAtt = nil
  158. maxAtt = nil
  159. end
  160. elseif i == 200021 then
  161. maxAtt = v.att
  162. if minAtt then
  163. table.insert(self.equipAttinfo, { key = "mAtt", id = i, max = maxAtt, min = minAtt, color = v.color })
  164. minAtt = nil
  165. maxAtt = nil
  166. end
  167. else
  168. table.insert(self.equipAttinfo, { id = i, value = v.att, color = v.color })
  169. end
  170. end
  171. end
  172. if #self.equipAttinfo > 0 then
  173. GUI:setVisible(self.view.empty_attr_bg, false)
  174. else
  175. GUI:setVisible(self.view.empty_attr_bg, true)
  176. end
  177. GUI:DataListUpdateData(self.view.equip_att_list)
  178. ---刷新全部套装
  179. self.grailSuitList = {}
  180. ---@type cfg_equip_angelGrailSuit_column[]
  181. local suitTbl = SL:GetConfigTable("cfg_equip_angelGrailSuit")
  182. for _, v in ipairs(suitTbl) do
  183. if not self.grailSuitList[v.group] then
  184. self.grailSuitList[v.group] = {}
  185. end
  186. self.grailSuitList[v.group].name = v.mainName
  187. local info = self.grailSuitList[v.group].attr or {}
  188. local count
  189. if self.isOther then
  190. count = InfoManager.archangeEquipInfo:GetOtherGrailSuitCount(v.group, v.level)
  191. else
  192. count = InfoManager.archangeEquipInfo:GetGrailSuitCount(v.group, v.level)
  193. end
  194. for j, k in pairs(v.suitEffect) do
  195. if info[k[1]] then
  196. if count >= k[1] then
  197. info[k[1]] = {}
  198. info[k[1]].attrName = k[2]
  199. info[k[1]].attrValue = k[3]
  200. info[k[1]].color = E_ArchangelGrailQualityColor[v.level]
  201. end
  202. else
  203. info[k[1]] = {}
  204. info[k[1]].attrName = k[2]
  205. info[k[1]].attrValue = k[3]
  206. info[k[1]].color = k[1] <= count and E_ArchangelGrailQualityColor[v.level] or "#999999"
  207. end
  208. end
  209. self.grailSuitList[v.group].attr = info
  210. end
  211. GUI:DataListUpdateData(self.view.grail_all_suit_list)
  212. end
  213. function this:RefreshEquip()
  214. if not self.selectEquip then
  215. self:IsSelectEquip(false)
  216. return
  217. end
  218. self:IsSelectEquip(true)
  219. self:EquipItemShow()
  220. --请求装备信息
  221. self.type = SendType.Equip
  222. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_GET_EQUIP_ALL_ENTRY_INFO, self.selectEquip.id)
  223. end
  224. function this:RES_EQUIP_ALL_ENTRY_INFO(_, message)
  225. if self.type == SendType.Equip then
  226. self.equipGrailInfo = {}
  227. -- 选择装备后的请求
  228. for i, v in pairs(message) do
  229. self.equipGrailInfo[v.position] = v
  230. end
  231. self:RefreshGrail()
  232. self:ShowEquipAtt()
  233. elseif self.type == SendType.Fusion then
  234. -- 融合后的响应
  235. local data = message["1"]
  236. self.equipGrailInfo[data.position] = data
  237. --self.grailItemList[data.position]:UpdateUI({ itemCfgId = data.itemConfigId, id = data.itemId, holeIndex = data.position, isGray = false })
  238. InfoManager.archangeEquipInfo:GrailChange(self.selectEquip.id, data.position, data.itemConfigId, data.itemId)
  239. InfoManager.archangeEquipInfo:GrailInfoChange(data.itemId, message["1"])
  240. self:RefreshGrail()
  241. self:GrailSelect(data.position, data.itemConfigId, data.itemId)
  242. else
  243. --self.grailItemList[self.unFusionHole]:UpdateUI({ holeIndex = self.unFusionHole, isGray = false })
  244. self.equipGrailInfo[self.unFusionHole] = nil
  245. --local info = { equipId = self.selectEquip.id, gradePosition = self.unFusionHole }
  246. InfoManager.archangeEquipInfo:GrailChange(self.selectEquip.id, self.unFusionHole)
  247. self:RefreshGrail()
  248. self:GrailSelect(self.unFusionHole)
  249. end
  250. InfoManager.archangeEquipInfo:CheckEquipRed()
  251. local group = GUI:GetUI("dev/outui/Archangel/Panel/KLArchangelGroup/KLArchangelGroupPanel")
  252. if group then
  253. group:RefreshRed()
  254. end
  255. self:RefreshEquipWear()
  256. end
  257. function this:RefreshGrail()
  258. self.grailInfo = {}
  259. local equipInfo = InfoManager.archangeEquipInfo:GetEquipLevelInfo(self.selectEquip.id)
  260. local hole, max = self:GetHole(equipInfo.rank, self.selectEquip.cfgId)
  261. local tbl = {}
  262. for i, v in pairs(self.equipGrailInfo) do
  263. tbl[v.position] = { id = v.itemId, cfgId = v.itemConfigId }
  264. end
  265. for i = 1, max do
  266. local data = {}
  267. if i <= hole then
  268. -- 孔位解锁
  269. data.isGray = false
  270. if tbl[i] then
  271. -- 是否有圣杯
  272. data.itemCfgId = tbl[i].cfgId
  273. data.id = tbl[i].id
  274. end
  275. else
  276. data.isGray = true
  277. end
  278. data.holeIndex = i
  279. table.insert(self.grailInfo, data)
  280. end
  281. GUI:DataListUpdateData(self.view.grail_list, nil, function()
  282. self.isHideSelect = false
  283. end)
  284. end
  285. function this:AttShow(holeIndex)
  286. self.grailAttrInfo = {}
  287. GUI:setVisible(self.view.strength_panel, true)
  288. GUI:setVisible(self.view.equipatt_panel, false)
  289. for i, v in pairs(self.equipGrailInfo) do
  290. if v.position == holeIndex then
  291. local minAtt = nil
  292. local maxAtt = nil
  293. for _, att in pairs(v.attrInfo.main) do
  294. if tonumber(att.attrId) == 200011 then
  295. minAtt = att.value
  296. if maxAtt then
  297. table.insert(self.grailAttrInfo, { key = "mAtt", id = att.id, isMain = true, max = maxAtt, min = minAtt })
  298. minAtt = nil
  299. maxAtt = nil
  300. end
  301. elseif tonumber(att.attrId) == 200021 then
  302. maxAtt = att.value
  303. if minAtt then
  304. table.insert(self.grailAttrInfo, { key = "mAtt", id = att.id, isMain = true, max = maxAtt, min = minAtt })
  305. minAtt = nil
  306. maxAtt = nil
  307. end
  308. else
  309. att.isMain = true
  310. table.insert(self.grailAttrInfo, att)
  311. end
  312. end
  313. minAtt = nil
  314. maxAtt = nil
  315. for _, att in pairs(v.attrInfo.secondary) do
  316. for _, k in pairs(att) do
  317. if tonumber(k.attrId) == 200011 then
  318. minAtt = k.value
  319. if maxAtt then
  320. table.insert(self.grailAttrInfo, { key = "mAtt", id = k.id, isMain = false, max = maxAtt, min = minAtt })
  321. minAtt = nil
  322. maxAtt = nil
  323. end
  324. elseif tonumber(k.attrId) == 200021 then
  325. maxAtt = k.value
  326. if minAtt then
  327. table.insert(self.grailAttrInfo, { key = "mAtt", id = k.id, isMain = false, max = maxAtt, min = minAtt })
  328. minAtt = nil
  329. maxAtt = nil
  330. end
  331. else
  332. k.isMain = false
  333. table.insert(self.grailAttrInfo, k)
  334. end
  335. end
  336. end
  337. end
  338. end
  339. GUI:DataListUpdateData(self.view.grail_att_list, nil, function()
  340. self.strengthChange = {}
  341. end)
  342. end
  343. function this:ShowEquipAtt()
  344. self.equipAttinfo = {}
  345. if table.count(self.equipGrailInfo) == 0 then
  346. GUI:setVisible(self.view.strength_panel, false)
  347. GUI:setVisible(self.view.equipatt_panel, false)
  348. GUI:setVisible(self.view.warning_img, false)
  349. return
  350. end
  351. local data = {}
  352. GUI:setVisible(self.view.warning_img, false)
  353. GUI:setVisible(self.view.strength_panel, false)
  354. GUI:setVisible(self.view.equipatt_panel, true)
  355. for i, v in pairs(self.equipGrailInfo) do
  356. for _, k in pairs(v.attrInfo.main) do
  357. if data[tonumber(k.attrId)] then
  358. data[tonumber(k.attrId)].att = data[tonumber(k.attrId)].att + k.value
  359. else
  360. data[tonumber(k.attrId)] = {}
  361. data[tonumber(k.attrId)].att = k.value
  362. data[tonumber(k.attrId)].color = E_ArchangelGrailQualityColor[SL:GetConfig("cfg_equip_angelEntry", k.id, "id").attQuality]
  363. end
  364. end
  365. if not v.attrInfo.secondary then
  366. v.attrInfo.secondary = {}
  367. end
  368. for _, k in pairs(v.attrInfo.secondary) do
  369. for _, j in pairs(k) do
  370. if data[tonumber(j.attrId)] then
  371. data[tonumber(j.attrId)].att = data[tonumber(j.attrId)].att + j.value
  372. else
  373. data[tonumber(j.attrId)] = {}
  374. data[tonumber(j.attrId)].att = j.value
  375. data[tonumber(j.attrId)].color = E_ArchangelGrailQualityColor[SL:GetConfig("cfg_equip_angelEntry", j.id, "id").attQuality]
  376. end
  377. end
  378. end
  379. end
  380. local minAtt = nil
  381. local maxAtt = nil
  382. for i, v in pairs(data) do
  383. if i == 200011 then
  384. minAtt = v.att
  385. if maxAtt then
  386. table.insert(self.equipAttinfo, { key = "mAtt", id = i, max = maxAtt, min = minAtt, color = v.color })
  387. minAtt = nil
  388. maxAtt = nil
  389. end
  390. elseif i == 200021 then
  391. maxAtt = v.att
  392. if minAtt then
  393. table.insert(self.equipAttinfo, { key = "mAtt", id = i, max = maxAtt, min = minAtt, color = v.color })
  394. minAtt = nil
  395. maxAtt = nil
  396. end
  397. else
  398. table.insert(self.equipAttinfo, { id = i, value = v.att, color = v.color })
  399. end
  400. end
  401. GUI:DataListUpdateData(self.view.equip_att_list)
  402. end
  403. function this:EquipAttUpdateItem(realIndex, kmlcontrol)
  404. local data = self.equipAttinfo[realIndex + 1]
  405. local text = GUI:GetChildControl(self.view.equip_att_list, realIndex, "equip_att_text")
  406. local equip_value_text = GUI:GetChildControl(self.view.equip_att_list, realIndex, "equip_value_text")
  407. --GUI:Text_setTextColor(text, data.color)
  408. if data.key then
  409. if data.key == "mAtt" then
  410. GUI:Text_setString(text, "攻击力")
  411. GUI:Text_setString(equip_value_text, "+" .. tostring(data.min) .. "~" .. tostring(data.max))
  412. end
  413. return
  414. end
  415. local attTbl = SL:GetConfig("cfg_att_info", tonumber(data.id), "id")
  416. GUI:Text_setString(text, attTbl.name)
  417. local value
  418. if attTbl.remarks == 2 then
  419. value = "+" .. tostring(data.value / 100) .. "%"
  420. else
  421. value = "+" .. tostring(data.value)
  422. end
  423. GUI:Text_setString(equip_value_text, tostring(value))
  424. end
  425. function this:GrailSuitUpdateItem(realIndex, kmlCtrl)
  426. local suit_name = GUI:GetChildControl(self.view.grail_all_suit_list, realIndex, "suit_name")
  427. local suit_attr_1 = GUI:GetChildControl(self.view.grail_all_suit_list, realIndex, "suit_attr_1")
  428. local suit_attr_2 = GUI:GetChildControl(self.view.grail_all_suit_list, realIndex, "suit_attr_2")
  429. local suit_attr_3 = GUI:GetChildControl(self.view.grail_all_suit_list, realIndex, "suit_attr_3")
  430. local tipsBtn = GUI:GetChildControl(self.view.grail_all_suit_list, realIndex, "tipsBtn")
  431. local data = self.grailSuitList[realIndex + 1]
  432. GUI:Text_setString(suit_name, data.name)
  433. for i, v in pairs(data.attr) do
  434. ---@type cfg_att_info_column
  435. local tbl = SL:GetConfig("cfg_att_info", v.attrName)
  436. local value
  437. if tbl.remarks == 1 then
  438. value = v.attrValue
  439. else
  440. value = v.attrValue / 100 .. "%"
  441. end
  442. if i == 3 then
  443. GUI:Text_setString(suit_attr_1, "3件套:" .. tbl.name .. "+" .. value)
  444. GUI:Text_setTextColor(suit_attr_1, v.color)
  445. elseif i == 5 then
  446. GUI:Text_setString(suit_attr_2, "5件套:" .. tbl.name .. "+" .. value)
  447. GUI:Text_setTextColor(suit_attr_2, v.color)
  448. elseif i == 7 then
  449. GUI:Text_setString(suit_attr_3, "7件套:" .. tbl.name .. "+" .. value)
  450. GUI:Text_setTextColor(suit_attr_3, v.color)
  451. end
  452. end
  453. GUI:AddOnClickEvent(tipsBtn, self, self.ShowSuitDetail, realIndex + 1)
  454. end
  455. function this:GrailAttDataListUpdateFunc(realIndex, kmlcontrol)
  456. local att_text = GUI:GetChildControl(self.view.grail_att_list, realIndex, "att_text")
  457. local zhufu_img = GUI:GetChildControl(self.view.grail_att_list, realIndex, "zhufu_img")
  458. local max_att_text = GUI:GetChildControl(self.view.grail_att_list, realIndex, "max_att_text")
  459. local select_img = GUI:GetChildControl(self.view.grail_att_list, realIndex, "select_img")
  460. local bg_img = GUI:GetChildControl(self.view.grail_att_list, realIndex, "bg_img")
  461. local loadingbar_attr = GUI:GetChildControl(self.view.grail_att_list, realIndex, "loadingbar_attr")
  462. local data = self.grailAttrInfo[realIndex + 1]
  463. if data.isMain then
  464. GUI:Image_loadTexture(zhufu_img, "icon_zhu", "Atlas/UIArchangelGrail.spriteatlas")
  465. else
  466. GUI:Image_loadTexture(zhufu_img, "icon_fu", "Atlas/UIArchangelGrail.spriteatlas")
  467. end
  468. ---@type cfg_equip_angelEntry_column
  469. local angelEntry = SL:GetConfig("cfg_equip_angelEntry", data.id, "id")
  470. GUI:Text_setTextColor(att_text, E_ArchangelGrailQualityColor[angelEntry.attQuality])
  471. GUI:Text_setTextColor(max_att_text, E_ArchangelGrailQualityColor[angelEntry.attQuality])
  472. GUI:Image_loadTexture(bg_img, "bg_attr_" .. angelEntry.attQuality, "Atlas/UIArchangelGrail.spriteatlas")
  473. if data.key then
  474. if data.key == "mAtt" then
  475. if table.contains(self.strengthChange, "200011") or table.contains(self.strengthChange, "200021") then
  476. GUI:setVisible(select_img, true)
  477. else
  478. GUI:setVisible(select_img, false)
  479. end
  480. if data.isMain and not table.isNullOrEmpty(self.strengthChange) then
  481. GUI:setVisible(select_img, true)
  482. end
  483. GUI:Text_setString(att_text, "攻击力+" .. tostring(data.min) .. "~" .. tostring(data.max))
  484. GUI:Text_setString(max_att_text, "最大:" .. tostring(angelEntry.attMax[1]) .. "~" .. tostring(angelEntry.attMax[2]))
  485. GUI:SetLoadingbar_startper(loadingbar_attr, (data.min + data.max) / (angelEntry.attMax[1] + angelEntry.attMax[2]) * 100)
  486. end
  487. return
  488. end
  489. if table.contains(self.strengthChange, data.id) then
  490. GUI:setVisible(select_img, true)
  491. else
  492. GUI:setVisible(select_img, false)
  493. end
  494. if data.isMain and not table.isNullOrEmpty(self.strengthChange) then
  495. GUI:setVisible(select_img, true)
  496. end
  497. ---@type cfg_att_info_column
  498. local attTbl = SL:GetConfig("cfg_att_info", tonumber(data.attrId), "id")
  499. local str = attTbl.name
  500. local maxStr = "最大:"
  501. if attTbl.remarks == 2 then
  502. str = str .. "+" .. tostring(data.value / 100) .. "%"
  503. maxStr = maxStr .. tostring(angelEntry.attMax[1] / 100) .. "%"
  504. else
  505. str = str .. "+" .. tostring(data.value)
  506. maxStr = maxStr .. tostring(angelEntry.attMax[1])
  507. end
  508. GUI:SetLoadingbar_startper(loadingbar_attr, data.value / angelEntry.attMax[1] * 100)
  509. GUI:Text_setString(max_att_text, maxStr)
  510. GUI:Text_setString(att_text, str)
  511. end
  512. function this:LUA_EVENT_EQUIP_GRID_CLICK(_, pos)
  513. self.selectEquipPos = pos
  514. local equip = SL:GetMetaValue("EQUIP_DATA_LIST", pos)[1]
  515. if pos == EEquipSlotType.ArchangelWeapon and not equip then
  516. equip = SL:GetMetaValue("EQUIP_DATA_LIST", EEquipSlotType.ArchangelTwoHandWeapon)[1]
  517. self.selectEquipPos = EEquipSlotType.ArchangelTwoHandWeapon
  518. end
  519. if pos == EEquipSlotType.ArchangelTwoHandWeapon and not equip then
  520. equip = SL:GetMetaValue("EQUIP_DATA_LIST", EEquipSlotType.ArchangelWeapon)[1]
  521. self.selectEquipPos = EEquipSlotType.ArchangelWeapon
  522. end
  523. if not equip then
  524. return
  525. end
  526. GUI:Image_loadTexture(self.view.img_attr_title, "equip_att_title", "Atlas/UIArchangelGrail.spriteatlas")
  527. GUI:setPositionY(self.view.equipatt_panel, -155)
  528. GUI:setVisible(self.view.equip_top, true)
  529. GUI:setVisible(self.view.grail_suit_all, false)
  530. GUI:setVisible(self.view.suit_detail_panel, false)
  531. self.equipPanel:SetSelectIndex(self.selectEquipPos)
  532. self.selectEquip = equip
  533. self.selectGrail = {}
  534. self:RefreshEquip()
  535. self.isHideSelect = true
  536. end
  537. function this:Strengthen()
  538. if table.isNullOrEmpty(self.selectGrail) then
  539. return
  540. end
  541. if self.isStrengthlvMax then
  542. return
  543. end
  544. GUI:setVisible(self.view.effectfail, false)
  545. GUI:setVisible(self.view.effectSucceed, false)
  546. self.isStrengthInfo = false
  547. self.isStrength = false
  548. self.type = SendType.Strength
  549. self.strengthQian = {}
  550. for i, v in pairs(self.grailAttrInfo) do
  551. if not v.attrId then
  552. self.strengthQian[v.key] = { v.max, v.min }
  553. elseif not self.strengthQian[v.attrId] and v.isMain == false then
  554. self.strengthQian[v.id] = v.value
  555. end
  556. end
  557. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_STRENGTHEN_ANGEL_GRAIL, { itemConfigId = self.selectGrail.cfgId, itemId = self.selectGrail.id })
  558. end
  559. function this:BtnHelpOnClick()
  560. local helpCfg = SL:GetConfig("cfg_rule_text", 29001)
  561. if helpCfg then
  562. SL:CommonStrTipsMessage({ title = helpCfg.menutxt, str = helpCfg.location })
  563. end
  564. end
  565. function this:BtnHideSuitDetail()
  566. GUI:setVisible(self.view.suit_detail_panel, false)
  567. end
  568. function this:BtnGrailTipsOnClick()
  569. if self.selectGrail and self.selectGrail.cfgId then
  570. SL:OpenTips("", tonumber(self.selectGrail.cfgId), tonumber(self.selectGrail.id))
  571. else
  572. self:OpenEquip()
  573. end
  574. end
  575. function this:ShowSuitDetail(_, eventData)
  576. GUI:setVisible(self.view.suit_detail_panel, true)
  577. if eventData then
  578. local name
  579. local data = {}
  580. ---@type cfg_equip_angelGrailSuit_column[]
  581. local tbl = SL:GetConfigTable("cfg_equip_angelGrailSuit")
  582. for i, v in ipairs(tbl) do
  583. if v.group == eventData then
  584. name = v.mainName
  585. for j, k in ipairs(v.suitEffect) do
  586. ---@type cfg_att_info_column
  587. local tbl_2 = SL:GetConfig("cfg_att_info", k[2])
  588. local attrValue
  589. if tbl_2.remarks == 2 then
  590. attrValue = k[3] / 100 .. "%"
  591. else
  592. attrValue = k[3]
  593. end
  594. attrValue = "<color=" .. E_ArchangelGrailQualityColor[v.level] .. ">" .. attrValue .. "</color>"
  595. if not data[k[1]] then
  596. data[k[1]] = tbl_2.name .. "+" .. attrValue
  597. else
  598. data[k[1]] = data[k[1]] .. "/" .. attrValue
  599. end
  600. end
  601. end
  602. end
  603. GUI:Text_setString(self.view.detail_name, name)
  604. GUI:Text_setString(self.view.detail_attr_1, "3件套:" .. data[3])
  605. GUI:Text_setString(self.view.detail_attr_2, "5件套:" .. data[5])
  606. GUI:Text_setString(self.view.detail_attr_3, "7件套:" .. data[7])
  607. end
  608. end
  609. function this:RES_GRAIL_ENTRY_STRENGTHEN_RESULT(_, message)
  610. self.isStrength = true
  611. if not message then
  612. GUI:setVisible(self.view.effectfail, true)
  613. self:GrailSelect(self.selectGrailIndex, self.selectGrail.cfgId, self.selectGrail.id)
  614. return
  615. end
  616. GUI:setVisible(self.view.effectSucceed, true)
  617. if self.isStrengthInfo then
  618. self:GrailSelect(self.selectGrailIndex, self.selectGrail.cfgId, self.selectGrail.id)
  619. end
  620. end
  621. function this:LUA_EVENT_GRAIL_INFO_CHANGE(_, message)
  622. if self.bagUI then
  623. if self.type == SendType.Fusion then
  624. self:RefreshBag(self.selectGrailIndex)
  625. elseif self.type == SendType.UnFusion then
  626. self:RefreshBag(self.unFusionHole)
  627. end
  628. end
  629. end
  630. function this:IsSelectEquip(IsSelect)
  631. GUI:setVisible(self.view.item_add_img, not IsSelect)
  632. GUI:setVisible(self.view.item_name, IsSelect)
  633. GUI:setVisible(self.view.item8, IsSelect)
  634. GUI:setVisible(self.view.warning_img, not IsSelect)
  635. --GUI:setVisible(self.view.equipatt_panel, IsSelect)
  636. --GUI:setVisible(self.view.strength_panel, IsSelect)
  637. end
  638. function this:CostDataListUpdateFunc(realIndex, kmlcontrol)
  639. local cost_item = GUI:GetChildControl(self.view.cost_list, realIndex, "cost_item")
  640. local cost_name = GUI:GetChildControl(self.view.cost_list, realIndex, "cost_name")
  641. local cost_num = GUI:GetChildControl(self.view.cost_list, realIndex, "cost_num")
  642. local costAddBtn = GUI:GetChildControl(self.view.cost_list, realIndex, "costAddBtn")
  643. local data = self.costList[realIndex + 1]
  644. GUI:Item_setItemId(cost_item, data[1])
  645. ---@type cfg_item_column
  646. local itemTbl = SL:GetConfig("cfg_item", data[1], "id")
  647. GUI:Text_setString(cost_name, itemTbl.name)
  648. local costNumStr = ""
  649. local bagCount = SL:GetBagItemCount(data[1])
  650. if bagCount >= data[2] then
  651. costNumStr = "<color='#1add1f'>" .. tostring(bagCount) .. "</color>/" .. tostring(data[2])
  652. --self.isCost = true
  653. else
  654. costNumStr = "<color='#ff2323'>" .. tostring(bagCount) .. "</color>/" .. tostring(data[2])
  655. --self.isCost = false
  656. end
  657. GUI:Text_setString(cost_num, costNumStr)
  658. GUI:AddOnClickEvent(costAddBtn, self, function()
  659. SL:CommonItemGetPath(nil, data[1])
  660. end)
  661. end
  662. function this:GrailItemGet(realIndex)
  663. ---@type KLGrailItem
  664. local item = GUI:UIPanel_Open("dev/outui/Archangel/Item/KLGrail/KLGrailItem", self.view.grail_list, self, nil, true)
  665. self.grailItemList[item.view.root] = item
  666. return item.view.root
  667. end
  668. function this:GrailUpdateItem(realIndex, kmlcontrol)
  669. self.grailItemList[kmlcontrol]:UpdateUI(self.grailInfo[realIndex + 1], self.isHideSelect)
  670. end
  671. function this:GetGrailItemShowRedPoint(holeIndex, cfgId)
  672. if not self.equipGrailInfo[holeIndex] then
  673. return false
  674. end
  675. local angelstrengthenLv = self.equipGrailInfo[holeIndex].attrInfo.level
  676. local strengthenTbl = SL:GetConfig("cfg_equip_angelStrengthen", cfgId, "id")
  677. local costTbl = SL:GetConfigTwoKeys("cfg_equip_angelStrengthenCost", strengthenTbl.costGroup, angelstrengthenLv, "AngelstrengthenGroup", "AngelstrengthenLv")
  678. if table.count(costTbl.Angelstrengthencost) == 0 then
  679. return false
  680. end
  681. for _, v in pairs(costTbl.Angelstrengthencost) do
  682. if v[2] > SL:GetBagItemCount(v[1]) then
  683. return false
  684. end
  685. end
  686. return true
  687. end
  688. function this:GetGrailByHoleIndex(holeIndex)
  689. local data = self:GetBagItem(holeIndex, self.selectEquipPos)
  690. if data and table.count(data) > 0 then
  691. return true
  692. else
  693. return false
  694. end
  695. end
  696. function this:GrailSelect(holeIndex, cfgId, id)
  697. for i, v in pairs(self.grailItemList) do
  698. v:SelectItemUIChange(holeIndex)
  699. end
  700. if not self.grailInfo[holeIndex] then
  701. return
  702. end
  703. self.selectGrailIndex = holeIndex
  704. if cfgId then
  705. self.selectGrail = { cfgId = cfgId, id = id }
  706. local angelstrengthenLv = self.equipGrailInfo[holeIndex].attrInfo.level
  707. local strengthenTbl = SL:GetConfig("cfg_equip_angelStrengthen", cfgId, "id")
  708. local costTbl = SL:GetConfigTwoKeys("cfg_equip_angelStrengthenCost", strengthenTbl.costGroup, angelstrengthenLv, "AngelstrengthenGroup", "AngelstrengthenLv")
  709. local tbl = SL:FindConfigs("cfg_equip_angelStrengthenCost", "AngelstrengthenGroup", strengthenTbl.costGroup)
  710. table.sort(tbl, function(a, b)
  711. return a.AngelstrengthenLv > b.AngelstrengthenLv
  712. end)
  713. self:GrailItemShow(holeIndex)
  714. self:OpenEquip()
  715. self.costList = costTbl.Angelstrengthencost
  716. GUI:Text_setString(self.view.success_rate, tostring(costTbl.AngelstrengthenSuccessRate) .. "%")
  717. self:AttShow(holeIndex)
  718. GUI:DataListUpdateData(self.view.cost_list)
  719. if angelstrengthenLv == tbl[1].AngelstrengthenLv then
  720. --等级已满
  721. GUI:Button_setGrey(self.view.strengthenBtn, true)
  722. self.isStrengthlvMax = true
  723. GUI:Button_setTitleText(self.view.strengthenBtn, "等级已满")
  724. GUI:setVisible(self.view.success_img, false)
  725. GUI:setVisible(self.view.cost_title, false)
  726. GUI:setVisible(self.view.StrengthCostScrollView, false)
  727. elseif self:IsGrailEntryMax(holeIndex) then
  728. GUI:Button_setGrey(self.view.strengthenBtn, true)
  729. self.isStrengthlvMax = true
  730. GUI:Button_setTitleText(self.view.strengthenBtn, "属性已满")
  731. GUI:setVisible(self.view.success_img, false)
  732. GUI:setVisible(self.view.cost_title, false)
  733. GUI:setVisible(self.view.StrengthCostScrollView, false)
  734. else
  735. GUI:Button_setGrey(self.view.strengthenBtn, false)
  736. GUI:Button_setTitleText(self.view.strengthenBtn, "强化")
  737. self.isStrengthlvMax = false
  738. GUI:setVisible(self.view.success_img, true)
  739. GUI:setVisible(self.view.cost_title, true)
  740. GUI:setVisible(self.view.StrengthCostScrollView, true)
  741. end
  742. else
  743. self.selectGrail = {}
  744. self:ShowEquipAtt()
  745. self:RefreshBag(holeIndex)
  746. self:EquipItemShow()
  747. end
  748. end
  749. function this:IsGrailEntryMax(holeIndex)
  750. local data = self.equipGrailInfo[holeIndex]
  751. for i, v in pairs(self.equipGrailInfo[holeIndex].attrInfo.main) do
  752. if v.isMax == false then
  753. return false
  754. end
  755. end
  756. for i, v in pairs(self.equipGrailInfo[holeIndex].attrInfo.secondary) do
  757. for _, j in pairs(v) do
  758. if j.isMax == false then
  759. return false
  760. end
  761. end
  762. end
  763. return true
  764. end
  765. function this:GrailItemShow(holeIndex)
  766. if self.equipGrailInfo[holeIndex] then
  767. GUI:Item_setItemId(self.view.item8, self.equipGrailInfo[holeIndex].itemConfigId)
  768. ---@type cfg_item_column
  769. local itemCfg = SL:GetConfig("cfg_item", self.equipGrailInfo[holeIndex].itemConfigId, "id")
  770. GUI:Text_setTextColor(self.view.item_name, SL:GetConfig("cfg_color", tonumber(itemCfg.color), "id").color)
  771. GUI:Text_setString(self.view.item_name, itemCfg.name)
  772. GUI:Text_setString(self.view.preLevel, "+" .. tostring(self.equipGrailInfo[holeIndex].attrInfo.level))
  773. local maxLevel = InfoManager.archangeEquipInfo:GetGrailMaxStrengthLv(self.equipGrailInfo[holeIndex].itemConfigId)
  774. if maxLevel == self.equipGrailInfo[holeIndex].attrInfo.level then
  775. GUI:setVisible(self.view.nextLevel, false)
  776. GUI:setVisible(self.view.arrow, false)
  777. GUI:setPositionX(self.view.preLevel, 0)
  778. else
  779. GUI:setPositionX(self.view.preLevel, -45)
  780. GUI:setVisible(self.view.nextLevel, true)
  781. GUI:setVisible(self.view.arrow, true)
  782. GUI:Text_setString(self.view.nextLevel, "+" .. tostring(self.equipGrailInfo[holeIndex].attrInfo.level + 1))
  783. end
  784. else
  785. self:EquipItemShow()
  786. end
  787. end
  788. function this:EquipItemShow()
  789. if not self.selectEquip then
  790. return
  791. end
  792. GUI:Item_setItemId(self.view.item8, self.selectEquip.cfgId)
  793. ---@type cfg_item_column
  794. local itemCfg = SL:GetConfig("cfg_item", self.selectEquip.cfgId, "id")
  795. GUI:Text_setTextColor(self.view.item_name, SL:GetConfig("cfg_color", tonumber(itemCfg.color), "id").color)
  796. GUI:Text_setString(self.view.item_name, itemCfg.name)
  797. end
  798. --- 传入阶数和配置id获取孔位
  799. ---@return number,number 解锁的孔位,总孔位
  800. function this:GetHole(rank, cfgId)
  801. if not cfgId then
  802. return 0, 0
  803. end
  804. ---@type cfg_equip_angelGroup_column
  805. local tbl = SL:GetConfig("cfg_equip_angelGroup", cfgId, "id")
  806. if not rank or rank == 0 then
  807. return 0, table.count(tbl.grailOpen)
  808. end
  809. local grailOpen = table.copy(tbl.grailOpen)
  810. table.sort(grailOpen, function(a, b)
  811. return a[1] < b[1]
  812. end)
  813. --local rankIndex = 1
  814. for i, v in pairs(grailOpen) do
  815. if v[1] > rank then
  816. return grailOpen[i - 1][2], table.count(grailOpen)
  817. end
  818. if v[1] == rank then
  819. return grailOpen[i][2], table.count(grailOpen)
  820. end
  821. end
  822. return 0, table.count(grailOpen)
  823. end
  824. function this:Fusion(itemId, cfgId)
  825. local data = { equipId = self.selectEquip.id, itemId = itemId, index = SL:GetBagIndex(itemId), position = self.selectGrailIndex, itemConfigId = cfgId, equipConfigId = self.selectEquip.cfgId }
  826. --local da =data
  827. self.type = SendType.Fusion
  828. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_INLAY_ANGEL_GRAIL, data)
  829. end
  830. function this:UnFusion(itemId, cfgId, holeIndex)
  831. self.type = SendType.UnFusion
  832. self.unFusionHole = holeIndex
  833. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_UNLOAD_ANGEL_GRAIL, { equipId = self.selectEquip.id, itemId = itemId, itemConfigId = cfgId })
  834. end
  835. function this:BagItemClick(itemControl, itemData)
  836. SL:OpenTips("bag", itemData.cfgId, itemData.id)
  837. --self:Fusion(itemData.id, itemData.cfgId)
  838. --SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_GET_ANGEL_GRAIL_INFO, itemData.id)
  839. end
  840. --- 打开背包并筛选
  841. ---@param holeIndex number @孔位
  842. function this:RefreshBag(holeIndex)
  843. if holeIndex <= 0 then
  844. return
  845. end
  846. if not self.bagUI then
  847. GUI:UIPanel_Open("dev/outui/Archangel/Panel/KLFusionBag/KLFusionBagPanel", nil, nil, { x = -482, y = 0, itemClick = self.BagItemClick,selectList={}, callBackUI = self },true,function(bagUI)
  848. ---@type KLFusionBagPanel
  849. self.bagUI = bagUI
  850. self.bagUI:RefreshItem(self:GetBagItem(holeIndex, self.selectEquipPos))
  851. end)
  852. end
  853. if self.equipPanel then
  854. GUI:UIPanel_Close(nil, self.equipPanel)
  855. self.equipPanel = nil
  856. end
  857. --if self.selectEquip then
  858. --
  859. --end
  860. --self.bagUI:RefreshItem(self:GetBagItem(holeIndex))
  861. end
  862. --- 打开穿戴栏
  863. function this:OpenEquip()
  864. if not self.equipPanel then
  865. local equipPanel = GUI:GetUI("dev/ui/Equip/Panel/KLEquipUI/KLEquipUIPanel")
  866. if equipPanel then
  867. self.equipPanel = equipPanel
  868. else
  869. self.equipPanel = GUI:UIPanel_Open("dev/ui/Equip/Panel/KLEquipUI/KLEquipUIPanel", nil, nil,
  870. { x = -465, hideTips = true, callBack = self.ClosePanel, })
  871. end
  872. self.equipPanel:SetSelfWearBarType(EEquipWearBarType.Archange)
  873. self.equipPanel:SetSelectIndex(self.selectEquipPos)
  874. end
  875. if self.bagUI then
  876. GUI:UIPanel_Close(nil, self.bagUI)
  877. self.bagUI = nil
  878. end
  879. --self:GrailSelect(-1)
  880. end
  881. --- 刷新穿戴栏(重开一次)
  882. function this:RefreshEquipWear()
  883. if self.equipPanel then
  884. local equipPanel = GUI:GetUI("dev/ui/Equip/Panel/KLEquipUI/KLEquipUIPanel")
  885. if equipPanel then
  886. self.equipPanel = equipPanel
  887. else
  888. self.equipPanel = GUI:UIPanel_Open("dev/ui/Equip/Panel/KLEquipUI/KLEquipUIPanel", nil, nil,
  889. { x = -465, hideTips = true, callBack = self.ClosePanel, })
  890. end
  891. self.equipPanel:SetSelfWearBarType(EEquipWearBarType.Archange)
  892. self.equipPanel:SetSelectIndex(self.selectEquipPos)
  893. end
  894. --self:GrailSelect(-1)
  895. end
  896. --self.archangeGrailInfo[equipId][grailId] = { grailPosition = grailPos, itemConfigId = grailCfgId }
  897. function this:Hide()
  898. end
  899. function this:ClosePanel()
  900. GUI:UIPanel_Close("dev/outui/Archangel/Panel/KLArchangelGrail/KLArchangelGrailPanel")
  901. GUI:UIPanel_Close("dev/outui/Archangel/Panel/KLArchangelGroup/KLArchangelGroupPanel")
  902. end
  903. function this:Close()
  904. if self.bagUI then
  905. GUI:UIPanel_Close(nil, self.bagUI)
  906. elseif self.equipPanel then
  907. GUI:UIPanel_Close(nil, self.equipPanel)
  908. end
  909. if self.isOther then
  910. InfoManager.archangeEquipInfo:ResetOtherInfo()
  911. end
  912. end
  913. function this:InitDataList()
  914. GUI:DataListInitData(self.view.cost_list, function()
  915. return table.count(self.costList)
  916. end, function(realIndex)
  917. end, function(realIndex, kmlcontrol)
  918. end, function(realIndex, kmlcontrol)
  919. return self:CostDataListUpdateFunc(realIndex, kmlcontrol)
  920. end)
  921. GUI:DataListInitData(self.view.grail_att_list, function()
  922. return table.count(self.grailAttrInfo)
  923. end, function(realIndex)
  924. end, function(realIndex, kmlcontrol)
  925. end, function(realIndex, kmlcontrol)
  926. return self:GrailAttDataListUpdateFunc(realIndex, kmlcontrol)
  927. end)
  928. GUI:DataListInitData(self.view.grail_list, function()
  929. return table.count(self.grailInfo)
  930. end, function(realIndex)
  931. return self:GrailItemGet(realIndex)
  932. end, function(realIndex, kmlcontrol)
  933. end, function(realIndex, kmlcontrol)
  934. return self:GrailUpdateItem(realIndex, kmlcontrol)
  935. end)
  936. GUI:DataListInitData(self.view.equip_att_list, function()
  937. return table.count(self.equipAttinfo)
  938. end, function(realIndex)
  939. end, function(realIndex, kmlcontrol)
  940. end, function(realIndex, kmlcontrol)
  941. return self:EquipAttUpdateItem(realIndex, kmlcontrol)
  942. end)
  943. GUI:DataListInitData(self.view.grail_all_suit_list, function()
  944. return table.count(self.grailSuitList)
  945. end, function(realIndex)
  946. end, function(realIndex, kmlcontrol)
  947. end, function(realIndex, kmlcontrol)
  948. return self:GrailSuitUpdateItem(realIndex, kmlcontrol)
  949. end)
  950. end
  951. function this:LUA_EVENT_BAG_CHANGE_AFTER(_, message)
  952. if self.bagUI then
  953. if self.type == SendType.Fusion then
  954. self:RefreshBag(self.selectGrailIndex)
  955. elseif self.type == SendType.UnFusion then
  956. self:RefreshBag(self.unFusionHole)
  957. end
  958. end
  959. end
  960. --- 筛选背包物品
  961. function this:GetBagItem(holeIndex, pos)
  962. local data = {}
  963. local bagItemTabl = SL:GetMetaValue("BAG_DATA")[1]
  964. if bagItemTabl then
  965. for _, v in pairs(bagItemTabl) do
  966. local tbl = nil
  967. if SL:HasConfig("cfg_equip_angelGrail", v.cfgId, "id") then
  968. tbl = SL:GetConfig("cfg_equip_angelGrail", v.cfgId, "id")
  969. end
  970. if pos then
  971. if tbl and table.contains(tbl.gradePosition, holeIndex) and table.contains(tbl.strPart, pos) then
  972. table.insert(data, v)
  973. end
  974. else
  975. if tbl and table.contains(tbl.gradePosition, holeIndex) then
  976. table.insert(data, v)
  977. end
  978. end
  979. end
  980. end
  981. return data
  982. end
  983. return this