2023-03-20 11:22:44 +08:00
|
|
|
|
require("Base/BasePanel")
|
|
|
|
|
local GodsWayOtherTeamPanel = Inherit(BasePanel)
|
|
|
|
|
local XiuXianSkillConfig = ConfigManager.GetConfig(ConfigName.XiuXianSkillConfig)
|
|
|
|
|
local endLess=ConfigManager.GetConfig(ConfigName.EndlessHeroProp)
|
|
|
|
|
local type=0 --1:挑战 2:详情
|
2023-03-21 10:11:06 +08:00
|
|
|
|
local floor=0
|
2023-03-20 11:22:44 +08:00
|
|
|
|
local itemId, needNum
|
|
|
|
|
local haveNum=0
|
|
|
|
|
local time=0
|
|
|
|
|
local enemyId
|
|
|
|
|
local curMsg=nil
|
|
|
|
|
function GodsWayOtherTeamPanel:InitComponent()
|
|
|
|
|
self.spLoader = SpriteLoader.New()
|
|
|
|
|
self.btnBack = Util.GetGameObject(self.gameObject, "Frame/other/BackBtn")
|
|
|
|
|
self.mask = Util.GetGameObject(self.gameObject, "mask")
|
|
|
|
|
self.Frame = Util.GetGameObject(self.gameObject, "Frame")
|
|
|
|
|
self.content = Util.GetGameObject(self.gameObject, "Frame/Content")
|
|
|
|
|
self.costImg=Util.GetGameObject(self.gameObject, "Frame/Button/Image"):GetComponent("Image")
|
|
|
|
|
self.costTxt=Util.GetGameObject(self.gameObject, "Frame/Button/Image/num"):GetComponent("Text")
|
2023-03-21 10:11:06 +08:00
|
|
|
|
|
2023-03-20 11:22:44 +08:00
|
|
|
|
--队伍信息
|
|
|
|
|
self.teamInfo = Util.GetGameObject(self.content, "teamInfo")
|
|
|
|
|
self.teamList = {}
|
|
|
|
|
for i = 1, 3 do
|
|
|
|
|
self.teamList[i] = {}
|
|
|
|
|
self.teamList[i].title = Util.GetGameObject(self.teamInfo, "Team ("..i..")/Title")
|
2023-03-21 10:11:06 +08:00
|
|
|
|
self.teamList[i].go = Util.GetGameObject(self.teamInfo, "Team ("..i..")")
|
2023-03-20 11:22:44 +08:00
|
|
|
|
self.teamList[i].warPower = Util.GetGameObject(self.teamInfo, "Team ("..i..")/WarPower/Text"):GetComponent("Text")
|
|
|
|
|
self.teamList[i].heroList = {}
|
|
|
|
|
for j = 1, 6 do
|
|
|
|
|
self.teamList[i].heroList[j] = {}
|
|
|
|
|
self.teamList[i].heroList[j].go = Util.GetGameObject(self.teamInfo, "Team ("..i..")/TeamList/heroPro ("..j..")")
|
|
|
|
|
self.teamList[i].heroList[j].frame = Util.GetGameObject(self.teamList[i].heroList[j].go, "frame"):GetComponent("Image")
|
|
|
|
|
self.teamList[i].heroList[j].hero = Util.GetGameObject(self.teamList[i].heroList[j].go, "hero")
|
|
|
|
|
self.teamList[i].heroList[j].starGrid = Util.GetGameObject(self.teamList[i].heroList[j].hero, "starGrid")
|
|
|
|
|
self.teamList[i].heroList[j].proIcon = Util.GetGameObject(self.teamList[i].heroList[j].hero, "proIcon"):GetComponent("Image")
|
|
|
|
|
self.teamList[i].heroList[j].levelText = Util.GetGameObject(self.teamList[i].heroList[j].hero, "lvbg/levelText"):GetComponent("Text")
|
|
|
|
|
self.teamList[i].heroList[j].icon = Util.GetGameObject(self.teamList[i].heroList[j].hero, "icon"):GetComponent("Image")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--灵兽信息
|
|
|
|
|
self.pokemonInfo = Util.GetGameObject(self.content, "pokemonInfo")
|
|
|
|
|
self.pokemonList = {}
|
|
|
|
|
for i = 1, 6 do
|
|
|
|
|
self.pokemonList[i] = Util.GetGameObject(self.pokemonInfo, "Demons/heroPro ("..i..")")
|
|
|
|
|
end
|
|
|
|
|
--神印信息
|
|
|
|
|
self.imprintInfo = Util.GetGameObject(self.content, "imprintInfo")
|
|
|
|
|
self.imprintGrid = Util.GetGameObject(self.imprintInfo, "Imprints")
|
|
|
|
|
self.imprintPre = Util.GetGameObject(self.gameObject, "Frame/other/imprintPre")
|
|
|
|
|
self.imprintItemList = {}
|
|
|
|
|
--挑战
|
|
|
|
|
self.btnChallenge = Util.GetGameObject(self.Frame, "Button")
|
|
|
|
|
self.challengeTxt=Util.GetGameObject(self.Frame, "Button/Text"):GetComponent("Text")
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function GodsWayOtherTeamPanelBindEvent()
|
|
|
|
|
Util.AddClick(self.mask, function()
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(self.btnBack, function()
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(self.btnChallenge, function()
|
|
|
|
|
if not ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.JumpServer_YuXu) then
|
|
|
|
|
PopupTipPanel.ShowTip(Language[10075])
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
if time==0 and haveNum<needNum then
|
|
|
|
|
PopupTipPanel.ShowTip("挑战券不足!")
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
NetManager.CrossYuXuLunDaoChallengeBeforeRequest(PlayerManager.uid,self.playerId,function(msg)
|
|
|
|
|
LogError("open battleinfo ???")
|
|
|
|
|
UIManager.OpenPanel(UIName.WorldArenaBattleInfoPanel,msg,1, function()
|
|
|
|
|
--self:RefreshChallengeList()
|
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
--显示挑战界面
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function GodsWayOtherTeamPanel:AddListener()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function GodsWayOtherTeamPanel:RemoveListener()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
2023-03-21 10:11:06 +08:00
|
|
|
|
function GodsWayOtherTeamPanel:OnOpen(_type,_floor)
|
2023-03-20 11:22:44 +08:00
|
|
|
|
type=_type
|
2023-03-21 10:11:06 +08:00
|
|
|
|
floor=_floor
|
2023-03-20 11:22:44 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
|
|
|
|
function GodsWayOtherTeamPanel:OnShow()
|
2023-03-21 10:11:06 +08:00
|
|
|
|
|
|
|
|
|
local towers=ConfigManager.TryGetAllConfigsDataByDoubleKey(ConfigName.DuoDuiTower,"Type",type,"TowerNumber",floor)
|
2023-03-20 11:22:44 +08:00
|
|
|
|
itemId, needNum = WorldArenaManager.GetArenaChallengeCost()
|
|
|
|
|
haveNum = BagManager.GetItemCountById(itemId)
|
|
|
|
|
--设置挑战按钮显示
|
|
|
|
|
self.costImg.sprite = SetIcon(self.spLoader, itemId)
|
|
|
|
|
self.costTxt.text = "×"..needNum
|
|
|
|
|
self.costTxt.color = haveNum < needNum and UIColor.NOT_ENOUGH_RED or UIColor.BTN_TEXT
|
|
|
|
|
time=WorldArenaManager.GetFreeTime()
|
|
|
|
|
self.costImg.gameObject:SetActive(time<=0)
|
|
|
|
|
self.challengeTxt.gameObject:SetActive(time>0)
|
|
|
|
|
self.challengeTxt.text="免费挑战"
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function GodsWayOtherTeamPanel:OnSortingOrderChange()
|
|
|
|
|
if self.PlayerHead then
|
|
|
|
|
self.PlayerHead:SetLayer(self.sortingOrder)
|
|
|
|
|
end
|
|
|
|
|
for k,v in pairs(self.teamList) do
|
|
|
|
|
for m,n in pairs(v.heroList) do
|
|
|
|
|
Util.SetParticleSortLayer(n.starGrid,self.sortingOrder + 1)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function GodsWayOtherTeamPanel:Refresh()
|
|
|
|
|
LogError("self.playerid=="..self.playerId)
|
|
|
|
|
--NetManager.GetPlayerCrossYxldOneTeamInfoRequest(self.playerId,0,function(msg)
|
2023-03-21 10:11:06 +08:00
|
|
|
|
--WorldArenaOtherTeamPanel:SetPlayerInfo(self.playerInfo,curMsg.teamInfo)
|
2023-03-20 11:22:44 +08:00
|
|
|
|
WorldArenaOtherTeamPanel:SetTeamInfo(self.teamInfo,{curMsg.teamInfo.crossTeam[1],curMsg.teamInfo.crossTeam[2],curMsg.teamInfo.crossTeam[3]})
|
|
|
|
|
WorldArenaOtherTeamPanel:SetPokemonInfo(self.pokemonInfo,curMsg.teamInfo.crossTeam[1].PokemonInfos)
|
2023-03-21 10:11:06 +08:00
|
|
|
|
-- WorldArenaOtherTeamPanel:SetImprintInfo(self.imprintInfo,curMsg.teamInfo.crossTeam[1].sealShow)
|
2023-03-20 11:22:44 +08:00
|
|
|
|
if type==1 then
|
|
|
|
|
self.btnChallenge:SetActive(true)
|
|
|
|
|
else
|
|
|
|
|
self.btnChallenge:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
ForceRebuildLayout(self.content.transform)
|
|
|
|
|
ForceRebuildLayout(self.Frame.transform)
|
|
|
|
|
--end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--实在不想算了,直接写死吧,毁灭吧
|
|
|
|
|
function GodsWayOtherTeamPanel:SetImgPos(_go,data)
|
|
|
|
|
local img = Util.GetGameObject(_go,"WarPower/Img")
|
|
|
|
|
local warPower = Util.GetGameObject(_go,"WarPower/Text"):GetComponent("Text")
|
|
|
|
|
local setPos = function (num)
|
|
|
|
|
if num >= 10 and num < 100 then
|
|
|
|
|
img.transform.localPosition = Vector2.New(55.6,0)
|
|
|
|
|
elseif num >= 100 and num < 1000 then
|
|
|
|
|
img.transform.localPosition = Vector2.New(77.3,0)
|
|
|
|
|
elseif num >= 1000 and num < 10000 then
|
|
|
|
|
img.transform.localPosition = Vector2.New(103.4,0)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if data < 100000 then
|
|
|
|
|
warPower.text = data
|
|
|
|
|
img:SetActive(false)
|
|
|
|
|
elseif data >= 100000000 then
|
|
|
|
|
warPower.text = math.floor( data/100000000 )
|
|
|
|
|
img:SetActive(true)
|
|
|
|
|
img:GetComponent("Image").sprite = self.spLoader:LoadSprite("bd_zhanli-yi")
|
|
|
|
|
setPos(math.floor( data/100000000 ))
|
|
|
|
|
else
|
|
|
|
|
warPower.text = math.floor( data/10000 )
|
|
|
|
|
img:SetActive(true)
|
|
|
|
|
img:GetComponent("Image").sprite = self.spLoader:LoadSprite("bd_zhanli-wan")
|
|
|
|
|
setPos(math.floor( data/10000 ))
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local serverName=nil
|
|
|
|
|
|
|
|
|
|
--编队信息
|
|
|
|
|
function GodsWayOtherTeamPanel:SetTeamInfo(_go,teamData)
|
|
|
|
|
for index = 1, 3 do
|
|
|
|
|
local go = Util.GetGameObject(_go,"Team ("..index..")")
|
|
|
|
|
local data = teamData[index]
|
|
|
|
|
local title = Util.GetGameObject(go,"Title"):GetComponent("Text")
|
|
|
|
|
local teamList = Util.GetGameObject(go,"TeamList")
|
|
|
|
|
title.text = string.format( "第%s队",NumToChinese[index])
|
|
|
|
|
--self:SetImgPos(go,data.totalForce)
|
|
|
|
|
Util.GetGameObject(go,"WarPower/Text"):GetComponent("Text").text=data.totalForce
|
|
|
|
|
|
|
|
|
|
for i, demon in ipairs(self.teamList[index].heroList) do
|
|
|
|
|
demon.frame.sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(1))
|
|
|
|
|
demon.hero:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
--队伍阵容
|
|
|
|
|
for i, hero in ipairs(data.team) do
|
|
|
|
|
local heroTid = data.team[i].heroTid
|
|
|
|
|
if heroTid then
|
|
|
|
|
self.teamList[index].heroList[hero.position].hero:SetActive(true)
|
|
|
|
|
local star,starType = GetStarOrGodSoulLv(1,hero)
|
|
|
|
|
local starScale = -15
|
|
|
|
|
local starSize = Vector2.New(32,32)
|
|
|
|
|
if starType == 3 then
|
|
|
|
|
starScale = -16
|
|
|
|
|
starSize = Vector2.New(0.8,-15)
|
|
|
|
|
elseif starType == 2 then
|
|
|
|
|
starSize = Vector2.New(48,48)
|
|
|
|
|
end
|
|
|
|
|
SetHeroStars(self.spLoader, self.teamList[index].heroList[hero.position].starGrid, star,nil,nil,-10)
|
|
|
|
|
Util.SetParticleSortLayer(self.teamList[index].heroList[hero.position].starGrid,self.sortingOrder + 1)
|
|
|
|
|
local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, heroTid)
|
|
|
|
|
self.teamList[index].heroList[hero.position].proIcon.sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(hero.propertyId))
|
|
|
|
|
self.teamList[index].heroList[hero.position].levelText.text =endLess[heroTid].Level or hero.level
|
|
|
|
|
self.teamList[index].heroList[hero.position].frame.sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(heroConfig.Quality, star))
|
|
|
|
|
SetHeroIcon(self.spLoader,hero, self.teamList[index].heroList[hero.position].icon,heroConfig)
|
|
|
|
|
SetHeroFlyEffect(self.teamList[index].heroList[hero.position].hero,self.spLoader,star,self.sortingOrder+1,0.8,2)
|
|
|
|
|
local heroData = {}
|
|
|
|
|
Util.AddOnceClick(self.teamList[index].heroList[hero.position].frame.gameObject, function()
|
|
|
|
|
-- LogError("playerid=="..self.playerId.." heroid=="..hero.heroid.." servername=="..serverName.." arrayid=="..2000+index)
|
|
|
|
|
NetManager.ViewHeroInfoRequest(self.playerId,hero.heroid,serverName,2000+index,function(msg)
|
|
|
|
|
if not hero.heroid then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
heroData= GoodFriendManager.GetHeroDatas(msg.hero,msg.force,msg.SpecialEffects,msg.guildSkill)
|
|
|
|
|
heroData.star=star
|
|
|
|
|
heroData.lv=endLess[heroTid].Level
|
|
|
|
|
GoodFriendManager.InitEquipData(msg.equip,heroData)--HeroManager.GetSingleHeroData(heroData.dynamicId)
|
|
|
|
|
UIManager.OpenPanel(UIName.RoleInfoPopup, heroData,true)
|
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--灵兽信息
|
|
|
|
|
function GodsWayOtherTeamPanel:SetPokemonInfo(go,pokemonData)
|
|
|
|
|
local len = #pokemonData
|
|
|
|
|
if len>0 then
|
|
|
|
|
self.pokemonInfo:SetActive(true)
|
|
|
|
|
for i, demon in ipairs(self.pokemonList) do
|
|
|
|
|
demon.gameObject:SetActive(false)
|
|
|
|
|
Util.GetGameObject(demon, "frame"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(1))
|
|
|
|
|
Util.GetGameObject(demon, "hero"):SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
self.pokemonInfo:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
for i, hero in ipairs(pokemonData) do
|
|
|
|
|
local demonId = pokemonData[i].heroTid
|
|
|
|
|
self.pokemonList[i].gameObject:SetActive(true)
|
|
|
|
|
if demonId then
|
|
|
|
|
local heroGo = Util.GetGameObject(self.pokemonList[i], "hero")
|
|
|
|
|
heroGo:SetActive(true)
|
|
|
|
|
SetHeroStars(self.spLoader, Util.GetGameObject(heroGo, "starGrid"), hero.star)
|
|
|
|
|
local heroConfig = ConfigManager.GetConfigData(ConfigName.SpiritAnimal, demonId)
|
|
|
|
|
Util.GetGameObject(heroGo, "lvbg/levelText"):GetComponent("Text").text = hero.level
|
|
|
|
|
Util.GetGameObject(self.pokemonList[i], "frame"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(heroConfig.Quality))
|
|
|
|
|
Util.GetGameObject(heroGo, "icon"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetResourcePath(heroConfig.Icon))
|
|
|
|
|
local frameBtn = Util.GetGameObject(self.pokemonList[i], "frame")
|
|
|
|
|
local heroData = {}
|
|
|
|
|
Util.AddOnceClick(frameBtn, function()
|
|
|
|
|
local pokemonData={tempId=demonId,id=demonId,star=hero.star,level=hero.level}
|
|
|
|
|
UIManager.OpenPanel(UIName.PokemonGetInfoPopup,true,pokemonData)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function GodsWayOtherTeamPanel:OnClose()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
function GodsWayOtherTeamPanel:OnDestroy()
|
|
|
|
|
self.spLoader:Destroy()
|
|
|
|
|
if self.PlayerHead then
|
|
|
|
|
self.PlayerHead:Recycle()
|
|
|
|
|
self.PlayerHead = nil
|
|
|
|
|
end
|
|
|
|
|
self.InfoList = {}
|
|
|
|
|
self.dragViewList = {}
|
|
|
|
|
self.triggerList = {}
|
|
|
|
|
self.gridList = {}
|
|
|
|
|
self.teamList = {}
|
|
|
|
|
self.pokemonList = {}
|
|
|
|
|
self.imprintItemList = {}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return GodsWayOtherTeamPanel
|