diff --git a/lua/app/global/global_const.lua b/lua/app/global/global_const.lua index f8e3b0d7..72a64d81 100644 --- a/lua/app/global/global_const.lua +++ b/lua/app/global/global_const.lua @@ -435,13 +435,13 @@ GConst.HERO_FRAME = { } GConst.FRAME_QLT = { - [1] = "frame_1", - [2] = "frame_2", - [3] = "frame_3", - [4] = "frame_4", - [5] = "frame_5", - [6] = "frame_6", - [7] = "frame_7", + [1] = "hero_frame_1", + [2] = "hero_frame_2", + [3] = "hero_frame_1", + [4] = "hero_frame_1", + [5] = "hero_frame_1", + [6] = "hero_frame_1", + [7] = "hero_frame_1", } GConst.HERO_SMALL_FRAME_QLT = { @@ -465,13 +465,13 @@ GConst.HERO_FRAME_GRAY_QLT = { } GConst.HERO_DEC_QLT = { - [1] = "frame_dec_1", - [2] = "frame_dec_2", - [3] = "frame_dec_3", - [4] = "frame_dec_4", - [5] = "frame_dec_5", - [6] = "frame_dec_6", - [7] = "frame_dec_7", + [1] = "hero_frame_1_1", + [2] = "hero_frame_2_2", + [3] = "hero_frame_1_1", + [4] = "hero_frame_1_1", + [5] = "hero_frame_1_1", + [6] = "hero_frame_1_1", + [7] = "hero_frame_1_1", } GConst.HERO_FRAME_QLT = { diff --git a/lua/app/ui/common/cell/hero_cell.lua b/lua/app/ui/common/cell/hero_cell.lua index c1142402..7b3f3963 100644 --- a/lua/app/ui/common/cell/hero_cell.lua +++ b/lua/app/ui/common/cell/hero_cell.lua @@ -15,12 +15,15 @@ function HeroCell:init() self.progressBg = uiMap["hero_cell.hero_bg.self_node.progress_bg"] self.progress = uiMap["hero_cell.hero_bg.self_node.progress_bg.progress"] self.progressTx = uiMap["hero_cell.hero_bg.self_node.progress_bg.progress_tx"] - self.unlockTx = uiMap["hero_cell.hero_bg.self_node.unlock_tx"] + self.unlockTx = uiMap["hero_cell.hero_bg.unlock_tx"] self.fragmenImg = uiMap["hero_cell.hero_bg.self_node.progress_bg.fragment_img"] self.lvUpArrow = uiMap["hero_cell.hero_bg.self_node.effect_node.ui_spine_obj"] + self.maskImg2 = uiMap["hero_cell.hero_bg.mask_img_2"] -- 他人节点 self.otherNode = uiMap["hero_cell.hero_bg.other_node"] self.otherTxName = uiMap["hero_cell.hero_bg.other_node.tx_name"] + self.starComp = uiMap["hero_cell.hero_bg.star_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL) + self.unlockTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_7)) self.isGray = false self.baseObject:addClickListener(function() @@ -64,6 +67,8 @@ function HeroCell:refresh(heroEntity, isGray) self.progress:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_2", nil, self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)) end self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount + local star = heroEntity:getStar() + self.starComp:refresh(star) if heroEntity:isUnlock() then if heroEntity:isActived() then self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, heroEntity:getLv())) @@ -81,15 +86,6 @@ function HeroCell:refresh(heroEntity, isGray) else self.unlockTx:setVisible(true) self.progressBg:setVisible(false) - -- local unlcokChapter = heroEntity:getUnlcokChapter() - -- local unlockDan = heroEntity:getUnlockDan() - -- if unlcokChapter then - -- self.unlockTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_10, unlcokChapter)) - -- elseif unlockDan then - -- self.unlockTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_12, I18N:getGlobalText(I18N.GlobalConst["ARENA_RANKNAME_" .. unlockDan]))) - -- else - -- self.unlockTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_11)) - -- end end end self:refreshRedPoint() @@ -174,12 +170,9 @@ end function HeroCell:_refresh(heroInfo, isGray) self.clickCallback = nil - if isGray then - self.heroBg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HERO_FRAME_GRAY_QLT[heroInfo.qlt]) - else - self.heroBg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.FRAME_QLT[heroInfo.qlt]) - end - self.heroDec:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HERO_DEC_QLT[heroInfo.qlt]) + self.maskImg2:setActive(isGray) + self.heroBg:setSprite(GConst.ATLAS_PATH.HERO, GConst.FRAME_QLT[heroInfo.qlt]) + self.heroDec:setSprite(GConst.ATLAS_PATH.HERO, GConst.HERO_DEC_QLT[heroInfo.qlt]) self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[heroInfo.position]) self.check:setVisible(false) self.sImg:setVisible(heroInfo.qlt >= 4) diff --git a/lua/app/ui/common/cell/large_hero_cell.lua b/lua/app/ui/common/cell/large_hero_cell.lua index 002cd056..0d0b36c5 100644 --- a/lua/app/ui/common/cell/large_hero_cell.lua +++ b/lua/app/ui/common/cell/large_hero_cell.lua @@ -57,12 +57,13 @@ function LargeHeroCell:refreshWithCfgId(id, isGray) end function LargeHeroCell:_refresh(heroInfo, isGray) - if isGray then - self.heroBg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HERO_FRAME_GRAY_QLT[heroInfo.qlt]) - else - self.heroBg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.FRAME_QLT[heroInfo.qlt]) - end - self.heroDec:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HERO_DEC_QLT[heroInfo.qlt]) + -- if isGray then + -- self.heroBg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HERO_FRAME_GRAY_QLT[heroInfo.qlt]) + -- else + -- self.heroBg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.FRAME_QLT[heroInfo.qlt]) + -- end + self.heroBg:setSprite(GConst.ATLAS_PATH.HERO, GConst.FRAME_QLT[heroInfo.qlt]) + self.heroDec:setSprite(GConst.ATLAS_PATH.HERO, GConst.HERO_DEC_QLT[heroInfo.qlt]) self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[heroInfo.position]) self.check:setVisible(false) self.sImg:setVisible(heroInfo.qlt >= 4) diff --git a/lua/app/ui/hero/cell/hero_list_cell.lua b/lua/app/ui/hero/cell/hero_list_cell.lua index db5d3644..005c526f 100644 --- a/lua/app/ui/hero/cell/hero_list_cell.lua +++ b/lua/app/ui/hero/cell/hero_list_cell.lua @@ -1,8 +1,8 @@ local HeroListCell = class("HeroListCell", BaseCell) local H = { - NORMAL = 220, - HAS_TITLE = 340 + NORMAL = 260, + HAS_TITLE = 380 } function HeroListCell:init() diff --git a/lua/app/ui/hero/hero_comp.lua b/lua/app/ui/hero/hero_comp.lua index 8e8abbaf..8ca784ab 100644 --- a/lua/app/ui/hero/hero_comp.lua +++ b/lua/app/ui/hero/hero_comp.lua @@ -5,7 +5,7 @@ local OUT_SCREEN_X = 10000 function HeroComp:init() self.uiMap = self:getBaseObject():genAllChildren() - self.scrollRect = self.uiMap["hero_ui.scrollrect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) + self.scrollRect = self.uiMap["hero_ui.bottom_bg.scrollrect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) self.scrollRect:addInitCallback(function() return HERO_LIST_CELL end) @@ -37,10 +37,10 @@ function HeroComp:init() self.uiMap["hero_ui.formation.hero_5.ui_spine_obj"], } self.heroSpineList = {} - self.largeHeroCell = CellManager:addCellComp(self.uiMap["hero_ui.scrollrect.viewport.content.large_hero_cell"], GConst.TYPEOF_LUA_CLASS.LARGE_HERO_CELL) + self.largeHeroCell = CellManager:addCellComp(self.uiMap["hero_ui.bottom_bg.scrollrect.viewport.content.large_hero_cell"], GConst.TYPEOF_LUA_CLASS.LARGE_HERO_CELL) self.txTitle = self.uiMap["hero_ui.top_bg.title_bg_img.title_tx"] self.rimgTopBG = self.uiMap["hero_ui.top_bg"] - self.content = self.uiMap["hero_ui.scrollrect.viewport.content"] + self.content = self.uiMap["hero_ui.bottom_bg.scrollrect.viewport.content"] self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X) self.content:addClickListener(function() self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X) @@ -52,6 +52,21 @@ function HeroComp:init() end) self.uiMap["hero_ui.btn_collect.tx_collect"]:setText(I18N:getGlobalText(I18N.GlobalConst.COLLECTION_DESC_10)) + local attrTx = self.uiMap["hero_ui.bottom_bg.attr_bg.attr_tx"] + local infoBtn = self.uiMap["hero_ui.bottom_bg.attr_bg.info_btn"] + self.elementType = 0 + self.elementTypeBtns = {} + for i = 0, 5 do + self.elementTypeBtns[i] = self.uiMap["hero_ui.bottom_bg.filter_bg.btn_" .. i] + self.elementTypeBtns[i]:addClickListener(function() + if self.elementType == i then + return + end + self.elementType = i + self:refresh() + end) + end + for index, obj in ipairs(self.heroNodeList) do obj:addClickListener(function() local heroId = self.curFormation[index] @@ -197,7 +212,7 @@ function HeroComp:refreshDungeonRuneFormation() end function HeroComp:refreshScrollRect() - self.heroList = DataManager.HeroData:getAllHeroesSort(self.battleType) -- 每次都重新算一次 + self.heroList = DataManager.HeroData:getAllHeroesSort(self.battleType, self.elementType) -- 每次都重新算一次 for i = 1, 5 do local heroId = self.curFormation[i] @@ -230,7 +245,7 @@ function HeroComp:refreshScrollRect() end self.allHeroCount = #self.heroList - self.unlockCount = DataManager.HeroData:getUnlockHeroCount() + self.unlockCount = DataManager.HeroData:getUnlockHeroCount(self.elementType) local lockCount = self.allHeroCount - self.unlockCount local cellCount = 0 if self.unlockCount > 0 then @@ -276,8 +291,8 @@ end function HeroComp:adapt() local addH = GFunc.calculateFitSizeY() local uiMap = self:getBaseObject():genAllChildren() - local scrollRect = uiMap["hero_ui.scrollrect"] - local viewport = uiMap["hero_ui.scrollrect.viewport"] + local scrollRect = uiMap["hero_ui.bottom_bg.scrollrect"] + local viewport = uiMap["hero_ui.bottom_bg.scrollrect.viewport"] if not self.rectDefaultSize then self.rectDefaultSize = scrollRect:getSizeDelta() end @@ -290,8 +305,8 @@ end function HeroComp:clearAdapt() local uiMap = self:getBaseObject():genAllChildren() - local scrollRect = uiMap["hero_ui.scrollrect"] - local viewport = uiMap["hero_ui.scrollrect.viewport"] + local scrollRect = uiMap["hero_ui.bottom_bg.scrollrect"] + local viewport = uiMap["hero_ui.bottom_bg.scrollrect.viewport"] if not self.rectDefaultSize then self.rectDefaultSize = scrollRect:getSizeDelta() end diff --git a/lua/app/userdata/hero/hero_data.lua b/lua/app/userdata/hero/hero_data.lua index 43c31271..b9d3f83b 100644 --- a/lua/app/userdata/hero/hero_data.lua +++ b/lua/app/userdata/hero/hero_data.lua @@ -130,10 +130,10 @@ function HeroData:getHeroIsUnlock(id) return entity:isUnlock() end -function HeroData:getUnlockHeroCount() +function HeroData:getUnlockHeroCount(elementType) local count = 0 for id, entity in pairs(self.heroes) do - if entity:isUnlock() then + if entity:isUnlock() and (not elementType or elementType == 0 or entity:getMatchType() == elementType) then count = count + 1 end end @@ -273,7 +273,7 @@ function HeroData:getAllHeroesBIStr() end -- 获取所有英雄列表(等级>品质>id) -function HeroData:getAllHeroesSort(formationType) +function HeroData:getAllHeroesSort(formationType, elementType) local formationMap if formationType then local formation = DataManager.FormationData:getFormation(formationType) @@ -285,7 +285,9 @@ function HeroData:getAllHeroesSort(formationType) local result = {} local heroCfg = ConfigManager:getConfig("hero") for id, v in pairs(heroCfg) do - table.insert(result, {cfgId = id, sort = id, elementType = v.position}) + if not elementType or elementType == 0 or elementType == v.position then + table.insert(result, {cfgId = id, sort = id, elementType = v.position}) + end end for _, info in ipairs(result) do diff --git a/lua/app/userdata/hero/hero_entity.lua b/lua/app/userdata/hero/hero_entity.lua index a867ae9e..7c8f0d39 100644 --- a/lua/app/userdata/hero/hero_entity.lua +++ b/lua/app/userdata/hero/hero_entity.lua @@ -435,7 +435,7 @@ function HeroEntity:getLvUpLv() end count = count + 1 end - return count + self.data.lv, count == 0 + return count + self.data.lv, count ~= 0 end -- endregion