2020-08-25 15:46:38 +08:00
require ( " Base/BasePanel " )
2020-05-09 13:31:21 +08:00
local PlayerInfoPopup = Inherit ( BasePanel )
local this = PlayerInfoPopup
2021-06-15 20:08:14 +08:00
local netserverName = nil
2021-05-18 14:59:47 +08:00
local XiuXianSkillConfig = ConfigManager.GetConfig ( ConfigName.XiuXianSkillConfig )
2021-07-28 15:48:35 +08:00
local isNpc = false --是否是机器人
2020-05-09 13:31:21 +08:00
local _ViewConfig = {
[ PLAYER_INFO_VIEW_TYPE.NORMAL ] = {
formationType = FormationTypeDef.FORMATION_NORMAL ,
2021-04-09 12:26:35 +08:00
tip = Language [ 10933 ] ,
2020-05-09 13:31:21 +08:00
btnType = {
--{name = "举 报", func = 1},
2021-04-09 12:26:35 +08:00
{ name = Language [ 11496 ] , func = 2 } ,
{ name = Language [ 11497 ] , func = 3 } ,
2020-05-09 13:31:21 +08:00
}
} ,
[ PLAYER_INFO_VIEW_TYPE.BLACK_REMOVE ] = {
formationType = FormationTypeDef.FORMATION_NORMAL ,
2021-04-09 12:26:35 +08:00
tip = Language [ 10933 ] ,
2020-05-09 13:31:21 +08:00
btnType = {
2021-04-09 12:26:35 +08:00
{ name = Language [ 11498 ] , func = 4 } ,
2020-05-09 13:31:21 +08:00
}
} ,
[ PLAYER_INFO_VIEW_TYPE.GO_TO_BLACK ] = {
formationType = FormationTypeDef.FORMATION_NORMAL ,
2021-04-09 12:26:35 +08:00
tip = Language [ 10933 ] ,
2020-05-09 13:31:21 +08:00
btnType = {
2021-04-09 12:26:35 +08:00
{ name = Language [ 11499 ] , func = 5 } ,
2020-05-09 13:31:21 +08:00
}
} ,
[ PLAYER_INFO_VIEW_TYPE.ARENA ] = {
formationType = FormationTypeDef.FORMATION_ARENA_DEFEND ,
2021-04-09 12:26:35 +08:00
tip = Language [ 11500 ] ,
2020-05-09 13:31:21 +08:00
} ,
2021-04-16 14:09:36 +08:00
[ PLAYER_INFO_VIEW_TYPE.MIND_DEMON ] = {
formationType = FormationTypeDef.MONSTER_CAMP_ATTACK ,
2021-05-11 17:03:09 +08:00
tip = Language [ 12306 ] ,
2021-04-16 16:12:43 +08:00
btnType = {
2021-05-29 18:37:45 +08:00
}
} ,
[ PLAYER_INFO_VIEW_TYPE.TSLX ] = {
formationType = FormationTypeDef.FORMATION_TSLX ,
tip = " 挑战阵容 " ,
btnType = {
2021-04-16 16:12:43 +08:00
}
2021-04-16 14:09:36 +08:00
} ,
2021-06-15 20:08:14 +08:00
[ PLAYER_INFO_VIEW_TYPE.JUPMSERVER ] = {
formationType = FormationTypeDef.JUMPSERVER_HIGHTLADDER ,
2021-07-13 17:40:25 +08:00
tip = " 罗浮争锋阵容: " ,
2021-06-15 20:08:14 +08:00
btnType = {
2021-07-28 18:38:06 +08:00
{ name = " 挑战 " , func = 6 } ,
{ name = " 切磋 " , func = 7 } ,
2021-06-15 20:08:14 +08:00
}
} ,
2020-05-09 13:31:21 +08:00
}
2021-03-17 16:56:02 +08:00
local curPlayerName = " "
2020-05-09 13:31:21 +08:00
local _PlayerHead = nil
--初始化组件(用于子类重写)
function PlayerInfoPopup : InitComponent ( )
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New ( )
2020-05-09 13:31:21 +08:00
this.btnBack = Util.GetGameObject ( self.transform , " btnClose " )
this.memHead = Util.GetGameObject ( self.transform , " tipImage/panel/info/head " )
this.memName = Util.GetGameObject ( self.transform , " tipImage/panel/info/name " ) : GetComponent ( " Text " )
this.memProfess = Util.GetGameObject ( self.transform , " tipImage/panel/info/profess " ) : GetComponent ( " Text " )
this.addFriendBtn = Util.GetGameObject ( self.transform , " tipImage/panel/info/btnAdd " )
this.addFriendBtnText = Util.GetGameObject ( this.addFriendBtn , " text " ) : GetComponent ( " Text " )
this.starBox = Util.GetGameObject ( self.transform , " tipImage/panel/info/starBox " )
this.star = Util.GetGameObject ( self.transform , " tipImage/panel/info/starBox/star " )
2021-04-12 16:23:57 +08:00
this.titlePar = Util.GetGameObject ( self.transform , " tipImage/panel/info/titlePar " )
2020-05-09 13:31:21 +08:00
this.memPower = Util.GetGameObject ( self.transform , " tipImage/panel/defendbox/power " ) : GetComponent ( " Text " )
this.formationTip = Util.GetGameObject ( self.transform , " tipImage/panel/defendbox/tip " ) : GetComponent ( " Text " )
this.attackCount = Util.GetGameObject ( self.transform , " tipImage/attackCount " ) : GetComponent ( " Text " )
this.demonsHeroList = Util.GetGameObject ( self.gameObject , " tipImage/panel/defendbox/demons " )
this.diffDemonsHeroList = Util.GetGameObject ( self.gameObject , " tipImage/panel/defendbox/diffdemons " )
-- this.DiffDemons = {}
-- for i = 1, 3 do
-- table.insert(this.DiffDemons, Util.GetGameObject(self.gameObject, "tipImage/panel/defendbox/diffdemons/icon_"..i))
-- end
this.Demons = { }
for i = 1 , 6 do
2020-07-04 16:11:14 +08:00
table.insert ( this.Demons , Util.GetGameObject ( self.gameObject , " tipImage/panel/defendbox/Demons/heroPro ( " .. i .. " ) " ) )
2020-05-09 13:31:21 +08:00
end
2020-10-31 17:01:46 +08:00
this.Pokemons = { }
for i = 1 , 6 do
table.insert ( this.Demons , Util.GetGameObject ( self.gameObject , " tipImage/panel/Pokemons/Demons/heroPro ( " .. i .. " ) " ) )
end
2020-05-09 13:31:21 +08:00
2021-04-09 12:26:35 +08:00
Util.GetGameObject ( self.transform , " tipImage/panel/pokemonInfo/tip " ) : GetComponent ( " Text " ) . text = Language [ 11501 ]
2020-10-31 17:01:46 +08:00
this.Pokemons = { }
for i = 1 , 6 do
table.insert ( this.Pokemons , Util.GetGameObject ( self.gameObject , " tipImage/panel/pokemonInfo/Demons/heroPro ( " .. i .. " ) " ) )
end
this.pokemonObj = Util.GetGameObject ( self.transform , " tipImage/panel/pokemonInfo " ) . gameObject
2020-05-09 13:31:21 +08:00
this.boxLine = Util.GetGameObject ( self.transform , " tipImage/panel/defendbox/line " )
this.btnBox = Util.GetGameObject ( self.transform , " tipImage/panel/box " )
2021-05-18 14:59:47 +08:00
-- this.bgImg= Util.GetGameObject(self.transform, "tipImage/tipImage"):GetComponent("RectTransform")
2020-05-09 13:31:21 +08:00
this.btnList = { }
this.btnList [ 1 ] = Util.GetGameObject ( this.btnBox , " btn1 " )
this.btnList [ 2 ] = Util.GetGameObject ( this.btnBox , " btn2 " )
this.btnList [ 3 ] = Util.GetGameObject ( this.btnBox , " btn3 " )
2021-05-18 14:59:47 +08:00
--神印信息
this.imprintObj = Util.GetGameObject ( self.transform , " tipImage/panel/imprintInfo " )
this.imprintGrid = Util.GetGameObject ( this.imprintObj , " Imprints " )
this.imprintPre = Util.GetGameObject ( self.transform , " imprintPre " )
this.imprintItemList = { }
2020-05-09 13:31:21 +08:00
end
--绑定事件(用于子类重写)
function PlayerInfoPopup : BindEvent ( )
Util.AddClick ( this.btnBack , function ( )
PlaySoundWithoutClick ( SoundConfig.Sound_UICancel )
this : ClosePanel ( )
end )
Util.AddClick ( this.addFriendBtn , function ( )
if not ActTimeCtrlManager.SingleFuncState ( FUNCTION_OPEN_TYPE.GOODFRIEND ) then
PopupTipPanel.ShowTip ( ActTimeCtrlManager.GetFuncTip ( FUNCTION_OPEN_TYPE.GOODFRIEND ) )
return
end
if GoodFriendManager.IsInBlackList ( this._PlayerId ) then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 10814 ] )
2020-05-09 13:31:21 +08:00
return
end
if this._PlayerId == PlayerManager.uid then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 10931 ] )
2020-05-09 13:31:21 +08:00
return
end
if GoodFriendManager.IsMyFriend ( this._PlayerId ) then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 10932 ] )
2020-05-09 13:31:21 +08:00
return
end
if this._PlayerData . isApplyed == 1 then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 10819 ] )
2020-05-09 13:31:21 +08:00
return
end
GoodFriendManager.InviteFriendRequest ( this._PlayerId , function ( )
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 11502 ] )
2020-05-09 13:31:21 +08:00
this._PlayerData . isApplyed = 1
this.RefreshFunction ( )
end )
end )
end
--添加事件监听(用于子类重写)
function PlayerInfoPopup : AddListener ( )
end
--移除事件监听(用于子类重写)
function PlayerInfoPopup : RemoveListener ( )
end
--界面打开时调用(用于子类重写)
2021-06-15 20:08:14 +08:00
function PlayerInfoPopup : OnOpen ( playerId , viewType , serverName )
2020-05-09 13:31:21 +08:00
this._PlayerId = playerId
this._ViewType = viewType or PLAYER_INFO_VIEW_TYPE.NORMAL
2021-06-15 20:08:14 +08:00
this.serverName = serverName --跨服加的服务器数据
2021-07-28 15:48:35 +08:00
isNpc = this._PlayerId <= 1000000
2020-05-09 13:31:21 +08:00
-- 界面类型修正
if this._ViewType == PLAYER_INFO_VIEW_TYPE.NORMAL and GoodFriendManager.IsInBlackList ( this._PlayerId ) then
this._ViewType = PLAYER_INFO_VIEW_TYPE.GO_TO_BLACK
end
this._Config = _ViewConfig [ this._ViewType ]
-- 注册按钮事件
this.btnFunc = {
[ 1 ] = this.Report ,
[ 2 ] = this.AddToBlackList ,
[ 3 ] = this.BeatHim ,
[ 4 ] = this.RemoveFromBlackList ,
[ 5 ] = this.GoToBlack ,
2021-06-15 20:08:14 +08:00
[ 6 ] = this.JumpServerBattle ,
2021-07-28 18:38:06 +08:00
[ 7 ] = this.JumpServerCrossBattle ,
2020-05-09 13:31:21 +08:00
}
end
-- 设置界面类型
function PlayerInfoPopup : SetViewType ( viewType )
this._ViewType = viewType or PLAYER_INFO_VIEW_TYPE.NORMAL
this._Config = _ViewConfig [ this._ViewType ]
this : OnShow ( )
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function PlayerInfoPopup : OnShow ( )
this.RefreshBtnShow ( )
-- 请求数据
2021-04-21 16:36:12 +08:00
-- --LogGreen(this._PlayerId.." "..this._Config.formationType)
2021-06-15 20:08:14 +08:00
netserverName = nil
2021-06-26 13:35:59 +08:00
if this.serverName and this.serverName ~= " " then --and this.serverName ~= PlayerManager.serverInfo.name
2021-06-15 20:08:14 +08:00
netserverName = 1
end
NetManager.RequestPlayerInfo ( this._PlayerId , this._Config . formationType , netserverName , function ( msg )
2020-05-09 13:31:21 +08:00
-- 如果是好友更新好友数据
2021-03-17 16:56:02 +08:00
curPlayerName = msg.teamInfo . name
2021-03-02 18:05:06 +08:00
GoodFriendManager.UpdateFriendData ( this._PlayerId , msg.teamInfo . level , JingJiShouWeiToEn ( msg.teamInfo . name ) , msg.teamInfo . head , msg.teamInfo . headFrame )
2020-05-09 13:31:21 +08:00
this._PlayerData = msg.teamInfo
this.RefreshPlayerInfo ( msg.teamInfo )
local teamInfo = msg.teamInfo . team
this.FormationAdapter ( teamInfo )
--
this.RefreshFunction ( )
2021-03-17 16:56:02 +08:00
this.RefreshBtnShow ( )
2020-05-09 13:31:21 +08:00
end )
end
-- 刷新基础信息显示
2021-04-12 16:23:57 +08:00
local titleLiveStr
local titleLive
2020-05-09 13:31:21 +08:00
function this . RefreshPlayerInfo ( data )
2021-06-15 20:08:14 +08:00
local curname = " "
if this._ViewType == PLAYER_INFO_VIEW_TYPE.JUPMSERVER and this.serverName then
curname = this.serverName .. " " .. data.name
else
curname = data.name
end
this.memName . text = PracticeManager.SetNameColor ( curname , data.practiceLevel ) --data.name
2020-05-09 13:31:21 +08:00
if ( data.guildName ~= " " ) then
2021-04-09 12:26:35 +08:00
this.memProfess . text = Language [ 10633 ] .. data.guildName --GUILD_GRANT_STR[data.position]
2020-05-09 13:31:21 +08:00
else
2021-04-09 12:26:35 +08:00
this.memProfess . text = Language [ 10633 ] .. Language [ 10086 ]
2020-05-09 13:31:21 +08:00
end
-- 头像
if not _PlayerHead then
_PlayerHead = SubUIManager.Open ( SubUIConfig.PlayerHeadView , this.memHead . transform )
end
2021-06-02 18:26:31 +08:00
-- if titleLive then
-- poolManager:UnLoadAsset(titleLiveStr, titleLive, PoolManager.AssetType.GameObject)
-- titleLive = nil
-- titleLiveStr = nil
-- end
2020-05-09 13:31:21 +08:00
_PlayerHead : Reset ( )
_PlayerHead : SetScale ( Vector3.one * 0.85 )
_PlayerHead : SetHead ( data.head )
_PlayerHead : SetFrame ( data.headFrame )
_PlayerHead : SetLevel ( data.level )
2020-09-25 21:19:01 +08:00
_PlayerHead : SetLayer ( this.sortingOrder )
_PlayerHead : SetEffectScale ( 0.9 )
2021-04-12 16:23:57 +08:00
local title = data.userTitle
if title and title > 0 then
this.titlePar : SetActive ( true )
2021-06-02 18:26:31 +08:00
-- local curPlayerRole = ConfigManager.GetConfigData(ConfigName.PlayerRole,title)
-- local curArtResourcesConfig = ConfigManager.GetConfigData(ConfigName.ArtResourcesConfig,curPlayerRole.LiveAnimName)
-- titleLiveStr = curArtResourcesConfig.Name
-- titleLive = poolManager:LoadAsset(titleLiveStr, PoolManager.AssetType.GameObject)
-- titleLive.transform:SetParent(this.titlePar.transform)
-- titleLive.transform.localPosition = Vector3.New(0,0,0)
-- titleLive.transform.localScale = Vector3.New(0.5,0.5,0.5)
-- local sortingorder=0
-- if this.sortingOrder then
-- Util.AddParticleSortLayer(titleLive,this.sortingOrder - sortingorder)
-- sortingorder = this.sortingOrder
-- end
LogError ( " title== " .. title )
2021-06-30 14:10:30 +08:00
if titleLive then
SubUIManager.Close ( titleLive )
titleLive = nil
end
2021-06-02 18:26:31 +08:00
if not titleLive then
titleLive = SubUIManager.Open ( SubUIConfig.PlayerTitle , this.titlePar . transform )
titleLive : SetShow ( title , Vector3.New ( 0 , 0 , 0 ) , 0.5 , 0.03 * 20 , this.sortingOrder )
2021-04-12 16:23:57 +08:00
end
2021-06-02 18:26:31 +08:00
2021-04-12 16:23:57 +08:00
else
this.titlePar : SetActive ( false )
end
2020-09-25 21:19:01 +08:00
end
function this : OnSortingOrderChange ( )
if _PlayerHead then
_PlayerHead : SetLayer ( self.sortingOrder )
end
2020-05-09 13:31:21 +08:00
end
-- 刷新功能区
function this . RefreshFunction ( )
this.addFriendBtn : SetActive ( false )
this.starBox : SetActive ( false )
2021-04-16 16:12:43 +08:00
if this._ViewType == PLAYER_INFO_VIEW_TYPE.NORMAL or this._ViewType == PLAYER_INFO_VIEW_TYPE.MIND_DEMON then
2020-05-09 13:31:21 +08:00
this.addFriendBtn : SetActive ( true )
local isSelf = this._PlayerId == PlayerManager.uid
local isMyFriend = isSelf and true or GoodFriendManager.IsMyFriend ( this._PlayerId )
local isApplyed = this._PlayerData . isApplyed == 1
Util.SetGray ( this.addFriendBtn , isMyFriend or isApplyed )
2021-04-09 12:26:35 +08:00
this.addFriendBtnText . text = isApplyed and Language [ 10816 ] or Language [ 10937 ]
2020-05-09 13:31:21 +08:00
end
end
-- 编队数据匹配
function this . FormationAdapter ( teamInfo )
this.formationTip . text = _ViewConfig [ this._ViewType ] . tip
-- 战斗力
this.memPower . text = teamInfo.totalForce
2020-07-04 16:11:14 +08:00
for i , demon in ipairs ( this.Demons ) do
2021-04-21 13:12:04 +08:00
Util.GetGameObject ( demon , " frame " ) : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetQuantityImageByquality ( 1 ) )
2020-07-04 16:11:14 +08:00
Util.GetGameObject ( demon , " hero " ) : SetActive ( false )
2020-10-31 17:01:46 +08:00
end
--队伍阵容
2020-07-04 16:11:14 +08:00
for i , hero in ipairs ( teamInfo.team ) do
local demonId = teamInfo.team [ i ] . heroTid
if demonId then
local heroGo = Util.GetGameObject ( this.Demons [ hero.position ] , " hero " )
heroGo : SetActive ( true )
2021-04-21 13:12:04 +08:00
SetHeroStars ( this.spLoader , Util.GetGameObject ( heroGo , " starGrid " ) , hero.star )
2020-07-04 16:11:14 +08:00
local heroConfig = ConfigManager.GetConfigData ( ConfigName.HeroConfig , demonId )
2021-04-21 13:12:04 +08:00
Util.GetGameObject ( heroGo , " proIcon " ) : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetProStrImageByProNum ( heroConfig.PropertyName ) )
2020-07-04 16:11:14 +08:00
Util.GetGameObject ( heroGo , " lvbg/levelText " ) : GetComponent ( " Text " ) . text = hero.level
2021-04-21 13:12:04 +08:00
Util.GetGameObject ( this.Demons [ hero.position ] , " frame " ) : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetQuantityImageByquality ( heroConfig.Quality , hero.star ) )
2020-11-06 09:37:27 +08:00
-- if hero.skinId == 0 then
2021-04-21 13:12:04 +08:00
-- Util.GetGameObject(heroGo, "icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetResourcePath(heroConfig.Icon))
2020-11-06 09:37:27 +08:00
-- else
-- local config = ConfigManager.GetConfigDataByKey(ConfigName.HeroSkin,"Type",hero.skinId)
2021-04-21 13:12:04 +08:00
-- Util.GetGameObject(heroGo, "icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetResourcePath(config.Icon))
2020-11-06 09:37:27 +08:00
-- end
2021-04-21 13:12:04 +08:00
SetHeroIcon ( this.spLoader , hero , Util.GetGameObject ( heroGo , " icon " ) : GetComponent ( " Image " ) , heroConfig )
2020-07-04 16:11:14 +08:00
local frameBtn = Util.GetGameObject ( this.Demons [ hero.position ] , " frame " )
local heroData = { }
2021-05-29 18:37:45 +08:00
if this._Config . formationType == FormationTypeDef.FORMATION_TSLX then
Util.AddOnceClick ( frameBtn , function ( )
UIManager.OpenPanel ( UIName.RoleGetInfoPopup , false , demonId , hero.star )
end )
else
Util.AddOnceClick ( frameBtn , function ( )
2021-06-15 20:08:14 +08:00
NetManager.ViewHeroInfoRequest ( this._PlayerId , hero.heroid , netserverName , function ( msg )
2021-05-29 18:37:45 +08:00
if not hero.heroid then
return
end
heroData = GoodFriendManager.GetHeroDatas ( msg.hero , msg.force , msg.SpecialEffects , msg.guildSkill )
GoodFriendManager.InitEquipData ( msg.equip , heroData ) --HeroManager.GetSingleHeroData(heroData.dynamicId)
UIManager.OpenPanel ( UIName.RoleInfoPopup , heroData , true )
end )
2020-05-09 13:31:21 +08:00
end )
2021-05-29 18:37:45 +08:00
end
2020-07-04 16:11:14 +08:00
end
2020-05-09 13:31:21 +08:00
end
2020-10-31 17:01:46 +08:00
local len =# teamInfo.PokemonInfos
if len > 0 then
2021-05-18 14:59:47 +08:00
-- this.bgImg.sizeDelta=Vector2.New(900,1024)
2020-10-31 17:01:46 +08:00
this.pokemonObj : SetActive ( true )
for i , demon in ipairs ( this.Pokemons ) do
demon.gameObject : SetActive ( false )
2021-04-21 13:12:04 +08:00
Util.GetGameObject ( demon , " frame " ) : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetQuantityImageByquality ( 1 ) )
2021-05-18 14:59:47 +08:00
Util.GetGameObject ( demon , " hero " ) : SetActive ( false )
2020-10-31 17:01:46 +08:00
end
else
2021-05-18 14:59:47 +08:00
-- this.bgImg.sizeDelta=Vector2.New(900,850)
2020-10-31 17:01:46 +08:00
this.pokemonObj : SetActive ( false )
end
--队伍灵兽
for i , hero in ipairs ( teamInfo.PokemonInfos ) do
local demonId = teamInfo.PokemonInfos [ i ] . heroTid
this.Pokemons [ i ] . gameObject : SetActive ( true )
if demonId then
local heroGo = Util.GetGameObject ( this.Pokemons [ i ] , " hero " )
heroGo : SetActive ( true )
2021-04-21 13:12:04 +08:00
SetHeroStars ( this.spLoader , Util.GetGameObject ( heroGo , " starGrid " ) , hero.star )
2020-10-31 17:01:46 +08:00
local heroConfig = ConfigManager.GetConfigData ( ConfigName.SpiritAnimal , demonId )
Util.GetGameObject ( heroGo , " lvbg/levelText " ) : GetComponent ( " Text " ) . text = hero.level
2021-04-21 13:12:04 +08:00
Util.GetGameObject ( this.Pokemons [ i ] , " frame " ) : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetQuantityImageByquality ( heroConfig.Quality ) )
Util.GetGameObject ( heroGo , " icon " ) : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetResourcePath ( heroConfig.Icon ) )
2020-10-31 17:01:46 +08:00
local frameBtn = Util.GetGameObject ( this.Pokemons [ 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
2021-05-18 14:59:47 +08:00
--神印信息
if teamInfo.sealShow and # teamInfo.sealShow > 0 then
this.imprintObj : SetActive ( true )
if not this.imprintItemList then
this.imprintItemList = { }
end
for i = 1 , # this.imprintItemList do
this.imprintItemList [ i ] . gameObject : SetActive ( false )
end
for i = 1 , # teamInfo.sealShow do
local item = this.imprintItemList [ i ]
local value = teamInfo.sealShow [ i ]
if not item then
item = newObject ( this.imprintPre )
item.name = " imprintPre_ " .. i
item.transform : SetParent ( this.imprintGrid . transform )
item.transform . localScale = Vector3.one
item.transform . localPosition = Vector3.zero
this.imprintItemList [ i ] = item
end
item.gameObject : SetActive ( true )
local icon = Util.GetGameObject ( item , " icon " ) : GetComponent ( " Image " )
2021-05-26 11:53:45 +08:00
icon.sprite = this.spLoader : LoadSprite ( GetResourcePath ( XiuXianSkillConfig [ value.id ] . Icon ) )
2021-05-18 14:59:47 +08:00
Util.AddOnceClick ( item.gameObject , function ( )
2021-05-18 16:13:26 +08:00
UIManager.OpenPanel ( UIName.GeneralInfoPopup , GENERALINFO_TYPE.Imprint , value.id , value.heroTId )
2021-05-18 14:59:47 +08:00
end )
end
else
this.imprintObj : SetActive ( false )
end
2020-05-09 13:31:21 +08:00
end
-- 刷新按钮显示
function this . RefreshBtnShow ( )
-- 自己
2021-04-09 12:26:35 +08:00
if this._PlayerId == PlayerManager.uid or curPlayerName == Language [ 12230 ] then
2020-05-09 13:31:21 +08:00
this.boxLine : SetActive ( false )
this.btnBox : SetActive ( false )
2021-04-07 10:30:47 +08:00
this.addFriendBtn : SetActive ( false )
2020-05-09 13:31:21 +08:00
return
end
-- 判断该界面类型是否有按钮显示
2021-07-28 15:48:35 +08:00
if not this._Config or not this._Config . btnType or isNpc then --or (this._ViewType == PLAYER_INFO_VIEW_TYPE.JUPMSERVER and not JumpServerManager.GetCurPersonInfo())
2020-05-09 13:31:21 +08:00
this.boxLine : SetActive ( false )
this.btnBox : SetActive ( false )
2021-04-07 10:30:47 +08:00
this.addFriendBtn : SetActive ( false )
2020-05-09 13:31:21 +08:00
return
end
2021-07-13 11:28:36 +08:00
if this._ViewType == PLAYER_INFO_VIEW_TYPE.JUPMSERVER then
this.addFriendBtn : SetActive ( false )
else
this.addFriendBtn : SetActive ( true )
end
2020-05-09 13:31:21 +08:00
-- 有按钮显示
local btnType = this._Config . btnType
this.btnBox : SetActive ( true )
for index , btn in ipairs ( this.btnList ) do
btn : SetActive ( btnType [ index ] ~= nil )
2021-07-28 18:38:06 +08:00
--罗浮争锋时 挑战阶段显示两个按钮 挑战 和 切磋 其他阶段显示 切磋
if this._ViewType == PLAYER_INFO_VIEW_TYPE.JUPMSERVER and JumpServerManager.GetHightLadderDatastage ( ) == JumpServer_Stage.Attack then
this.btnList [ 1 ] : SetActive ( true )
else
this.btnList [ 1 ] : SetActive ( false )
end
2020-05-09 13:31:21 +08:00
if btnType [ index ] then
Util.GetGameObject ( btn , " Text " ) : GetComponent ( " Text " ) . text = btnType [ index ] . name
Util.AddOnceClick ( btn , function ( )
local funcType = btnType [ index ] . func
if not this.btnFunc [ funcType ] then
2021-01-09 14:20:06 +08:00
Log ( " 方法不存在 " )
2020-05-09 13:31:21 +08:00
return
end
this.btnFunc [ funcType ] ( btnType [ index ] . param )
end )
end
end
end
----=============================== 按钮事件==================================
-- 举报
function this . Report ( )
2021-01-09 14:20:06 +08:00
Log ( " 举报 " )
2020-05-09 13:31:21 +08:00
end
-- 拉黑
function this . AddToBlackList ( )
if not ActTimeCtrlManager.SingleFuncState ( FUNCTION_OPEN_TYPE.GOODFRIEND ) then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 10828 ] )
2020-05-09 13:31:21 +08:00
return
end
if table.nums ( GoodFriendManager.blackFriendList ) >= GoodFriendManager.blackFriendLimit then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 11503 ] )
2020-05-09 13:31:21 +08:00
return
end
GoodFriendManager.RequestAddToBlackList ( this._PlayerId , function ( )
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 11504 ] )
2020-05-09 13:31:21 +08:00
this : SetViewType ( PLAYER_INFO_VIEW_TYPE.GO_TO_BLACK )
end )
end
-- 移除黑名单
function this . RemoveFromBlackList ( )
if not ActTimeCtrlManager.SingleFuncState ( FUNCTION_OPEN_TYPE.GOODFRIEND ) then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 10828 ] )
2020-05-09 13:31:21 +08:00
return
end
GoodFriendManager.RequestDeleteFromBlackList ( this._PlayerId , function ( )
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 11505 ] )
2020-05-09 13:31:21 +08:00
this : ClosePanel ( )
end )
end
-- 移除黑名单
function this . GoToBlack ( )
if not ActTimeCtrlManager.SingleFuncState ( FUNCTION_OPEN_TYPE.GOODFRIEND ) then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 10828 ] )
2020-05-09 13:31:21 +08:00
return
end
this : ClosePanel ( )
UIManager.OpenPanel ( UIName.GoodFriendMainPanel , true , 4 )
end
-- 打他
function this . BeatHim ( )
this : ClosePanel ( )
2020-08-25 20:28:32 +08:00
UIManager.OpenPanel ( UIName.FormationPanelV2 , FORMATION_TYPE.PLAY , this._PlayerData )
2020-05-09 13:31:21 +08:00
end
2021-07-28 18:38:06 +08:00
2021-06-15 20:08:14 +08:00
-- 跨服天梯
function this . JumpServerBattle ( )
2021-07-28 18:38:06 +08:00
this : ClosePanel ( )
local JoinRank = ConfigManager.GetConfigData ( ConfigName.MServerArenaSetting , 1 ) . JoinRank
if not JumpServerManager.GetHightLadderDataEnterable ( ) then
PopupTipPanel.ShowTip ( " 本服千战逐胜台前 " .. JoinRank .. " 名可以参加 " )
return
end
local JumpPanel = UIManager.GetOpenPanel ( UIName.JumpServerHightLadderPanel )
if not JumpPanel then return end
local curData = JumpServerManager.GetCurPersonInfo ( )
if not curData then return end
this : ClosePanel ( )
JumpPanel.BuyVipFun ( 1 , 1 , function ( )
--直接战斗
JumpServerManager.StarFightHightLadder ( curData , 0 , function ( msg )
PrivilegeManager.RefreshPrivilegeUsedTimes ( PRIVILEGE_TYPE.JUMPSERVER_GIGHTLADDER_MIANFEINUM , 1 ) --更新特权
JumpPanel = UIManager.GetOpenPanel ( UIName.JumpServerHightLadderPanel )
JumpPanel.RefreshBuyNum ( )
JumpPanel.OnShowPanel ( )
JumpServerManager.SetCurPersonInfo ( nil )
end )
end )
end
-- 跨服天梯
function this . JumpServerCrossBattle ( )
2021-06-15 20:08:14 +08:00
this : ClosePanel ( )
2021-07-28 15:48:35 +08:00
UIManager.OpenPanel ( UIName.FormationPanelV2 , FORMATION_TYPE.JUMPSERVER_HIGHTLADDER , true , this._PlayerData )
2021-06-15 20:08:14 +08:00
end
2020-05-09 13:31:21 +08:00
--界面关闭时调用(用于子类重写)
function PlayerInfoPopup : OnClose ( )
2021-05-27 14:44:49 +08:00
this.imprintObj : SetActive ( false )
2021-06-15 20:08:14 +08:00
JumpServerManager.SetCurPersonInfo ( nil )
2021-06-30 14:10:30 +08:00
if titleLive then
SubUIManager.Close ( titleLive )
titleLive = nil
end
2020-05-09 13:31:21 +08:00
end
--界面销毁时调用(用于子类重写)
function PlayerInfoPopup : OnDestroy ( )
2021-04-21 13:12:04 +08:00
this.spLoader : Destroy ( )
2020-05-09 13:31:21 +08:00
-- 头像
if _PlayerHead then
_PlayerHead : Recycle ( )
_PlayerHead = nil
end
2021-04-12 16:23:57 +08:00
titleLive = nil
titleLiveStr = nil
2021-05-18 14:59:47 +08:00
this.imprintItemList = { }
2020-05-09 13:31:21 +08:00
end
2021-04-21 13:12:04 +08:00
return PlayerInfoPopup