【山河社稷图】提交

dev_chengFeng
zhangqiang 2021-05-07 20:24:41 +08:00
parent 1db33218d8
commit 1745c20ab0
8 changed files with 7537 additions and 8484 deletions

View File

@ -0,0 +1,12 @@
FightLevelManager = {};
local this = FightLevelManager
function this.Initialize()
end
--开始战斗
function this.FightLevelFightBattle(_fightLevelId,_teamId, callBack)
NetManager.StartExpeditionBattleRequest(_fightLevelId, _teamId,function (msg)
local fightData = BattleManager.GetBattleServerData(msg,0)
UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.EXECUTE_FIGHT, callBack)
end)
end
return this

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 561dddac65606f248b940344cb8ad788
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -76,8 +76,8 @@ function FightLevelSingleLevelInfoPopup:OnOpen(popupType,...)
for i=1,#contentPrefabs do
contentPrefabs[i].gameObject:SetActive(false)
end
this.BGImage1:SetActive(index == 1 or index == 2)
this.BGImage2:SetActive(index == 3 or index == 4 or index == 5)
this.BGImage1:SetActive(index == 1 )
this.BGImage2:SetActive(index == 2 or index == 3 or index == 4)
contentPrefabs[index].gameObject:SetActive(true)
contentScripts[index].view:OnShow(this,...)--1、传入自己 2、传入不定参
end

View File

@ -5,28 +5,36 @@ local parent
--传入特效层级
local sortingOrder=0
local fun
--item容器
local itemList = {}
local heroListGo = {}
local monsterData = {}
local rewardData = {}
local type = 1 --1 前往 2 放弃
local fightLevelId = 0
local liveNodes = {}
local liveNames = {}
local curNodeConFig
local roleConfig=ConfigManager.GetConfig(ConfigName.RoleConfig)
local rewardGoList = {}
local rewardItemViewGoList = {}
local curShowIndex = true
function this:InitComponent(gameObject)
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
this.tip=Util.GetGameObject(gameObject,"tip"):GetComponent("Text")
this.conditionInfoText=Util.GetGameObject(gameObject,"conditionInfoText")
this.power = Util.GetGameObject(gameObject, "Power/Value"):GetComponent("Text")
this.sureBtn=Util.GetGameObject(gameObject,"sureBtn")
this.sureBtnText=Util.GetGameObject(gameObject,"sureBtn/Text"):GetComponent("Text")
--滚动条根节点
this.root = Util.GetGameObject(gameObject, "Root")
rewardGoList = {}
rewardItemViewGoList = {}
this.itemPre = Util.GetGameObject(gameObject, "itemPre")
this.rewardRoot = Util.GetGameObject(gameObject, "rewardRoot")
this.NoviceItemList={}--存储itemview 重复利用
heroListGo = {}
for i = 1, 6 do
heroListGo[i] = Util.GetGameObject(gameObject, "RoleGrid/Bg"..i.."/Hero"..i)
end
this.backBtn=Util.GetGameObject(gameObject,"BackBtn")
this.BackBattleBtn=Util.GetGameObject(gameObject,"BackBattleBtn")
this.rewardBtn=Util.GetGameObject(gameObject,"rewardBtn")
this.leftBtn=Util.GetGameObject(gameObject,"leftBtn")
this.rightBtn=Util.GetGameObject(gameObject,"rightBtn")
end
function this:BindEvent()
@ -36,14 +44,18 @@ function this:BindEvent()
Util.AddClick(this.backBtn, function()
parent:ClosePanel()
end)
end
function this:BtnClickEvent()
if type == 1 then
Util.AddClick(this.BackBattleBtn, function()
parent:ClosePanel()
elseif type == 2 then
end)
Util.AddClick(this.rewardBtn, function()
parent:ClosePanel()
UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.EXPEDITION, monsterData)
end
end)
Util.AddClick(this.leftBtn, function()
this:LeftOrRightBtnClickEvent()
end)
Util.AddClick(this.rightBtn, function()
this:LeftOrRightBtnClickEvent()
end)
end
function this:AddListener()
@ -56,76 +68,65 @@ function this:OnShow(_parent,...)
sortingOrder = _parent.sortingOrder
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
local args = {...}
monsterData = args[1]
type = args[2]
fun = args[3]
--组数据
rewardData = {}
local curRewardData = {}
--curNodeConFig = ConfigManager.TryGetConfigData(ConfigName.ExpeditionNodeConfig,monsterData.type)
curNodeConFig = ConfigManager.TryGetConfigData(ConfigName.ExpeditionNodeConfig,monsterData.type)
local Reward = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.ExpeditionFloorConfig,"Floor",ExpeditionManager.expeditionLeve,"FloorLay",monsterData.lay - 1)
if Reward and Reward.Reward and #Reward.Reward > 0 then
for i = 1, #Reward.Reward do
local rewardGroupConfig = ConfigManager.TryGetConfigData(ConfigName.RewardGroup,Reward.Reward[i])
if rewardGroupConfig and #rewardGroupConfig.ShowItem > 0 then
for j = 1, #rewardGroupConfig.ShowItem do
local v = rewardGroupConfig.ShowItem[j]
if curRewardData[v[1]] then
curRewardData[v[1]] = {v[1],curRewardData[v[1]][2] + v[2]}
else
curRewardData[v[1]] = {v[1],v[2]}
end
end
end
end
end
for i, v in pairs(curRewardData) do
if curNodeConFig and curNodeConFig.Reward and curNodeConFig.Reward > 0 then
v = {v[1],math.floor(v[2] * curNodeConFig.Reward)}
end
table.insert(rewardData,v)
end
fightLevelId = args[1]
this.titleText.text="关卡情报"
this.tip.text="特殊规则"
this.conditionInfoText:GetComponent("Text").text="特殊规则"
this.sureBtnText.text=Language[10287]
this.power.text = monsterData.bossTeaminfo.totalForce
curShowIndex = true
this:ShoeReward()
this:FormationAdapter()
end
function this:ShoeReward()
local rewardDataList = {}
for i = 1, math.max(#rewardDataList, #rewardGoList) do
local go = rewardGoList[i]
if not go then
go = newObject(this.itemPre)
go.transform:SetParent(this.Root.transform)
go.transform.localScale = Vector3.one
go.transform.localPosition = Vector3.zero
rewardGoList[i] = go
end
go.gameObject:SetActive(false)
end
for i, v in pairs(rewardDataList) do
local _go = rewardGoList[i]
_go:SetActive(true)
local itemParent = Util.GetGameObject(_go, "parent")
Util.GetGameObject(_go, "getImage"):SetActive(false)
if not this.NoviceItemList[_go] then
this.NoviceItemList[_go] = SubUIManager.Open(SubUIConfig.ItemView, itemParent.transform)
end
this.NoviceItemList[_go]:OnOpen(false, v, 0.9,false,false,false,sortingOrder)
end
end
-- 编队数据匹配
function this:FormationAdapter()
if type == 1 then
this.sureBtnText.text = Language[10555]
elseif type == 2 then
this.sureBtnText.text = Language[10559]
end
if curNodeConFig then
if curNodeConFig.type == ExpeditionNodeType.Common then
this.titleText.text=Language[10560]
elseif curNodeConFig.type == ExpeditionNodeType.Jy then
this.titleText.text=Language[10561]
elseif curNodeConFig.type == ExpeditionNodeType.Boss then
this.titleText.text=Language[10562]
end
end
if monsterData == nil then LogError(Language[10558]) return end
this.power.text = monsterData.bossTeaminfo.totalForce
for i = 1, #heroListGo do
heroListGo[i]:SetActive(false)
end
for i = 1, #heroListGo do
if(monsterData.bossTeaminfo.hero[i]) then
local pos = monsterData.bossTeaminfo.hero[i].position
if monsterData.bossTeaminfo.hero[i].remainHp > 0 then
this.SetCardSingleData(heroListGo[pos],monsterData.bossTeaminfo.hero[i],pos)
heroListGo[pos]:SetActive(true)
end
this.SetCardSingleData(heroListGo[pos],monsterData.bossTeaminfo.hero[i],pos)
heroListGo[pos]:SetActive(true)
end
end
FindFairyManager.ResetItemView(this.root,this.root.transform,itemList,5,1,sortingOrder,false,rewardData)
end
function this.OnSortingOrderChange()
for i = 1, #heroListGo do
Util.AddParticleSortLayer(heroListGo[i], self.sortingOrder - sortingOrder)
end
for i, v in pairs(this.NoviceItemList) do
if this.NoviceItemList[i] and this.NoviceItemList[i].gameObject then
this.NoviceItemList[i]:SetEffectLayer(sortingOrder)
end
end
sortingOrder = self.sortingOrder
end
@ -187,6 +188,16 @@ function this.SetCardSingleData(o,monsterId, _pos)
hpPass.fillAmount = curHeroHpVal
rage.fillAmount = 0.5
end
function this:LeftOrRightBtnClickEvent()
curShowIndex = not curShowIndex
if curShowIndex then
this.conditionInfoText:SetActive(false)
this.rewardRoot:SetActive(true)
else
this.conditionInfoText:SetActive(true)
this.rewardRoot:SetActive(false)
end
end
function this:OnClose()
if fun then
fun()

View File

@ -5,28 +5,30 @@ local parent
--传入特效层级
local sortingOrder=0
local fun
--item容器
local itemList = {}
local heroListGo = {}
local monsterData = {}
local rewardData = {}
local type = 1 --1 前往 2 放弃
local fightLevelId = 0
local liveNodes = {}
local liveNames = {}
local curNodeConFig
local roleConfig=ConfigManager.GetConfig(ConfigName.RoleConfig)
local condition = {}
local conditionGo = {}
function this:InitComponent(gameObject)
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
this.power = Util.GetGameObject(gameObject, "Power/Value"):GetComponent("Text")
this.sureBtn=Util.GetGameObject(gameObject,"sureBtn")
this.sureBtnText=Util.GetGameObject(gameObject,"sureBtn/Text"):GetComponent("Text")
--滚动条根节点
this.root = Util.GetGameObject(gameObject, "Root")
heroListGo = {}
for i = 1, 6 do
heroListGo[i] = Util.GetGameObject(gameObject, "RoleGrid/Bg"..i.."/Hero"..i)
end
conditionGo = {}
for i = 1, 3 do
conditionGo[i] = Util.GetGameObject(gameObject, "Root/item (" .. i ..")")
end
this.Root = Util.GetGameObject(gameObject,"Root")
this.backBtn=Util.GetGameObject(gameObject,"BackBtn")
this.BackBattleBtn=Util.GetGameObject(gameObject,"BackBattleBtn")
this.rewardBtn=Util.GetGameObject(gameObject,"rewardBtn")
end
function this:BindEvent()
@ -36,14 +38,12 @@ function this:BindEvent()
Util.AddClick(this.backBtn, function()
parent:ClosePanel()
end)
end
function this:BtnClickEvent()
if type == 1 then
Util.AddClick(this.BackBattleBtn, function()
parent:ClosePanel()
elseif type == 2 then
end)
Util.AddClick(this.rewardBtn, function()
parent:ClosePanel()
UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.EXPEDITION, monsterData)
end
end)
end
function this:AddListener()
@ -56,56 +56,40 @@ function this:OnShow(_parent,...)
sortingOrder = _parent.sortingOrder
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
local args = {...}
monsterData = args[1]
type = args[2]
fun = args[3]
fightLevelId = args[1]
--组数据
rewardData = {}
local curRewardData = {}
--curNodeConFig = ConfigManager.TryGetConfigData(ConfigName.ExpeditionNodeConfig,monsterData.type)
curNodeConFig = ConfigManager.TryGetConfigData(ConfigName.ExpeditionNodeConfig,monsterData.type)
local Reward = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.ExpeditionFloorConfig,"Floor",ExpeditionManager.expeditionLeve,"FloorLay",monsterData.lay - 1)
if Reward and Reward.Reward and #Reward.Reward > 0 then
for i = 1, #Reward.Reward do
local rewardGroupConfig = ConfigManager.TryGetConfigData(ConfigName.RewardGroup,Reward.Reward[i])
if rewardGroupConfig and #rewardGroupConfig.ShowItem > 0 then
for j = 1, #rewardGroupConfig.ShowItem do
local v = rewardGroupConfig.ShowItem[j]
if curRewardData[v[1]] then
curRewardData[v[1]] = {v[1],curRewardData[v[1]][2] + v[2]}
else
curRewardData[v[1]] = {v[1],v[2]}
end
end
end
end
end
for i, v in pairs(curRewardData) do
if curNodeConFig and curNodeConFig.Reward and curNodeConFig.Reward > 0 then
v = {v[1],math.floor(v[2] * curNodeConFig.Reward)}
end
table.insert(rewardData,v)
end
--条件组数据
condition = {}
this:FormationAdapter()
end
function this:ShoeCondition()
for i = 1, math.max(#condition, #conditionGo) do
local go = conditionGo[i]
if not go then
go = newObject(this.conditionGo[1])
go.transform:SetParent(this.Root.transform)
go.transform.localScale = Vector3.one
go.transform.localPosition = Vector3.zero
conditionGo[i] = go
end
go.gameObject:SetActive(false)
end
for i, v in pairs(condition) do
conditionGo[i]:SetActive(true)
local levelData = dailyTasksConfig[v.missionId]
local noStarImage = Util.GetGameObject(conditionGo[i], "noStarImage")
local getStarImage = Util.GetGameObject(conditionGo[i], "getStarImage")
noStarImage:SetActive(false)
noStarImage:SetActive(false)
Util.GetGameObject(conditionGo[i], "Text"):GetComponent("Text").text = i
Util.GetGameObject(conditionGo[i], "infolText"):GetComponent("Text").text = "1-5"
end
end
-- 编队数据匹配
function this:FormationAdapter()
if type == 1 then
this.sureBtnText.text = Language[10555]
elseif type == 2 then
this.sureBtnText.text = Language[10559]
end
if curNodeConFig then
if curNodeConFig.type == ExpeditionNodeType.Common then
this.titleText.text=Language[10560]
elseif curNodeConFig.type == ExpeditionNodeType.Jy then
this.titleText.text=Language[10561]
elseif curNodeConFig.type == ExpeditionNodeType.Boss then
this.titleText.text=Language[10562]
end
end
if monsterData == nil then LogError(Language[10558]) return end
this.titleText.text="关卡情报"
this.sureBtnText.text=Language[10287]
this.power.text = monsterData.bossTeaminfo.totalForce
for i = 1, #heroListGo do
heroListGo[i]:SetActive(false)
@ -113,13 +97,10 @@ function this:FormationAdapter()
for i = 1, #heroListGo do
if(monsterData.bossTeaminfo.hero[i]) then
local pos = monsterData.bossTeaminfo.hero[i].position
if monsterData.bossTeaminfo.hero[i].remainHp > 0 then
this.SetCardSingleData(heroListGo[pos],monsterData.bossTeaminfo.hero[i],pos)
heroListGo[pos]:SetActive(true)
end
this.SetCardSingleData(heroListGo[pos],monsterData.bossTeaminfo.hero[i],pos)
heroListGo[pos]:SetActive(true)
end
end
FindFairyManager.ResetItemView(this.root,this.root.transform,itemList,5,1,sortingOrder,false,rewardData)
end
function this.OnSortingOrderChange()

View File

@ -5,57 +5,22 @@ local parent
--传入特效层级
local sortingOrder=0
local fun
--item容器
local itemList = {}
local monsterData = {}
local type = 1 --1 前往 2 放弃
local curSelectHero = nil
local oldSelectHeroGo = nil
local itemGrid = {}
local fightLevelId = 0
local prbGoGrid = {}
function this:InitComponent(gameObject)
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
this.sureBtn=Util.GetGameObject(gameObject,"sureBtn")
this.sureBtnText=Util.GetGameObject(gameObject,"sureBtn/Text"):GetComponent("Text")
this.Demons = Util.GetGameObject(gameObject, "demons")
this.singlePre = Util.GetGameObject(gameObject, "itemPre")
this.backBtn=Util.GetGameObject(gameObject,"BackBtn")
prbGoGrid = {}
for i = 1, 2 do
prbGoGrid[i] = Util.GetGameObject(gameObject,"rect/ItemPre (" .. i .. ")")
end
end
function this:BindEvent()
Util.AddClick(this.sureBtn, function()
this:BtnClickEvent()
end)
Util.AddClick(this.backBtn, function()
parent:ClosePanel()
end)
end
function this:BtnClickEvent()
if type == 1 then
parent:ClosePanel()
elseif type == 2 then
if curSelectHero then
--LogError("monsterData.sortId,curSelectHero.dynamicId "..monsterData.sortId.." "..curSelectHero.id)
NetManager.HeroNodeRequest(monsterData.sortId,curSelectHero.id,function (msg)
if msg.drop and msg.drop.soulEquip and #msg.drop.soulEquip > 0 then
for i = 1, #msg.drop.soulEquip do
ExpeditionManager.InitSingleTreasureData(msg.drop.soulEquip[i])
end
end
if msg.drop and msg.drop.Hero and msg.drop.Hero[1] then
ExpeditionManager.UpdateHeroDatas(msg.drop.Hero[1])
end
parent:ClosePanel()
if fun then
fun()
fun = nil
end
end)
else
PopupTipPanel.ShowTip(Language[10563])
end
end
end
function this:AddListener()
end
@ -67,96 +32,52 @@ function this:OnShow(_parent,...)
sortingOrder = _parent.sortingOrder
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
local args = {...}
monsterData = args[1]
type = args[2]
--LogGreen("type "..type)
fun = args[3]
this.titleText.text=Language[10564]
if type == 1 then
this.sureBtnText.text = Language[10555]
elseif type == 2 then
this.sureBtnText.text = Language[10564]
end
curSelectHero = nil
oldSelectHeroGo = nil
if monsterData == nil then LogError(Language[10558]) return end
for i = 1, 4 do
if itemGrid[i] then
itemGrid[i]:SetActive(false)
end
fightLevelId = args[1]
this.titleText.text="战斗回放"
for i = 1, 2 do
prbGoGrid[i]:SetActive(false)
end
NetManager.HeroNodeGetInfoRequest(monsterData.sortId,function (msg)
--LogError("#msg.viewHeroInfo "..#msg.viewHeroInfo)
this:FormationAdapter(msg)
for i = 1, 2 do
local data = {}
local root = prbGoGrid[i]
this.SetInfo(root,data)
end
end)
end
-- 编队数据匹配
function this:FormationAdapter(msg)
for i = 1, math.max(#msg.viewHeroInfo, #itemGrid) do
local go = itemGrid[i]
if not go then
go = newObject(this.singlePre)
go.transform:SetParent(this.Demons.transform)
go.transform.localScale = Vector3.one
go.transform.localPosition = Vector3.zero
itemGrid[i] = go
end
go.gameObject:SetActive(false)
--设置头像
function this.SetInfo(root,data,index)
root:SetActive(true)
--头像
local headObj=Util.GetGameObject(root,"HeadParent")
if not this.playerScrollHead[root] then
this.playerScrollHead[root]=CommonPool.CreateNode(POOL_ITEM_TYPE.PLAYER_HEAD,headObj)
end
for i = 1, #msg.viewHeroInfo do
local demon = itemGrid[i]
demon:SetActive(true)
local curData = msg.viewHeroInfo[i]
local demonId = curData.hero.heroId
local starGrid=Util.GetGameObject(demon, "starGrid")
local proImage=Util.GetGameObject(demon, "heroShow/proIcon"):GetComponent("Image")
Util.GetGameObject(demon, "heroShow/posIcon"):SetActive(false)
--local posImage=Util.GetGameObject(demon, "heroShow/posIcon"):GetComponent("Image")
local roleLevel=Util.GetGameObject(demon, "lvbg/levelText"):GetComponent("Text")
local frameBtn=Util.GetGameObject(demon, "frame")
if demonId then
demon:SetActive(true)
local demonData = ConfigManager.GetConfigData(ConfigName.HeroConfig, demonId)
Util.GetGameObject(demon, "icon"):GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(demonData.Icon))
local heroConFig = ConfigManager.GetConfigData(ConfigName.HeroConfig,demonId)
Util.GetGameObject(demon, "frame"):GetComponent("Image").sprite = Util.LoadSprite(GetHeroQuantityImageByquality(heroConFig.Quality, curData.hero.star))
Util.GetGameObject(demon, "nameText"):GetComponent("Text").text = SubString2(GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.HeroConfig,demonId).ReadingName),6)
SetHeroStars(starGrid, curData.hero.star)
proImage.sprite = Util.LoadSprite(GetProStrImageByProNum(demonData.PropertyName))
--posImage.sprite = Util.LoadSprite(GetJobSpriteStrByJobNum(demonData.Profession))
roleLevel.text = curData.hero.level
local choosed = Util.GetGameObject(demon, "selectImage")
choosed:SetActive(false)
Util.AddOnceClick(frameBtn, function()
if type ~= 1 then
if curSelectHero == curData.hero then
choosed:SetActive(false)
curSelectHero = nil
oldSelectHeroGo = nil
return
end
curSelectHero = curData.hero
choosed:SetActive(true)
if oldSelectHeroGo then
Util.GetGameObject(oldSelectHeroGo, "selectImage"):SetActive(false)
end
oldSelectHeroGo = demon
end
end)
local heroData = {}
Util.AddLongPressClick(frameBtn, function()
heroData= GoodFriendManager.GetHeroDatas(curData.hero,curData.force,curData.SpecialEffects)
GoodFriendManager.InitEquipData(curData.equip,heroData)
UIManager.OpenPanel(UIName.RoleInfoPopup, heroData,true)
end, 0.5)
end
this.playerScrollHead[root]:Reset()
this.playerScrollHead[root]:SetHead(data.head)
this.playerScrollHead[root]:SetFrame(data.frame)
this.playerScrollHead[root]:SetLevel(data.level)
this.playerScrollHead[root]:SetScale(Vector3.one*0.7)
this.playerScrollHead[root]:SetLayer(this.sortingOrder)
this.playerScrollHead[root]:SetEffectScale(0.75)
Util.GetGameObject(root,"name"):GetComponent("Text").text = data.name
Util.GetGameObject(root,"warPower/Text"):GetComponent("Text").text = data.warPower
if index == 1 then
Util.GetGameObject(root,"ClickBtn/tip"):GetComponent("Text").text = "首次三星通关"
else
Util.GetGameObject(root,"ClickBtn/tip"):GetComponent("Text").text = "最低战力三星通关"
end
Util.AddOnceClick(Util.GetGameObject(root,"ClickBtn"), function()
UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.BACK, function()
end)
end)
end
function this:OnClose()
end
function this:OnDestroy()
itemGrid = {}
end
return this

View File

@ -7,44 +7,26 @@ local sortingOrder=0
local fun
--item容器
local itemList = {}
local heroListGo = {}
local monsterData = {}
local rewardData = {}
local type = 1 --1 前往 2 放弃
local liveNodes = {}
local liveNames = {}
local curNodeConFig
local roleConfig=ConfigManager.GetConfig(ConfigName.RoleConfig)
local fightLevelId = 0
function this:InitComponent(gameObject)
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
this.power = Util.GetGameObject(gameObject, "Power/Value"):GetComponent("Text")
this.sureBtn=Util.GetGameObject(gameObject,"sureBtn")
this.sureBtnText=Util.GetGameObject(gameObject,"sureBtn/Text"):GetComponent("Text")
--滚动条根节点
this.root = Util.GetGameObject(gameObject, "Root")
heroListGo = {}
for i = 1, 6 do
heroListGo[i] = Util.GetGameObject(gameObject, "RoleGrid/Bg"..i.."/Hero"..i)
end
this.tipText=Util.GetGameObject(gameObject,"tipText"):GetComponent("Text")
this.backBtn=Util.GetGameObject(gameObject,"BackBtn")
this.rewardPre = Util.GetGameObject(gameObject, "rewardPre")
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(gameObject, "Root").transform,
this.rewardPre, nil, Vector2.New(832.8, 983.5), 1, 1, Vector2.New(0,0))
this.ScrollView.moveTween.MomentumAmount = 1
this.ScrollView.moveTween.Strength = 1
this.NoviceItemList={}--存储itemview 重复利用
end
function this:BindEvent()
Util.AddClick(this.sureBtn, function()
this:BtnClickEvent()
end)
Util.AddClick(this.backBtn, function()
parent:ClosePanel()
end)
end
function this:BtnClickEvent()
if type == 1 then
parent:ClosePanel()
elseif type == 2 then
parent:ClosePanel()
UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.EXPEDITION, monsterData)
end
end
function this:AddListener()
end
@ -56,152 +38,67 @@ function this:OnShow(_parent,...)
sortingOrder = _parent.sortingOrder
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
local args = {...}
monsterData = args[1]
type = args[2]
fun = args[3]
fightLevelId = args[1]
--组数据
rewardData = {}
local curRewardData = {}
--curNodeConFig = ConfigManager.TryGetConfigData(ConfigName.ExpeditionNodeConfig,monsterData.type)
curNodeConFig = ConfigManager.TryGetConfigData(ConfigName.ExpeditionNodeConfig,monsterData.type)
local Reward = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.ExpeditionFloorConfig,"Floor",ExpeditionManager.expeditionLeve,"FloorLay",monsterData.lay - 1)
if Reward and Reward.Reward and #Reward.Reward > 0 then
for i = 1, #Reward.Reward do
local rewardGroupConfig = ConfigManager.TryGetConfigData(ConfigName.RewardGroup,Reward.Reward[i])
if rewardGroupConfig and #rewardGroupConfig.ShowItem > 0 then
for j = 1, #rewardGroupConfig.ShowItem do
local v = rewardGroupConfig.ShowItem[j]
if curRewardData[v[1]] then
curRewardData[v[1]] = {v[1],curRewardData[v[1]][2] + v[2]}
else
curRewardData[v[1]] = {v[1],v[2]}
end
end
end
end
end
for i, v in pairs(curRewardData) do
if curNodeConFig and curNodeConFig.Reward and curNodeConFig.Reward > 0 then
v = {v[1],math.floor(v[2] * curNodeConFig.Reward)}
end
table.insert(rewardData,v)
end
this:FormationAdapter()
end
-- 编队数据匹配
function this:FormationAdapter()
if type == 1 then
this.sureBtnText.text = Language[10555]
elseif type == 2 then
this.sureBtnText.text = Language[10559]
end
if curNodeConFig then
if curNodeConFig.type == ExpeditionNodeType.Common then
this.titleText.text=Language[10560]
elseif curNodeConFig.type == ExpeditionNodeType.Jy then
this.titleText.text=Language[10561]
elseif curNodeConFig.type == ExpeditionNodeType.Boss then
this.titleText.text=Language[10562]
end
end
if monsterData == nil then LogError(Language[10558]) return end
this.power.text = monsterData.bossTeaminfo.totalForce
for i = 1, #heroListGo do
heroListGo[i]:SetActive(false)
end
for i = 1, #heroListGo do
if(monsterData.bossTeaminfo.hero[i]) then
local pos = monsterData.bossTeaminfo.hero[i].position
if monsterData.bossTeaminfo.hero[i].remainHp > 0 then
this.SetCardSingleData(heroListGo[pos],monsterData.bossTeaminfo.hero[i],pos)
heroListGo[pos]:SetActive(true)
end
end
end
FindFairyManager.ResetItemView(this.root,this.root.transform,itemList,5,1,sortingOrder,false,rewardData)
this.ScrollView:SetData(rewardData, function (index, go)
this.SingleDataShow(go,rewardData[index])
end, true,true)
end
function this.SingleMissionDatasDataShow(_go,_rewardData)
local rewardData = _rewardData
local missionConfigData = dailyTasksConfig[rewardData.missionId]
local reward = {}
local titleText = Util.GetGameObject(_go, "titleImage/titleText"):GetComponent("Text")
titleText.text =string.format(GetLanguageStrById(missionConfigData.Desc),missionConfigData.Values[2][1])
function this.OnSortingOrderChange()
for i = 1, #heroListGo do
Util.AddParticleSortLayer(heroListGo[i], self.sortingOrder - sortingOrder)
local noStarImage = Util.GetGameObject(_go, "noStarImage")
local getStarImage = Util.GetGameObject(_go, "getStarImage")
noStarImage:SetActive(false)
noStarImage:SetActive(false)
local itemGroup = Util.GetGameObject(_go, "content")
--滚动条复用重设itemview
if not this.NoviceItemList[_go] then
this.NoviceItemList[_go] = {}
end
for i = 1, #reward do
if not this.NoviceItemList[_go][i] then
this.NoviceItemList[_go][i] = SubUIManager.Open(SubUIConfig.ItemView, itemGroup.transform)
end
this.NoviceItemList[_go][i].gameObject:SetActive(false)
end
for i = 1, #reward do
this.NoviceItemList[_go][i]:OnOpen(false, reward[i].reward, 0.9,false,false,false,sortingOrder)
this.NoviceItemList[_go][i].gameObject:SetActive(true)
end
local noButton = Util.GetGameObject(_go.gameObject, "noButton")
local okButton = Util.GetGameObject(_go.gameObject, "okButton")
local state=missionData.state--0:未完成 1完成未领取 2已达成已领取
noButton:SetActive(state == SingleDailyMissionState.Finish)
okButton:SetActive(state == SingleDailyMissionState.NoFinish)
end
function this.OnSortingOrderChange()
for i, v in pairs(this.NoviceItemList) do
for j = 1, #this.NoviceItemList[i] do
if this.NoviceItemList[i][j] and this.NoviceItemList[i][j].gameObject then
this.NoviceItemList[i][j]:SetEffectLayer(sortingOrder)
end
end
end
sortingOrder = self.sortingOrder
end
--设置单个上阵英雄信息
function this.SetCardSingleData(o,monsterId, _pos)
o.transform.parent:GetComponent("Image").sprite=Util.LoadSprite("bd_xinkapaifan")
local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, monsterId.heroTid)
local bg=Util.GetGameObject(o,"Bg1"):GetComponent("Image")
local fg=Util.GetGameObject(o,"Bg2"):GetComponent("Image")
-- local live=Util.GetGameObject(o,"Mask/Live")
local lv=Util.GetGameObject(o,"lv/Text"):GetComponent("Text")
local pro=Util.GetGameObject(o,"Pro/Image"):GetComponent("Image")
local starGrid=Util.GetGameObject(o,"StarGrid")
local nameParent = Util.GetGameObject(o,"Name") -- 用于解决本地化问题
local name=Util.GetGameObject(nameParent,"Text"):GetComponent("Text")
-- local pos=Util.GetGameObject(o,"Pos"):GetComponent("Image")
local yuanImage=Util.GetGameObject(o,"yuanImage")
local hp = Util.GetGameObject(o,"hpProgress/hp"):GetComponent("Image")
local hpPass = Util.GetGameObject(o,"hpProgress/hpPass"):GetComponent("Image")
local rage = Util.GetGameObject(o,"rageProgress/rage"):GetComponent("Image")
local live = Util.GetGameObject(o, "Mask/icon"):GetComponent("RawImage")
local liveName = GetResourcePath(heroConfig.Live)
local roleConfig = ConfigManager.GetConfigData(ConfigName.RoleConfig, heroConfig.Id)
local scale = roleConfig.play_liveScale
local livePos = Vector3.New(roleConfig.offset[1], roleConfig.offset[2], 0)
live.texture = CardRendererManager.GetSpineTexture(_pos, liveName, Vector3.one * scale, livePos, true)
live.transform.localScale = Vector3.one
live.transform.localPosition = Vector3.zero
local zs = Util.GetGameObject(o, "zs")
local zsName = GetHeroCardStarZs[monsterId.star]
if zsName == "" then
zs:SetActive(false)
else
zs:SetActive(true)
zs:GetComponent("Image").sprite = Util.LoadSprite(zsName)
end
yuanImage:SetActive(false)
lv.text=monsterId.level
bg.sprite = Util.LoadSprite(GetFormationHeroCardStarBg[monsterId.star])
fg.sprite = Util.LoadSprite(GetHeroCardStarFg[monsterId.star])
pro.sprite=Util.LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
SetCardStars(starGrid,monsterId.star)
if monsterId.star > 9 then
Util.GetGameObject(o,"UI_Effect_jinkuang_KaPai").gameObject:SetActive(true)
else
Util.GetGameObject(o,"UI_Effect_jinkuang_KaPai").gameObject:SetActive(false)
end
name.text=GetLanguageStrById(heroConfig.ReadingName)
SetTextVerTial(name.gameObject,Vector3.New(35,-7.45,0),nil,nil,8)
local curHeroHpVal = monsterId.remainHp
hp.fillAmount = curHeroHpVal
hpPass.fillAmount = curHeroHpVal
rage.fillAmount = 0.5
end
function this:OnClose()
if fun then
fun()
fun = nil
end
for i, v in pairs(liveNodes) do
if v then
poolManager:UnLoadLive(liveNames[i],v)
liveNames[i]= nil
end
end
end
function this:OnDestroy()
heroListGo = {}
end
return this