local RunesSuitUI = class("RunesSuitUI", BaseUI) function RunesSuitUI:isFullScreen() return false end function RunesSuitUI:getPrefabPath() return "assets/prefabs/ui/runes/runes_suit_ui.prefab" end function RunesSuitUI:onPressBackspace() self:closeUI() end function RunesSuitUI:ctor(params) self.heroEntity = params self.runesEntity = DataManager.RunesData:getRunes(self.heroEntity:getCfgId()) self.curLevel = DataManager.RunesData:getLevel() end function RunesSuitUI:onLoadRootComplete() local uiMap = self.root:genAllChildren() self.txTitle = uiMap["runes_suit_ui.bg.title.tx_title"] self.btnClose = uiMap["runes_suit_ui.bg.close_btn"] self.suits = {} for i = 1, 5 do self.suits[i] = uiMap["runes_suit_ui.bg.list.suit_cell_" .. i] end self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_9)) self.btnClose:addClickListener(function() self:closeUI() end) end function RunesSuitUI:onRefresh() for index, obj in ipairs(self.suits) do local map = obj:genAllChildren() local imgIcon = map["img_type"] local txName = map["tx_suit_name"] local txAttr1 = map["tx_suit_attr1"] local txAttr2 = map["tx_suit_attr2"] local txLevel = map["tx_level"] imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_rune_"..index) txName:setText(DataManager.RunesData:getSuitName(index)) local attr1 = DataManager.RunesData:getSuitAttr(index, self.heroEntity:getMatchType(), 1) local attr2 = DataManager.RunesData:getSuitAttr(index, self.heroEntity:getMatchType(), 2) local level = self.runesEntity:getSuitLevel(index) txLevel:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, level)) local str1 = I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_15, GFunc.getAttrDesc(attr1.type, attr1.num)) local str2 = I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_16, GFunc.getAttrDesc(attr2.type, attr2.num)) if level == 0 then str1 = "" .. str1 .. "" str2 = "" .. str2 .. "" elseif level == 1 then str1 = "" .. str1 .. "" str2 = "" .. str2 .. "" elseif level == 2 then str1 = "" .. str1 .. "" str2 = "" .. str2 .. "" end txAttr1:setText(str1) txAttr2:setText(str2) end end return RunesSuitUI