hero
This commit is contained in:
parent
22ba335f36
commit
32534e7880
@ -435,13 +435,13 @@ GConst.HERO_FRAME = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GConst.FRAME_QLT = {
|
GConst.FRAME_QLT = {
|
||||||
[1] = "frame_1",
|
[1] = "hero_frame_1",
|
||||||
[2] = "frame_2",
|
[2] = "hero_frame_2",
|
||||||
[3] = "frame_3",
|
[3] = "hero_frame_1",
|
||||||
[4] = "frame_4",
|
[4] = "hero_frame_1",
|
||||||
[5] = "frame_5",
|
[5] = "hero_frame_1",
|
||||||
[6] = "frame_6",
|
[6] = "hero_frame_1",
|
||||||
[7] = "frame_7",
|
[7] = "hero_frame_1",
|
||||||
}
|
}
|
||||||
|
|
||||||
GConst.HERO_SMALL_FRAME_QLT = {
|
GConst.HERO_SMALL_FRAME_QLT = {
|
||||||
@ -465,13 +465,13 @@ GConst.HERO_FRAME_GRAY_QLT = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GConst.HERO_DEC_QLT = {
|
GConst.HERO_DEC_QLT = {
|
||||||
[1] = "frame_dec_1",
|
[1] = "hero_frame_1_1",
|
||||||
[2] = "frame_dec_2",
|
[2] = "hero_frame_2_2",
|
||||||
[3] = "frame_dec_3",
|
[3] = "hero_frame_1_1",
|
||||||
[4] = "frame_dec_4",
|
[4] = "hero_frame_1_1",
|
||||||
[5] = "frame_dec_5",
|
[5] = "hero_frame_1_1",
|
||||||
[6] = "frame_dec_6",
|
[6] = "hero_frame_1_1",
|
||||||
[7] = "frame_dec_7",
|
[7] = "hero_frame_1_1",
|
||||||
}
|
}
|
||||||
|
|
||||||
GConst.HERO_FRAME_QLT = {
|
GConst.HERO_FRAME_QLT = {
|
||||||
|
|||||||
@ -15,12 +15,15 @@ function HeroCell:init()
|
|||||||
self.progressBg = uiMap["hero_cell.hero_bg.self_node.progress_bg"]
|
self.progressBg = uiMap["hero_cell.hero_bg.self_node.progress_bg"]
|
||||||
self.progress = uiMap["hero_cell.hero_bg.self_node.progress_bg.progress"]
|
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.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.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.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.otherNode = uiMap["hero_cell.hero_bg.other_node"]
|
||||||
self.otherTxName = uiMap["hero_cell.hero_bg.other_node.tx_name"]
|
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.isGray = false
|
||||||
self.baseObject:addClickListener(function()
|
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))
|
self.progress:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_2", nil, self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER))
|
||||||
end
|
end
|
||||||
self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount
|
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:isUnlock() then
|
||||||
if heroEntity:isActived() then
|
if heroEntity:isActived() then
|
||||||
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, heroEntity:getLv()))
|
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, heroEntity:getLv()))
|
||||||
@ -81,15 +86,6 @@ function HeroCell:refresh(heroEntity, isGray)
|
|||||||
else
|
else
|
||||||
self.unlockTx:setVisible(true)
|
self.unlockTx:setVisible(true)
|
||||||
self.progressBg:setVisible(false)
|
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
|
||||||
end
|
end
|
||||||
self:refreshRedPoint()
|
self:refreshRedPoint()
|
||||||
@ -174,12 +170,9 @@ end
|
|||||||
|
|
||||||
function HeroCell:_refresh(heroInfo, isGray)
|
function HeroCell:_refresh(heroInfo, isGray)
|
||||||
self.clickCallback = nil
|
self.clickCallback = nil
|
||||||
if isGray then
|
self.maskImg2:setActive(isGray)
|
||||||
self.heroBg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HERO_FRAME_GRAY_QLT[heroInfo.qlt])
|
self.heroBg:setSprite(GConst.ATLAS_PATH.HERO, GConst.FRAME_QLT[heroInfo.qlt])
|
||||||
else
|
self.heroDec:setSprite(GConst.ATLAS_PATH.HERO, GConst.HERO_DEC_QLT[heroInfo.qlt])
|
||||||
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.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[heroInfo.position])
|
self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[heroInfo.position])
|
||||||
self.check:setVisible(false)
|
self.check:setVisible(false)
|
||||||
self.sImg:setVisible(heroInfo.qlt >= 4)
|
self.sImg:setVisible(heroInfo.qlt >= 4)
|
||||||
|
|||||||
@ -57,12 +57,13 @@ function LargeHeroCell:refreshWithCfgId(id, isGray)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function LargeHeroCell:_refresh(heroInfo, isGray)
|
function LargeHeroCell:_refresh(heroInfo, isGray)
|
||||||
if isGray then
|
-- if isGray then
|
||||||
self.heroBg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HERO_FRAME_GRAY_QLT[heroInfo.qlt])
|
-- self.heroBg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HERO_FRAME_GRAY_QLT[heroInfo.qlt])
|
||||||
else
|
-- else
|
||||||
self.heroBg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.FRAME_QLT[heroInfo.qlt])
|
-- self.heroBg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.FRAME_QLT[heroInfo.qlt])
|
||||||
end
|
-- end
|
||||||
self.heroDec:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HERO_DEC_QLT[heroInfo.qlt])
|
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.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[heroInfo.position])
|
||||||
self.check:setVisible(false)
|
self.check:setVisible(false)
|
||||||
self.sImg:setVisible(heroInfo.qlt >= 4)
|
self.sImg:setVisible(heroInfo.qlt >= 4)
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
local HeroListCell = class("HeroListCell", BaseCell)
|
local HeroListCell = class("HeroListCell", BaseCell)
|
||||||
|
|
||||||
local H = {
|
local H = {
|
||||||
NORMAL = 220,
|
NORMAL = 260,
|
||||||
HAS_TITLE = 340
|
HAS_TITLE = 380
|
||||||
}
|
}
|
||||||
|
|
||||||
function HeroListCell:init()
|
function HeroListCell:init()
|
||||||
|
|||||||
@ -5,7 +5,7 @@ local OUT_SCREEN_X = 10000
|
|||||||
|
|
||||||
function HeroComp:init()
|
function HeroComp:init()
|
||||||
self.uiMap = self:getBaseObject():genAllChildren()
|
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()
|
self.scrollRect:addInitCallback(function()
|
||||||
return HERO_LIST_CELL
|
return HERO_LIST_CELL
|
||||||
end)
|
end)
|
||||||
@ -37,10 +37,10 @@ function HeroComp:init()
|
|||||||
self.uiMap["hero_ui.formation.hero_5.ui_spine_obj"],
|
self.uiMap["hero_ui.formation.hero_5.ui_spine_obj"],
|
||||||
}
|
}
|
||||||
self.heroSpineList = {}
|
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.txTitle = self.uiMap["hero_ui.top_bg.title_bg_img.title_tx"]
|
||||||
self.rimgTopBG = self.uiMap["hero_ui.top_bg"]
|
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.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
|
||||||
self.content:addClickListener(function()
|
self.content:addClickListener(function()
|
||||||
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
|
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
|
||||||
@ -52,6 +52,21 @@ function HeroComp:init()
|
|||||||
end)
|
end)
|
||||||
self.uiMap["hero_ui.btn_collect.tx_collect"]:setText(I18N:getGlobalText(I18N.GlobalConst.COLLECTION_DESC_10))
|
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
|
for index, obj in ipairs(self.heroNodeList) do
|
||||||
obj:addClickListener(function()
|
obj:addClickListener(function()
|
||||||
local heroId = self.curFormation[index]
|
local heroId = self.curFormation[index]
|
||||||
@ -197,7 +212,7 @@ function HeroComp:refreshDungeonRuneFormation()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function HeroComp:refreshScrollRect()
|
function HeroComp:refreshScrollRect()
|
||||||
self.heroList = DataManager.HeroData:getAllHeroesSort(self.battleType) -- 每次都重新算一次
|
self.heroList = DataManager.HeroData:getAllHeroesSort(self.battleType, self.elementType) -- 每次都重新算一次
|
||||||
|
|
||||||
for i = 1, 5 do
|
for i = 1, 5 do
|
||||||
local heroId = self.curFormation[i]
|
local heroId = self.curFormation[i]
|
||||||
@ -230,7 +245,7 @@ function HeroComp:refreshScrollRect()
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.allHeroCount = #self.heroList
|
self.allHeroCount = #self.heroList
|
||||||
self.unlockCount = DataManager.HeroData:getUnlockHeroCount()
|
self.unlockCount = DataManager.HeroData:getUnlockHeroCount(self.elementType)
|
||||||
local lockCount = self.allHeroCount - self.unlockCount
|
local lockCount = self.allHeroCount - self.unlockCount
|
||||||
local cellCount = 0
|
local cellCount = 0
|
||||||
if self.unlockCount > 0 then
|
if self.unlockCount > 0 then
|
||||||
@ -276,8 +291,8 @@ end
|
|||||||
function HeroComp:adapt()
|
function HeroComp:adapt()
|
||||||
local addH = GFunc.calculateFitSizeY()
|
local addH = GFunc.calculateFitSizeY()
|
||||||
local uiMap = self:getBaseObject():genAllChildren()
|
local uiMap = self:getBaseObject():genAllChildren()
|
||||||
local scrollRect = uiMap["hero_ui.scrollrect"]
|
local scrollRect = uiMap["hero_ui.bottom_bg.scrollrect"]
|
||||||
local viewport = uiMap["hero_ui.scrollrect.viewport"]
|
local viewport = uiMap["hero_ui.bottom_bg.scrollrect.viewport"]
|
||||||
if not self.rectDefaultSize then
|
if not self.rectDefaultSize then
|
||||||
self.rectDefaultSize = scrollRect:getSizeDelta()
|
self.rectDefaultSize = scrollRect:getSizeDelta()
|
||||||
end
|
end
|
||||||
@ -290,8 +305,8 @@ end
|
|||||||
|
|
||||||
function HeroComp:clearAdapt()
|
function HeroComp:clearAdapt()
|
||||||
local uiMap = self:getBaseObject():genAllChildren()
|
local uiMap = self:getBaseObject():genAllChildren()
|
||||||
local scrollRect = uiMap["hero_ui.scrollrect"]
|
local scrollRect = uiMap["hero_ui.bottom_bg.scrollrect"]
|
||||||
local viewport = uiMap["hero_ui.scrollrect.viewport"]
|
local viewport = uiMap["hero_ui.bottom_bg.scrollrect.viewport"]
|
||||||
if not self.rectDefaultSize then
|
if not self.rectDefaultSize then
|
||||||
self.rectDefaultSize = scrollRect:getSizeDelta()
|
self.rectDefaultSize = scrollRect:getSizeDelta()
|
||||||
end
|
end
|
||||||
|
|||||||
@ -130,10 +130,10 @@ function HeroData:getHeroIsUnlock(id)
|
|||||||
return entity:isUnlock()
|
return entity:isUnlock()
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroData:getUnlockHeroCount()
|
function HeroData:getUnlockHeroCount(elementType)
|
||||||
local count = 0
|
local count = 0
|
||||||
for id, entity in pairs(self.heroes) do
|
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
|
count = count + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -273,7 +273,7 @@ function HeroData:getAllHeroesBIStr()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- 获取所有英雄列表(等级>品质>id)
|
-- 获取所有英雄列表(等级>品质>id)
|
||||||
function HeroData:getAllHeroesSort(formationType)
|
function HeroData:getAllHeroesSort(formationType, elementType)
|
||||||
local formationMap
|
local formationMap
|
||||||
if formationType then
|
if formationType then
|
||||||
local formation = DataManager.FormationData:getFormation(formationType)
|
local formation = DataManager.FormationData:getFormation(formationType)
|
||||||
@ -285,8 +285,10 @@ function HeroData:getAllHeroesSort(formationType)
|
|||||||
local result = {}
|
local result = {}
|
||||||
local heroCfg = ConfigManager:getConfig("hero")
|
local heroCfg = ConfigManager:getConfig("hero")
|
||||||
for id, v in pairs(heroCfg) do
|
for id, v in pairs(heroCfg) do
|
||||||
|
if not elementType or elementType == 0 or elementType == v.position then
|
||||||
table.insert(result, {cfgId = id, sort = id, elementType = v.position})
|
table.insert(result, {cfgId = id, sort = id, elementType = v.position})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
for _, info in ipairs(result) do
|
for _, info in ipairs(result) do
|
||||||
local heroEntity = self:getHeroById(info.cfgId)
|
local heroEntity = self:getHeroById(info.cfgId)
|
||||||
|
|||||||
@ -435,7 +435,7 @@ function HeroEntity:getLvUpLv()
|
|||||||
end
|
end
|
||||||
count = count + 1
|
count = count + 1
|
||||||
end
|
end
|
||||||
return count + self.data.lv, count == 0
|
return count + self.data.lv, count ~= 0
|
||||||
end
|
end
|
||||||
-- endregion
|
-- endregion
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user