KLArchangelGrailTipsPanel.lua 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  1. ---@class KLArchangelGrailTipsPanel:UIKmlLuaPanelBase
  2. ---@field view KLArchangelGrailTipsPanelView
  3. local KLArchangelGrailTipsPanel = class(UIKmlLuaPanelBase)
  4. local this = KLArchangelGrailTipsPanel
  5. function this:AsyncLoadUI()
  6. end
  7. ---创建时调用一次
  8. function this:Init()
  9. self.otherGrail = nil
  10. if self.args.info and self.args.info.hideMask then
  11. GUI:setVisible(self.view.background_close, false)
  12. else
  13. GUI:setVisible(self.view.background_close, true)
  14. end
  15. if self.args.info and self.args.info.isRight then
  16. GUI:setAnchorPoint(self.view.root, 2, 0)
  17. end
  18. if self.args.info and self.args.info.posX then
  19. GUI:setPositionX(self.view.root, self.args.info.posX)
  20. end
  21. GUI:DataListInitData(self.view.all_info_data, function()
  22. return self:EquipAttrDataListItemCountFunc()
  23. end, function(realIndex)
  24. return self:EquipAttrDataListItemGetFunc(realIndex)
  25. end, function(realIndex, kmlcontrol)
  26. return self:EquipAttrDataListItemInitFunc(realIndex, kmlcontrol)
  27. end, function(realIndex, kmlcontrol)
  28. return self:EquipAttrDataListItemUpdateFunc(realIndex, kmlcontrol)
  29. end)
  30. self.firstCharge_list = { 28810531, 28820531, 28830531 }
  31. self.left_all = {}
  32. end
  33. ---界面显示时调用一次
  34. function this:Show()
  35. if self.args.info and self.args.info.otherRid and self.args.id then
  36. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_OTHER_ANGE_GRAIL_INFO, { rid = tonumber(self.args.info.otherRid), itemId = tonumber(self.args.id) })
  37. end
  38. end
  39. ---创建或者刷新界面数据时调用
  40. function this:Refresh()
  41. self.archenge = {}
  42. self.all_info = {}
  43. GUI:Item_setItemId(self.view.item5, self.args.cfgId)
  44. local itemTbl = SL:GetConfig("cfg_item", self.args.cfgId)
  45. local shape = itemTbl.shape[1]
  46. local rotation = SL:GetConfig("cfg_model_charactor", shape).rotateAxis
  47. local rotation_str = rotation .. ",50,0"
  48. self.Schedule1 = SL:ScheduleOnce(0.2, function()
  49. GUI:Item_Rotate(self.view.item5, rotation_str)
  50. end)
  51. GUI:Text_setTextColor(self.view.item_name, SL:GetConfig("cfg_color", tonumber(itemTbl.color), "id").color)
  52. GUI:Text_setString(self.view.item_name, itemTbl.name)
  53. local tbl = SL:GetConfig("cfg_equip_angelGrail", self.args.cfgId, "id")
  54. local strPart = "可融合部位:<color='#e6e600'>"
  55. for i, v in pairs(tbl.strPart) do
  56. strPart = strPart .. E_ArchangelGrailstrPart[v] .. " "
  57. end
  58. strPart = strPart.."</color>"
  59. GUI:Text_setString(self.view.fusion_pos, strPart)
  60. --self:NoHaveGrail()
  61. if not self.args.id then
  62. self:NoHaveGrail()
  63. else
  64. self:HaveGrail()
  65. end
  66. if self.args.info and self.args.info.hideBtn then
  67. GUI:setVisible(self.view.bag_root, false)
  68. GUI:setVisible(self.view.equip_root, false)
  69. elseif self.args.equip_pos == "bag" then
  70. GUI:setVisible(self.view.bag_root, true)
  71. GUI:setVisible(self.view.equip_root, false)
  72. self:bagBtnUpdate()
  73. elseif self.args.equip_pos == "depots" then
  74. GUI:setVisible(self.view.bag_root, true)
  75. GUI:setVisible(self.view.equip_root, false)
  76. self:depotsBtnUpdate()
  77. elseif self.args.equip_pos == "equip" then
  78. GUI:setVisible(self.view.equip_root, true)
  79. GUI:setVisible(self.view.bag_root, false)
  80. local wearBarId = SL:GetEquipValue(EMetaVarGetKey.EQUIP_WEAR_BAR_ID, nil, self.args.cfgId)
  81. if wearBarId[1] and wearBarId[1] > 2 then
  82. GUI:setVisible(self.view.duanzaobtn, false)
  83. elseif self.subType == 14 then
  84. GUI:setVisible(self.view.duanzaobtn, false)
  85. else
  86. GUI:setVisible(self.view.duanzaobtn, true)
  87. end
  88. if self.subType == 10 or self.subType == 11 or self.subType == 12 then
  89. GUI:setVisible(self.view.tuoxiabtn, false)
  90. GUI:setVisible(self.view.shengjibtn, true)
  91. else
  92. GUI:setVisible(self.view.tuoxiabtn, true)
  93. GUI:setVisible(self.view.shengjibtn, false)
  94. end
  95. elseif self.args.equip_pos == "synthesis" then
  96. GUI:setVisible(self.view.left_btn, true)
  97. GUI:setVisible(self.view.right_btn, true)
  98. GUI:setVisible(self.view.equip_root, false)
  99. GUI:Button_setTitleText(self.view.left_btn, "取消")
  100. GUI:Button_setTitleText(self.view.right_btn, "替换")
  101. else
  102. GUI:setVisible(self.view.equip_root, false)
  103. GUI:setVisible(self.view.bag_root, false)
  104. --没有下方二个按钮的模型位置(equip_pos不是bag)
  105. --GUI:setPositionY(self.view.model1, -220)
  106. end
  107. GUI:DataListUpdateData(self.view.all_info_data)
  108. end
  109. ---注册UI事件和服务器消息
  110. function this:RegistEvents()
  111. GUI:AddOnClickEvent(self.view.background_close, self, self.CloseEquipTips)
  112. GUI:AddOnClickEvent(self.view.left_btn, self, self.BtnLeftOnClick)
  113. GUI:AddOnClickEvent(self.view.right_btn, self, self.BtnRightOnClick)
  114. --GUI:AddOnClickEvent(self.view.tuoxiabtn, self, self.TakeOffEquip)
  115. --GUI:AddOnClickEvent(self.view.shengjibtn, self, self.ShengJi)
  116. --GUI:AddOnClickEvent(self.view.duanzaobtn, self, self.ForgeOnClick)
  117. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_OTHER_ANGE_GRAIL_INFO, self.RES_OTHER_ANGE_GRAIL_INFO, self)
  118. end
  119. function this:HaveGrail()
  120. local grailInfo = InfoManager.archangeEquipInfo:GetGrailInfo(self.args.id)
  121. if not grailInfo then
  122. grailInfo = self.otherGrail
  123. end
  124. if not grailInfo then
  125. self:NoHaveGrail()
  126. return
  127. end
  128. local itemTbl = SL:GetConfig("cfg_item", self.args.cfgId)
  129. GUI:Text_setTextColor(self.view.item_name, SL:GetConfig("cfg_color", tonumber(itemTbl.color), "id").color)
  130. if grailInfo.level > 0 then
  131. GUI:Text_setString(self.view.item_name, itemTbl.name .. "+" .. tostring(grailInfo.level))
  132. else
  133. GUI:Text_setString(self.view.item_name, itemTbl.name)
  134. end
  135. ---@type CommonProtos.Item
  136. local iteminfo = SL:GetPosItemInfo(self.args.equip_pos, self.args.cfgId, self.args.id)
  137. if not iteminfo then
  138. GUI:setVisible(self.view.bing_text, false)
  139. else
  140. GUI:setVisible(self.view.bing_text, true)
  141. if iteminfo.bind then
  142. GUI:Text_setString(self.view.bing_text, "不可交易")
  143. else
  144. GUI:Text_setString(self.view.bing_text, "可交易")
  145. end
  146. end
  147. if grailInfo.score and grailInfo.score ~= 0 then
  148. GUI:Text_setString(self.view.score_text, "圣杯评分:" .. tostring(grailInfo.score))
  149. GUI:setVisible(self.view.score_text, true)
  150. else
  151. GUI:setVisible(self.view.score_text, false)
  152. end
  153. GUI:Text_setString(self.view.rant_text, "圣杯阶数:" .. tostring(grailInfo.grailGrade) .. "阶")
  154. local grailQuality = SL:GetConfig("cfg_equip_angelGrail", grailInfo.itemConfigId, "id").grailQuality
  155. GUI:Text_setString(self.view.quality_text, "圣杯品质:<color='" .. E_ArchangelGrailQualityColor[grailQuality] .. "'>" .. E_ArchangelGrailQualityName[grailQuality] .. "</color>")
  156. self.all_info = {}
  157. ---主属性
  158. table.insert(self.all_info, { title = "tips_attribute27" })
  159. local maxAtt = nil
  160. local minAtt = nil
  161. for i, v in pairs(grailInfo.main) do
  162. if tonumber(v.attrId) == 200021 then
  163. maxAtt = v.value
  164. if minAtt then
  165. table.insert(self.all_info, { name = "攻击力", value = tostring(minAtt) .. "~" .. tostring(maxAtt), color = E_ArchangelGrailQualityColor[SL:GetConfig("cfg_equip_angelEntry", v.id, "id").attQuality] })
  166. minAtt = nil
  167. maxAtt = nil
  168. end
  169. elseif tonumber(v.attrId) == 200011 then
  170. minAtt = v.value
  171. if maxAtt then
  172. table.insert(self.all_info, { name = "攻击力", value = tostring(minAtt) .. "~" .. tostring(maxAtt), color = E_ArchangelGrailQualityColor[SL:GetConfig("cfg_equip_angelEntry", v.id, "id").attQuality] })
  173. minAtt = nil
  174. maxAtt = nil
  175. end
  176. else
  177. ---@type cfg_att_info_column
  178. local attTbl = SL:GetConfig("cfg_att_info", tonumber(v.attrId), "id")
  179. local strName = attTbl.name
  180. local strValeue = ""
  181. if attTbl.remarks == 2 then
  182. strValeue = tostring(v.value / 100) .. "%"
  183. else
  184. strValeue = tostring(v.value)
  185. end
  186. --SL:GetConfig("cfg_equip_angelEntry",v.id,"id").attQuality
  187. table.insert(self.all_info, { name = strName, value = strValeue, color = E_ArchangelGrailQualityColor[SL:GetConfig("cfg_equip_angelEntry", v.id, "id").attQuality] })
  188. end
  189. end
  190. ---副属性
  191. table.insert(self.all_info, { title = "tips_attribute26" })
  192. maxAtt = nil
  193. minAtt = nil
  194. if grailInfo.secondary then
  195. for i, v in pairs(grailInfo.secondary) do
  196. for _, k in pairs(v) do
  197. if tonumber(k.attrId) == 200021 then
  198. maxAtt = k.value
  199. if minAtt then
  200. table.insert(self.all_info, { name = "攻击力", value = tostring(minAtt) .. "~" .. tostring(maxAtt), color = v.color })
  201. minAtt = nil
  202. maxAtt = nil
  203. end
  204. elseif tonumber(k.attrId) == 200011 then
  205. minAtt = k.value
  206. if maxAtt then
  207. table.insert(self.all_info, { name = "攻击力", value = tostring(minAtt) .. "~" .. tostring(maxAtt), color = v.color })
  208. minAtt = nil
  209. maxAtt = nil
  210. end
  211. else
  212. ---@type cfg_att_info_column
  213. local attTbl = SL:GetConfig("cfg_att_info", tonumber(k.attrId), "id")
  214. local strName = attTbl.name
  215. local strValeue = ""
  216. if attTbl.remarks == 2 then
  217. strValeue = tostring(k.value / 100) .. "%"
  218. else
  219. strValeue = tostring(k.value)
  220. end
  221. --SL:GetConfig("cfg_equip_angelEntry",k.id,"id").attQuality
  222. table.insert(self.all_info, { name = strName, value = strValeue, color = E_ArchangelGrailQualityColor[SL:GetConfig("cfg_equip_angelEntry", k.id, "id").attQuality] })
  223. end
  224. end
  225. end
  226. end
  227. ---圣杯套装
  228. table.insert(self.all_info, { title = "tips_attribute2" })
  229. table.insert(self.all_info, { name = "融合一定数量该圣杯,即可获得额外效果", value = "", isSuit = true, color = "#e6e600" })
  230. ---@type cfg_equip_angelGrail_column
  231. local tbl = SL:GetConfig("cfg_equip_angelGrail", self.args.cfgId)
  232. ---@type cfg_equip_angelGrailSuit_column[]
  233. local angelGrailTbl = SL:GetConfigTable("cfg_equip_angelGrailSuit")
  234. for _, v in pairs(angelGrailTbl) do
  235. if v.group == tbl.grailGrade and v.level == tbl.grailQuality then
  236. local count = InfoManager.archangeEquipInfo:GetGrailSuitCount(v.group, v.level) or 0
  237. local groupInfo = InfoManager.archangeEquipInfo:GetGrailGroupInfo(v.group) or {}
  238. local heightCount = 0
  239. for m, n in pairs(groupInfo) do
  240. if m > v.level then
  241. heightCount = heightCount + n
  242. end
  243. end
  244. table.insert(self.all_info, { name = v.name, value = "(" .. count .. "/7)", isSuit = true, color = "#ff8a00" })
  245. for j, k in pairs(v.suitEffect) do
  246. local colorStr = "#999999"
  247. if k[1] <= count and k[1] > heightCount then
  248. colorStr = E_ArchangelGrailQualityColor[v.level]
  249. end
  250. ---@type cfg_att_info_column
  251. local attTbl = SL:GetConfig("cfg_att_info", tonumber(k[2]))
  252. local strValeue = ""
  253. if attTbl.remarks == 2 then
  254. strValeue = tostring(k[3] / 100) .. "%"
  255. else
  256. strValeue = tostring(k[3])
  257. end
  258. table.insert(self.all_info, { name = k[1] .. "件套效果", value = attTbl.name .. "+" .. strValeue, color = colorStr, isSuit = true })
  259. end
  260. break
  261. end
  262. end
  263. end
  264. function this:NoHaveGrail()
  265. GUI:Text_setString(self.view.bing_text, "可交易")
  266. ---@type cfg_equip_angelGrail_column
  267. local grailTbl = SL:GetConfig("cfg_equip_angelGrail", self.args.cfgId, "id")
  268. GUI:setVisible(self.view.score_text, false)
  269. GUI:Text_setString(self.view.rant_text, "圣杯阶数:" .. tostring(grailTbl.grailGrade) .. "阶")
  270. local grailQuality = grailTbl.grailQuality
  271. GUI:Text_setString(self.view.quality_text, "圣杯品质:<color='" .. E_ArchangelGrailQualityColor[grailQuality] .. "'>" .. E_ArchangelGrailQualityName[grailQuality] .. "</color>")
  272. self.all_info = {}
  273. table.insert(self.all_info, { title = "tips_attribute27" })
  274. --主词条
  275. local entryGroup = grailTbl.mainAttGroup
  276. ---@type cfg_equip_angelEntry_column[]
  277. local mainEntry = SL:FindConfigs("cfg_equip_angelEntry", "group", entryGroup)
  278. --走表的老铁 todo
  279. local data = {}
  280. local maxAtt = nil
  281. local minAtt = nil
  282. for i, v in pairs(mainEntry) do
  283. for _, att in pairs(v.att) do
  284. local attTbl = SL:GetConfig("cfg_att_info", tonumber(att[1]), "id")
  285. local strName = attTbl.name
  286. local strValeue
  287. if tonumber(att[1]) == 200021 then
  288. maxAtt = att[3]
  289. if minAtt then
  290. if minAtt == maxAtt then
  291. table.insert(self.all_info, { name = "攻击力", value = tostring(minAtt), color = E_ArchangelGrailQualityColor[v.attQuality] })
  292. else
  293. table.insert(self.all_info, { name = "攻击力", value = tostring(minAtt) .. "~" .. tostring(maxAtt), color = E_ArchangelGrailQualityColor[v.attQuality] })
  294. end
  295. minAtt = nil
  296. maxAtt = nil
  297. end
  298. elseif tonumber(att[1]) == 200011 then
  299. minAtt = att[2]
  300. if maxAtt then
  301. if minAtt == maxAtt then
  302. table.insert(self.all_info, { name = "攻击力", value = tostring(minAtt), color = E_ArchangelGrailQualityColor[v.attQuality] })
  303. else
  304. table.insert(self.all_info, { name = "攻击力", value = tostring(minAtt) .. "~" .. tostring(maxAtt), color = E_ArchangelGrailQualityColor[v.attQuality] })
  305. end
  306. minAtt = nil
  307. maxAtt = nil
  308. end
  309. else
  310. if att[2] == att[3] then
  311. if attTbl.remarks == 2 then
  312. strValeue = tostring(att[2] / 100) .. "%"
  313. else
  314. strValeue = tostring(att[2])
  315. end
  316. else
  317. if attTbl.remarks == 2 then
  318. strValeue = tostring(att[2] / 100) .. "%~" .. tostring(att[3] / 100) .. "%"
  319. else
  320. strValeue = tostring(att[2]) .. "~" .. tostring(att[3])
  321. end
  322. end
  323. table.insert(self.all_info, { name = strName, value = strValeue, color = E_ArchangelGrailQualityColor[v.attQuality] })
  324. end
  325. end
  326. end
  327. table.insert(self.all_info, { title = "tips_attribute26" })
  328. local haveEntry = {}
  329. --副词条
  330. entryGroup = grailTbl.randomAttGroup
  331. -- 存储词条信息
  332. for _, v in pairs(entryGroup) do
  333. for _, j in pairs(v) do
  334. ---@type cfg_equip_angelEntry_column[]
  335. local entry = SL:FindConfigs("cfg_equip_angelEntry", "group", j)
  336. for _, c in pairs(entry) do
  337. for _, att in pairs(c.att) do
  338. if not haveEntry[att[1]] then
  339. haveEntry[att[1]] = {}
  340. haveEntry[att[1]].att = {}
  341. end
  342. table.insert(haveEntry[att[1]].att, { value = att[2], color = E_ArchangelGrailQualityColor[c.attQuality] })
  343. end
  344. end
  345. end
  346. end
  347. maxAtt = nil
  348. minAtt = nil
  349. for i, v in pairs(haveEntry) do
  350. table.sort(v.att, function(a, b)
  351. return a.value < b.value
  352. end)
  353. local attTbl = SL:GetConfig("cfg_att_info", tonumber(i), "id")
  354. local strName = attTbl.name
  355. local strValeue
  356. if i == 200021 then
  357. maxAtt = v.att[table.count(v.att)]
  358. if minAtt then
  359. if minAtt.value == maxAtt.value then
  360. table.insert(self.all_info, { name = "攻击力", value = tostring(minAtt.value) })
  361. else
  362. table.insert(self.all_info, { name = "攻击力", value = "<color='" .. minAtt.color .. "'>" .. tostring(minAtt.value) .. "</color>~<color='" .. maxAtt.color .. "'>" .. tostring(maxAtt.value) .. "</color>" })
  363. end
  364. minAtt = nil
  365. maxAtt = nil
  366. end
  367. elseif i == 200011 then
  368. minAtt = v.att[1]
  369. if maxAtt then
  370. if minAtt.value == maxAtt.value then
  371. table.insert(self.all_info, { name = "攻击力", value = tostring(minAtt.value) })
  372. else
  373. table.insert(self.all_info, { name = "攻击力", value = "<color='" .. minAtt.color .. "'>" .. tostring(minAtt.value) .. "</color>~<color='" .. maxAtt.color .. "'>" .. tostring(maxAtt.value) .. "</color>" })
  374. end
  375. minAtt = nil
  376. maxAtt = nil
  377. end
  378. else
  379. if v.att[1].value == v.att[table.count(v.att)].value then
  380. if attTbl.remarks == 2 then
  381. strValeue = "<color='" .. v.att[table.count(v.att)].color .. "'>" .. tostring(v.att[table.count(v.att)].value / 100) .. "%</color>"
  382. else
  383. strValeue = "<color='" .. v.att[table.count(v.att)].color .. "'>" .. tostring(v.att[table.count(v.att)].value) .. "</color>"
  384. end
  385. else
  386. if attTbl.remarks == 2 then
  387. strValeue = "<color='" .. v.att[1].color .. "'>" .. tostring(v.att[1].value / 100) .. "%</color>~<color='" .. v.att[table.count(v.att)].color .. "'>" .. tostring(v.att[table.count(v.att)].value / 100) .. "%</color>"
  388. else
  389. strValeue = "<color='" .. v.att[1].color .. "'>" .. tostring(v.att[1].value) .. "</color>~<color='" .. v.att[table.count(v.att)].color .. "'>" .. tostring(v.att[table.count(v.att)].value) .. "</color>"
  390. end
  391. end
  392. table.insert(self.all_info, { name = strName, value = strValeue })
  393. end
  394. end
  395. end
  396. function this:CloseEquipTips()
  397. GUI:UIPanel_Close("dev/outui/Archangel/Panel/KLArchangelGrailTips/KLArchangelGrailTipsPanel")
  398. end
  399. function this:Close()
  400. if self.Schedule1 then
  401. SL:UnSchedule(self.Schedule1)
  402. end
  403. end
  404. function this:EquipAttrDataListItemCountFunc()
  405. return #self.all_info
  406. end
  407. function this:EquipAttrDataListItemGetFunc(realIndex)
  408. end
  409. function this:EquipAttrDataListItemInitFunc(realIndex, kmlcontrol)
  410. end
  411. function this:EquipAttrDataListItemUpdateFunc(realIndex, kmlcontrol)
  412. local data = self.all_info[realIndex + 1]
  413. local root = GUI:GetChildControl(self.view.all_info_data, realIndex, "root")
  414. local title = GUI:GetChildControl(self.view.all_info_data, realIndex, "title")
  415. local di = GUI:GetChildControl(self.view.all_info_data, realIndex, "di")
  416. local bg = GUI:GetChildControl(self.view.all_info_data, realIndex, "bg")
  417. local value = GUI:GetChildControl(self.view.all_info_data, realIndex, "value")
  418. local desc = GUI:GetChildControl(self.view.all_info_data, realIndex, "desc")
  419. if data.title then
  420. GUI:setContentSize(root, 350, 25)
  421. GUI:setVisible(title, true)
  422. GUI:setVisible(di, true)
  423. GUI:setVisible(value, false)
  424. GUI:setVisible(desc, false)
  425. GUI:setVisible(bg, false)
  426. GUI:Image_loadTexture(title, data.title, "Atlas/TipsAttTitle.spriteatlas")
  427. else
  428. GUI:setContentSize(root, 350, 16)
  429. GUI:setVisible(title, false)
  430. GUI:setVisible(di, false)
  431. GUI:setVisible(value, true)
  432. GUI:setVisible(bg, true)
  433. local value_str = data.name .. " " .. data.value
  434. GUI:Text_setString(value, value_str)
  435. if data.color then
  436. GUI:Text_setTextColor(value, data.color)
  437. end
  438. if not data.isSuit then
  439. if data.color == E_ArchangelGrailQualityColor[E_ArchangelGrailQuality.Green] then
  440. GUI:Image_loadTexture(bg, "bg_tips_1", "Atlas/UIArchangelGrail.spriteatlas")
  441. elseif data.color == E_ArchangelGrailQualityColor[E_ArchangelGrailQuality.Blue] then
  442. GUI:Image_loadTexture(bg, "bg_tips_2", "Atlas/UIArchangelGrail.spriteatlas")
  443. elseif data.color == E_ArchangelGrailQualityColor[E_ArchangelGrailQuality.Purple] then
  444. GUI:Image_loadTexture(bg, "bg_tips_3", "Atlas/UIArchangelGrail.spriteatlas")
  445. elseif data.color == E_ArchangelGrailQualityColor[E_ArchangelGrailQuality.Golden] then
  446. GUI:Image_loadTexture(bg, "bg_tips_4", "Atlas/UIArchangelGrail.spriteatlas")
  447. elseif data.color == E_ArchangelGrailQualityColor[E_ArchangelGrailQuality.Color] then
  448. GUI:Image_loadTexture(bg, "bg_tips_5", "Atlas/UIArchangelGrail.spriteatlas")
  449. end
  450. end
  451. if data.desc then
  452. GUI:setVisible(desc, true)
  453. GUI:Text_setString(desc, data.desc)
  454. end
  455. if data.descColor then
  456. GUI:Text_setTextColor(desc, data.descColor)
  457. end
  458. end
  459. end
  460. function this:depotsBtnUpdate()
  461. GUI:setVisible(self.view.left_btn, true)
  462. GUI:Button_setTitleText(self.view.left_btn, "丢弃")
  463. GUI:setVisible(self.view.right_btn, true)
  464. GUI:Button_setTitleText(self.view.right_btn, "取出")
  465. self.left_all = {{"11"}}
  466. end
  467. function this:bagBtnUpdate()
  468. local leftButton = SL:GetEquipValue(EMetaVarGetKey.EQUIP_TIPS_LEFT_BUTTON, self.args.equip_pos, self.args.cfgId, self.args.id)
  469. local rightButton = SL:GetEquipValue(EMetaVarGetKey.EQUIP_TIPS_RIGHT_BUTTON, self.args.equip_pos, self.args.cfgId, self.args.id)
  470. local isDelete = SL:GetConfig("cfg_item", self.args.cfgId).isDelete
  471. self.left_all = {}
  472. self.left_all_item = {}
  473. for i, v in ipairs(leftButton) do
  474. -- for j, btn_type in ipairs(v) do
  475. -- if btn_type == "9" and isDelete == 0 then
  476. -- else
  477. -- table.insert(self.left_all, btn_type)
  478. -- end
  479. -- end
  480. local btn_type = v[1]
  481. if btn_type == "9" and isDelete == 0 then
  482. else
  483. table.insert(self.left_all, v)
  484. end
  485. end
  486. self.right_all = {}
  487. self.right_all_item = {}
  488. for i, v in ipairs(rightButton) do
  489. -- for j, btn_type in ipairs(v) do
  490. -- if btn_type == "9" and isDelete == 0 then
  491. -- else
  492. -- table.insert(self.right_all, btn_type)
  493. -- end
  494. -- end
  495. local btn_type = v[1]
  496. if btn_type == "9" and isDelete == 0 then
  497. else
  498. table.insert(self.right_all, v)
  499. end
  500. end
  501. self.left_is_open = false
  502. local ui = GUI:GetUI("dev/outui/Archangel/Panel/KLArchangelGrail/KLArchangelGrailPanel")
  503. if not ui then
  504. if #self.left_all < 1 then
  505. GUI:setVisible(self.view.left_btn, false)
  506. elseif #self.left_all == 1 then
  507. GUI:setVisible(self.view.left_btn, true)
  508. local str = self:getBtnName(self.left_all[1])
  509. GUI:Button_setTitleText(self.view.left_btn, str)
  510. else
  511. GUI:setVisible(self.view.left_btn, true)
  512. GUI:Button_setTitleText(self.view.left_btn, "更多")
  513. GUI:DataListInitData(self.view.left_data_list, function()
  514. return self:LeftDataListItemCountFunc()
  515. end, function(realIndex)
  516. return self:LeftDataListItemGetFunc(realIndex)
  517. end, function(realIndex, kmlcontrol)
  518. return self:LeftDataListItemInitFunc(realIndex, kmlcontrol)
  519. end, function(realIndex, kmlcontrol)
  520. return self:LeftDataListItemUpdateFunc(realIndex, kmlcontrol)
  521. end)
  522. end
  523. end
  524. if GUI:GetUI("dev/ui/Bag/Panel/KLDepots/KLDepotsPanel") then
  525. GUI:setVisible(self.view.right_btn, true)
  526. GUI:Button_setTitleText(self.view.right_btn, "放入")
  527. return
  528. end
  529. self.right_is_open = false
  530. if ui then
  531. GUI:setVisible(self.view.left_btn, true)
  532. GUI:setVisible(self.view.right_btn, true)
  533. GUI:Button_setTitleText(self.view.left_btn, "分解")
  534. GUI:Button_setTitleText(self.view.right_btn, "融合")
  535. return
  536. end
  537. if #self.right_all < 1 then
  538. GUI:setVisible(self.view.right_btn, false)
  539. elseif #self.right_all == 1 then
  540. GUI:setVisible(self.view.right_btn, true)
  541. local str = self:getBtnName(self.right_all[1])
  542. GUI:Button_setTitleText(self.view.right_btn, str)
  543. else
  544. GUI:setVisible(self.view.right_btn, true)
  545. GUI:Button_setTitleText(self.view.right_btn, "更多")
  546. GUI:DataListInitData(self.view.right_data_list, function()
  547. return self:RightDataListItemCountFunc()
  548. end, function(realIndex)
  549. return self:RightDataListItemGetFunc(realIndex)
  550. end, function(realIndex, kmlcontrol)
  551. return self:RightDataListItemInitFunc(realIndex, kmlcontrol)
  552. end, function(realIndex, kmlcontrol)
  553. return self:RightDataListItemUpdateFunc(realIndex, kmlcontrol)
  554. end)
  555. end
  556. end
  557. function this:BtnLeftOnClick()
  558. ---@type KLArchangelGrailPanel
  559. local archangelGroup = GUI:GetUI("dev/outui/Archangel/Panel/KLArchangelGroup/KLArchangelGroupPanel")
  560. if archangelGroup then
  561. GUI:Toggle_setIsOn(archangelGroup.view.decomposeToggle, true)
  562. self:CloseEquipTips()
  563. return
  564. end
  565. if #self.left_all < 1 then
  566. elseif #self.left_all == 1 then
  567. local btnType = self.left_all[1][1]
  568. if not InfoManager.equipOrItemTipsInfo:IsCanOnClickButton(self.left_all[1]) then
  569. return
  570. end
  571. if btnType == "0" then
  572. self:CloseEquipTips()
  573. elseif btnType == "2" then
  574. self:CloseEquipTips()
  575. elseif btnType == "3" then
  576. self:PutOneEquip()
  577. elseif btnType == "9" then
  578. local name = SL:GetEquipValue(EMetaVarGetKey.EQUIP_NAME, self.args.equip_pos, self.args.cfgId, self.args.id)
  579. SL:CommonTipsMessage({ showTips = "是否摧毁" .. name,
  580. ui = self,
  581. sureBtnText = "确定",
  582. cancelBtnText = "取消",
  583. callback = self.DestroyItem
  584. })
  585. elseif btnType == "10" then
  586. self:JieFeng()
  587. elseif btnType == "11" then
  588. self:DiuQi()
  589. elseif btnType == "13" then
  590. self:Decompose()
  591. elseif btnType == "99" then
  592. self:OpenPanel(self.left_all[1])
  593. end
  594. else
  595. if not self.left_is_open then
  596. GUI:setVisible(self.view.left_btn_content, true)
  597. self.left_is_open = true
  598. GUI:DataListUpdateData(self.view.left_data_list)
  599. else
  600. GUI:setVisible(self.view.left_btn_content, false)
  601. self.left_is_open = false
  602. end
  603. end
  604. end
  605. function this.DestroyItem(returnData)
  606. local ui = returnData.ui
  607. local index = SL:GetBagIndex(ui.args.id)
  608. SL:ReqDestroyItemMessage(index)
  609. ui:CloseEquipTips()
  610. end
  611. function this:getBtnName(data)
  612. local btn_type = data[1]
  613. if btn_type == "0" then
  614. return "取消"
  615. elseif btn_type == "1" then
  616. return "使用"
  617. elseif btn_type == "2" then
  618. return "回收"
  619. elseif btn_type == "3" then
  620. return "穿戴"
  621. elseif btn_type == "4" then
  622. return "强化"
  623. elseif btn_type == "5" then
  624. return "上架"
  625. elseif btn_type == "6" then
  626. return "合并"
  627. elseif btn_type == "7" then
  628. return "拆分"
  629. elseif btn_type == "8" then
  630. return "批量使用"
  631. elseif btn_type == "9" then
  632. return "摧毁"
  633. elseif btn_type == "10" then
  634. return "解封"
  635. elseif btn_type == "11" then
  636. return "丢弃"
  637. elseif btn_type == "13" then
  638. return "分解"
  639. elseif btn_type == "14" then
  640. return "装备"
  641. elseif btn_type == "99" then
  642. return data[2]
  643. end
  644. return ""
  645. end
  646. function this:LeftDataListItemCountFunc()
  647. return #self.left_all
  648. end
  649. function this:LeftDataListItemGetFunc(realIndex)
  650. local data = self.left_all[realIndex + 1]
  651. local str = self:getBtnName(data)
  652. local message = { equip_pos = self.args.equip_pos, cfgId = self.args.cfgId, id = self.args.id, btnType = data, nameStr = str }
  653. local item = GUI:UIPanel_Open("dev/ui/Tips/Item/KLUITips/KLTipBtntem", self.view.left_data_list, self, message, true)
  654. self.left_all_item[item.view.root] = item
  655. return item.view.root
  656. end
  657. function this:LeftDataListItemInitFunc(realIndex, kmlcontrol)
  658. end
  659. function this:LeftDataListItemUpdateFunc(realIndex, kmlcontrol)
  660. end
  661. function this:BtnRightOnClick()
  662. ---@type KLArchangelGrailPanel
  663. local archangelGrail = GUI:GetUI("dev/outui/Archangel/Panel/KLArchangelGrail/KLArchangelGrailPanel")
  664. if archangelGrail then
  665. archangelGrail:Fusion(self.args.id, self.args.cfgId)
  666. self:CloseEquipTips()
  667. return
  668. end
  669. if self.args.equip_pos == "depots" then
  670. local storeIndex = SL:GetDepotsIndex(self.args.id)
  671. SL.Equip:ReqStoreTakeButtonMessage(storeIndex)
  672. self:CloseEquipTips()
  673. return
  674. end
  675. local depotPanel = GUI:GetUI("dev/ui/Bag/Panel/KLDepots/KLDepotsPanel")
  676. if depotPanel then
  677. local BagIndex = SL:GetBagIndex(self.args.id)
  678. if depotPanel.bagType == "privilege" then
  679. SL.Equip:ReqBagPutStoreButtonMessage(BagIndex, SL:GetDepotsCurPage() + depotPanel.maxDepotsPages)
  680. else
  681. SL.Equip:ReqBagPutStoreButtonMessage(BagIndex, SL:GetDepotsCurPage())
  682. end
  683. self:CloseEquipTips()
  684. return
  685. end
  686. if #self.right_all < 1 then
  687. elseif #self.right_all == 1 then
  688. local btnType = self.right_all[1][1]
  689. if not InfoManager.equipOrItemTipsInfo:IsCanOnClickButton(self.right_all[1]) then
  690. return
  691. end
  692. if btnType == "0" then
  693. self:CloseEquipTips()
  694. elseif btnType == "1" then
  695. self:UseItem()
  696. elseif btnType == "2" then
  697. self:CloseEquipTips()
  698. elseif btnType == "3" then
  699. self:PutOneEquip()
  700. elseif btnType == "9" then
  701. SL:CommonTipsMessage({ showTips = "是否摧毁" .. name,
  702. ui = self,
  703. sureBtnText = "确定",
  704. cancelBtnText = "取消",
  705. callback = self.DestroyItem
  706. })
  707. elseif btnType == "10" then
  708. self:JieFeng()
  709. elseif btnType == "11" then
  710. self:DiuQi()
  711. elseif btnType == "13" then
  712. self:Decompose()
  713. elseif btnType == "14" then
  714. --准备坐骑道具
  715. local panel = GUI:GetUI("dev/outui/Mount/Panel/KLMountEquip/KLMountEquipPanel")
  716. if panel then
  717. local BagIndex = SL:GetBagIndex(self.args.id)
  718. ---@type cfg_item_column
  719. local tbl = SL:GetConfig("cfg_item", self.args.cfgId, "id")
  720. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_MOUNT_PUT_ON_ITEM, { self.args.mountId, BagIndex, tbl.subType, self.args.cfgId, self.args.id })
  721. else
  722. GUI:UIPanel_Open("dev/outui/Mount/Panel/KLMountStore/KLMountStorePanel", nil, nil)
  723. GUI:UIPanel_Close("dev/ui/Bag/Panel/KLUIBag/KLUIBagPanel")
  724. end
  725. self:CloseEquipTips()
  726. elseif btnType == "99" then
  727. self:OpenPanel(self.right_all[1])
  728. end
  729. else
  730. if not self.right_is_open then
  731. GUI:setVisible(self.view.right_btn_content, true)
  732. self.right_is_open = true
  733. GUI:DataListUpdateData(self.view.right_data_list)
  734. else
  735. GUI:setVisible(self.view.right_btn_content, false)
  736. self.right_is_open = false
  737. end
  738. end
  739. end
  740. function this:OpenPanel(btnType)
  741. if #btnType < 3 then
  742. return
  743. end
  744. self:CloseEquipTips()
  745. GUI:UIPanel_Close("dev/ui/Bag/Panel/KLUIBag/KLUIBagPanel")
  746. GUI:UIPanel_Close("dev/ui/Equip/Panel/KLEquipUI/KLEquipUIPanel")
  747. local panel = btnType[4]
  748. if #btnType == 4 then
  749. GUI:UIPanel_Open(panel)
  750. elseif #btnType == 5 then
  751. local num = btnType[5]
  752. if tonumber(num) then
  753. num = tonumber(num)
  754. end
  755. GUI:UIPanel_Open(panel, nil, nil, num)
  756. elseif #btnType >= 7 then
  757. local message = {}
  758. for i = 5, #btnType - 2, 3 do
  759. if btnType[i] and btnType[i + 1] and btnType[i + 2] then
  760. if btnType[i + 1] == "string" then
  761. message[btnType[i]] = btnType[i + 2]
  762. else
  763. message[btnType[i]] = tonumber(btnType[i + 2])
  764. end
  765. end
  766. end
  767. GUI:UIPanel_Open(panel, nil, nil, message)
  768. end
  769. SL.HideMainPanel()
  770. end
  771. function this:RightDataListItemCountFunc()
  772. return #self.right_all
  773. end
  774. function this:RightDataListItemGetFunc(realIndex)
  775. local data = self.right_all[realIndex + 1]
  776. local str = self:getBtnName(data)
  777. local message = { equip_pos = self.args.equip_pos, cfgId = self.args.cfgId, id = self.args.id, btnType = data, nameStr = str }
  778. local item = GUI:UIPanel_Open("dev/ui/Tips/Item/KLUITips/KLTipBtntem", self.view.right_data_list, self, message, true)
  779. self.right_all_item[item.view.root] = item
  780. return item.view.root
  781. end
  782. function this:RightDataListItemInitFunc(realIndex, kmlcontrol)
  783. end
  784. function this:RightDataListItemUpdateFunc(realIndex, kmlcontrol)
  785. end
  786. function this:RES_OTHER_ANGE_GRAIL_INFO(_, message)
  787. self.otherGrail = message[tostring(self.args.id)]
  788. self:Refresh()
  789. end
  790. function this:DiuQi()
  791. local index = SL:GetDepotsIndex(self.args.id)
  792. if index then
  793. SL:ReqStoreGiveUpItemMessage(index)
  794. end
  795. self:CloseEquipTips()
  796. end
  797. return this