690 lines
27 KiB
Lua
690 lines
27 KiB
Lua
require("Base/BasePanel")
|
|
local GuildMemberInfoPopup = Inherit(BasePanel)
|
|
local this = GuildMemberInfoPopup
|
|
local XiuXianSkillConfig = ConfigManager.GetConfig(ConfigName.XiuXianSkillConfig)
|
|
|
|
local _GuildPosBtnType = {
|
|
[GUILD_MEM_POPUP_TYPE.INFORMATION] = {
|
|
[GUILD_GRANT.MASTER] = {
|
|
[GUILD_GRANT.ADMIN] = {
|
|
{name = Language[10924], func = 1},
|
|
{name = Language[10925], func = 6},
|
|
{name = Language[10926], func = 3},
|
|
},
|
|
[GUILD_GRANT.MEMBER] = {
|
|
{name = Language[10924], func = 1},
|
|
{name = Language[10927], func = 2},
|
|
{name = Language[10926], func = 3},
|
|
},
|
|
},
|
|
[GUILD_GRANT.ADMIN] = {
|
|
[GUILD_GRANT.MEMBER] = {
|
|
{name = Language[10926], func = 3},
|
|
}
|
|
},
|
|
},
|
|
[GUILD_MEM_POPUP_TYPE.DEFEND] = {
|
|
[GUILD_GRANT.MASTER] = {
|
|
{name = Language[10928], func = 4, param = GUILD_BUILD_TYPE.HOUSE },
|
|
{name = Language[10929], func = 4, param = GUILD_BUILD_TYPE.STORE },
|
|
{name = Language[10930], func = 4, param = GUILD_BUILD_TYPE.LOGO },
|
|
},
|
|
[GUILD_GRANT.ADMIN] = {
|
|
{name = Language[10928], func = 4, param = GUILD_BUILD_TYPE.HOUSE },
|
|
{name = Language[10929], func = 4, param = GUILD_BUILD_TYPE.STORE },
|
|
{name = Language[10930], func = 4, param = GUILD_BUILD_TYPE.LOGO },
|
|
},
|
|
},
|
|
[GUILD_MEM_POPUP_TYPE.ATTACK_ENEMY_DEFEND] = {
|
|
[GUILD_GRANT.MASTER] = {
|
|
{name = Language[10724], func = 5},
|
|
},
|
|
[GUILD_GRANT.ADMIN] = {
|
|
{name = Language[10724], func = 5},
|
|
},
|
|
[GUILD_GRANT.MEMBER] = {
|
|
{name = Language[10724], func = 5},
|
|
},
|
|
}
|
|
}
|
|
-- 头像
|
|
local _PlayerHead = nil
|
|
-- 星星
|
|
local _StarList = {}
|
|
local _StarMaxNum = 10
|
|
this.Pokemons = {}
|
|
--初始化组件(用于子类重写)
|
|
function GuildMemberInfoPopup:InitComponent()
|
|
this.spLoader = SpriteLoader.New()
|
|
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")
|
|
this.titlePar = Util.GetGameObject(self.transform, "tipImage/panel/info/titlePar")
|
|
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
|
|
this.Demons[i] = {}
|
|
this.Demons[i].go = Util.GetGameObject(self.gameObject, "tipImage/panel/defendbox/Demons/heroPro (" .. i .. ")")
|
|
this.Demons[i].frame = Util.GetGameObject(this.Demons[i].go, "frame"):GetComponent("Image")
|
|
this.Demons[i].hero = Util.GetGameObject(this.Demons[i].go, "hero")
|
|
this.Demons[i].starGrid = Util.GetGameObject(this.Demons[i].hero, "starGrid")
|
|
this.Demons[i].proIcon = Util.GetGameObject(this.Demons[i].hero, "proIcon"):GetComponent("Image")
|
|
this.Demons[i].levelText = Util.GetGameObject(this.Demons[i].hero, "lvbg/levelText"):GetComponent("Text")
|
|
this.Demons[i].icon = Util.GetGameObject(this.Demons[i].hero, "icon"):GetComponent("Image")
|
|
end
|
|
this.Pokemons={}
|
|
for i = 1, 6 do
|
|
table.insert(this.Demons, Util.GetGameObject(self.gameObject, "tipImage/panel/Pokemons/Demons/heroPro (" .. i .. ")"))
|
|
end
|
|
|
|
Util.GetGameObject(self.transform, "tipImage/panel/pokemonInfo/tip"):GetComponent("Text").text=Language[11501]
|
|
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
|
|
this.boxLine = Util.GetGameObject(self.transform, "tipImage/panel/defendbox/line")
|
|
this.btnBox = Util.GetGameObject(self.transform, "tipImage/panel/box")
|
|
-- this.bgImg= Util.GetGameObject(self.transform, "tipImage/tipImage"):GetComponent("RectTransform")
|
|
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")
|
|
--神印信息
|
|
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 = {}
|
|
end
|
|
|
|
--绑定事件(用于子类重写)
|
|
function GuildMemberInfoPopup:BindEvent()
|
|
Util.AddClick(this.btnBack, function()
|
|
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
|
this:ClosePanel()
|
|
end)
|
|
Util.AddClick(this.addFriendBtn, function()
|
|
if this._ViewType ~= GUILD_MEM_POPUP_TYPE.INFORMATION then
|
|
Log("公会战阶段屏蔽添加好友功能")
|
|
return
|
|
end
|
|
if not ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.GOODFRIEND) then
|
|
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.GOODFRIEND))
|
|
return
|
|
end
|
|
if GoodFriendManager.IsInBlackList(this._MemId) then
|
|
PopupTipPanel.ShowTip(Language[10814])
|
|
return
|
|
end
|
|
if this._MemId == PlayerManager.uid then
|
|
PopupTipPanel.ShowTip(Language[10931])
|
|
return
|
|
end
|
|
if GoodFriendManager.IsMyFriend(this._MemId) then
|
|
PopupTipPanel.ShowTip(Language[10932])
|
|
return
|
|
end
|
|
if this._PlayerData.isApplyed == 1 then
|
|
PopupTipPanel.ShowTip(Language[10819])
|
|
return
|
|
end
|
|
GoodFriendManager.InviteFriendRequest(this._MemId, function()
|
|
PopupTipPanel.ShowTip(Language[10381])
|
|
this._PlayerData.isApplyed = 1
|
|
this.RefreshFunction()
|
|
end)
|
|
end)
|
|
end
|
|
|
|
--添加事件监听(用于子类重写)
|
|
function GuildMemberInfoPopup:AddListener()
|
|
Game.GlobalEvent:AddEvent(GameEvent.Guild.BeKickOut, this.CloseSelf)
|
|
end
|
|
|
|
--移除事件监听(用于子类重写)
|
|
function GuildMemberInfoPopup:RemoveListener()
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Guild.BeKickOut, this.CloseSelf)
|
|
end
|
|
|
|
-- 关闭界面
|
|
function this.CloseSelf()
|
|
this:ClosePanel()
|
|
end
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
function GuildMemberInfoPopup:OnOpen(type, memId, starNum)
|
|
this._MemId = memId
|
|
this._ViewType = type or GUILD_MEM_POPUP_TYPE.INFORMATION
|
|
this._StarNum = starNum
|
|
|
|
this.formationTip.text = type == GUILD_MEM_POPUP_TYPE.INFORMATION and Language[10933] or Language[10934]
|
|
-- 注册按钮事件
|
|
this.btnFunc = {
|
|
[1] = this.SetMaster,
|
|
[2] = this.SetAdmin,
|
|
[3] = this.KickOut,
|
|
[4] = this.ChangeMemBuildType,
|
|
[5] = this.AttackEnemy,
|
|
[6] = this.CancelAdmin,
|
|
}
|
|
end
|
|
|
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
|
function GuildMemberInfoPopup:OnShow()
|
|
if this._ViewType == GUILD_MEM_POPUP_TYPE.ATTACK_MY_DEFEND then
|
|
this._MemData = GuildFightManager.GetAttackStagePlayerDefendData(GUILD_FIGHT_GUILD_TYPE.MY, this._MemId).userInfo
|
|
elseif this._ViewType == GUILD_MEM_POPUP_TYPE.ATTACK_ENEMY_DEFEND then
|
|
this._MemData = GuildFightManager.GetAttackStagePlayerDefendData(GUILD_FIGHT_GUILD_TYPE.ENEMY, this._MemId).userInfo
|
|
else
|
|
this._MemData = MyGuildManager.GetMemInfo(this._MemId)
|
|
end
|
|
-- 刷新基础信息
|
|
this.RefreshPlayerInfo()
|
|
-- 刷新进攻次数显示
|
|
this.RefreshAttackCount()
|
|
-- 刷新功能区显示
|
|
this.RefreshFunction()
|
|
-- 刷新编队显示
|
|
this.RefreshFormationShow()
|
|
-- 刷新按钮显示
|
|
this.RefreshBtnShow()
|
|
end
|
|
|
|
-- 刷新基础信息显示
|
|
local titleLiveStr
|
|
local titleLive
|
|
function this.RefreshPlayerInfo()
|
|
this.memName.text = this._MemData.userName
|
|
this.memProfess.text = Language[10935]..GUILD_GRANT_STR[this._MemData.position]
|
|
-- 头像
|
|
if not _PlayerHead then
|
|
_PlayerHead = SubUIManager.Open(SubUIConfig.PlayerHeadView, this.memHead.transform)
|
|
end
|
|
if titleLive then
|
|
poolManager:UnLoadAsset(titleLiveStr, titleLive, PoolManager.AssetType.GameObject)
|
|
titleLive = nil
|
|
titleLiveStr = nil
|
|
end
|
|
_PlayerHead:Reset()
|
|
_PlayerHead:SetScale(Vector3.one * 0.85)
|
|
_PlayerHead:SetHead(this._MemData.head)
|
|
_PlayerHead:SetFrame(this._MemData.frame)
|
|
_PlayerHead:SetLevel(this._MemData.userLevel)
|
|
_PlayerHead:SetLayer(this.sortingOrder)
|
|
_PlayerHead:SetEffectScale(0.9)
|
|
local title=this._MemData.userTitle
|
|
if title and title>0 then
|
|
this.titlePar:SetActive(true)
|
|
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
|
|
else
|
|
this.titlePar:SetActive(false)
|
|
end
|
|
end
|
|
|
|
function this:OnSortingOrderChange()
|
|
if _PlayerHead then
|
|
_PlayerHead:SetLayer(self.sortingOrder)
|
|
end
|
|
|
|
for i, demon in ipairs(this.Demons) do
|
|
Util.SetParticleSortLayer(demon.starGrid,self.sortingOrder + 1)
|
|
end
|
|
end
|
|
-- 刷新进攻次数显示
|
|
function this.RefreshAttackCount()
|
|
this.attackCount.gameObject:SetActive(false)
|
|
if this._ViewType == GUILD_MEM_POPUP_TYPE.ATTACK_ENEMY_DEFEND then
|
|
this.attackCount.gameObject:SetActive(true)
|
|
local leftCount = GuildFightManager.GetLeftAttackCount()
|
|
this.attackCount.text = string.format(Language[10936], leftCount)
|
|
end
|
|
end
|
|
|
|
-- 刷新功能区
|
|
function this.RefreshFunction()
|
|
this.addFriendBtn:SetActive(false)
|
|
this.starBox:SetActive(false)
|
|
|
|
if this._ViewType == GUILD_MEM_POPUP_TYPE.INFORMATION then
|
|
this.addFriendBtn:SetActive(true)
|
|
if not this._PlayerData then return end
|
|
local isSelf = this._MemId == PlayerManager.uid
|
|
local isMyFriend = isSelf and true or GoodFriendManager.IsMyFriend(this._MemId)
|
|
local isApplyed = this._PlayerData.isApplyed == 1
|
|
Util.SetGray(this.addFriendBtn, isMyFriend or isApplyed)
|
|
this.addFriendBtnText.text = isApplyed and Language[10816] or Language[10937]
|
|
|
|
elseif this._ViewType == GUILD_MEM_POPUP_TYPE.DEFEND
|
|
or this._ViewType == GUILD_MEM_POPUP_TYPE.ATTACK_ENEMY_DEFEND
|
|
or this._ViewType == GUILD_MEM_POPUP_TYPE.ATTACK_MY_DEFEND then
|
|
if not this._StarNum then return end
|
|
this.starBox:SetActive(true)
|
|
local maxNum = math.max(this._StarNum, #_StarList)
|
|
for i = 1, maxNum do
|
|
if not _StarList[i] then
|
|
_StarList[i] = newObjToParent(this.star, this.starBox)
|
|
end
|
|
_StarList[i]:SetActive(i <= this._StarNum)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- 刷新编队信息
|
|
function this.RefreshFormationShow()
|
|
if this._ViewType == GUILD_MEM_POPUP_TYPE.INFORMATION then
|
|
NetManager.RequestPlayerInfo(this._MemId, FormationTypeDef.FORMATION_NORMAL, nil,0,function(msg)
|
|
-- 重置战斗力
|
|
local teamInfo = msg.teamInfo.team
|
|
local force = teamInfo.totalForce
|
|
MyGuildManager.ResetMemForce(this._MemId, force)
|
|
this.FormationAdapter(teamInfo)
|
|
-- 刷新功能显示
|
|
this._PlayerData = msg.teamInfo
|
|
this.RefreshFunction()
|
|
end)
|
|
elseif this._ViewType == GUILD_MEM_POPUP_TYPE.DEFEND then
|
|
NetManager.RequestGuildFightDefendFormation(PlayerManager.familyId, this._MemId,function(msg)
|
|
-- 重置战斗力
|
|
GuildFightManager.ResetDefendStageDataForce(this._MemId, msg.teamInfo.totalForce)
|
|
--
|
|
this.FormationAdapter(msg.teamInfo)
|
|
end)
|
|
elseif this._ViewType == GUILD_MEM_POPUP_TYPE.ATTACK_MY_DEFEND then
|
|
NetManager.RequestGuildFightDefendFormation(PlayerManager.familyId, this._MemId, function(msg)
|
|
this.FormationAdapter(msg.teamInfo)
|
|
end)
|
|
elseif this._ViewType == GUILD_MEM_POPUP_TYPE.ATTACK_ENEMY_DEFEND then
|
|
local enemyGuild = GuildFightManager.GetEnemyBaseData()
|
|
if not enemyGuild then return end
|
|
NetManager.RequestGuildFightDefendFormation(enemyGuild.id, this._MemId, function(msg)
|
|
this.FormationAdapter(msg.teamInfo)
|
|
end)
|
|
end
|
|
end
|
|
|
|
-- 编队数据匹配
|
|
function this.FormationAdapter(teamInfo)
|
|
-- 战斗力
|
|
this.memPower.text = teamInfo.totalForce
|
|
|
|
for i, demon in ipairs(this.Demons) do
|
|
demon.frame.sprite = this.spLoader:LoadSprite(GetQuantityImageByquality(1))
|
|
demon.hero:SetActive(false)
|
|
end
|
|
--队伍阵容
|
|
for i, hero in ipairs(teamInfo.team) do
|
|
local demonId = teamInfo.team[i].heroTid
|
|
if demonId then
|
|
this.Demons[hero.position].hero:SetActive(true)
|
|
local star,starType = GetStarOrGodSoulLv(1,hero)
|
|
SetHeroStars(this.spLoader, this.Demons[hero.position].starGrid, star,starType)
|
|
SetHeroFlyEffect(this.Demons[hero.position].hero,this.spLoader,hero.star,this.sortingOrder+1,1,2)
|
|
Util.SetParticleSortLayer(this.Demons[hero.position].starGrid,this.sortingOrder + 1)
|
|
local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, demonId)
|
|
this.Demons[hero.position].proIcon.sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
|
|
this.Demons[hero.position].levelText.text = hero.level
|
|
this.Demons[hero.position].frame.sprite = this.spLoader:LoadSprite(GetQuantityImageByquality(heroConfig.Quality, hero.star))
|
|
-- if hero.skinId == 0 then
|
|
-- this.Demons[hero.position].heroicon:GetComponent("Image.sprite = this.spLoader:LoadSprite(GetResourcePath(heroConfig.Icon))
|
|
-- else
|
|
-- local config = ConfigManager.GetConfigDataByKey(ConfigName.HeroSkin,"Type",hero.skinId)
|
|
-- this.Demons[hero.position].heroicon:GetComponent("Image.sprite = this.spLoader:LoadSprite(GetResourcePath(config.Icon))
|
|
-- end
|
|
SetHeroIcon(this.spLoader, hero,this.Demons[hero.position].icon,heroConfig)
|
|
local heroData = {}
|
|
Util.AddOnceClick( this.Demons[hero.position].frame.gameObject, function()
|
|
NetManager.ViewHeroInfoRequest(this._MemId,hero.heroid,nil,FormationTypeDef.FORMATION_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)--HeroManager.GetSingleHeroData(heroData.dynamicId)
|
|
UIManager.OpenPanel(UIName.RoleInfoPopup, heroData,true)
|
|
end)
|
|
end)
|
|
end
|
|
end
|
|
|
|
local len=#teamInfo.PokemonInfos
|
|
LogError("长度:"..len)
|
|
if len>0 then
|
|
-- this.bgImg.sizeDelta=Vector2.New(900,1024)
|
|
this.pokemonObj:SetActive(true)
|
|
for i, demon in ipairs(this.Pokemons) do
|
|
demon.gameObject:SetActive(false)
|
|
Util.GetGameObject(demon, "frame"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetQuantityImageByquality(1))
|
|
Util.GetGameObject(demon, "hero"):SetActive(false)
|
|
end
|
|
else
|
|
-- this.bgImg.sizeDelta=Vector2.New(900,850)
|
|
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)
|
|
SetHeroStars(this.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(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))
|
|
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
|
|
|
|
--神印信息
|
|
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")
|
|
-- local hero = Util.GetGameObject(item,"hero"):GetComponent("Image")
|
|
icon.sprite = this.spLoader:LoadSprite(GetResourcePath(XiuXianSkillConfig[value.id].Icon))
|
|
-- if value.type == 1 then
|
|
-- hero.gameObject:SetActive(true)
|
|
-- hero.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(value.heroTId))
|
|
-- else
|
|
-- hero.gameObject:SetActive(false)
|
|
-- end
|
|
Util.AddOnceClick(item.gameObject,function ()
|
|
UIManager.OpenPanel(UIName.GeneralInfoPopup,GENERALINFO_TYPE.Imprint,value.id,value.heroTId)
|
|
end)
|
|
end
|
|
else
|
|
this.imprintObj:SetActive(false)
|
|
end
|
|
|
|
end
|
|
|
|
-- 刷新按钮显示
|
|
function this.RefreshBtnShow()
|
|
-- 判断该界面类型是否有按钮显示
|
|
local posToType = _GuildPosBtnType[this._ViewType]
|
|
if not posToType then
|
|
this.boxLine:SetActive(false)
|
|
this.btnBox:SetActive(false)
|
|
return
|
|
end
|
|
-- 判断我的职位是否有按钮显示
|
|
local pos = MyGuildManager.GetMyPositionInGuild()
|
|
local btnType = posToType[pos]
|
|
if btnType and (not btnType[1] or not btnType[1].name) then -- 判断类型
|
|
btnType = btnType[this._MemData.position]
|
|
end
|
|
if not btnType then
|
|
this.boxLine:SetActive(false)
|
|
this.btnBox:SetActive(false)
|
|
return
|
|
end
|
|
-- 有按钮显示
|
|
this.boxLine:SetActive(true)
|
|
this.btnBox:SetActive(true)
|
|
for index, btn in ipairs(this.btnList) do
|
|
btn:SetActive(btnType[index] ~= nil)
|
|
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
|
|
Log("方法不存在")
|
|
return
|
|
end
|
|
this.btnFunc[funcType](btnType[index].param)
|
|
end)
|
|
end
|
|
end
|
|
end
|
|
|
|
----=============================== 按钮事件==================================
|
|
-- 转让会长
|
|
function this.SetMaster()
|
|
-- 公会战期间无法执行此操作
|
|
if GuildFightManager.IsInGuildFight() then
|
|
PopupTipPanel.ShowTip(Language[10893])
|
|
return
|
|
end
|
|
-- 判断是否有权限
|
|
local pos = MyGuildManager.GetMyPositionInGuild()
|
|
if pos ~= GUILD_GRANT.MASTER then
|
|
PopupTipPanel.ShowTip(Language[10938])
|
|
return
|
|
end
|
|
if this._MemId == PlayerManager.uid then
|
|
PopupTipPanel.ShowTip(Language[10939])
|
|
return
|
|
end
|
|
if this._MemData.position == GUILD_GRANT.MASTER then
|
|
PopupTipPanel.ShowTip(Language[10940])
|
|
return
|
|
end
|
|
|
|
MsgPanel.ShowTwo(Language[10941], nil, function()
|
|
-- 转让会长
|
|
MyGuildManager.AppointmentPos(this._MemId, GUILD_GRANT.MASTER, function ()
|
|
this:ClosePanel()
|
|
PopupTipPanel.ShowTip(Language[10942])
|
|
end)
|
|
end)
|
|
end
|
|
-- 委任管理员
|
|
function this.SetAdmin()
|
|
-- 公会战期间无法执行此操作
|
|
if GuildFightManager.IsInGuildFight() then
|
|
PopupTipPanel.ShowTip(Language[10893])
|
|
return
|
|
end
|
|
-- 判断是否有权限
|
|
local pos = MyGuildManager.GetMyPositionInGuild()
|
|
if pos ~= GUILD_GRANT.MASTER then
|
|
PopupTipPanel.ShowTip(Language[10943])
|
|
return
|
|
end
|
|
if this._MemId == PlayerManager.uid then
|
|
PopupTipPanel.ShowTip(Language[10939])
|
|
return
|
|
end
|
|
if this._MemData.position == GUILD_GRANT.MASTER then
|
|
PopupTipPanel.ShowTip(Language[10944])
|
|
return
|
|
end
|
|
if this._MemData.position == GUILD_GRANT.ADMIN then
|
|
PopupTipPanel.ShowTip(Language[10945])
|
|
return
|
|
end
|
|
|
|
local adminNum = MyGuildManager.GetAdminMemNum()
|
|
local guildData = MyGuildManager.GetMyGuildInfo()
|
|
local maxNum = ConfigManager.GetConfigData(ConfigName.GuildLevelConfig, guildData.levle).OfficalNum
|
|
if adminNum >= maxNum then
|
|
PopupTipPanel.ShowTip(Language[10946])
|
|
return
|
|
end
|
|
|
|
MsgPanel.ShowTwo(Language[10947], nil, function()
|
|
-- 委任管理员
|
|
MyGuildManager.AppointmentPos(this._MemId, GUILD_GRANT.ADMIN, function ()
|
|
this:ClosePanel()
|
|
PopupTipPanel.ShowTip(Language[10948])
|
|
end)
|
|
end)
|
|
end
|
|
-- 取消管理员
|
|
function this.CancelAdmin()
|
|
-- 公会战期间无法执行此操作
|
|
if GuildFightManager.IsInGuildFight() then
|
|
PopupTipPanel.ShowTip(Language[10893])
|
|
return
|
|
end
|
|
-- 判断是否有权限
|
|
local pos = MyGuildManager.GetMyPositionInGuild()
|
|
if pos ~= GUILD_GRANT.MASTER then
|
|
PopupTipPanel.ShowTip(Language[10949])
|
|
return
|
|
end
|
|
if this._MemId == PlayerManager.uid then
|
|
PopupTipPanel.ShowTip(Language[10939])
|
|
return
|
|
end
|
|
if this._MemData.position == GUILD_GRANT.MASTER then
|
|
PopupTipPanel.ShowTip(Language[10950])
|
|
return
|
|
end
|
|
if this._MemData.position ~= GUILD_GRANT.ADMIN then
|
|
PopupTipPanel.ShowTip(Language[10951])
|
|
return
|
|
end
|
|
|
|
MsgPanel.ShowTwo(Language[10952], nil, function()
|
|
-- 委任管理员
|
|
MyGuildManager.AppointmentPos(this._MemId, GUILD_GRANT.MEMBER, function ()
|
|
this:ClosePanel()
|
|
PopupTipPanel.ShowTip(Language[10953])
|
|
end)
|
|
end)
|
|
end
|
|
|
|
-- 驱逐公会
|
|
function this.KickOut()
|
|
-- 公会战期间无法执行此操作
|
|
if GuildFightManager.IsInGuildFight() then
|
|
PopupTipPanel.ShowTip(Language[10893])
|
|
return
|
|
end
|
|
-- 判断是否有权限
|
|
local pos = MyGuildManager.GetMyPositionInGuild()
|
|
if pos ~= GUILD_GRANT.MASTER and pos ~= GUILD_GRANT.ADMIN then
|
|
PopupTipPanel.ShowTip(Language[10954])
|
|
return
|
|
end
|
|
if this._MemId == PlayerManager.uid then
|
|
PopupTipPanel.ShowTip(Language[10939])
|
|
return
|
|
end
|
|
if this._MemData.position == GUILD_GRANT.MASTER then
|
|
PopupTipPanel.ShowTip(Language[10955])
|
|
return
|
|
end
|
|
if pos == GUILD_GRANT.ADMIN and this._MemData.position == GUILD_GRANT.ADMIN then
|
|
PopupTipPanel.ShowTip(Language[10956])
|
|
return
|
|
end
|
|
|
|
|
|
MsgPanel.ShowTwo(Language[10957], nil, function()
|
|
MyGuildManager.RequestKickOut(this._MemId, function()
|
|
this:ClosePanel()
|
|
PopupTipPanel.ShowTip(Language[10958])
|
|
end)
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
-- 改变成员防守建筑
|
|
function this.ChangeMemBuildType(buildType)
|
|
-- 判断是否有权限
|
|
local pos = MyGuildManager.GetMyPositionInGuild()
|
|
if pos ~= GUILD_GRANT.MASTER and pos ~= GUILD_GRANT.ADMIN then
|
|
PopupTipPanel.ShowTip(Language[10902])
|
|
return
|
|
end
|
|
GuildFightManager.RequestChangeMemDefend(this._MemId, buildType, function ()
|
|
this:ClosePanel()
|
|
end)
|
|
end
|
|
|
|
|
|
-- 改变成员防守建筑
|
|
function this.AttackEnemy()
|
|
|
|
local leftCount = GuildFightManager.GetLeftAttackCount()
|
|
if not leftCount or leftCount <= 0 then
|
|
PopupTipPanel.ShowTip(Language[10723])
|
|
return
|
|
end
|
|
|
|
-- 获取我的英雄的数据
|
|
GuildFightManager.RequestMyHeroBloodData(function()
|
|
this:ClosePanel()
|
|
FormationManager.CheckFormationHp(FormationTypeDef.FORMATION_GUILD_FIGHT_ATTACK)
|
|
UIManager.OpenPanel(UIName.FormationPanel, FORMATION_TYPE.GUILD_ATTACK, this._MemId)
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
function GuildMemberInfoPopup:OnClose()
|
|
end
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
function GuildMemberInfoPopup:OnDestroy()
|
|
this.spLoader:Destroy()
|
|
-- 头像
|
|
if _PlayerHead then
|
|
_PlayerHead:Recycle()
|
|
_PlayerHead = nil
|
|
end
|
|
-- 星星
|
|
_StarList = {}
|
|
titleLive = nil
|
|
titleLiveStr = nil
|
|
this.imprintItemList = {}
|
|
|
|
end
|
|
|
|
return GuildMemberInfoPopup
|
|
|