Merge branch 'fang/调整' into 'dev'
英雄编队拆分出来 See merge request b6-client/b6-lua!4
This commit is contained in:
commit
134797fc09
@ -177,6 +177,9 @@ GConst.TYPEOF_LUA_CLASS = {
|
|||||||
POP_HERO_CELL = "app/ui/shop/cell/pop_hero_cell",
|
POP_HERO_CELL = "app/ui/shop/cell/pop_hero_cell",
|
||||||
POP_REWARD_CELL = "app/ui/shop/cell/pop_reward_cell",
|
POP_REWARD_CELL = "app/ui/shop/cell/pop_reward_cell",
|
||||||
GIFT_REWARD_CELL = "app/ui/shop/cell/gift_reward_cell",
|
GIFT_REWARD_CELL = "app/ui/shop/cell/gift_reward_cell",
|
||||||
|
|
||||||
|
-- comp
|
||||||
|
HERO_FORMATION_COMP = "app/ui/common/component/hero_formation_comp",
|
||||||
}
|
}
|
||||||
|
|
||||||
GConst.ATLAS_PATH = {
|
GConst.ATLAS_PATH = {
|
||||||
|
|||||||
47
lua/app/ui/common/component/hero_formation_comp.lua
Normal file
47
lua/app/ui/common/component/hero_formation_comp.lua
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
-- 英雄编队
|
||||||
|
local HeroFormationComp = class("HeroFormationComp", LuaComponent)
|
||||||
|
|
||||||
|
function HeroFormationComp:init()
|
||||||
|
local uiMap = self.baseObject:genAllChildren()
|
||||||
|
|
||||||
|
self.heroCells = {
|
||||||
|
uiMap["hero_formation_comp.hero_cell_1"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
|
||||||
|
uiMap["hero_formation_comp.hero_cell_2"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
|
||||||
|
uiMap["hero_formation_comp.hero_cell_3"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
|
||||||
|
uiMap["hero_formation_comp.hero_cell_4"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
|
||||||
|
uiMap["hero_formation_comp.hero_cell_5"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function HeroFormationComp:refresh()
|
||||||
|
|
||||||
|
-- todo 传参控制显示对手还是自己的编队
|
||||||
|
|
||||||
|
local formation = DataManager.FormationData:getStageFormation()
|
||||||
|
for i, heroCell in ipairs(self.heroCells) do
|
||||||
|
if formation[i] then
|
||||||
|
local heroEntity = DataManager.HeroData:getHeroById(formation[i])
|
||||||
|
if heroEntity then
|
||||||
|
heroCell:setVisible(true, 1)
|
||||||
|
heroCell:refresh(heroEntity)
|
||||||
|
heroCell:addClickListener(function()
|
||||||
|
ModuleManager.HeroManager:showHeroDetailUI(heroEntity:getCfgId())
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
heroCell:setVisible(false)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
heroCell:setVisible(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function HeroFormationComp:setFormationVisible(visible)
|
||||||
|
self.baseObject:setVisible(visible)
|
||||||
|
end
|
||||||
|
|
||||||
|
function HeroFormationComp:getFormationPosY()
|
||||||
|
return self.baseObject:fastGetAnchoredPositionY()
|
||||||
|
end
|
||||||
|
|
||||||
|
return HeroFormationComp
|
||||||
10
lua/app/ui/common/component/hero_formation_comp.lua.meta
Normal file
10
lua/app/ui/common/component/hero_formation_comp.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 313e4030686a03942908f4e6796b6ab6
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -174,23 +174,16 @@ function MainComp:getCurRightModuleIdx()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function MainComp:initStageFormation()
|
function MainComp:initStageFormation()
|
||||||
self.heroCells = {
|
self.heroCells = self.uiMap["main_comp.hero_formation_comp"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_FORMATION_COMP)
|
||||||
self.uiMap["main_comp.hero_bg.hero_cell_1"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
|
|
||||||
self.uiMap["main_comp.hero_bg.hero_cell_2"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
|
|
||||||
self.uiMap["main_comp.hero_bg.hero_cell_3"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
|
|
||||||
self.uiMap["main_comp.hero_bg.hero_cell_4"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
|
|
||||||
self.uiMap["main_comp.hero_bg.hero_cell_5"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
|
|
||||||
}
|
|
||||||
|
|
||||||
self.heroFormation = self.uiMap["main_comp.hero_bg"]
|
local heroBgPosY = self.heroCells:getFormationPosY()
|
||||||
local heroBgPosY = self.heroFormation:fastGetAnchoredPositionY()
|
|
||||||
local sWidth, sHeight = GFunc.getUIExpandScreenSize()
|
local sWidth, sHeight = GFunc.getUIExpandScreenSize()
|
||||||
local hSHeight = sHeight / 2
|
local hSHeight = sHeight / 2
|
||||||
self.btnPosY = (heroBgPosY + (BOTTOM_HEIGHT / 2 - hSHeight)) / 2
|
self.btnPosY = (heroBgPosY + (BOTTOM_HEIGHT / 2 - hSHeight)) / 2
|
||||||
end
|
end
|
||||||
|
|
||||||
function MainComp:setFormationVisible(visible)
|
function MainComp:setFormationVisible(visible)
|
||||||
self.heroFormation:setVisible(visible)
|
self.heroCells:setFormationVisible(visible)
|
||||||
end
|
end
|
||||||
|
|
||||||
function MainComp:refresh()
|
function MainComp:refresh()
|
||||||
@ -218,23 +211,7 @@ function MainComp:refreshDungeon()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function MainComp:refreshStageFormaion()
|
function MainComp:refreshStageFormaion()
|
||||||
local formation = DataManager.FormationData:getStageFormation()
|
self.heroCells:refresh()
|
||||||
for i, heroCell in ipairs(self.heroCells) do
|
|
||||||
if formation[i] then
|
|
||||||
local heroEntity = DataManager.HeroData:getHeroById(formation[i])
|
|
||||||
if heroEntity then
|
|
||||||
heroCell:setVisible(true, 1)
|
|
||||||
heroCell:refresh(heroEntity)
|
|
||||||
heroCell:addClickListener(function()
|
|
||||||
ModuleManager.HeroManager:showHeroDetailUI(heroEntity:getCfgId())
|
|
||||||
end)
|
|
||||||
else
|
|
||||||
heroCell:setVisible(false)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
heroCell:setVisible(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function MainComp:getDailyChallengeIconPos()
|
function MainComp:getDailyChallengeIconPos()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user