---@class KLShapeShiftCardTipsPanel:UIKmlLuaPanelBase ---@field view KLShapeShiftCardTipsPanelView local KLShapeShiftCardTipsPanel = class(UIKmlLuaPanelBase) local this = KLShapeShiftCardTipsPanel function this:AsyncLoadUI() end ---创建时调用一次 function this:Init() GUI:DataListInitData(self.view.all_info_data, function() return self:EquipAttrDataListItemCountFunc() end, nil, nil, function(realIndex, kmlcontrol) return self:EquipAttrDataListItemUpdateFunc(realIndex, kmlcontrol) end) self.qualityText = { "蓝色", "金色", "红色" } self.subTypeText = { "变身泰坦卡牌", "赋能泰坦卡牌", "神赋泰坦卡牌" } end function this:EquipAttrDataListItemCountFunc() return #self.all_info end function this:EquipAttrDataListItemUpdateFunc(realIndex) local data = self.all_info[realIndex + 1] local root = GUI:GetChildControl(self.view.all_info_data, realIndex, "root") local title = GUI:GetChildControl(self.view.all_info_data, realIndex, "title") local di = GUI:GetChildControl(self.view.all_info_data, realIndex, "di") local value = GUI:GetChildControl(self.view.all_info_data, realIndex, "value") local desc = GUI:GetChildControl(self.view.all_info_data, realIndex, "desc") local lock = GUI:GetChildControl(self.view.all_info_data, realIndex, "lock") local upgrade = GUI:GetChildControl(self.view.all_info_data, realIndex, "upgrade") if data.title then GUI:setContentSize(root, 350, 25) GUI:setVisible(title, true) GUI:setVisible(di, true) GUI:setVisible(value, false) GUI:setVisible(desc, false) GUI:setVisible(lock, false) GUI:setVisible(upgrade, false) self.panelHeight = self.panelHeight + 31 GUI:Image_loadTexture(title, data.title, "Atlas/TipsAttTitle.spriteatlas") elseif data.icon then GUI:setContentSize(root, 350, 60) if data.atlas then GUI:Image_loadTexture(title, data.icon, data.atlas) else GUI:Image_loadTexture(title, data.icon, "Atlas/UIOutSkillIcon.spriteatlas") end GUI:setContentSize(title, 50, 50) GUI:setVisible(title, true) GUI:setVisible(di, false) GUI:setVisible(value, false) GUI:setVisible(desc, true) GUI:setVisible(lock, data.lock) GUI:setVisible(upgrade, data.upgrade) GUI:Text_setString(desc, data.tips) self.panelHeight = self.panelHeight + 66 else GUI:setContentSize(root, 350, 16) GUI:setVisible(title, false) GUI:setVisible(di, false) GUI:setVisible(value, true) GUI:setVisible(desc, false) GUI:setVisible(lock, false) GUI:setVisible(upgrade, false) local value_str if data.value2 then value_str = data.name .. " " .. data.value .. "~" .. data.value2 else value_str = data.name .. " " .. data.value end GUI:Text_setString(value, value_str) local color = "#DCE1E5" if data.color then local strColor = SL:GetColorCfg(data.color) if strColor then color = strColor. color end end GUI:Text_setTextColor(value, color) if data.special then GUI:setVisible(title, true) GUI:setPosition(title, 21, 2) GUI:Image_loadTexture(title, "ty_icon_arrow_small", "Atlas/TS_Common.spriteatlas") end self.panelHeight = self.panelHeight + 22 end end ---注册UI事件和服务器消息 function this:RegistEvents() GUI:AddOnClickEvent(self.view.img_close, self, self.CloseSelf) GUI:AddOnClickEvent(self.view.btn_func, self, self.OnClickFuncBtn) end ---界面显示时调用一次 function this:Show() end ---创建或者刷新界面数据时调用 function this:Refresh() self.all_info = {} self.cardInfo = self.args.cardInfo ---@type cfg_item_column self.item_tbl = SL:GetConfig("cfg_item", self.cardInfo.cfgid) ---@type cfg_card_shapeshift_column self.card_tbl = SL:GetConfig("cfg_card_shapeshift", self.cardInfo.cfgid) GUI:Image_loadTexture(self.view.card_bg, "card_quality_" .. self.card_tbl.quality, "Atlas/KLShapeShiftCard.spriteatlas") GUI:Image_loadTexture(self.view.card_level, "num_quality_" .. self.card_tbl.quality .. "_" .. self.card_tbl.level, "Atlas/KLShapeShiftCard.spriteatlas") GUI:Image_loadTexture(self.view.card_img, self.card_tbl.img, "Atlas/KLShapeShiftCard.spriteatlas") if #self.card_tbl.position > 0 then GUI:setPosition(self.view.card_img, self.card_tbl.position[1], self.card_tbl.position[2]) else GUI:setPosition(self.view.card_img, 0, 0) end if self.card_tbl.scale ~= 0 then GUI:setScale(self.view.card_img, self.card_tbl.scale) else GUI:setScale(self.view.card_img, 1) end GUI:Text_setString(self.view.card_name, self.item_tbl.name) GUI:Text_setTextColor(self.view.card_name, tostring(self.item_tbl.color)) GUI:Text_setString(self.view.text_name, self.item_tbl.name) GUI:Text_setTextColor(self.view.text_name, tostring(self.item_tbl.color)) GUI:Text_setString(self.view.text_tips, "不可交易") GUI:Text_setString(self.view.text_quality, "品质:" .. self.qualityText[self.card_tbl.quality]) GUI:Text_setString(self.view.text_type, "泰坦类型:" .. self.subTypeText[self.item_tbl.subType]) GUI:Text_setString(self.view.text_level, "等级:" .. self.card_tbl.level) self:RefreshAttrItem() self:RefreshSkillItem() self:RefreshNextUnLockAttr() self.panelHeight = 0 GUI:DataListUpdateData(self.view.all_info_data, nil, function() if self.panelHeight >= 300 then self.panelHeight = 300 end GUI:setContentSize(self.view.info_view, 360, self.panelHeight) GUI:setContentSize(self.view.img_panel, 380, 300 + self.panelHeight) GUI:setVisible(self.view.img_panel, true) end) if self.args.type then GUI:setVisible(self.view.btn_func, true) if self.args.type == E_ShapeShiftCardFuncType.UnInlay then GUI:Button_setTitleText(self.view.btn_func, "卸下") elseif self.args.type == E_ShapeShiftCardFuncType.Inlay then GUI:Button_setTitleText(self.view.btn_func, "镶嵌") elseif self.args.type == E_ShapeShiftCardFuncType.Synthesis then if self.args.select then GUI:Button_setTitleText(self.view.btn_func, "卸下") else GUI:Button_setTitleText(self.view.btn_func, "合成") end elseif self.args.type == E_ShapeShiftCardFuncType.UnSynthesis then GUI:Button_setTitleText(self.view.btn_func, "卸下") elseif self.args.type == E_ShapeShiftCardFuncType.Break then if self.args.select then GUI:Button_setTitleText(self.view.btn_func, "卸下") else GUI:Button_setTitleText(self.view.btn_func, "突破") end elseif self.args.type == E_ShapeShiftCardFuncType.UnBreak then GUI:Button_setTitleText(self.view.btn_func, "卸下") else GUI:setVisible(self.view.btn_func, false) end else GUI:setVisible(self.view.btn_func, false) end end function this:RefreshAttrItem() self.all_info[#self.all_info + 1] = { title = "tips_attribute1" } local specialIndex for _, v in pairs(self.card_tbl.attribute) do local preValue local tbl = SL:GetConfig("cfg_att_info", tonumber(v[1])) local attrName = tbl.name local att_remark = tbl.remarks if att_remark == 1 then preValue = v[2] else preValue = tonumber(v[2]) / 100 .. '%' end if v[1] == 201021 then if specialIndex then self.all_info[specialIndex].value = preValue else specialIndex = #self.all_info + 1 self.all_info[specialIndex] = { name = "攻击力" .. ":", value = preValue } end elseif v[1] == 201011 then if specialIndex then self.all_info[specialIndex].value2 = preValue else specialIndex = #self.all_info + 1 self.all_info[specialIndex] = { name = "攻击力" .. ":", value2 = preValue } end else self.all_info[#self.all_info + 1] = { name = attrName .. ":", value = preValue } end end if self.cardInfo.entry and table.count(self.cardInfo.entry) > 0 then self.all_info[#self.all_info + 1] = { title = "tips_attribute24" } local attrTbl = {} for _, v in pairs(self.cardInfo.entry) do local info = {} ---@type cfg_att_info_column local tbl = SL:GetConfig("cfg_att_info", tonumber(v.attrid)) info.attrName = tbl.name info.sort = tbl.sort if tbl.remarks == 1 then info.preValue = v.attrvalue else info.preValue = tonumber(v.attrvalue) / 100 .. '%' end ---@type cfg_card_att_column local tbl_2 = SL:GetConfig("cfg_card_att", tonumber(v.entryid)) if tbl_2 then info.color = tbl_2.color end attrTbl[#attrTbl + 1] = info end table.sort(attrTbl, function(a, b) return a.sort < b.sort end) for i, v in ipairs(attrTbl) do self.all_info[#self.all_info + 1] = { name = v.attrName .. ":", value = v.preValue, color = v.color } end end end function this:RefreshSkillItem() if self.card_tbl.skill and next(self.card_tbl.skill) then self.all_info[#self.all_info + 1] = { title = "tips_attribute22" } ---@type cfg_monster_column local monster = SL:GetConfig("cfg_monster", self.card_tbl.model) local text = "变身为" .. self.card_tbl.name .. ", 持续变身时间" .. math.floor(self.card_tbl.time / 1000) .. "秒, 冷却时间" .. math.floor(self.card_tbl.cd / 1000) .. "秒" self.all_info[#self.all_info + 1] = { icon = monster.icon, tips = text, atlas = "Atlas/UIbianshentb.spriteatlas" } local allSkill = InfoManager.shapeShiftCardInfo:GetAllCardSkillByGroup(self.card_tbl.group, self.card_tbl.level) local skillList = {} for i, v in pairs(allSkill) do skillList[#skillList + 1] = v end table.sort(skillList, function(a, b) return a.cardLevel < b.cardLevel end) for _, v in pairs(skillList) do ---@type cfg_skill_info_column self.all_info[#self.all_info + 1] = { icon = v.icon, tips = v.tips, lock = v.lock, upgrade = v.upgrade } end end end function this:RefreshNextUnLockAttr() local level = self.card_tbl.level local info, eachLevel = InfoManager.shapeShiftCardInfo:GetNextLevelUnLockAttr(self.card_tbl.group, self.card_tbl.level) if info and #info > 0 then local isShow = false if eachLevel then self.all_info[#self.all_info + 1] = { title = "tips_attribute25" } self.all_info[#self.all_info + 1] = { name = "Lv ", value = "随机解锁新赋能", special = true } isShow = true end for i, v in ipairs(info) do if v and v.special and v.special >= 1 then if not isShow then self.all_info[#self.all_info + 1] = { title = "tips_attribute25" } isShow = true end self.all_info[#self.all_info + 1] = { name = "Lv" .. level + i, value = "额外解锁新赋能" } end end end end function this:OnClickFuncBtn() if self.args.type == E_ShapeShiftCardFuncType.Inlay then if self.args.index > 0 then SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_TRANSFER_CARD_INLAY, { self.args.part, self.args.index, self.cardInfo.id }) else SL:TipMessage("当前无法镶嵌卡牌",1, NoticeType.NoticeMid) end elseif self.args.type == E_ShapeShiftCardFuncType.UnInlay then SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_TRANSFER_CARD_PUTOFF, { self.args.part, self.args.index }) elseif self.args.type == E_ShapeShiftCardFuncType.Synthesis then ---@type KLShapeShiftCardSynthesisPanel local panel = GUI:GetUI("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardSynthesis/KLShapeShiftCardSynthesisPanel") if panel then if panel.synthesisIsShow then if not self.args.select then local result = panel:SetSynthesisInfo(self.cardInfo, true) if result then SL:TipMessage(SL:GetConfig('cfg_string', 20007).text, 1, NoticeType.NoticeMid) end else panel:SetSynthesisInfo(self.cardInfo, false) end else panel:RefreshSynthesisPanel() panel:SetSynthesisInfo(self.cardInfo, true) end end elseif self.args.type == E_ShapeShiftCardFuncType.UnSynthesis then ---@type KLShapeShiftCardSynthesisPanel local panel = GUI:GetUI("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardSynthesis/KLShapeShiftCardSynthesisPanel") if panel then if panel.synthesisIsShow then panel:SetSynthesisInfo(self.cardInfo, false) end end elseif self.args.type == E_ShapeShiftCardFuncType.Break then ---@type KLShapeShiftCardBreakPanel local panel = GUI:GetUI("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardBreak/KLShapeShiftCardBreakPanel") if panel then if panel.breakIsShow then if not self.args.select then local result = panel:SetBreakInfo(self.cardInfo, true) if result then SL:TipMessage(SL:GetConfig('cfg_string', 20007).text, 1, NoticeType.NoticeMid) end else panel:SetBreakInfo(self.cardInfo, false) end else panel:RefreshBreakPanel() panel:SetBreakInfo(self.cardInfo, true) end end elseif self.args.type == E_ShapeShiftCardFuncType.UnBreak then ---@type KLShapeShiftCardBreakPanel local panel = GUI:GetUI("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardBreak/KLShapeShiftCardBreakPanel") if panel then if panel.breakIsShow then panel:SetBreakInfo(self.cardInfo, false) end end end self:CloseSelf() end function this:CloseSelf() GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardTips/KLShapeShiftCardTipsPanel") end function this:Close() end return this