2020-12-08 17:01:53 +08:00
|
|
|
|
----- 远征怪节点弹窗 -----
|
|
|
|
|
local this = {}
|
|
|
|
|
--传入父脚本模块
|
|
|
|
|
local parent
|
|
|
|
|
--传入特效层级
|
|
|
|
|
local sortingOrder=0
|
|
|
|
|
local fun
|
|
|
|
|
--item容器
|
|
|
|
|
local itemList = {}
|
|
|
|
|
local heroListGo = {}
|
2020-12-21 09:51:08 +08:00
|
|
|
|
local waveId = 0 --当前层
|
2020-12-10 16:23:13 +08:00
|
|
|
|
local configData = {}
|
2020-12-08 17:01:53 +08:00
|
|
|
|
local rewardData = {}
|
2020-12-21 09:51:08 +08:00
|
|
|
|
local curType = 1 --当前试炼类型
|
2020-12-08 17:01:53 +08:00
|
|
|
|
local liveNodes = {}
|
|
|
|
|
local liveNames = {}
|
|
|
|
|
local curNodeConFig
|
|
|
|
|
local roleConfig=ConfigManager.GetConfig(ConfigName.RoleConfig)
|
|
|
|
|
function this:InitComponent(gameObject)
|
|
|
|
|
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
|
|
|
|
|
this.power = Util.GetGameObject(gameObject, "Power/Value"):GetComponent("Text")
|
2020-12-10 16:23:13 +08:00
|
|
|
|
|
2020-12-08 17:01:53 +08:00
|
|
|
|
--滚动条根节点
|
|
|
|
|
this.root = Util.GetGameObject(gameObject, "Root")
|
|
|
|
|
for i = 1, 6 do
|
|
|
|
|
heroListGo[i] = Util.GetGameObject(gameObject, "RoleGrid/Bg"..i.."/Hero"..i)
|
|
|
|
|
end
|
|
|
|
|
this.backBtn=Util.GetGameObject(gameObject,"BackBtn")
|
2020-12-10 16:23:13 +08:00
|
|
|
|
this.fightBtn=Util.GetGameObject(gameObject,"fightBtn")
|
|
|
|
|
this.fightBtnText=Util.GetGameObject(this.fightBtn,"Text"):GetComponent("Text")
|
|
|
|
|
this.fightBtnIcon=Util.GetGameObject(this.fightBtn,"Icon"):GetComponent("Image")
|
|
|
|
|
this.fightBtnNum=Util.GetGameObject(this.fightBtn,"IconNum"):GetComponent("Text")
|
|
|
|
|
this.fightBtn.gameObject:SetActive(true)
|
|
|
|
|
this.returnLook=Util.GetGameObject(gameObject,"returnLook")
|
|
|
|
|
this.returnLook.gameObject:SetActive(true)
|
|
|
|
|
Util.GetGameObject(gameObject,"sureBtn"):SetActive(false)
|
2020-12-08 17:01:53 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:BindEvent()
|
2020-12-10 16:23:13 +08:00
|
|
|
|
Util.AddClick(this.fightBtn, function()
|
2020-12-08 17:01:53 +08:00
|
|
|
|
this:BtnClickEvent()
|
2020-12-10 16:23:13 +08:00
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(this.returnLook, function()
|
|
|
|
|
|
2020-12-08 17:01:53 +08:00
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(this.backBtn, function()
|
|
|
|
|
parent:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
function this:BtnClickEvent()
|
2020-12-10 16:23:13 +08:00
|
|
|
|
--挑战
|
2020-12-08 17:01:53 +08:00
|
|
|
|
if type == 1 then
|
|
|
|
|
parent:ClosePanel()
|
2020-12-10 16:23:13 +08:00
|
|
|
|
--扫荡
|
2020-12-08 17:01:53 +08:00
|
|
|
|
elseif type == 2 then
|
|
|
|
|
parent:ClosePanel()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:AddListener()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:RemoveListener()
|
2020-12-10 16:23:13 +08:00
|
|
|
|
|
2020-12-08 17:01:53 +08:00
|
|
|
|
end
|
|
|
|
|
function this:OnShow(_parent,...)
|
|
|
|
|
parent=_parent
|
|
|
|
|
sortingOrder = _parent.sortingOrder
|
|
|
|
|
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
|
2020-12-21 09:51:08 +08:00
|
|
|
|
local args = {...}
|
|
|
|
|
curType = args[1]
|
|
|
|
|
waveId = args[2]
|
|
|
|
|
configData = MonsterCampManager.GetFourElementMonsterInfoByWave(curType,waveId)
|
|
|
|
|
|
|
|
|
|
-- --组数据
|
|
|
|
|
-- rewardData = {}
|
|
|
|
|
-- local curRewardData = {}
|
|
|
|
|
-- local Reward
|
|
|
|
|
-- if type == 1 then
|
|
|
|
|
-- Reward = configData.FirstReward
|
|
|
|
|
-- else
|
|
|
|
|
-- Reward = configData.CommonReward
|
|
|
|
|
-- end
|
|
|
|
|
-- 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
|
2020-12-08 17:01:53 +08:00
|
|
|
|
this:FormationAdapter()
|
|
|
|
|
end
|
|
|
|
|
-- 编队数据匹配
|
|
|
|
|
function this:FormationAdapter()
|
2020-12-10 16:23:13 +08:00
|
|
|
|
this.fightBtnNum.gameObject:SetActive(false)
|
|
|
|
|
this.fightBtnIcon.gameObject:SetActive(false)
|
2020-12-21 09:51:08 +08:00
|
|
|
|
-- if type == 1 then
|
|
|
|
|
-- this.fightBtn.text = "挑战"
|
2020-12-10 16:23:13 +08:00
|
|
|
|
|
2020-12-21 09:51:08 +08:00
|
|
|
|
-- elseif type == 2 then
|
|
|
|
|
-- this.fightBtn.text = "扫荡"
|
|
|
|
|
-- end
|
|
|
|
|
|
|
|
|
|
this.titleText.text = string.format("%s层",configData.wave)
|
|
|
|
|
this.power.text = configData.power
|
2020-12-08 17:01:53 +08:00
|
|
|
|
|
|
|
|
|
|
2020-12-21 09:51:08 +08:00
|
|
|
|
|
2020-12-10 16:23:13 +08:00
|
|
|
|
local bossTeaminfo = ConfigManager.GetConfigData(ConfigName.MonsterGroup,configData.Monster)
|
2020-12-08 17:01:53 +08:00
|
|
|
|
for i = 1, #heroListGo do
|
2020-12-10 16:23:13 +08:00
|
|
|
|
if (bossTeaminfo.Contents[1][i]) and bossTeaminfo.Contents[1][i] > 0 then
|
|
|
|
|
this.SetCardSingleData(heroListGo[i],bossTeaminfo.Contents[1][i],i)
|
|
|
|
|
heroListGo[i]:SetActive(true)
|
|
|
|
|
else
|
|
|
|
|
heroListGo[i]:SetActive(false)
|
2020-12-08 17:01:53 +08:00
|
|
|
|
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
|
|
|
|
|
sortingOrder = self.sortingOrder
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--设置单个上阵英雄信息
|
|
|
|
|
function this.SetCardSingleData(o,monsterId, _pos)
|
|
|
|
|
o.transform.parent:GetComponent("Image").sprite=Util.LoadSprite("bd_xinkapaifan")
|
2020-12-10 16:23:13 +08:00
|
|
|
|
local monsterconfig = ConfigManager.GetConfigData(ConfigName.MonsterConfig, monsterId)
|
|
|
|
|
local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, monsterconfig.MonsterId)
|
2020-12-08 17:01:53 +08:00
|
|
|
|
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 name=Util.GetGameObject(o,"Name/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[heroConfig.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(GetHeroCardStarBg[heroConfig.Star])
|
|
|
|
|
fg.sprite = Util.LoadSprite(GetHeroCardStarFg[heroConfig.Star])
|
|
|
|
|
|
|
|
|
|
pro.sprite=Util.LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
|
|
|
|
|
SetCardStars(starGrid,heroConfig.Star)
|
|
|
|
|
if heroConfig.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=heroConfig.ReadingName
|
|
|
|
|
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()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return this
|