local BaseTips = require "app/ui/tips/base_tips" local LegacyTips = class("LegacyTips", BaseTips) function LegacyTips:ctor(params) self.params = params or {} self.entity = DataManager.BagData.LegacyData:getLegacyByCfgId(self.params.id) end function LegacyTips:getPrefabPath() return "assets/prefabs/ui/tips/legacy_tips.prefab" end function LegacyTips:onLoadRootComplete() local uiMap = self.root:genAllChildren() self.descTx = uiMap["legacy_tips.bg.desc_tx"] self.legacyFrameBg = uiMap["legacy_tips.bg.frame_bg"] self.legacyIcon = uiMap["legacy_tips.bg.icon"] self.nameTx = uiMap["legacy_tips.bg.name_tx"] self.lvTx = uiMap["legacy_tips.bg.lv_tx"] self.slider = uiMap["legacy_tips.bg.slider_bg.slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER) self.sliderTx = uiMap["legacy_tips.bg.slider_bg.slider_tx"] self.qltTx = uiMap["legacy_tips.bg.qlt_tx"] self.attrTx = uiMap["legacy_tips.bg.attr_tx"] uiMap["legacy_tips.bg.desc_tx_1"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_1)) uiMap["legacy_tips.bg.close_btn"]:addClickListener(function () self:closeUI() end) end function LegacyTips:onRefresh() self.root:addClickListener(function () self:closeUI() end) local qlt = self.entity:getQuality() local lv = self.entity:getLv() self.nameTx:setText(self.entity:getName()) self.legacyFrameBg:setSprite(self.entity:getFrameRes()) self.legacyIcon:setSprite(self.entity:getIconRes()) local skillIds = self.entity:getSkills() local str for i,v in ipairs(skillIds) do if not str then str = GFunc.getSkillEffectStr(v, lv) else str = str .. "\n" .. GFunc.getSkillEffectStr(v, lv) end end self.descTx:setText(str) local attrCfg = ConfigManager:getConfig("attr") local attrs = self.entity:getAllOwnAttr() local attrStr local valueStr for i = 1, #attrCfg do if attrs[i] then if not attrStr then attrStr = GFunc.getAttrName(i) else attrStr = attrStr .. "&" .. GFunc.getAttrName(i) end if not valueStr then valueStr = string.format("%s", GConst.COLOR_CODE.GREEN, " +" .. GFunc.getFinalPerStr(i, attrs[i])) end end end attrStr = attrStr .. valueStr self.attrTx:setText(attrStr) local str = string.format("%s", GConst.QUALITY_TYPE[qlt], I18N:getGlobalText("QLT_DESC_" .. qlt)) self.qltTx:setText(str) self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.LV_POINT, lv)) local num = self.entity:getCount() local needNum = self.entity:getNeedNum() self.sliderTx:setText(num .. "/" .. needNum) self.slider.value = num / needNum end return LegacyTips