614 lines
24 KiB
Lua
614 lines
24 KiB
Lua
require("Base/BasePanel")
|
||
local GuildInfoPopup = Inherit(BasePanel)
|
||
local this = GuildInfoPopup
|
||
-- Tab管理器
|
||
local TabBox = require("Modules/Common/TabBox")
|
||
local _TabFontColor = { default = Color.New(255 / 255, 255 / 255, 255 / 255, 1),
|
||
select = Color.New(255 / 255, 255 / 255, 255 / 255, 1) }
|
||
local _TabData = {
|
||
[GUILD_GRANT.MASTER] = {
|
||
[1] = { default = "UI_hz_gonghui_19", select = "UI_hz_gonghui_18", name = Language[10888] },
|
||
[2] = { default = "UI_hz_gonghui_19", select = "UI_hz_gonghui_18", name = Language[10889] },
|
||
[3] = { default = "UI_hz_gonghui_19", select = "UI_hz_gonghui_18", name = Language[10890] },
|
||
},
|
||
[GUILD_GRANT.ADMIN] = {
|
||
[1] = { default = "UI_hz_gonghui_19", select = "UI_hz_gonghui_18", name = Language[10888] },
|
||
[2] = { default = "UI_hz_gonghui_19", select = "UI_hz_gonghui_18", name = Language[10889] },
|
||
[3] = { default = "UI_hz_gonghui_19", select = "UI_hz_gonghui_18", name = Language[10890]},
|
||
},
|
||
[GUILD_GRANT.MEMBER] = {
|
||
[1] = { default = "UI_hz_gonghui_19", select = "UI_hz_gonghui_18", name = Language[10888] },
|
||
[2] = { default = "UI_hz_gonghui_19", select = "UI_hz_gonghui_18", name = Language[10889] },
|
||
},
|
||
}
|
||
|
||
-- 头像管理
|
||
local _PlayerHeadList = {}
|
||
|
||
--初始化组件(用于子类重写)
|
||
function GuildInfoPopup:InitComponent()
|
||
this.spLoader = SpriteLoader.New()
|
||
this.m_go = Util.GetGameObject(self.transform, "Panel")
|
||
this.btnBack = Util.GetGameObject(this.m_go, "btnBack")
|
||
this.tabbox = Util.GetGameObject(this.m_go, "top")
|
||
this.title = Util.GetGameObject(this.m_go, "Title"):GetComponent("Text")
|
||
|
||
this.contentList = {}
|
||
this.contentList[1] = Util.GetGameObject(this.m_go, "content/info")
|
||
this.contentList[2] = Util.GetGameObject(this.m_go, "content/members")
|
||
this.contentList[3] = Util.GetGameObject(this.m_go, "content/verify")
|
||
|
||
-- 基础信息展示
|
||
this.guildName = Util.GetGameObject(this.contentList[1], "name/bg/Text"):GetComponent("Text")
|
||
this.guildLevel = Util.GetGameObject(this.contentList[1], "level/Text"):GetComponent("Text")
|
||
this.guildMaster = Util.GetGameObject(this.contentList[1], "master/Text"):GetComponent("Text")
|
||
this.expSlider = Util.GetGameObject(this.contentList[1], "level/Slider"):GetComponent("Slider")
|
||
this.expText = Util.GetGameObject(this.contentList[1], "level/Slider/Text"):GetComponent("Text")
|
||
this.guildMember = Util.GetGameObject(this.contentList[1], "member/Text"):GetComponent("Text")
|
||
this.guildAnnounce = Util.GetGameObject(this.contentList[1], "declarationBg/Text"):GetComponent("Text")
|
||
this.btnLog = Util.GetGameObject(this.contentList[1], "function/log")
|
||
this.btnStore = Util.GetGameObject(this.contentList[1], "function/store")
|
||
this.btnLogo = Util.GetGameObject(this.contentList[1], "function/logo")
|
||
|
||
this.btnEditName = Util.GetGameObject(this.contentList[1], "name/bg")
|
||
this.btnEditAnnounce = Util.GetGameObject(this.contentList[1], "declarationBg")
|
||
|
||
this.guildCharge = Util.GetGameObject(this.contentList[1], "option")
|
||
this.btnDismiss = Util.GetGameObject(this.contentList[1], "option/box/dimiss")
|
||
this.dismissStr = Util.GetGameObject(this.btnDismiss, "Text"):GetComponent("Text")
|
||
this.dismissTime = Util.GetGameObject(this.btnDismiss, "time"):GetComponent("Text")
|
||
this.btnSetting = Util.GetGameObject(this.contentList[1], "option/box/setting")
|
||
this.btnInvite = Util.GetGameObject(this.contentList[1], "option/box/invite")
|
||
|
||
this.helpBtn = Util.GetGameObject(this.contentList[1], "help")
|
||
this.helpPos = Util.GetGameObject(this.m_go, "helppos"):GetComponent("RectTransform").localPosition
|
||
-- 成员
|
||
this.memScrollRoot = Util.GetGameObject(this.contentList[2], "scrollpos")
|
||
this.memItem = Util.GetGameObject(this.contentList[2], "scrollpos/mem")
|
||
this.onlineNumText = Util.GetGameObject(this.contentList[2], "title/status/num"):GetComponent("Text")
|
||
this.btnQuit = Util.GetGameObject(this.contentList[2], "quit")
|
||
|
||
-- 审核信息
|
||
this.btnBg = Util.GetGameObject(this.contentList[3], "btnbg")
|
||
this.verifyClearBtn = Util.GetGameObject(this.contentList[3], "btnbg/clear")
|
||
this.verifyAgreeBtn = Util.GetGameObject(this.contentList[3], "btnbg/agree")
|
||
this.verifyScrollRoot = Util.GetGameObject(this.contentList[3], "scrollpos")
|
||
this.verifyItem = Util.GetGameObject(this.contentList[3], "scrollpos/verify")
|
||
this.empty = Util.GetGameObject(this.contentList[3], "empty")
|
||
this.agreeRedpot = Util.GetGameObject(this.contentList[3], "btnbg/agree/redpot")
|
||
-- 公会日志
|
||
this.logPanel = Util.GetGameObject(this.m_go, "log")
|
||
this.logScrollRoot = Util.GetGameObject(this.logPanel, "bg/scrollpos")
|
||
this.logItem = Util.GetGameObject(this.logPanel, "bg/scrollpos/log")
|
||
|
||
this.layoutName = Util.GetGameObject(this.contentList[1], "name")
|
||
this.layoutLevel = Util.GetGameObject(this.contentList[1], "level")
|
||
this.layoutMaster = Util.GetGameObject(this.contentList[1], "master")
|
||
this.layoutMember = Util.GetGameObject(this.contentList[1], "member")
|
||
this.layoutDeclaration = Util.GetGameObject(this.contentList[1], "declaration")
|
||
end
|
||
|
||
--绑定事件(用于子类重写)
|
||
function GuildInfoPopup:BindEvent()
|
||
Util.AddClick(this.helpBtn, function()
|
||
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.GuildInFo,this.helpPos.x,this.helpPos.y)
|
||
end)
|
||
|
||
Util.AddClick(this.btnBack, function()
|
||
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
||
this:ClosePanel()
|
||
end)
|
||
|
||
-- 公会日志
|
||
Util.AddClick(this.btnLog, function()
|
||
this.logPanel:SetActive(true)
|
||
this.RefreshLogShow()
|
||
end)
|
||
Util.AddClick(this.logPanel, function()
|
||
this.logPanel:SetActive(false)
|
||
end)
|
||
-- 跳转公会商店
|
||
Util.AddClick(this.btnStore, function()
|
||
UIManager.OpenPanel(UIName.MainShopPanel, SHOP_TYPE.GUILD_SHOP)
|
||
end)
|
||
-- 公会图腾
|
||
Util.AddClick(this.btnLogo, function()
|
||
--UIManager.OpenPanel(UIName.GuildLogoPopup)
|
||
local pos = MyGuildManager.GetMyPositionInGuild()
|
||
if pos ~= GUILD_GRANT.MASTER and pos ~= GUILD_GRANT.ADMIN then
|
||
PopupTipPanel.ShowTip(Language[10907])
|
||
return
|
||
end
|
||
UIManager.OpenPanel(UIName.GuildChangePopup, GUILD_CHANGE_TYPE.LOGO)
|
||
end)
|
||
|
||
-- 基础操作
|
||
Util.AddClick(this.btnDismiss, function()
|
||
local guildData = MyGuildManager.GetMyGuildInfo()
|
||
if guildData.levelTime ~= 0 then
|
||
MsgPanel.ShowTwo(Language[10891],nil, function()
|
||
local pos = MyGuildManager.GetMyPositionInGuild()
|
||
if pos ~= GUILD_GRANT.MASTER then
|
||
PopupTipPanel.ShowTip(Language[10892])
|
||
return
|
||
end
|
||
MyGuildManager.RequestDismissGuild(2)
|
||
end)
|
||
else
|
||
-- 公会战期间无法执行此操作
|
||
if GuildFightManager.IsInGuildFight() then
|
||
PopupTipPanel.ShowTip(Language[10893])
|
||
return
|
||
end
|
||
MsgPanel.ShowTwo(Language[10894],nil, function()
|
||
local pos = MyGuildManager.GetMyPositionInGuild()
|
||
if pos ~= GUILD_GRANT.MASTER then
|
||
PopupTipPanel.ShowTip(Language[10895])
|
||
return
|
||
end
|
||
MyGuildManager.RequestDismissGuild(1)
|
||
end)
|
||
end
|
||
end)
|
||
Util.AddClick(this.btnSetting, function()
|
||
local pos = MyGuildManager.GetMyPositionInGuild()
|
||
if pos ~= GUILD_GRANT.MASTER and pos ~= GUILD_GRANT.ADMIN then
|
||
PopupTipPanel.ShowTip(Language[10896])
|
||
return
|
||
end
|
||
UIManager.OpenPanel(UIName.GuildChangePopup, GUILD_CHANGE_TYPE.SETTING)
|
||
end)
|
||
Util.AddClick(this.btnEditName, function()
|
||
local pos = MyGuildManager.GetMyPositionInGuild()
|
||
if pos ~= GUILD_GRANT.MASTER and pos ~= GUILD_GRANT.ADMIN then
|
||
PopupTipPanel.ShowTip(Language[10897])
|
||
return
|
||
end
|
||
UIManager.OpenPanel(UIName.GuildChangePopup, GUILD_CHANGE_TYPE.NAME)
|
||
end)
|
||
Util.AddClick(this.btnEditAnnounce, function()
|
||
-- local pos = MyGuildManager.GetMyPositionInGuild()
|
||
-- if pos ~= GUILD_GRANT.MASTER and pos ~= GUILD_GRANT.ADMIN then
|
||
-- PopupTipPanel.ShowTip(Language[10898])
|
||
-- return
|
||
-- end
|
||
-- UIManager.OpenPanel(UIName.GuildChangePopup, GUILD_CHANGE_TYPE.ANNOUNCE)
|
||
end)
|
||
Util.AddClick(this.btnInvite, function()
|
||
local pos = MyGuildManager.GetMyPositionInGuild()
|
||
if pos ~= GUILD_GRANT.MASTER and pos ~= GUILD_GRANT.ADMIN then
|
||
PopupTipPanel.ShowTip(Language[10899])
|
||
return
|
||
end
|
||
-- 请求发送给公会邀请
|
||
ChatManager.RequestSendGuildInvite(function()
|
||
PopupTipPanel.ShowTip(Language[10900])
|
||
end)
|
||
end)
|
||
Util.AddClick(this.btnQuit, function()
|
||
-- 公会战期间无法执行此操作
|
||
if GuildFightManager.IsInGuildFight() then
|
||
PopupTipPanel.ShowTip(Language[10893])
|
||
return
|
||
end
|
||
local str = ""
|
||
if MyGuildManager.IsHasRedPacket() then
|
||
str = "退出公会后未发放的福利红包将会消失,确认退出公会?"
|
||
else
|
||
str = Language[10901]
|
||
end
|
||
MsgPanel.ShowTwo(str,nil, function()
|
||
MyGuildManager.RequestQuitGuild(function()
|
||
this:ClosePanel()
|
||
GuildManager.RefreshGuildAllRedState()
|
||
MyGuildManager.PackageNum=0
|
||
UIManager.OpenPanel(UIName.MainPanel)
|
||
end)
|
||
end)
|
||
end)
|
||
|
||
-- 申请操作
|
||
Util.AddClick(this.verifyClearBtn, function()
|
||
-- 判断是否有权限
|
||
local pos = MyGuildManager.GetMyPositionInGuild()
|
||
if pos ~= GUILD_GRANT.MASTER and pos ~= GUILD_GRANT.ADMIN then
|
||
PopupTipPanel.ShowTip(Language[10902])
|
||
return
|
||
end
|
||
MyGuildManager.OperateApply(GUILD_APPLY_OPTYPE.ALL_REFUSE)
|
||
|
||
end)
|
||
Util.AddClick(this.verifyAgreeBtn, function()
|
||
-- 判断是否有权限
|
||
local pos = MyGuildManager.GetMyPositionInGuild()
|
||
if pos ~= GUILD_GRANT.MASTER and pos ~= GUILD_GRANT.ADMIN then
|
||
PopupTipPanel.ShowTip(Language[10902])
|
||
return
|
||
end
|
||
Timer.New(function ()
|
||
-- this.RefreshShow()
|
||
this.OnTabChange(3)
|
||
this.agreeRedpot:SetActive(false)
|
||
end,0.3):Start()
|
||
MyGuildManager.OperateApply(GUILD_APPLY_OPTYPE.ALL_AGREE)
|
||
end)
|
||
|
||
|
||
-- 初始化Tab管理器
|
||
this.TabCtrl = TabBox.New()
|
||
this.TabCtrl:SetTabAdapter(this.TabAdapter)
|
||
this.TabCtrl:SetChangeTabCallBack(this.OnTabChange)
|
||
end
|
||
|
||
--添加事件监听(用于子类重写)
|
||
function GuildInfoPopup:AddListener()
|
||
Game.GlobalEvent:AddEvent(GameEvent.Guild.DataUpdate, this.RefreshBaseInfoShow)
|
||
Game.GlobalEvent:AddEvent(GameEvent.Guild.DataUpdate, this.RefreshMembersShow)
|
||
Game.GlobalEvent:AddEvent(GameEvent.Guild.ApplyDataUpdate, this.RefreshVerifyShow)
|
||
Game.GlobalEvent:AddEvent(GameEvent.Guild.MemberDataUpdate, this.RefreshMembersShow)
|
||
Game.GlobalEvent:AddEvent(GameEvent.Guild.BeKickOut, this.CloseSelf)
|
||
Game.GlobalEvent:AddEvent(GameEvent.Guild.PositionUpdate, this.RefreshShow)
|
||
|
||
end
|
||
|
||
--移除事件监听(用于子类重写)
|
||
function GuildInfoPopup:RemoveListener()
|
||
Game.GlobalEvent:RemoveEvent(GameEvent.Guild.DataUpdate, this.RefreshBaseInfoShow)
|
||
Game.GlobalEvent:RemoveEvent(GameEvent.Guild.DataUpdate, this.RefreshMembersShow)
|
||
Game.GlobalEvent:RemoveEvent(GameEvent.Guild.ApplyDataUpdate, this.RefreshVerifyShow)
|
||
Game.GlobalEvent:RemoveEvent(GameEvent.Guild.MemberDataUpdate, this.RefreshMembersShow)
|
||
Game.GlobalEvent:RemoveEvent(GameEvent.Guild.BeKickOut, this.CloseSelf)
|
||
Game.GlobalEvent:RemoveEvent(GameEvent.Guild.PositionUpdate, this.RefreshShow)
|
||
|
||
end
|
||
|
||
--界面打开时调用(用于子类重写)
|
||
function GuildInfoPopup:OnOpen(...)
|
||
this.RefreshShow()
|
||
ForceRebuildLayout(this.layoutName.transform)
|
||
ForceRebuildLayout(this.layoutLevel.transform)
|
||
ForceRebuildLayout(this.layoutMaster.transform)
|
||
ForceRebuildLayout(this.layoutMember.transform)
|
||
ForceRebuildLayout(this.layoutDeclaration.transform)
|
||
end
|
||
|
||
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
||
function GuildInfoPopup:OnShow()
|
||
|
||
end
|
||
|
||
-- 我的职位变更回调
|
||
function this.RefreshShow()
|
||
this.ClearRedpot()
|
||
local pos = MyGuildManager.GetMyPositionInGuild()
|
||
this.TabCtrl:Init(this.tabbox, _TabData[pos])
|
||
end
|
||
|
||
-- 关闭界面
|
||
function this.CloseSelf()
|
||
this:ClosePanel()
|
||
end
|
||
|
||
-- tab节点显示自定义
|
||
function this.TabAdapter(tab, index, status)
|
||
local pos = MyGuildManager.GetMyPositionInGuild()
|
||
local tabLab = Util.GetGameObject(tab, "Text")
|
||
local redpot = Util.GetGameObject(tab, "redpot")
|
||
Util.GetGameObject(tab,"Image"):GetComponent("Image").sprite = this.spLoader:LoadSprite(_TabData[pos][index][status])
|
||
Util.GetGameObject(tab,"Image"):GetComponent("Image"):SetNativeSize()
|
||
tabLab:GetComponent("Text").text = _TabData[pos][index].name
|
||
tabLab:GetComponent("Text").color = _TabFontColor[status]
|
||
|
||
-- 判断是否需要检测红点
|
||
redpot:SetActive(false)
|
||
if status ~= "lock" then
|
||
this.ClearRedpot(index)
|
||
this.BindRedpot(index, redpot)
|
||
end
|
||
end
|
||
-- tab改变回调事件
|
||
function this.OnTabChange(index, lastIndex)
|
||
-- 设置显示
|
||
for i = 1, 3 do
|
||
this.contentList[i]:SetActive(i == index)
|
||
end
|
||
|
||
this._CurIndex = index
|
||
if index == 1 then
|
||
this.RefreshBaseInfoShow()
|
||
NetManager.RequestMyGuildInfo()
|
||
elseif index == 2 then
|
||
this.RefreshMembersShow(true,true)
|
||
MyGuildManager.RequestMyGuildMembers()
|
||
elseif index == 3 then
|
||
this.RefreshVerifyShow()
|
||
MyGuildManager.RequestMyGuildApplyList()
|
||
end
|
||
|
||
local pos = MyGuildManager.GetMyPositionInGuild()
|
||
this.title.text = _TabData[pos][this._CurIndex].name
|
||
end
|
||
|
||
-- 绑定数据
|
||
local _RedBindData = {}
|
||
function this.BindRedpot(index, redpot)
|
||
local pos = MyGuildManager.GetMyPositionInGuild()
|
||
local rpType = _TabData[pos][index].rpType
|
||
if not rpType then return end
|
||
BindRedPointObject(rpType, redpot)
|
||
_RedBindData[rpType] = redpot
|
||
this.agreeRedpot:SetActive(redpot.activeSelf)
|
||
end
|
||
function this.ClearRedpot(index)
|
||
-- 清除红点绑定
|
||
if index then -- 清除某个
|
||
local pos = MyGuildManager.GetMyPositionInGuild()
|
||
local rpType = _TabData[pos][index].rpType
|
||
if not rpType then return end
|
||
ClearRedPointObject(rpType, _RedBindData[rpType])
|
||
_RedBindData[rpType] = nil
|
||
else -- 全部清除
|
||
for rpt, redpot in pairs(_RedBindData) do
|
||
ClearRedPointObject(rpt, redpot)
|
||
end
|
||
_RedBindData = {}
|
||
end
|
||
end
|
||
|
||
|
||
|
||
-- 刷新公会基础信息显示
|
||
function this.RefreshBaseInfoShow()
|
||
if this._CurIndex ~= 1 then return end
|
||
local guildData = MyGuildManager.GetMyGuildInfo()
|
||
local curGuildlv = guildData.levle
|
||
local curGuildLevelInfo = ConfigManager.GetConfigData(ConfigName.GuildLevelConfig, curGuildlv)
|
||
local masterInfo = MyGuildManager.GetMyGuildMasterInfo()
|
||
-- 判断是否满级
|
||
local expTxt = "已满级"
|
||
local expVal = 1
|
||
if ConfigManager.TryGetConfigData(ConfigName.GuildLevelConfig, curGuildlv+1) then
|
||
expTxt = string.format("%s/%s", guildData.exp, curGuildLevelInfo.Exp)
|
||
expVal = guildData.exp/curGuildLevelInfo.Exp
|
||
end
|
||
this.guildName.text = guildData.name
|
||
this.guildAnnounce.text = GetLanguageStrById(guildData.annouce)
|
||
this.guildLevel.text = curGuildlv..Language[10065]
|
||
this.guildMaster.text = masterInfo.userName
|
||
this.guildMember.text = string.format("(%s/%s)", guildData.totalNum, curGuildLevelInfo.Num)
|
||
this.expText.text = expTxt
|
||
this.expSlider.value = expVal
|
||
|
||
local pos = MyGuildManager.GetMyPositionInGuild()
|
||
this.guildCharge:SetActive(pos ~= GUILD_GRANT.MEMBER)
|
||
this.btnDismiss:SetActive(pos == GUILD_GRANT.MASTER)
|
||
this.btnLogo:SetActive(pos == GUILD_GRANT.MASTER)
|
||
this.dismissStr.text = Language[10903]
|
||
this.dismissTime.gameObject:SetActive(false)
|
||
if pos == GUILD_GRANT.MASTER then
|
||
if guildData.levelTime == 0 then
|
||
if this._TimeCounter then
|
||
this._TimeCounter:Stop()
|
||
this._TimeCounter = nil
|
||
end
|
||
else
|
||
this.dismissStr.text = Language[10904]
|
||
this.dismissTime.gameObject:SetActive(true)
|
||
this.RefreshDismissTime()
|
||
-- 开始吧
|
||
if not this._TimeCounter then
|
||
this._TimeCounter = Timer.New(this.RefreshDismissTime, 1, -1, true)
|
||
this._TimeCounter:Start()
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
-- 刷新公会解散时间显示
|
||
function this.RefreshDismissTime()
|
||
local guildData = MyGuildManager.GetMyGuildInfo()
|
||
if not guildData then return end
|
||
local destroyTime = ConfigManager.GetConfigData(ConfigName.GuildSetting, 1).DestroyTime
|
||
local leftTime = (guildData.levelTime + destroyTime) - GetTimeStamp()
|
||
this.dismissTime.text = string.format(Language[10905], TimeToHMS(leftTime))
|
||
end
|
||
|
||
-- 刷新公会成员显示
|
||
function this.RefreshMembersShow(isTop,isAni)
|
||
if this._CurIndex ~= 2 then return end
|
||
-- 创建滚动
|
||
if not this.memScrollView then
|
||
local height = this.memScrollRoot.transform.rect.height
|
||
local width = this.memScrollRoot.transform.rect.width
|
||
this.memScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.memScrollRoot.transform,
|
||
this.memItem, nil, Vector2.New(width, height), 1, 1, Vector2.New(0,0))
|
||
this.memScrollView.moveTween.Strength = 2
|
||
end
|
||
-- 设置数据
|
||
local members = MyGuildManager.GetMyGuildMemList()
|
||
this.memScrollView:SetData(members, function(index, go)
|
||
this.MemItemAdapter(go, members[index])
|
||
end, not isTop)--,not isAni)
|
||
-- 在线人数计算
|
||
local onlineNum = 0
|
||
for _, v in ipairs(members) do
|
||
if v.seconds == 0 then
|
||
onlineNum = onlineNum + 1
|
||
end
|
||
end
|
||
this.onlineNumText.text = onlineNum
|
||
end
|
||
|
||
-- 成员信息节点数据匹配
|
||
function this.MemItemAdapter(item, data)
|
||
local bg = Util.GetGameObject(item, "bg")
|
||
local headpos = Util.GetGameObject(item, "head")
|
||
local nameText = Util.GetGameObject(item, "name")
|
||
local powerText = Util.GetGameObject(item, "power")
|
||
local professText = Util.GetGameObject(item, "pos")
|
||
local onlineText = Util.GetGameObject(item, "online")
|
||
local offlineText = Util.GetGameObject(item, "offline")
|
||
|
||
nameText:GetComponent("Text").text = data.userName
|
||
professText:GetComponent("Text").text = GUILD_GRANT_STR[data.position]
|
||
powerText:GetComponent("Text").text = data.soulForce
|
||
|
||
-- 头像
|
||
if not _PlayerHeadList[item] then
|
||
_PlayerHeadList[item] = SubUIManager.Open(SubUIConfig.PlayerHeadView, headpos.transform)
|
||
end
|
||
_PlayerHeadList[item]:Reset()
|
||
_PlayerHeadList[item]:SetScale(Vector3.one * 0.65)
|
||
_PlayerHeadList[item]:SetHead(data.head)
|
||
_PlayerHeadList[item]:SetFrame(data.frame)
|
||
_PlayerHeadList[item]:SetLevel(data.userLevel)
|
||
_PlayerHeadList[item]:SetLayer(this.sortingOrder)
|
||
_PlayerHeadList[item]:SetEffectScale(0.75)
|
||
|
||
if data.seconds == 0 then
|
||
onlineText:SetActive(true)
|
||
offlineText:SetActive(false)
|
||
else
|
||
onlineText:SetActive(false)
|
||
offlineText:SetActive(true)
|
||
offlineText:GetComponent("Text").text = GetDeltaTimeStrByDeltaTime(data.seconds)
|
||
end
|
||
|
||
-- 添加点击事件
|
||
Util.AddOnceClick(bg, function()
|
||
UIManager.OpenPanel(UIName.GuildMemberInfoPopup, GUILD_MEM_POPUP_TYPE.INFORMATION, data.roleUid)
|
||
end)
|
||
end
|
||
|
||
-- 刷新申请信息
|
||
function this.RefreshVerifyShow()
|
||
if this._CurIndex ~= 3 then return end
|
||
--
|
||
local pos = MyGuildManager.GetMyPositionInGuild()
|
||
local isAdmin = pos == GUILD_GRANT.MASTER or pos == GUILD_GRANT.ADMIN
|
||
this.btnBg:SetActive(isAdmin)
|
||
-- 创建滚动
|
||
if not this.verifyScrollView then
|
||
local width = this.verifyScrollRoot.transform.rect.width
|
||
local height = isAdmin and this.verifyScrollRoot.transform.rect.height or this.verifyScrollRoot.transform.rect.height + this.btnBg.transform.rect.height
|
||
this.verifyScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.verifyScrollRoot.transform,
|
||
this.verifyItem, nil, Vector2.New(width, height), 1, 1, Vector2.New(0,0))
|
||
this.verifyScrollView.transform.anchoredPosition = Vector2.New(0, 0)
|
||
this.verifyScrollView.transform.anchorMin = Vector2.New(0.5, 1)
|
||
this.verifyScrollView.transform.anchorMax = Vector2.New(0.5, 1)
|
||
this.verifyScrollView.transform.pivot = Vector2.New(0.5, 1)
|
||
this.verifyScrollView.moveTween.Strength = 2
|
||
end
|
||
-- 获取数据
|
||
local verifies = MyGuildManager.GetMyGuildApplyList()
|
||
this.verifyScrollView:SetData(verifies, function(index, go)
|
||
this.VerifyItemAdapter(go, verifies[index])
|
||
end)
|
||
-- 判断空数据显示
|
||
this.empty:SetActive(#verifies == 0)
|
||
end
|
||
-- 成员信息节点数据匹配
|
||
function this.VerifyItemAdapter(item, data)
|
||
local headpos = Util.GetGameObject(item, "head")
|
||
local nameText = Util.GetGameObject(item, "name")
|
||
local powerText = Util.GetGameObject(item, "power")
|
||
local btnRefuse = Util.GetGameObject(item, "btnRefuse")
|
||
local btnAgree = Util.GetGameObject(item, "btnAgree")
|
||
nameText:GetComponent("Text").text = data.name
|
||
powerText:GetComponent("Text").text = data.foreces
|
||
-- 头像
|
||
if not _PlayerHeadList[item] then
|
||
_PlayerHeadList[item] = SubUIManager.Open(SubUIConfig.PlayerHeadView, headpos.transform)
|
||
end
|
||
_PlayerHeadList[item]:Reset()
|
||
_PlayerHeadList[item]:SetScale(Vector3.one * 0.8)
|
||
_PlayerHeadList[item]:SetHead(data.head)
|
||
_PlayerHeadList[item]:SetFrame(data.frame)
|
||
_PlayerHeadList[item]:SetLevel(data.level)
|
||
_PlayerHeadList[item]:SetLayer(this.sortingOrder)
|
||
_PlayerHeadList[item]:SetEffectScale(0.85)
|
||
|
||
local pos = MyGuildManager.GetMyPositionInGuild()
|
||
local isAdmin = pos == GUILD_GRANT.MASTER or pos == GUILD_GRANT.ADMIN
|
||
btnRefuse:SetActive(isAdmin)
|
||
btnAgree:SetActive(isAdmin)
|
||
Util.AddOnceClick(btnRefuse, function()
|
||
-- 判断是否有权限
|
||
if not isAdmin then
|
||
PopupTipPanel.ShowTip(Language[10902])
|
||
return
|
||
end
|
||
MyGuildManager.OperateApply(GUILD_APPLY_OPTYPE.ONE_REFUSE, data.roleUid)
|
||
end)
|
||
Util.AddOnceClick(btnAgree, function()
|
||
-- 判断是否有权限
|
||
if not isAdmin then
|
||
PopupTipPanel.ShowTip(Language[10902])
|
||
return
|
||
end
|
||
MyGuildManager.OperateApply(GUILD_APPLY_OPTYPE.ONE_AGREE, data.roleUid)
|
||
end)
|
||
end
|
||
|
||
|
||
-- 刷新公会日志
|
||
function this.RefreshLogShow()
|
||
MyGuildManager.RequestMyGuildLog(function()
|
||
if not this.logScrollView then
|
||
local height = this.logScrollRoot.transform.rect.height
|
||
local width = this.logScrollRoot.transform.rect.width
|
||
this.logScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.logScrollRoot.transform,
|
||
this.logItem, nil, Vector2.New(width, height), 1, 1, Vector2.New(0,0))
|
||
this.logScrollView.moveTween.Strength = 2
|
||
end
|
||
-- 设置数据
|
||
local logs = MyGuildManager.GetMyGuildLog()
|
||
this.logScrollView:SetData(logs, function(index, go)
|
||
this.LogItemAdapter(go, logs[index])
|
||
end)
|
||
local len = #logs
|
||
if len >= 10 then
|
||
this.logScrollView:SetIndex(len)
|
||
end
|
||
end)
|
||
end
|
||
-- 成员信息节点数据匹配
|
||
function this.LogItemAdapter(item, data)
|
||
local nameText = Util.GetGameObject(item, "name")
|
||
local statusText = Util.GetGameObject(item, "state")
|
||
--LogGreen("data.info:"..data.info)
|
||
local logStr = string.split(data.info,"|")
|
||
nameText:GetComponent("Text").text = logStr[GetCurLanguage()+1] or logStr[1]
|
||
statusText:GetComponent("Text").text = GetDeltaTimeStr(data.time)
|
||
end
|
||
|
||
--界面关闭时调用(用于子类重写)
|
||
function GuildInfoPopup:OnClose()
|
||
end
|
||
|
||
--界面销毁时调用(用于子类重写)
|
||
function GuildInfoPopup:OnDestroy()
|
||
this.spLoader:Destroy()
|
||
this.memScrollView = nil
|
||
this.verifyScrollView = nil
|
||
this.logScrollView = nil
|
||
|
||
-- 头像回收
|
||
for _, playerHead in pairs(_PlayerHeadList) do
|
||
playerHead:Recycle()
|
||
end
|
||
_PlayerHeadList = {}
|
||
|
||
-- 销毁计时器
|
||
if this._TimeCounter then
|
||
this._TimeCounter:Stop()
|
||
this._TimeCounter = nil
|
||
end
|
||
|
||
-- 清除红点
|
||
this.ClearRedpot()
|
||
end
|
||
|
||
return GuildInfoPopup
|
||
|