2021-08-26 17:14:13 +08:00
|
|
|
|
require("Base/BasePanel")
|
|
|
|
|
local WorldArenaOtherTeamPanel = Inherit(BasePanel)
|
|
|
|
|
local XiuXianSkillConfig = ConfigManager.GetConfig(ConfigName.XiuXianSkillConfig)
|
|
|
|
|
|
2021-09-09 11:48:09 +08:00
|
|
|
|
local type=0 --1:挑战 2:详情
|
|
|
|
|
local itemId, needNum
|
|
|
|
|
local haveNum=0
|
|
|
|
|
local time=0
|
2021-09-09 23:01:23 +08:00
|
|
|
|
local enemyId
|
2021-08-26 17:14:13 +08:00
|
|
|
|
function WorldArenaOtherTeamPanel:InitComponent()
|
|
|
|
|
self.spLoader = SpriteLoader.New()
|
2021-09-11 20:26:43 +08:00
|
|
|
|
self.btnBack = Util.GetGameObject(self.gameObject, "Frame/other/BackBtn")
|
2021-08-26 17:14:13 +08:00
|
|
|
|
self.mask = Util.GetGameObject(self.gameObject, "mask")
|
2021-09-11 20:26:43 +08:00
|
|
|
|
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")
|
2021-08-26 17:14:13 +08:00
|
|
|
|
--玩家信息
|
|
|
|
|
self.playerInfo = Util.GetGameObject(self.content, "playerInfo")
|
|
|
|
|
self.playerHead = Util.GetGameObject(self.playerInfo, "head")
|
|
|
|
|
self.playerName = Util.GetGameObject(self.playerInfo, "name")
|
|
|
|
|
self.playerScore = Util.GetGameObject(self.playerInfo, "score"):GetComponent("Text")
|
|
|
|
|
self.playerLevelImg = Util.GetGameObject(self.playerInfo, "levelImg"):GetComponent("Image")
|
|
|
|
|
--队伍信息
|
|
|
|
|
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")
|
|
|
|
|
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] = Util.GetGameObject(self.teamInfo, "Team ("..i..")/TeamList/heroPro ("..j..")")
|
|
|
|
|
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")
|
2021-09-11 20:26:43 +08:00
|
|
|
|
self.imprintPre = Util.GetGameObject(self.gameObject, "Frame/other/imprintPre")
|
2021-08-26 17:14:13 +08:00
|
|
|
|
self.imprintItemList = {}
|
2021-08-26 17:36:03 +08:00
|
|
|
|
--挑战
|
2021-09-11 20:26:43 +08:00
|
|
|
|
self.btnChallenge = Util.GetGameObject(self.Frame, "Button")
|
|
|
|
|
self.challengeTxt=Util.GetGameObject(self.Frame, "Button/Text"):GetComponent("Text")
|
2021-09-09 11:48:09 +08:00
|
|
|
|
|
2021-08-26 17:14:13 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function WorldArenaOtherTeamPanel:BindEvent()
|
|
|
|
|
Util.AddClick(self.mask, function()
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(self.btnBack, function()
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
2021-08-26 17:36:03 +08:00
|
|
|
|
Util.AddClick(self.btnChallenge, function()
|
2021-09-09 11:48:09 +08:00
|
|
|
|
if time==0 and haveNum<needNum then
|
|
|
|
|
PopupTipPanel.ShowTip("邀请函不足!")
|
|
|
|
|
return
|
|
|
|
|
end
|
2021-09-09 23:01:23 +08:00
|
|
|
|
NetManager.CrossYuXuLunDaoChallengeBeforeRequest(PlayerManager.uid,self.playerId,function(msg)
|
|
|
|
|
LogError("open battleinfo ???")
|
|
|
|
|
UIManager.OpenPanel(UIName.WorldArenaBattleInfoPanel,msg,1, function()
|
|
|
|
|
--self:RefreshChallengeList()
|
|
|
|
|
end)
|
|
|
|
|
end)
|
2021-09-09 11:48:09 +08:00
|
|
|
|
--显示挑战界面
|
2021-08-26 17:36:03 +08:00
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
2021-08-26 17:14:13 +08:00
|
|
|
|
end
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function WorldArenaOtherTeamPanel:AddListener()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function WorldArenaOtherTeamPanel:RemoveListener()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
2021-09-09 11:48:09 +08:00
|
|
|
|
function WorldArenaOtherTeamPanel:OnOpen(_playerId,_type)
|
2021-08-26 17:14:13 +08:00
|
|
|
|
self.playerId = _playerId
|
2021-09-09 11:48:09 +08:00
|
|
|
|
type=_type
|
2021-08-26 17:14:13 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
|
|
|
|
function WorldArenaOtherTeamPanel:OnShow()
|
2021-09-09 11:48:09 +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="免费挑战"
|
2021-08-26 17:14:13 +08:00
|
|
|
|
WorldArenaOtherTeamPanel:Refresh()
|
2021-09-11 20:26:43 +08:00
|
|
|
|
|
2021-08-26 17:14:13 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function WorldArenaOtherTeamPanel:OnSortingOrderChange()
|
|
|
|
|
if self.PlayerHead then
|
|
|
|
|
self.PlayerHead:SetLayer(self.sortingOrder)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function WorldArenaOtherTeamPanel:Refresh()
|
2021-09-09 11:48:09 +08:00
|
|
|
|
LogError("self.playerid=="..self.playerId)
|
|
|
|
|
NetManager.GetPlayerCrossYxldOneTeamInfoRequest(self.playerId,0,function(msg)
|
2021-08-26 17:14:13 +08:00
|
|
|
|
WorldArenaOtherTeamPanel:SetPlayerInfo(self.playerInfo,msg.teamInfo)
|
2021-09-09 11:48:09 +08:00
|
|
|
|
WorldArenaOtherTeamPanel:SetTeamInfo(self.teamInfo,{msg.teamInfo.crossTeam[1],msg.teamInfo.crossTeam[2],msg.teamInfo.crossTeam[3]})
|
2021-09-10 22:13:48 +08:00
|
|
|
|
WorldArenaOtherTeamPanel:SetPokemonInfo(self.pokemonInfo,msg.teamInfo.crossTeam[1].PokemonInfos)
|
|
|
|
|
WorldArenaOtherTeamPanel:SetImprintInfo(self.imprintInfo,msg.teamInfo.crossTeam[1].sealShow)
|
2021-09-09 11:48:09 +08:00
|
|
|
|
if type==1 then
|
|
|
|
|
self.btnChallenge:SetActive(true)
|
|
|
|
|
else
|
|
|
|
|
self.btnChallenge:SetActive(false)
|
|
|
|
|
end
|
2021-09-11 20:26:43 +08:00
|
|
|
|
|
|
|
|
|
ForceRebuildLayout(self.content.transform)
|
|
|
|
|
ForceRebuildLayout(self.Frame.transform)
|
2021-08-26 17:14:13 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
2021-08-26 18:14:46 +08:00
|
|
|
|
--实在不想算了,直接写死吧,毁灭吧
|
|
|
|
|
function WorldArenaOtherTeamPanel: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
|
|
|
|
|
|
2021-08-26 17:14:13 +08:00
|
|
|
|
--玩家信息
|
|
|
|
|
function WorldArenaOtherTeamPanel:SetPlayerInfo(go,playerData)
|
|
|
|
|
local head = Util.GetGameObject(go, "head")
|
|
|
|
|
local name = Util.GetGameObject(go, "name"):GetComponent("Text")
|
|
|
|
|
local score = Util.GetGameObject(go, "score"):GetComponent("Text")
|
|
|
|
|
local levelImg = Util.GetGameObject(go, "levelImg"):GetComponent("Image")
|
|
|
|
|
|
|
|
|
|
if not self.PlayerHead then
|
|
|
|
|
self.PlayerHead = SubUIManager.Open(SubUIConfig.PlayerHeadView, head.transform)
|
|
|
|
|
end
|
|
|
|
|
self.PlayerHead:Reset()
|
|
|
|
|
self.PlayerHead:SetScale(Vector3.one * 0.85)
|
|
|
|
|
self.PlayerHead:SetHead(playerData.head)
|
|
|
|
|
self.PlayerHead:SetFrame(playerData.headFrame)
|
|
|
|
|
self.PlayerHead:SetLevel(playerData.level)
|
|
|
|
|
self.PlayerHead:SetLayer(self.sortingOrder)
|
|
|
|
|
self.PlayerHead:SetEffectScale(0.9)
|
|
|
|
|
|
2021-09-09 11:48:09 +08:00
|
|
|
|
name.text = PracticeManager.SetNameColor(playerData.serverName.." "..playerData.name,playerData.practiceLevel)
|
|
|
|
|
score.text = string.format( "积分:%s",playerData.crossTeamScore)
|
|
|
|
|
local rank=WorldArenaManager.GetRankImgByScore(playerData.crossTeamScore)
|
|
|
|
|
levelImg.sprite = self.spLoader:LoadSprite("y_yuxulundao_xiaobiao_0"..rank)
|
2021-08-26 17:14:13 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--编队信息
|
2021-08-26 17:36:03 +08:00
|
|
|
|
function WorldArenaOtherTeamPanel:SetTeamInfo(_go,teamData)
|
2021-08-26 17:14:13 +08:00
|
|
|
|
for index = 1, 3 do
|
2021-08-26 17:36:03 +08:00
|
|
|
|
local go = Util.GetGameObject(_go,"Team ("..index..")")
|
2021-08-26 17:14:13 +08:00
|
|
|
|
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])
|
2021-08-26 18:14:46 +08:00
|
|
|
|
self:SetImgPos(go,data.totalForce)
|
2021-08-26 17:14:13 +08:00
|
|
|
|
|
|
|
|
|
for i, demon in ipairs(self.teamList[index].heroList) do
|
|
|
|
|
Util.GetGameObject(demon, "frame"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(1))
|
|
|
|
|
Util.GetGameObject(demon, "hero"):SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
--队伍阵容
|
|
|
|
|
for i, hero in ipairs(data.team) do
|
|
|
|
|
local heroTid = data.team[i].heroTid
|
|
|
|
|
if heroTid then
|
|
|
|
|
local heroGo = Util.GetGameObject(self.teamList[index].heroList[hero.position], "hero")
|
|
|
|
|
heroGo:SetActive(true)
|
|
|
|
|
SetHeroStars(self.spLoader, Util.GetGameObject(heroGo, "starGrid"), hero.star)
|
|
|
|
|
local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, heroTid)
|
|
|
|
|
Util.GetGameObject(heroGo, "proIcon"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
|
|
|
|
|
Util.GetGameObject(heroGo, "lvbg/levelText"):GetComponent("Text").text = hero.level
|
|
|
|
|
Util.GetGameObject(self.teamList[index].heroList[hero.position], "frame"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(heroConfig.Quality, hero.star))
|
|
|
|
|
SetHeroIcon(self.spLoader, hero,Util.GetGameObject(heroGo, "icon"):GetComponent("Image"),heroConfig)
|
|
|
|
|
local frameBtn = Util.GetGameObject(self.teamList[index].heroList[hero.position], "frame")
|
|
|
|
|
local heroData = {}
|
|
|
|
|
Util.AddOnceClick(frameBtn, function()
|
|
|
|
|
NetManager.ViewHeroInfoRequest(self.playerId,hero.heroid,1,PLAYER_INFO_VIEW_TYPE.NORMAL,function(msg)
|
|
|
|
|
if not hero.heroid then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
heroData= GoodFriendManager.GetHeroDatas(msg.hero,msg.force,msg.SpecialEffects,msg.guildSkill)
|
|
|
|
|
GoodFriendManager.InitEquipData(msg.equip,heroData)
|
|
|
|
|
UIManager.OpenPanel(UIName.RoleInfoPopup, heroData,true)
|
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--灵兽信息
|
|
|
|
|
function WorldArenaOtherTeamPanel: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 WorldArenaOtherTeamPanel:SetImprintInfo(go,imprintData)
|
|
|
|
|
if imprintData and #imprintData > 0 then
|
|
|
|
|
self.imprintInfo:SetActive(true)
|
|
|
|
|
if not self.imprintItemList then
|
|
|
|
|
self.imprintItemList = {}
|
|
|
|
|
end
|
|
|
|
|
for i = 1, #self.imprintItemList do
|
|
|
|
|
self.imprintItemList[i].gameObject:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
for i = 1, #imprintData do
|
|
|
|
|
local item = self.imprintItemList[i]
|
|
|
|
|
local value = imprintData[i]
|
|
|
|
|
if not item then
|
|
|
|
|
item = newObject(self.imprintPre)
|
|
|
|
|
item.name = "imprintPre_"..i
|
|
|
|
|
item.transform:SetParent(self.imprintGrid.transform)
|
|
|
|
|
item.transform.localScale = Vector3.one
|
|
|
|
|
item.transform.localPosition = Vector3.zero
|
|
|
|
|
self.imprintItemList[i] = item
|
|
|
|
|
end
|
|
|
|
|
item.gameObject:SetActive(true)
|
|
|
|
|
local icon = Util.GetGameObject(item,"icon"):GetComponent("Image")
|
|
|
|
|
icon.sprite = self.spLoader:LoadSprite(GetResourcePath(XiuXianSkillConfig[value.id].Icon))
|
|
|
|
|
Util.AddOnceClick(item.gameObject,function ()
|
|
|
|
|
UIManager.OpenPanel(UIName.GeneralInfoPopup,GENERALINFO_TYPE.Imprint,value.id,value.heroTId)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
self.imprintInfo:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function WorldArenaOtherTeamPanel:OnClose()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
function WorldArenaOtherTeamPanel: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 WorldArenaOtherTeamPanel
|