KLEquipAppendUIPanel.lua 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. ---@class KLEquipAppendUIPanel:UIKmlLuaPanelBase
  2. ---@field view KLEquipAppendUIPanelView
  3. --- kml代码lua化 会有较多冗余代码
  4. local KLEquipAppendUIPanel = class(UIKmlLuaPanelBase)
  5. local this =KLEquipAppendUIPanel
  6. ---创建时调用一次
  7. function this:Init()
  8. GUI:UIPanel_Open("dev/ui/Equip/Panel/KLEquipUI/KLEquipUIPanel",nil,nil, {x=-465, hideTips=true, callBack=self.CloseEquipUi,
  9. forgeGroupType=EForgeGroupType.Add},nil,function(equipPanel)
  10. self.equipPanel = equipPanel
  11. self:Refresh()
  12. end)
  13. self.bagIndex = nil
  14. self.equipIndex = nil
  15. self.strengthAttTextList = {}
  16. self.costList = {}
  17. self.showLiuGuang = false
  18. GUI:DataListInitData(self.view.strength_list, function()
  19. return table.count(self.strengthAttTextList)
  20. end,function()
  21. end,function()
  22. end,function(realIndex)
  23. local strengthInfo = self.strengthAttTextList[realIndex+1]
  24. local name = strengthInfo['attrName']
  25. local preValue = strengthInfo['preValue']
  26. local nextValue = strengthInfo['nextValue']
  27. local arrowShow = strengthInfo['arrowShow']
  28. local attControl = GUI:GetChildControl(self.view.strength_list,realIndex,'attrName')
  29. local preControl = GUI:GetChildControl(self.view.strength_list,realIndex,'preValue')
  30. local nextControl = GUI:GetChildControl(self.view.strength_list,realIndex,'nextValue')
  31. local arrowControl = GUI:GetChildControl(self.view.strength_list,realIndex,'arrow')
  32. local result = ""
  33. local len = utf8.len(name) -- 获取字符串的 UTF-8 长度
  34. local i = 1
  35. local j = 1
  36. -- 使用 utf8.offset 来逐个字符提取
  37. while i <= len do
  38. local char = utf8.sub(name, i, i+1)
  39. result = result .. char .. " "
  40. i = i+1 -- 移动到下一个字符
  41. end
  42. GUI:Text_setString(attControl, result)
  43. GUI:Text_setString(preControl, tostring(preValue))
  44. GUI:Text_setString(nextControl, tostring(nextValue))
  45. GUI:setVisible(arrowControl, arrowShow)
  46. end)
  47. GUI:DataListInitData(self.view.cost_list, function()
  48. return table.count(self.costList)
  49. end,function()
  50. end,function()
  51. end,function(realIndex)
  52. local costInfo = self.costList[realIndex+1]
  53. local cfgId = costInfo['cfgId']
  54. local needCount = costInfo['needCount']
  55. local itemControl = GUI:GetChildControl(self.view.cost_list,realIndex,'cost_item')
  56. local nameControl = GUI:GetChildControl(self.view.cost_list,realIndex,'cost_name')
  57. local numControl = GUI:GetChildControl(self.view.cost_list,realIndex,'cost_num')
  58. local costAddBtn = GUI:GetChildControl(self.view.cost_list,realIndex,'costAddBtn')
  59. if SL:GetConfig('cfg_item', cfgId) == nil then
  60. return
  61. end
  62. GUI:Item_setItemId(itemControl, cfgId)
  63. local name = SL:GetConfig('cfg_item', cfgId).name
  64. GUI:Text_setString(nameControl, name)
  65. local haveCount = SL:GetBagItemCount(cfgId)
  66. if haveCount < needCount then
  67. GUI:Text_setString(numControl, string.format('<color="#9b1818">%d</color>/%d', haveCount, needCount))
  68. else
  69. GUI:Text_setString(numControl, string.format('<color="#1add1f">%d</color>/%d', haveCount, needCount))
  70. end
  71. GUI:AddOnClickEvent(costAddBtn, self, self.costAddBtn, {cfgId=cfgId})
  72. end)
  73. end
  74. ---创建或者刷新界面数据时调用
  75. function this:Refresh()
  76. if not self.equipPanel then
  77. return
  78. end
  79. self.bagIndex = nil
  80. self.equipIndex = nil
  81. self:SelectEquip()
  82. end
  83. function this:costAddBtn(control, eventData)
  84. print (eventData)
  85. local cfgId = eventData.cfgId
  86. SL:CommonItemGetPath(nil, cfgId)
  87. end
  88. ---注册UI事件和服务器消息
  89. function this:RegistEvents()
  90. GUI:AddOnClickEvent(self.view.CloseButton, self, self.CloseButton)
  91. GUI:AddOnClickEvent(self.view.strengthButton, self, self.strengthButton)
  92. GUI:AddOnClickEvent(self.view.appendMasterBtn, self, self.AppendMasterBtn)
  93. GUI:AddOnClickEvent(self.view.item_model, self, self.item_modelOnClick)
  94. SL:RegisterLUAEvent(LUA_EVENT_EQUIP_GRID_CLICK, self.LUA_EVENT_EQUIP_GRID_CLICK, self)
  95. --SL:RegisterLUAEvent(LUA_EVENT_BAG_CHANGE_AFTER, self.LUA_EVENT_BAG_CHANGE_AFTER, self)
  96. SL:RegisterLuaNetMsg(LuaMessageIdToClient.APPEND_EQUIP_RESULT, self.APPEND_EQUIP_RESULT, self)
  97. GUI:SetToggleOnValueChange(self.view.equipBtn, self, self.equipBtn)
  98. GUI:SetToggleOnValueChange(self.view.bagBtn, self, self.ClickBag)
  99. SL:RegisterLUAEvent(LUA_EVENT_FORGE_GROUP_PANEL_CLOSE, self.CloseButton, self)
  100. end
  101. function this:equipBtn()
  102. self.equipPanel = GUI:UIPanel_Open("dev/ui/Equip/Panel/KLEquipUI/KLEquipUIPanel",nil,nil, {x=-465, hideTips=true, callBack=self.CloseEquipUi,forgeGroupType=EForgeGroupType.Add})
  103. GUI:UIPanel_Close("dev/outui/Bag/Panel/KLStrengthBag/KLStrengthBagPanel")
  104. self.selectItem = nil
  105. self:SelectEquip()
  106. end
  107. function this:item_modelOnClick()
  108. SL:OpenTips("equip",self.equipInfo.cfgId,self.equipInfo.id,nil, self.equipInfo, {hideBtn=true})
  109. end
  110. function this.CloseEquipUi()
  111. GUI:UIPanel_Close("dev/ui/UIForgeGroup/Panel/KLUIForgeGroup/KLUIForgeGroupPanel")
  112. GUI:UIPanel_Close("dev/ui/Equip/Panel/KLEquipUI/KLEquipUIPanel")
  113. GUI:UIPanel_Close("dev/outui/Equip/Panel/KLEquipAppendUI/KLEquipAppendUIPanel")
  114. end
  115. function this:closeMask()
  116. GUI:setVisible(self.view.equip_show_tips, false)
  117. end
  118. ---@param message {issuccess:boolean, appendlv:number, itemId:number}
  119. function this:APPEND_EQUIP_RESULT(id, message)
  120. GUI:SetActive(self.view.append_ok, false)
  121. GUI:SetActive(self.view.append_fail, false)
  122. if message.issuccess then
  123. GUI:SetActive(self.view.append_ok, true)
  124. else
  125. GUI:SetActive(self.view.append_fail, true)
  126. end
  127. SL:onLUAEvent(LUA_EVENT_APPEND_OK, message)
  128. self:ClickEquip(self.equipInfo)
  129. SL:RefreshPanelALLRedPoint("KLUIForgeGroupPanel")
  130. self.equipPanel:UpdateAllItem()
  131. end
  132. function this:strengthButton()
  133. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_APPEND_EQUIP,{itemId=self.equipInfo.id})
  134. -- self:STRENGTH_EQUIP_RESULT(_, {isSuccess = true})
  135. end
  136. function this:AppendMasterBtn()
  137. GUI:UIPanel_Open("dev/outui/Equip/Panel/KLUIForgingMaster/KLUIForgingMasterPanel", nil, nil, { uiType = 2, cfgId = self.equipInfo.cfgId })
  138. end
  139. function this:LUA_EVENT_BAG_CHANGE_AFTER(_,message)
  140. if self.isOpenBag then
  141. return
  142. end
  143. if not message then
  144. return
  145. end
  146. if self.equipInfo then
  147. local lv = EquipFunc.GetEquipAppendLevel(self.equipInfo)
  148. local isMax = this.IsMaxEquip(self.equipInfo,lv)
  149. if not isMax then
  150. self:SetEquipCostInfo(self.equipInfo.cfgId, lv)
  151. end
  152. end
  153. if self.updateEquipCo == nil then
  154. self.updateEquipCo = Coroutine.Start(function()
  155. Coroutine.Wait(0.2)
  156. self.equipPanel:UpdateAllItem()
  157. SL:RefreshPanelALLRedPoint("KLUIForgeGroupPanel")
  158. self.updateEquipCo = nil
  159. end)
  160. end
  161. end
  162. function this:LUA_EVENT_EQUIP_GRID_CLICK(_, index)
  163. local equip = SL:GetMetaValue("EQUIP_TARGET_DATA", 1, index)
  164. if index == E_AppearEquipType.Weapon and equip == nil then
  165. equip = SL:GetMetaValue("EQUIP_TARGET_DATA", 1, E_AppearEquipType.TwoHandWeapon)
  166. end
  167. if equip then
  168. local strength_tbl = SL:GetConfig('cfg_equip_appends', equip['cfgId'])
  169. if strength_tbl then
  170. self.bagIndex = nil
  171. self.equipPanel:SetSelectIndex(index)
  172. self:ClickEquip(equip)
  173. return
  174. else
  175. SL:TipMessage(SL:GetConfig('cfg_string',259).text, 1, NoticeType.NoticeMid )--"该装备无法被追加",
  176. end
  177. end
  178. end
  179. function this:CloseButton()
  180. GUI:UIPanel_Close("dev/ui/UIForgeGroup/Panel/KLUIForgeGroup/KLUIForgeGroupPanel")
  181. GUI:UIPanel_Close("dev/ui/Equip/Panel/KLEquipUI/KLEquipUIPanel")
  182. GUI:UIPanel_Close("dev/outui/Equip/Panel/KLEquipAppendUI/KLEquipAppendUIPanel")
  183. GUI:UIPanel_Close("dev/outui/Bag/Panel/KLStrengthBag/KLStrengthBagPanel")
  184. self.selectItem = nil
  185. end
  186. function this:Close()
  187. end
  188. function this:SelectEquip()
  189. if self.selectItem then
  190. local strength_tbl = SL:GetConfig('cfg_equip_appends', self.selectItem.item.cfgId)
  191. if strength_tbl then
  192. self.bagIndex = nil
  193. ---@type cfg_item_column
  194. local part = SL:GetConfig("cfg_item",self.selectItem.item.cfgId).subType
  195. self.equipPanel:SetSelectIndex(part)
  196. self:ClickEquip(self.selectItem.item)
  197. return
  198. end
  199. end
  200. -- 策划要求先选中武器
  201. local equip_boot = SL:GetMetaValue("EQUIP_TARGET_DATA", 1, EEquipSlotType.TwoHandWeapon)
  202. if equip_boot then
  203. local strength_tbl = SL:GetConfig('cfg_equip_appends', equip_boot['cfgId'])
  204. if strength_tbl then
  205. self.bagIndex = nil
  206. self.equipPanel:SetSelectIndex(EEquipSlotType.TwoHandWeapon)
  207. self:ClickEquip(equip_boot)
  208. return
  209. end
  210. end
  211. for index=1, 15 do
  212. local equip = SL:GetMetaValue("EQUIP_TARGET_DATA", 1, index)
  213. if equip then
  214. local strength_tbl = SL:GetConfig('cfg_equip_appends', equip['cfgId'])
  215. if strength_tbl then
  216. self.bagIndex = nil
  217. self.equipPanel:SetSelectIndex(index)
  218. self:ClickEquip(equip)
  219. return
  220. end
  221. end
  222. end
  223. GUI:setVisible(self.view.noticeText, true)
  224. end
  225. function this:ResetUi()
  226. GUI:setVisible(self.view.maxLevelTips, false)
  227. GUI:setVisible(self.view.strengthIcon, false)
  228. GUI:setVisible(self.view.baseSuccessRatioText, false)
  229. GUI:setVisible(self.view.successIcon, false)
  230. GUI:setVisible(self.view.strengthIcon_1, false)
  231. GUI:setVisible(self.view.StrengthCustomScrollView, false)
  232. GUI:setVisible(self.view.strengthButton, false)
  233. GUI:setVisible(self.view.strengthLevelBg, false)
  234. GUI:setVisible(self.view.maxStrengthLevelBg, false)
  235. GUI:setVisible(self.view.item_model, false)
  236. GUI:setVisible(self.view.equipName, false)
  237. GUI:setVisible(self.view.noticeText, false)
  238. GUI:setVisible(self.view.liuguangInfo, false)
  239. GUI:setVisible(self.view.appendMasterBtn, false)
  240. self.showLiuGuang = false
  241. end
  242. -- local testLevel = 0
  243. function this:ClickEquip(equipInfo)
  244. local strength_tbl = SL:GetConfig('cfg_equip_appends', equipInfo.cfgId)
  245. if strength_tbl then
  246. self.equipInfo = equipInfo
  247. self:ResetUi()
  248. local strengthLevel = EquipFunc.GetEquipAppendLevel(self.equipInfo)
  249. self:SetEquipName(self.equipInfo.cfgId, strengthLevel)
  250. self:SetEquipModel(self.equipInfo.cfgId)
  251. self:SetLiuGuang(self.equipInfo)
  252. local isMax = this.IsMaxEquip(self.equipInfo,strengthLevel)
  253. if isMax then
  254. GUI:setVisible(self.view.maxLevelTips, true)
  255. GUI:Text_setString(self.view.maxLevel, "+" .. strengthLevel)
  256. GUI:setVisible(self.view.maxStrengthLevelBg, true)
  257. self:SetMaxAttrInfo(self.equipInfo.cfgId, strengthLevel)
  258. else
  259. self:RefreshSuccessRatio(self.equipInfo.cfgId, strengthLevel)
  260. self:SetEquipLevelInfo(strengthLevel)
  261. self:SetEquipAttrInfo(self.equipInfo.cfgId, strengthLevel)
  262. self:SetEquipCostInfo(self.equipInfo.cfgId, strengthLevel)
  263. GUI:setVisible(self.view.strengthButton, true)
  264. self:SetEquipFailText(self.equipInfo.cfgId, strengthLevel)
  265. end
  266. -- testLevel = testLevel + 1
  267. end
  268. ---@type cfg_item_column
  269. local item = SL:GetConfig("cfg_item", equipInfo.cfgId)
  270. local masterId = tonumber(item.strPart[1] .. "02")
  271. ---@type cfg_equip_masterGroup_column
  272. local master = SL:GetConfig("cfg_equip_masterGroup", masterId)
  273. if master then
  274. GUI:setVisible(self.view.appendMasterBtn, true)
  275. else
  276. GUI:setVisible(self.view.appendMasterBtn, false)
  277. end
  278. end
  279. function this:SetLiuGuang(equipInfo)
  280. local liuGuangId = EquipFunc.GetEquipLiuGuangId(equipInfo)
  281. if liuGuangId then
  282. GUI:SetStreamAttr(self.view.item_model, liuGuangId)
  283. else
  284. GUI:ResetStreamAttr(self.view.item_model)
  285. end
  286. end
  287. function this:ClickBag()
  288. self:ResetUi()
  289. GUI:UIPanel_Close("dev/ui/Equip/Panel/KLEquipUI/KLEquipUIPanel")
  290. GUI:UIPanel_Open("dev/outui/Bag/Panel/KLStrengthBag/KLStrengthBagPanel", nil, nil, {x=-481, itemClickCallBack=self.itemClickCallBack,callBackUI=self},nil,nil,function(bag)
  291. self.bagTileScrollView = bag
  292. end)
  293. end
  294. function this:itemClickCallBack(control, item)
  295. if SL:HasConfig('cfg_equip_appends', item.cfgId) then
  296. local itemInfo = SL:GetItemInfoByItemId(item.id)
  297. self:ClickEquip(itemInfo)
  298. self:HideSelectItem(false)
  299. control.ui:SetSelect(true)
  300. self.selectItem = control.ui
  301. else
  302. SL:TipMessage( SL:GetConfig('cfg_string',259).text, 1, NoticeType.NoticeMid )--"该装备无法被追加",
  303. end
  304. end
  305. function this:HideSelectItem()
  306. if self.selectItem then
  307. self.selectItem:SetSelect(false)
  308. end
  309. end
  310. function this:SetMaxAttrInfo(cfgId, strengthLevel)
  311. self.strengthAttTextList = {}
  312. GUI:setVisible(self.view.strengthIcon, true)
  313. local groupId = SL:GetConfig('cfg_equip_appends', cfgId).groupId
  314. local nowAttrInfo = SL:GetConfigTwoKeys('cfg_equip_appendsGroup', groupId, strengthLevel, 'group', 'lv').att
  315. local now_attr_map = {}
  316. for _, nowAttr in pairs(nowAttrInfo) do
  317. now_attr_map[nowAttr[1]] = nowAttr[2]
  318. end
  319. local minAtk = now_attr_map[201021]
  320. local maxAtk = now_attr_map[201011]
  321. if minAtk and maxAtk then
  322. local tbl= {
  323. attrName = "攻击力",
  324. preValue = minAtk .. '~' .. maxAtk,
  325. nextValue = "",
  326. arrowShow = false
  327. }
  328. table.insert(self.strengthAttTextList, tbl)
  329. end
  330. local minMAtk = now_attr_map[202021]
  331. local maxMAtk = now_attr_map[202011]
  332. if minMAtk and maxMAtk then
  333. local tbl= {
  334. --attrName = "魔法攻击力",
  335. attrName = "攻击力",
  336. preValue = minMAtk .. '~' .. maxMAtk,
  337. nextValue = "",
  338. arrowShow = false
  339. }
  340. table.insert(self.strengthAttTextList, tbl)
  341. end
  342. minAtk = now_attr_map[200011]
  343. maxAtk = now_attr_map[200021]
  344. if minAtk and maxAtk then
  345. local tbl= {
  346. attrName = "攻击力",
  347. preValue = minAtk .. '~' .. maxAtk,
  348. nextValue = "",
  349. arrowShow = false
  350. }
  351. table.insert(self.strengthAttTextList, tbl)
  352. end
  353. for attrId, attrValue in pairs(now_attr_map) do
  354. if attrId ~= 201021 and attrId ~= 201011 and attrId ~= 202021 and attrId ~= 202011 and attrId ~= 200011 and attrId ~= 200021 then
  355. local name = SL:GetConfig("cfg_att_info", attrId).name
  356. local att_remark = SL:GetConfig("cfg_att_info", attrId).remarks
  357. local tbl = {}
  358. if att_remark == 1 then
  359. tbl = {
  360. attrName = name,
  361. preValue = attrValue,
  362. nextValue = "",
  363. arrowShow = false
  364. }
  365. else
  366. tbl = {
  367. attrName = name,
  368. preValue = attrValue/100 .. '%',
  369. nextValue = "",
  370. arrowShow = false
  371. }
  372. end
  373. table.insert(self.strengthAttTextList, tbl)
  374. end
  375. end
  376. GUI:DataListUpdateData(self.view.strength_list)
  377. end
  378. function this:SetEquipFailText(cfgId, strengthLevel)
  379. local costId = SL:GetConfig('cfg_equip_appends', cfgId).costId
  380. local fail_tips = SL:GetConfigTwoKeys('cfg_equip_appendsCost', costId, strengthLevel+1, 'costGroupId', 'level').tips
  381. if fail_tips then
  382. GUI:setVisible(self.view.failTips, true)
  383. GUI:Text_setString(self.view.failTips, fail_tips)
  384. end
  385. end
  386. function this:SetEquipCostInfo(cfgId, strengthLevel)
  387. self.costList = {}
  388. GUI:setVisible(self.view.strengthIcon_1, true)
  389. GUI:setVisible(self.view.StrengthCustomScrollView, true)
  390. local costId = SL:GetConfig('cfg_equip_appends', cfgId).costId
  391. local next_level = strengthLevel + 1
  392. local cost_info = SL:GetConfigTwoKeys('cfg_equip_appendsCost', costId, next_level, "costGroupId", "level").cost
  393. for _, cost in pairs(cost_info) do
  394. local tbl = {
  395. cfgId = cost[1],
  396. needCount = cost[2],
  397. }
  398. table.insert(self.costList, tbl)
  399. end
  400. GUI:DataListUpdateData(self.view.cost_list)
  401. end
  402. function this:SetEquipAttrInfo(cfgId, strengthLevel)
  403. self.strengthAttTextList = {}
  404. GUI:setVisible(self.view.strengthIcon, true)
  405. local groupId = SL:GetConfig('cfg_equip_appends', cfgId).groupId
  406. local nowAttrInfo
  407. if SL:HasConfigTwoKeys('cfg_equip_appendsGroup', groupId, strengthLevel, 'group', 'lv') then
  408. nowAttrInfo = SL:GetConfigTwoKeys('cfg_equip_appendsGroup', groupId, strengthLevel, 'group', 'lv')
  409. end
  410. nowAttrInfo = nowAttrInfo and nowAttrInfo.att or {}
  411. local nextAttrInfo
  412. if SL:HasConfigTwoKeys('cfg_equip_appendsGroup', groupId, strengthLevel+1, 'group', 'lv') then
  413. nextAttrInfo = SL:GetConfigTwoKeys('cfg_equip_appendsGroup', groupId, strengthLevel+1, 'group', 'lv')
  414. end
  415. nextAttrInfo = nextAttrInfo and nextAttrInfo.att or {}
  416. local now_attr_map = {}
  417. for _, nowAttr in pairs(nowAttrInfo) do
  418. now_attr_map[nowAttr[1]] = nowAttr[2]
  419. end
  420. local next_attr_map = {}
  421. for _, nextAttr in pairs(nextAttrInfo) do
  422. next_attr_map[nextAttr[1]] = tonumber(nextAttr[2])
  423. end
  424. for nextId, _ in pairs(next_attr_map) do
  425. if now_attr_map[nextId] == nil then
  426. now_attr_map[nextId] = 0
  427. end
  428. end
  429. local minAtk = now_attr_map[201021]
  430. local maxAtk = now_attr_map[201011]
  431. if minAtk and maxAtk then
  432. local nextMinAtk = next_attr_map[201021]
  433. local nextMaxAtk = next_attr_map[201011]
  434. local tbl= {
  435. attrName = "攻击力",
  436. preValue = minAtk .. '~' .. maxAtk,
  437. nextValue = nextMinAtk .. '~' .. nextMaxAtk,
  438. arrowShow = true
  439. }
  440. table.insert(self.strengthAttTextList, tbl)
  441. end
  442. local minMAtk = now_attr_map[202021]
  443. local maxMAtk = now_attr_map[202011]
  444. if minMAtk and maxMAtk then
  445. local nextMinAtk = next_attr_map[202021]
  446. local nextMaxAtk = next_attr_map[202011]
  447. local tbl= {
  448. --attrName = "魔法攻击力",
  449. attrName = "攻击力",
  450. preValue = minMAtk .. '~' .. maxMAtk,
  451. nextValue = nextMinAtk .. '~' .. nextMaxAtk,
  452. arrowShow = true
  453. }
  454. table.insert(self.strengthAttTextList, tbl)
  455. end
  456. minAtk = now_attr_map[200011]
  457. maxAtk = now_attr_map[200021]
  458. if minAtk and maxAtk then
  459. local nextMinAtk = next_attr_map[200011]
  460. local nextMaxAtk = next_attr_map[200021]
  461. local tbl= {
  462. attrName = "攻击力",
  463. preValue = minAtk .. '~' .. maxAtk,
  464. nextValue = nextMinAtk .. '~' .. nextMaxAtk,
  465. arrowShow = true
  466. }
  467. table.insert(self.strengthAttTextList, tbl)
  468. end
  469. for attrId, attrValue in pairs(now_attr_map) do
  470. if attrId ~= 201021 and attrId ~= 201011 and attrId ~= 202021 and attrId ~= 202011 and attrId ~= 200011 and attrId ~= 200021 then
  471. local nextValue = next_attr_map[attrId]
  472. local name = SL:GetConfig("cfg_att_info", attrId).name
  473. local att_remark = SL:GetConfig("cfg_att_info", attrId).remarks
  474. local tbl = {}
  475. if att_remark == 1 then
  476. tbl = {
  477. attrName = name,
  478. preValue = attrValue,
  479. nextValue = nextValue,
  480. arrowShow = true
  481. }
  482. else
  483. tbl = {
  484. attrName = name,
  485. preValue = attrValue/100 .. '%',
  486. nextValue = nextValue/100 .. '%',
  487. arrowShow = true
  488. }
  489. end
  490. table.insert(self.strengthAttTextList, tbl)
  491. end
  492. end
  493. local tips = SL:GetConfigTwoKeys('cfg_equip_appendsGroup', groupId, strengthLevel+1, 'group', 'lv').tips
  494. if not string.isNullOrEmpty(tips) then
  495. local tbl = {
  496. attrName = tips,
  497. preValue = '',
  498. nextValue = '',
  499. arrowShow = false
  500. }
  501. table.insert(self.strengthAttTextList, tbl)
  502. end
  503. GUI:DataListUpdateData(self.view.strength_list)
  504. end
  505. function this:SetEquipLevelInfo(strengthLevel)
  506. GUI:setVisible(self.view.strengthLevelBg, true)
  507. GUI:Text_setString(self.view.preLevel, "+" .. strengthLevel)
  508. GUI:Text_setString(self.view.nextLevel, "+" .. strengthLevel+1)
  509. end
  510. function this:RefreshSuccessRatio(cfgId, strengthLevel)
  511. GUI:setVisible(self.view.baseSuccessRatioText, true)
  512. GUI:setVisible(self.view.successIcon, true)
  513. local costId = SL:GetConfig('cfg_equip_appends', cfgId).costId
  514. local next_level = strengthLevel + 1
  515. local rate_client = SL:GetConfigTwoKeys('cfg_equip_appendsCost', costId, next_level, "costGroupId", "level").rateClient
  516. rate_client = rate_client // 100
  517. GUI:Text_setString(self.view.baseSuccessRatioText, rate_client .. '%')
  518. end
  519. function this:SetEquipName(cfgId, strengthLevel)
  520. GUI:setVisible(self.view.equipName, true)
  521. local equipName = SL:GetConfig('cfg_item', cfgId).name
  522. local colorStr = EquipFunc.GetEquipNameColor(cfgId)
  523. if strengthLevel > 0 then
  524. equipName = equipName .. '+' .. strengthLevel
  525. end
  526. GUI:Text_setString(self.view.equipName, string.format("<color=%s>%s</color>", colorStr, equipName))
  527. end
  528. function this:SetEquipModel(cfgId)
  529. GUI:setVisible(self.view.item_model, true)
  530. GUI:Item_setItemId(self.view.item_model, cfgId)
  531. end
  532. function this.IsMaxEquip(equipInfo, strength_level)
  533. local cfgId = equipInfo.cfgId
  534. --local strength_level = equipInfo["strengthlevel"]
  535. ---首饰换表处理
  536. local ornament_tbl = SL:HasConfig('cfg_equip_ornamentsMain', cfgId)
  537. if ornament_tbl then
  538. if InfoManager.equipJewelryInfo:GetCurLevelMaxAppend(equipInfo) <= strength_level then
  539. return true
  540. end
  541. return false
  542. end
  543. local strength_tbl = SL:GetConfig('cfg_equip_appends', cfgId)
  544. if strength_tbl then
  545. if strength_tbl.maxLevel <= strength_level then
  546. return true
  547. end
  548. return false
  549. end
  550. return false
  551. end
  552. return this