---@class KLEquipStrengthUIPanel:UIKmlLuaPanelBase ---@field view KLEquipStrengthUIPanelView --- kml代码lua化 会有较多冗余代码 local KLEquipStrengthUIPanel = class(UIKmlLuaPanelBase) local this =KLEquipStrengthUIPanel ---创建时调用一次 function this:Init() GUI:UIPanel_Open("dev/ui/Equip/Panel/KLEquipUI/KLEquipUIPanel",nil,nil, {x=-465, hideTips=true, callBack=self.CloseEquipUi,forgeGroupType=EForgeGroupType.Strength},nil,function(equipPanel) self.equipPanel = equipPanel self:Refresh() end) self.bagIndex = nil self.equipIndex = nil self.strengthAttTextList = {} self.costList = {} self.showLiuGuang = false GUI:setVisible(self.view.equip_show_tips, false) GUI:DataListInitData(self.view.strength_list, function() return table.count(self.strengthAttTextList) end,function() end,function() end,function(realIndex) local strengthInfo = self.strengthAttTextList[realIndex+1] local name = strengthInfo['attrName'] local preValue = strengthInfo['preValue'] local nextValue = strengthInfo['nextValue'] local arrowShow = strengthInfo['arrowShow'] local attControl = GUI:GetChildControl(self.view.strength_list,realIndex,'attrName') local preControl = GUI:GetChildControl(self.view.strength_list,realIndex,'preValue') local nextControl = GUI:GetChildControl(self.view.strength_list,realIndex,'nextValue') local arrowControl = GUI:GetChildControl(self.view.strength_list,realIndex,'arrow') local result = "" local len = utf8.len(name) -- 获取字符串的 UTF-8 长度 local i = 1 local j = 1 -- 使用 utf8.offset 来逐个字符提取 while i <= len do local char = utf8.sub(name, i, i+1) result = result .. char .. " " i = i+1 -- 移动到下一个字符 end GUI:Text_setString(attControl, result) GUI:Text_setString(preControl, tostring(preValue)) GUI:Text_setString(nextControl, tostring(nextValue)) GUI:setVisible(arrowControl, arrowShow) end) GUI:DataListInitData(self.view.cost_list, function() return table.count(self.costList) end,function() end,function() end,function(realIndex) local costInfo = self.costList[realIndex+1] local cfgId = costInfo['cfgId'] local needCount = costInfo['needCount'] local itemControl = GUI:GetChildControl(self.view.cost_list,realIndex,'cost_item') local nameControl = GUI:GetChildControl(self.view.cost_list,realIndex,'cost_name') local numControl = GUI:GetChildControl(self.view.cost_list,realIndex,'cost_num') local costAddBtn = GUI:GetChildControl(self.view.cost_list,realIndex,'costAddBtn') if SL:GetConfig('cfg_item', cfgId) == nil then return end GUI:Item_setItemId(itemControl, cfgId) local name = SL:GetConfig('cfg_item', cfgId).name GUI:Text_setString(nameControl, name) local haveCount = SL:GetBagItemCount(cfgId) if haveCount < needCount then GUI:Text_setString(numControl, string.format('%d/%d', haveCount, needCount)) else GUI:Text_setString(numControl, string.format('%d/%d', haveCount, needCount)) end GUI:AddOnClickEvent(costAddBtn, self, self.costAddBtn, {cfgId=cfgId}) end) self.updateEquipCo = nil end function this:costAddBtn(control, eventData) local cfgId = eventData.cfgId SL:CommonItemGetPath(nil, cfgId) end ---创建或者刷新界面数据时调用 function this:Refresh() if not self.equipPanel then return end self.bagIndex = nil self.equipIndex = nil self:SelectEquip(self.args and self.args.equipSlot or nil) SL:RefreshPanelALLRedPoint("KLUIForgeGroupPanel") if self.args and self.args.equipSlot then self.args.equipSlot = nil end end ---注册UI事件和服务器消息 function this:RegistEvents() GUI:AddOnClickEvent(self.view.CloseButton, self, self.CloseButton) GUI:AddOnClickEvent(self.view.strengthButton, self, self.strengthButton) GUI:AddOnClickEvent(self.view.closeMask, self, self.closeMask) GUI:AddOnClickEvent(self.view.liuGuangBtn, self, self.liuGuangBtn) GUI:AddOnClickEvent(self.view.strengthMasterBtn, self, self.strengthMasterBtn) GUI:AddOnClickEvent(self.view.item_model, self, self.item_modelOnClick) SL:RegisterLUAEvent(LUA_EVENT_EQUIP_GRID_CLICK, self.LUA_EVENT_EQUIP_GRID_CLICK, self) --SL:RegisterLUAEvent(LUA_EVENT_BAG_CHANGE_AFTER, self.LUA_EVENT_BAG_CHANGE_AFTER, self) --SL:RegisterLUAEvent(LUA_EVENT_MONEYCHANGE, self.LUA_EVENT_MONEYCHANGE, self) SL:RegisterLuaNetMsg(LuaMessageIdToClient.STRENGTH_EQUIP_RESULT, self.STRENGTH_EQUIP_RESULT, self) GUI:SetToggleOnValueChange(self.view.equipBtn, self, self.equipBtn) GUI:SetToggleOnValueChange(self.view.bagBtn, self, self.ClickBag) SL:RegisterLUAEvent(LUA_EVENT_FORGE_GROUP_PANEL_CLOSE, self.CloseButton, self) end function this:item_modelOnClick() SL:OpenTips("equip",self.equipInfo.cfgId,self.equipInfo.id,nil, self.equipInfo, {hideBtn=true}) end function this:liuGuangBtn() if self.showLiuGuang == false then local stream = SL:GetConfig('cfg_equip_strengthen', self.equipInfo.cfgId).stream if stream then local strengthLevel = EquipFunc.GetEquipStrengthLevel(self.equipInfo) for _, streamInfo in pairs(stream) do local nowStrengthLevel = streamInfo[1] local streamId = streamInfo[2] if strengthLevel < nowStrengthLevel then GUI:SetStreamAttr(self.view.item_model, streamId) GUI:setVisible(self.view.liuguangInfo, true) GUI:Text_setString(self.view.liuguangInfo, '+' .. nowStrengthLevel .. '流光效果') self.showLiuGuang = true return end end end else self:SetLiuGuang(self.equipInfo) GUI:setVisible(self.view.liuguangInfo, false) self.showLiuGuang = false end end function this:strengthMasterBtn() GUI:UIPanel_Open("dev/outui/Equip/Panel/KLUIForgingMaster/KLUIForgingMasterPanel", nil, nil, { uiType = 1, cfgId = self.equipInfo.cfgId }) end function this:equipBtn() self.isOpenBag = false self.equipPanel = GUI:UIPanel_Open("dev/ui/Equip/Panel/KLEquipUI/KLEquipUIPanel",nil,nil, {x=-465, hideTips=true, callBack=self.CloseEquipUi,forgeGroupType=EForgeGroupType.Strength}) GUI:UIPanel_Close("dev/outui/Bag/Panel/KLStrengthBag/KLStrengthBagPanel") self.selectItem = nil self:SelectEquip() end function this.CloseEquipUi() GUI:UIPanel_Close("dev/ui/UIForgeGroup/Panel/KLUIForgeGroup/KLUIForgeGroupPanel") GUI:UIPanel_Close("dev/ui/Equip/Panel/KLEquipUI/KLEquipUIPanel") GUI:UIPanel_Close("dev/outui/Equip/Panel/KLEquipStrengthUI/KLEquipStrengthUIPanel") end function this:closeMask() GUI:setVisible(self.view.equip_show_tips, false) end -- 强化结果回调 ---@param message {issuccess:boolean, strengthlv:number, itemId:number} function this:STRENGTH_EQUIP_RESULT(id, message) GUI:SetActive(self.view.strength_ok, false) GUI:SetActive(self.view.strength_fail, false) if message.issuccess then GUI:SetActive(self.view.strength_ok, true) local costId = SL:GetConfig('cfg_equip_strengthen', self.equipInfo.cfgId).costId local firstRate = SL:GetConfigTwoKeys('cfg_equip_strengthenCost', costId, message.strengthlv, 'costGroupId', 'level').firstRate if firstRate == 1 then self:ShowEquipSuccessMask(self.equipInfo.cfgId, message.strengthlv) end else GUI:SetActive(self.view.strength_fail, true) end SL:onLUAEvent(LUA_EVENT_STRENGTH_OK,message) self:ClickEquip(self.equipInfo) SL:RefreshPanelALLRedPoint("KLUIForgeGroupPanel") self.equipPanel:UpdateAllItem() end -- 强化跑马灯展示(特定等级展示) function this:ShowEquipSuccessMask(cfgId, strengthLevel) GUI:setVisible(self.view.equip_show_tips, true) local name = SL:GetConfig("cfg_item", cfgId).name GUI:Text_setString(self.view.mask_text, string.format("%s+%d", name, strengthLevel)) GUI:Item_setItemId(self.view.mask_item, cfgId) local liuGuangId = EquipFunc.GetEquipLiuGuangId(self.equipInfo) GUI:SetStreamAttr(self.view.mask_item, liuGuangId) end -- 点击强化按钮 function this:strengthButton() SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_STRENGTH_EQUIP,{itemId=self.equipInfo.id}) -- self:STRENGTH_EQUIP_RESULT(_, {isSuccess = true}) end -- 背包改变后 function this:LUA_EVENT_BAG_CHANGE_AFTER(_,message) if self.isOpenBag then return end if not message then return end if self.equipInfo then local lv = EquipFunc.GetEquipStrengthLevel(self.equipInfo) local isMax = this.IsMaxEquip(self.equipInfo,lv) if not isMax then self:SetEquipCostInfo(self.equipInfo.cfgId, lv) end end -- 临时处理下, 等后端整合成一个消息包 if self.updateEquipCo == nil then self.updateEquipCo = Coroutine.Start(function() Coroutine.Wait(0.2) self.equipPanel:UpdateAllItem() SL:RefreshPanelALLRedPoint("KLUIForgeGroupPanel") self.updateEquipCo = nil end) end end -- 货币变更 function this:LUA_EVENT_MONEYCHANGE(_,message) if self.isOpenBag then return end if self.equipInfo then local lv = EquipFunc.GetEquipStrengthLevel(self.equipInfo) local isMax = this.IsMaxEquip(self.equipInfo,lv) if not isMax then self:SetEquipCostInfo(self.equipInfo.cfgId, lv) end end if self.updateEquipCo == nil then self.updateEquipCo = Coroutine.Start(function() Coroutine.Wait(0.2) self.equipPanel:UpdateAllItem() SL:RefreshPanelALLRedPoint("KLUIForgeGroupPanel") self.updateEquipCo = nil end) end end -- 点击装备事件回调 function this:LUA_EVENT_EQUIP_GRID_CLICK(_, index) local equip = SL:GetMetaValue("EQUIP_TARGET_DATA", 1, index) if index == E_AppearEquipType.Weapon and equip == nil then equip = SL:GetMetaValue("EQUIP_TARGET_DATA", 1, E_AppearEquipType.TwoHandWeapon) end if equip then local strength_tbl = SL:GetConfig('cfg_equip_strengthen', equip['cfgId']) if strength_tbl then self.bagIndex = nil self.equipPanel:SetSelectIndex(index) self:ClickEquip(equip) return else SL:TipMessage( SL:GetConfig('cfg_string',268).text, 1, NoticeType.NoticeMid )--"该装备无法被强化", end end end -- 关闭按钮回调 function this:CloseButton() GUI:UIPanel_Close("dev/ui/UIForgeGroup/Panel/KLUIForgeGroup/KLUIForgeGroupPanel") GUI:UIPanel_Close("dev/ui/Equip/Panel/KLEquipUI/KLEquipUIPanel") GUI:UIPanel_Close("dev/outui/Equip/Panel/KLEquipStrengthUI/KLEquipStrengthUIPanel") GUI:UIPanel_Close("dev/outui/Bag/Panel/KLStrengthBag/KLStrengthBagPanel") self.selectItem = nil self.equipPanel = nil end function this:Close() end -- 选择装备 function this:SelectEquip(_index) if self.selectItem then local strength_tbl = SL:GetConfig('cfg_equip_strengthen', self.selectItem.item.cfgId) if strength_tbl then self.bagIndex = nil ---@type cfg_item_column local part = SL:GetConfig("cfg_item",self.selectItem.item.cfgId).subType self.equipPanel:SetSelectIndex(part) self:ClickEquip(self.selectItem.item) return end end if _index then local equip = SL:GetMetaValue("EQUIP_TARGET_DATA", 1, _index) if equip then local strength_tbl = SL:GetConfig('cfg_equip_strengthen', equip['cfgId']) if strength_tbl then self.bagIndex = nil self.equipPanel:SetSelectIndex(_index) self:ClickEquip(equip) return end end end -- 策划要求先选中武器 local equip_boot = SL:GetMetaValue("EQUIP_TARGET_DATA", 1, EEquipSlotType.TwoHandWeapon) if equip_boot then local strength_tbl = SL:GetConfig('cfg_equip_strengthen', equip_boot['cfgId']) if strength_tbl then self.bagIndex = nil self.equipPanel:SetSelectIndex(EEquipSlotType.TwoHandWeapon) self:ClickEquip(equip_boot) return end end for index=1, 15 do local equip = SL:GetMetaValue("EQUIP_TARGET_DATA", 1, index) if equip then local strength_tbl = SL:GetConfig('cfg_equip_strengthen', equip['cfgId']) if strength_tbl then self.bagIndex = nil self.equipPanel:SetSelectIndex(index) self:ClickEquip(equip) return end end end GUI:setVisible(self.view.noticeText, true) end -- 初始化UI为初始状态 function this:ResetUi() GUI:setVisible(self.view.maxLevelTips, false) GUI:setVisible(self.view.strengthIcon, false) GUI:setVisible(self.view.baseSuccessRatioText, false) GUI:setVisible(self.view.successIcon, false) GUI:setVisible(self.view.strengthIcon_1, false) GUI:setVisible(self.view.StrengthCustomScrollView, false) GUI:setVisible(self.view.strengthButton, false) GUI:setVisible(self.view.strengthLevelBg, false) GUI:setVisible(self.view.maxStrengthLevelBg, false) GUI:setVisible(self.view.item_model, false) GUI:setVisible(self.view.equipName, false) GUI:setVisible(self.view.noticeText, false) GUI:setVisible(self.view.liuGuangBtn, false) GUI:setVisible(self.view.liuguangInfo, false) GUI:setVisible(self.view.strengthMasterBtn, false) self.showLiuGuang = false end -- 点击装备(装备栏内) -- local testLevel = 0 function this:ClickEquip(equipInfo) local strength_tbl = SL:GetConfig('cfg_equip_strengthen', equipInfo.cfgId) if strength_tbl then self.equipInfo = equipInfo self:ResetUi() GUI:setVisible(self.view.liuGuangBtn, true) local strengthLevel = EquipFunc.GetEquipStrengthLevel(self.equipInfo) self:SetEquipName(self.equipInfo.cfgId, strengthLevel) self:SetEquipModel(self.equipInfo.cfgId) self:SetLiuGuang(self.equipInfo) self:SetLiuGuangBtn(self.equipInfo) local isMax = this.IsMaxEquip(self.equipInfo,strengthLevel) if isMax then GUI:setVisible(self.view.maxLevelTips, true) GUI:Text_setString(self.view.maxLevel, "+" .. strengthLevel) GUI:setVisible(self.view.maxStrengthLevelBg, true) self:SetMaxAttrInfo(self.equipInfo.cfgId, strengthLevel) else self:RefreshSuccessRatio(self.equipInfo.cfgId, strengthLevel) self:SetEquipLevelInfo(strengthLevel) self:SetEquipAttrInfo(self.equipInfo.cfgId, strengthLevel) self:SetEquipCostInfo(self.equipInfo.cfgId, strengthLevel) GUI:setVisible(self.view.strengthButton, true) self:SetEquipFailText(self.equipInfo.cfgId, strengthLevel) end -- testLevel = testLevel + 1 end ---@type cfg_item_column local item = SL:GetConfig("cfg_item", equipInfo.cfgId) local masterId = tonumber(item.strPart[1] .. "01") ---@type cfg_equip_masterGroup_column local master = SL:GetConfig("cfg_equip_masterGroup", masterId) if master then GUI:setVisible(self.view.strengthMasterBtn, true) else GUI:setVisible(self.view.strengthMasterBtn, false) end end function this:SetLiuGuangBtn(equipInfo) local stream = SL:GetConfig('cfg_equip_strengthen', equipInfo.cfgId).stream if stream then local strengthLevel = EquipFunc.GetEquipStrengthLevel(self.equipInfo) for _, streamInfo in pairs(stream) do local nowStrengthLevel = streamInfo[1] if strengthLevel < nowStrengthLevel then GUI:setVisible(self.view.liuGuangBtn, true) return end end end GUI:setVisible(self.view.liuGuangBtn, false) end -- 设置流光 function this:SetLiuGuang(equipInfo) local liuGuangId = EquipFunc.GetEquipLiuGuangId(equipInfo) if liuGuangId then GUI:SetStreamAttr(self.view.item_model, liuGuangId) else GUI:ResetStreamAttr(self.view.item_model) end end -- 点击背包 function this:ClickBag() self.isOpenBag = true self:ResetUi() GUI:UIPanel_Close("dev/ui/Equip/Panel/KLEquipUI/KLEquipUIPanel") GUI:UIPanel_Open("dev/outui/Bag/Panel/KLStrengthBag/KLStrengthBagPanel", nil, nil, {x=-481, itemClickCallBack=self.itemClickCallBack,callBackUI=self}) end -- 点击道具回调(背包) function this:itemClickCallBack(control, item) if SL:HasConfig('cfg_equip_strengthen', item.cfgId) then local itemInfo = SL:GetItemInfoByItemId(item.id) self:ClickEquip(itemInfo) self:HideSelectItem(false) control.ui:SetSelect(true) self.selectItem = control.ui else SL:TipMessage( SL:GetConfig('cfg_string',268).text, 1, NoticeType.NoticeMid )--"该装备无法被强化", end end function this:HideSelectItem() if self.selectItem then self.selectItem:SetSelect(false) end end -- 满级属性 function this:SetMaxAttrInfo(cfgId, strengthLevel) self.strengthAttTextList = {} GUI:setVisible(self.view.strengthIcon, true) local groupId = SL:GetConfig('cfg_equip_strengthen', cfgId).groupId local nowAttrInfo = SL:GetConfigTwoKeys('cfg_equip_strengthenGroup', groupId, strengthLevel, 'group', 'lv').att local now_attr_map = {} for _, nowAttr in pairs(nowAttrInfo) do now_attr_map[nowAttr[1]] = nowAttr[2] end local minAtk = now_attr_map[201021] local maxAtk = now_attr_map[201011] if minAtk and maxAtk then local tbl= { attrName = "攻击力", preValue = minAtk .. '~' .. maxAtk, nextValue = "", arrowShow = false } table.insert(self.strengthAttTextList, tbl) end local minMAtk = now_attr_map[202021] local maxMAtk = now_attr_map[202011] if minMAtk and maxMAtk then local tbl= { --attrName = "魔法攻击力", attrName = "攻击力", preValue = minMAtk .. '~' .. maxMAtk, nextValue = "", arrowShow = false } table.insert(self.strengthAttTextList, tbl) end minAtk = now_attr_map[200011] maxAtk = now_attr_map[200021] if minAtk and maxAtk then local tbl= { attrName = "攻击力", preValue = minAtk .. '~' .. maxAtk, nextValue = "", arrowShow = false } table.insert(self.strengthAttTextList, tbl) end for attrId, attrValue in pairs(now_attr_map) do if attrId ~= 201021 and attrId ~= 201011 and attrId ~= 202021 and attrId ~= 202011 and attrId ~= 200011 and attrId ~= 200021 then local name = SL:GetConfig("cfg_att_info", attrId).name local att_remark = SL:GetConfig("cfg_att_info", attrId).remarks local tbl = {} if att_remark == 1 then tbl = { attrName = name, preValue = attrValue, nextValue = "", arrowShow = false } else tbl = { attrName = name, preValue = attrValue/100 .. '%', nextValue = "", arrowShow = false } end table.insert(self.strengthAttTextList, tbl) end end GUI:DataListUpdateData(self.view.strength_list) end --失败文本 function this:SetEquipFailText(cfgId, strengthLevel) local costId = SL:GetConfig('cfg_equip_strengthen', cfgId).costId local fail_tips = SL:GetConfigTwoKeys('cfg_equip_strengthenCost', costId, strengthLevel+1, 'costGroupId', 'level').tips if fail_tips then GUI:setVisible(self.view.failTips, true) GUI:Text_setString(self.view.failTips, fail_tips) end end -- 消耗道具 function this:SetEquipCostInfo(cfgId, strengthLevel) self.costList = {} GUI:setVisible(self.view.strengthIcon_1, true) GUI:setVisible(self.view.StrengthCustomScrollView, true) local costId = SL:GetConfig('cfg_equip_strengthen', cfgId).costId local next_level = strengthLevel + 1 local cost_info = SL:GetConfigTwoKeys('cfg_equip_strengthenCost', costId, next_level, "costGroupId", "level").cost for _, cost in pairs(cost_info) do local tbl = { cfgId = cost[1], needCount = cost[2], } table.insert(self.costList, tbl) end GUI:DataListUpdateData(self.view.cost_list) end -- 装备属性 function this:SetEquipAttrInfo(cfgId, strengthLevel) self.strengthAttTextList = {} GUI:setVisible(self.view.strengthIcon, true) local groupId = SL:GetConfig('cfg_equip_strengthen', cfgId).groupId local nowAttrInfo if SL:HasConfigTwoKeys('cfg_equip_strengthenGroup', groupId, strengthLevel, 'group', 'lv') then nowAttrInfo = SL:GetConfigTwoKeys('cfg_equip_strengthenGroup', groupId, strengthLevel, 'group', 'lv') end nowAttrInfo = nowAttrInfo and nowAttrInfo.att or {} local nextAttrInfo if SL:HasConfigTwoKeys('cfg_equip_strengthenGroup', groupId, strengthLevel+1, 'group', 'lv') then nextAttrInfo = SL:GetConfigTwoKeys('cfg_equip_strengthenGroup', groupId, strengthLevel+1, 'group', 'lv') end nextAttrInfo = nextAttrInfo and nextAttrInfo.att or {} local now_attr_map = {} for _, nowAttr in pairs(nowAttrInfo) do now_attr_map[nowAttr[1]] = nowAttr[2] end local next_attr_map = {} for _, nextAttr in pairs(nextAttrInfo) do next_attr_map[nextAttr[1]] = tonumber(nextAttr[2]) end for nextId, _ in pairs(next_attr_map) do if now_attr_map[nextId] == nil then now_attr_map[nextId] = 0 end end local minAtk = now_attr_map[201021] local maxAtk = now_attr_map[201011] if minAtk and maxAtk then local nextMinAtk = next_attr_map[201021] local nextMaxAtk = next_attr_map[201011] local tbl= { attrName = "攻击力", preValue = minAtk .. '~' .. maxAtk, nextValue = nextMinAtk .. '~' .. nextMaxAtk, arrowShow = true } table.insert(self.strengthAttTextList, tbl) end local minMAtk = now_attr_map[202021] local maxMAtk = now_attr_map[202011] if minMAtk and maxMAtk then local nextMinAtk = next_attr_map[202021] local nextMaxAtk = next_attr_map[202011] local tbl= { --attrName = "魔法攻击力", attrName = "攻击力", preValue = minMAtk .. '~' .. maxMAtk, nextValue = nextMinAtk .. '~' .. nextMaxAtk, arrowShow = true } table.insert(self.strengthAttTextList, tbl) end minAtk = now_attr_map[200011] maxAtk = now_attr_map[200021] if minAtk and maxAtk then local nextMinAtk = next_attr_map[200011] local nextMaxAtk = next_attr_map[200021] local tbl= { attrName = "攻击力", preValue = minAtk .. '~' .. maxAtk, nextValue = nextMinAtk .. '~' .. nextMaxAtk, arrowShow = true } table.insert(self.strengthAttTextList, tbl) end for attrId, attrValue in pairs(now_attr_map) do if attrId ~= 201021 and attrId ~= 201011 and attrId ~= 202021 and attrId ~= 202011 and attrId ~= 200011 and attrId ~= 200021 then local nextValue = next_attr_map[attrId] or 0 local name = SL:GetConfig("cfg_att_info", attrId).name local att_remark = SL:GetConfig("cfg_att_info", attrId).remarks local tbl = {} if att_remark == 1 then tbl = { attrName = name, preValue = attrValue, nextValue = nextValue, arrowShow = true } else tbl = { attrName = name, preValue = attrValue/100 .. '%', nextValue = nextValue/100 .. '%', arrowShow = true } end table.insert(self.strengthAttTextList, tbl) end end local tips = SL:GetConfigTwoKeys('cfg_equip_strengthenGroup', groupId, strengthLevel+1, 'group', 'lv').tips if not string.isNullOrEmpty(tips) then local tbl = { attrName = tips, preValue = '', nextValue = '', arrowShow = false } table.insert(self.strengthAttTextList, tbl) end GUI:DataListUpdateData(self.view.strength_list) end -- 装备等级 function this:SetEquipLevelInfo(strengthLevel) GUI:setVisible(self.view.strengthLevelBg, true) GUI:Text_setString(self.view.preLevel, "+" .. strengthLevel) GUI:Text_setString(self.view.nextLevel, "+" .. strengthLevel+1) end -- 成功率 function this:RefreshSuccessRatio(cfgId, strengthLevel) GUI:setVisible(self.view.baseSuccessRatioText, true) GUI:setVisible(self.view.successIcon, true) local costId = SL:GetConfig('cfg_equip_strengthen', cfgId).costId local next_level = strengthLevel + 1 local rate_client = SL:GetConfigTwoKeys('cfg_equip_strengthenCost', costId, next_level, "costGroupId", "level").rateClient rate_client = rate_client // 100 GUI:Text_setString(self.view.baseSuccessRatioText, rate_client .. '%') end -- 装备名字 function this:SetEquipName(cfgId, strengthLevel) GUI:setVisible(self.view.equipName, true) local equipName = SL:GetConfig('cfg_item', cfgId).name local colorStr = EquipFunc.GetEquipNameColor(cfgId) if strengthLevel > 0 then equipName = equipName .. '+' .. strengthLevel end GUI:Text_setString(self.view.equipName, string.format("%s", colorStr, equipName)) end -- 装备模型 function this:SetEquipModel(cfgId) GUI:setVisible(self.view.item_model, true) GUI:Item_setItemId(self.view.item_model, cfgId) end --是否是满级装备 function this.IsMaxEquip(equipInfo, strength_level) local cfgId = equipInfo.cfgId --local strength_level = equipInfo["strengthlevel"] ---首饰换表处理 local ornament_tbl = SL:HasConfig('cfg_equip_ornamentsMain', cfgId) if ornament_tbl then if InfoManager.equipJewelryInfo:GetCurLevelMaxStrength(equipInfo) <= strength_level then return true end return false end local strength_tbl = SL:GetConfig('cfg_equip_strengthen', cfgId) if strength_tbl then if strength_tbl.maxLevel <= strength_level then return true end return false end return false end return this