2020-05-25 19:16:23 +08:00
|
|
|
----- 远征怪节点弹窗 -----
|
|
|
|
local this = {}
|
|
|
|
--传入父脚本模块
|
|
|
|
local parent
|
|
|
|
--传入特效层级
|
|
|
|
local sortingOrder=0
|
|
|
|
local fun
|
|
|
|
--item容器
|
|
|
|
local itemList = {}
|
2020-06-03 19:09:01 +08:00
|
|
|
local heroListGo = {}
|
2020-05-25 19:16:23 +08:00
|
|
|
local monsterData = {}
|
|
|
|
local rewardData = {}
|
|
|
|
local type = 1 --1 前往 2 放弃
|
2020-06-03 19:09:01 +08:00
|
|
|
local liveNodes = {}
|
|
|
|
local liveNames = {}
|
|
|
|
local roleConfig=ConfigManager.GetConfig(ConfigName.RoleConfig)
|
2020-05-25 19:16:23 +08:00
|
|
|
function this:InitComponent(gameObject)
|
|
|
|
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
|
2020-06-03 19:09:01 +08:00
|
|
|
this.power = Util.GetGameObject(gameObject, "Power/Value"):GetComponent("Text")
|
2020-05-25 19:16:23 +08:00
|
|
|
this.sureBtn=Util.GetGameObject(gameObject,"sureBtn")
|
|
|
|
this.sureBtnText=Util.GetGameObject(gameObject,"sureBtn/Text"):GetComponent("Text")
|
|
|
|
--滚动条根节点
|
2020-06-03 19:09:01 +08:00
|
|
|
this.root = Util.GetGameObject(gameObject, "Root")
|
2020-05-25 19:16:23 +08:00
|
|
|
for i = 1, 6 do
|
2020-06-03 19:09:01 +08:00
|
|
|
heroListGo[i] = Util.GetGameObject(gameObject, "RoleGrid/Bg"..i.."/Hero"..i)
|
2020-05-25 19:16:23 +08:00
|
|
|
end
|
|
|
|
this.backBtn=Util.GetGameObject(gameObject,"BackBtn")
|
|
|
|
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
|
|
|
|
|
|
|
|
function this:RemoveListener()
|
|
|
|
end
|
|
|
|
function this:OnShow(_parent,...)
|
|
|
|
parent=_parent
|
|
|
|
sortingOrder = _parent.sortingOrder
|
|
|
|
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
|
|
|
|
local args = {...}
|
|
|
|
monsterData = args[1]
|
|
|
|
type = args[2]
|
|
|
|
fun = args[3]
|
|
|
|
|
|
|
|
--组数据
|
|
|
|
rewardData = {}
|
|
|
|
local curRewardData = {}
|
|
|
|
local curNodeConFig = ConfigManager.TryGetConfigData(ConfigName.ExpeditionNodeConfig,monsterData.type)
|
2020-06-03 19:09:01 +08:00
|
|
|
if curNodeConFig and curNodeConFig.Reward and #curNodeConFig.Reward > 0 then
|
|
|
|
for i = 1, #curNodeConFig.Reward do
|
|
|
|
local rewardGroupConfig = ConfigManager.TryGetConfigData(ConfigName.RewardGroup,curNodeConFig.Reward[i])
|
2020-05-25 19:16:23 +08:00
|
|
|
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
|
|
|
|
table.insert(rewardData,v)
|
|
|
|
end
|
|
|
|
this:FormationAdapter()
|
|
|
|
end
|
|
|
|
-- 编队数据匹配
|
|
|
|
function this:FormationAdapter()
|
|
|
|
if type == 1 then
|
|
|
|
this.sureBtnText.text = "确 定"
|
|
|
|
elseif type == 2 then
|
|
|
|
this.sureBtnText.text = "前 往"
|
|
|
|
end
|
2020-06-03 19:09:01 +08:00
|
|
|
this.titleText.text="天 兵"
|
2020-05-25 19:16:23 +08:00
|
|
|
if monsterData == nil then LogError("远征数据为nil") return end
|
|
|
|
this.power.text = monsterData.bossTeaminfo.totalForce
|
2020-06-03 19:09:01 +08:00
|
|
|
|
|
|
|
for i = 1, #heroListGo do
|
2020-05-25 19:16:23 +08:00
|
|
|
if(monsterData.bossTeaminfo.hero[i]) then
|
2020-06-03 19:09:01 +08:00
|
|
|
this.SetCardSingleData(heroListGo[i],monsterData.bossTeaminfo.hero[i],i)
|
|
|
|
heroListGo[i]:SetActive(true)
|
2020-05-25 19:16:23 +08:00
|
|
|
else
|
2020-06-03 19:09:01 +08:00
|
|
|
heroListGo[i]:SetActive(false)
|
2020-05-25 19:16:23 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
FindFairyManager.ResetItemView(this.root,this.root.transform,itemList,5,1,sortingOrder,false,rewardData)
|
2020-06-03 19:09:01 +08:00
|
|
|
end
|
|
|
|
--设置单个上阵英雄信息
|
|
|
|
function this.SetCardSingleData(go,monsterId,_pos)
|
|
|
|
local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, monsterId.heroTid)
|
|
|
|
local live=Util.GetGameObject(go,"Mask/Live")
|
|
|
|
local lv=Util.GetGameObject(go,"Lv/Text"):GetComponent("Text")
|
|
|
|
local pro=Util.GetGameObject(go,"Pro/Image"):GetComponent("Image")
|
|
|
|
local starGrid=Util.GetGameObject(go,"StarGrid")
|
|
|
|
local name=Util.GetGameObject(go,"Name/Text"):GetComponent("Text")
|
|
|
|
local pos=Util.GetGameObject(go,"Pos"):GetComponent("Image")
|
|
|
|
|
|
|
|
lv.text=monsterId.level
|
|
|
|
pro.sprite=Util.LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
|
|
|
|
SetHeroStars(starGrid,monsterId.star)
|
|
|
|
name.text=heroConfig.ReadingName
|
|
|
|
pos.sprite=Util.LoadSprite("bd_bianhao".._pos)
|
|
|
|
--立绘(这里o只当区别索引用)
|
|
|
|
if liveNodes[_pos] then
|
|
|
|
poolManager:UnLoadLive(liveNames[_pos],liveNodes[_pos])
|
|
|
|
liveNames[_pos]= nil
|
|
|
|
end
|
|
|
|
liveNames[_pos] =GetResourcePath( heroConfig.Live)
|
|
|
|
local _scale=roleConfig[heroConfig.Id].play_liveScale
|
|
|
|
local curPos=roleConfig[heroConfig.Id].offset
|
|
|
|
liveNodes[_pos] = poolManager:LoadLive(liveNames[_pos], live.transform, Vector3.one * _scale, Vector3.New(curPos[1],curPos[2],0))
|
|
|
|
liveNodes[_pos]:GetComponent("SkeletonGraphic").raycastTarget=false
|
|
|
|
--hpSlider:GetComponent("Slider").value = monsterData.bossTeaminfo.hero[i].remainHp
|
|
|
|
--Log("monsterData.bossTeaminfo.hero[i].remainHp "..monsterData.bossTeaminfo.hero[i].remainHp)
|
|
|
|
--if monsterData.bossTeaminfo.hero[i].remainHp <= 0 then
|
|
|
|
-- Util.SetGray(demon,true)
|
|
|
|
--else
|
|
|
|
-- Util.SetGray(demon,false)
|
2020-05-25 19:16:23 +08:00
|
|
|
--end
|
2020-06-03 19:09:01 +08:00
|
|
|
--local heroData = {}
|
|
|
|
--Util.AddOnceClick(frameBtn, function()
|
|
|
|
-- NetManager.ViewHeroInfoRequest(this._PlayerId,teamInfo.team[i].heroid,function(msg)
|
|
|
|
-- heroData= GoodFriendManager.GetHeroDatas(msg.hero,msg.force,msg.SpecialEffects)
|
|
|
|
-- GoodFriendManager.InitEquipData(msg.equip,heroData)
|
|
|
|
-- UIManager.OpenPanel(UIName.RoleInfoPopup, heroData,true)
|
|
|
|
-- end)
|
|
|
|
--end)
|
2020-05-25 19:16:23 +08:00
|
|
|
end
|
|
|
|
function this:OnClose()
|
|
|
|
if fun then
|
|
|
|
fun()
|
|
|
|
fun = nil
|
|
|
|
end
|
2020-06-03 19:09:01 +08:00
|
|
|
for i, v in pairs(liveNodes) do
|
|
|
|
if v then
|
|
|
|
poolManager:UnLoadLive(liveNames[i],v)
|
|
|
|
liveNames[i]= nil
|
|
|
|
end
|
|
|
|
end
|
2020-05-25 19:16:23 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function this:OnDestroy()
|
|
|
|
end
|
|
|
|
|
|
|
|
return this
|