miduo_client/Assets/ManagedResources/~Lua/Modules/Guild/GuildMainCityPanel.lua

632 lines
25 KiB
Lua
Raw Normal View History

require("Base/BasePanel")
local limitTime=PlayerManager.GetServerOpenTime() + 7*24*60*60
2020-06-13 11:47:13 +08:00
local _GuildBuildConfig = {
[GUILD_MAP_BUILD_TYPE.HOUSE] = {
isOpen = true,
rpType = RedPointType.Guild_House,
btnName = "btnHouse",
btnFunc = function()
UIManager.OpenPanel(UIName.GuildInfoPopup)
end,
},
[GUILD_MAP_BUILD_TYPE.STORE] = {
isOpen = true,
rpType = RedPointType.Guild_Shop,
btnName = "btnShop",
btnFunc = function()
local isActive = ShopManager.IsActive(SHOP_TYPE.GUILD_SHOP)
if not isActive then
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[10908])
2020-06-13 11:47:13 +08:00
return
end
UIManager.OpenPanel(UIName.MainShopPanel, SHOP_TYPE.GUILD_SHOP)
end,
},
[GUILD_MAP_BUILD_TYPE.FETE] = { --祭祀
isOpen = true,
rpType = RedPointType.Guild_Fete,
btnName = "btnFete",
btnFunc = function ()
UIManager.OpenPanel(UIName.GuildFetePopup)
end,
},
[GUILD_MAP_BUILD_TYPE.TENPOS] = { --十绝阵
isOpen = true,
rpType = RedPointType.Guild_DeathPos,
btnName = "btnTenPos",
btnFunc = function()
if DeathPosManager.status==DeathPosStatus.Death then
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[10909])
2020-06-13 11:47:13 +08:00
return
elseif DeathPosManager.status==DeathPosStatus.Close then
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[10910])
2020-06-13 11:47:13 +08:00
return
end
UIManager.OpenPanel(UIName.DeathPosPanel)
end,
},
[GUILD_MAP_BUILD_TYPE.SKILL] = { --技能
isOpen = true,
rpType = RedPointType.Guild_Skill,
btnName = "btnSkill",
btnFunc = function()
UIManager.OpenPanel(UIName.GuildSkillUpLvPopup)
end,
},
[GUILD_MAP_BUILD_TYPE.CARDELAY] = { --车迟斗法
2021-07-22 15:13:24 +08:00
isOpen = true,
2021-07-22 17:41:01 +08:00
rpType = RedPointType.LegendExplore,
2020-06-13 11:47:13 +08:00
btnName = "btnCarDelay",
btnFunc = function()
if limitTime>GetTimeStamp() then
return
end
2021-07-22 17:41:01 +08:00
if ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.CARDELAY) then
if PlayerManager.familyId == 0 then
PopupTipPanel.ShowTip(Language[10278])
return
end
UIManager.OpenPanel(UIName.GuildCarDelayMainPanel)
else
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.CARDELAY))
end
2020-06-13 11:47:13 +08:00
end,
},
[GUILD_MAP_BUILD_TYPE.AID] = { --援助
isOpen = true,
rpType = RedPointType.Guild_Aid,
btnName = "btnAid",
btnFunc = function()
UIManager.OpenPanel(UIName.GuildAidMainPopup)
end,
},
2020-08-22 18:03:43 +08:00
[GUILD_MAP_BUILD_TYPE.TRANSCRIPT] = { --公会副本
isOpen = true,
rpType = RedPointType.Guild_Transcript,
btnName = "btntranscript",
btnFunc = function()
UIManager.OpenPanel(UIName.GuildTranscriptMainPopup)
end,
}
2020-06-13 11:47:13 +08:00
}
2020-05-09 13:31:21 +08:00
local GuildMainCityPanel = Inherit(BasePanel)
local this = GuildMainCityPanel
local _StageNameIcon = {
[GUILD_FIGHT_STAGE.DEFEND] = {"r_gonghui_bufangjieduan"},
[GUILD_FIGHT_STAGE.MATCHING] = {"r_gonghui_pipeijieduan"},
[GUILD_FIGHT_STAGE.ATTACK] = {"r_gonghui_jingongjieduan"},
[GUILD_FIGHT_STAGE.COUNTING] = {"r_gonghui_jiesuanjieduan", "r_gonghui_jiesuanwancheng"},
[GUILD_FIGHT_STAGE.EMPTEY] = {"r_gonghui_bencilunkong"},
}
--初始化组件(用于子类重写)
function GuildMainCityPanel: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, "btnBack")
this.btnHelp = Util.GetGameObject(self.gameObject, "btnHelp")
this.helpPosition=this.btnHelp:GetComponent("RectTransform").localPosition
this.stageView = Util.GetGameObject(self.transform, "layout/panel1")
this.stageName = Util.GetGameObject(this.stageView, "stage/name"):GetComponent("Image")
this.stageTime = Util.GetGameObject(this.stageView, "stage/time"):GetComponent("Text")
this.myGuild = Util.GetGameObject(this.stageView, "stage/my")
this.enemyGuild = Util.GetGameObject(this.stageView, "stage/enemy")
this.myStar = Util.GetGameObject(this.stageView, "stage/my/starNum"):GetComponent("Text")
this.enemyStar = Util.GetGameObject(this.stageView, "stage/enemy/starNum"):GetComponent("Text")
this.rightBox = Util.GetGameObject(self.transform, "layout/panel2/btnbox")
this.btnOneKeyDefend = Util.GetGameObject(this.rightBox, "oneKeyDefend")
this.btnCheckDefend = Util.GetGameObject(this.rightBox, "checkDefend")
this.btnMatching = Util.GetGameObject(this.rightBox, "matching")
this.btnAttack = Util.GetGameObject(this.rightBox, "attack")
this.btnAttackLog = Util.GetGameObject(this.rightBox, "attackLog")
this.btnResult = Util.GetGameObject(this.rightBox, "result")
this.btnRedPacket=Util.GetGameObject(this.rightBox,"redPacket")
this.btnRedPacketRedPoint=Util.GetGameObject(this.btnRedPacket,"redPoint")
this.timeCount = Util.GetGameObject(self.transform,"Bg/btnCarDelay/Time")
this.timeText = Util.GetGameObject(this.timeCount,"Text"):GetComponent("Text")
if not this.playerInfoView then
this.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, this.transform)
end
2020-05-09 13:31:21 +08:00
-- 聊天
this.ChatTipView = SubUIManager.Open(SubUIConfig.ChatTipView, self.transform, 2)
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft })
2020-06-13 11:47:13 +08:00
this.BtView = SubUIManager.Open(SubUIConfig.BtView, self.gameObject.transform)
for type, data in pairs(_GuildBuildConfig) do
if data.btnName then
local btn = Util.GetGameObject(self.gameObject, "Bg/"..data.btnName)
if btn then
btn:SetActive(data.isOpen)
if data.isOpen then
if data.btnFunc then
Util.AddOnceClick(btn, data.btnFunc)
end
if data.rpType then
BindRedPointObject(data.rpType, Util.GetGameObject(btn, "flag/redpot"))
end
end
end
end
end
2020-08-25 11:18:20 +08:00
--副本立绘
this.btntranscriptLive = Util.GetGameObject(self.gameObject, "Bg/btntranscript/live2d")
2020-05-09 13:31:21 +08:00
end
--绑定事件(用于子类重写)
function GuildMainCityPanel:BindEvent()
Util.AddClick(this.btnBack, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
this:ClosePanel()
end)
--帮助按钮
Util.AddClick(this.btnHelp, function()
2020-06-13 11:47:13 +08:00
UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.Guilds, this.helpPosition.x, this.helpPosition.y)
2020-05-09 13:31:21 +08:00
end)
-- 一键布防
Util.AddClick(this.btnOneKeyDefend, function()
-- 判断是否已经上阵
local defendData = GuildFightManager.GetDefendStagePlayerBuildType(PlayerManager.uid)
if defendData then
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[10911])
2020-05-09 13:31:21 +08:00
return
end
-- 判断编队是否符合条件
local curFormationIndex = FormationManager.curFormationIndex
local formationList = FormationManager.GetFormationByID(curFormationIndex)
if #formationList.teamHeroInfos < 5 then
UIManager.OpenPanel(UIName.FormationPanel, FORMATION_TYPE.GUILD_DEFEND, "DEFEND", 0)
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[10912])
2020-05-09 13:31:21 +08:00
return
end
-- 布防到随机建筑
GuildFightManager.RequestDefend(0, function()
-- 刷新编队信息
FormationManager.RefreshFormationData()
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[10726])
2020-05-09 13:31:21 +08:00
end)
end)
-- 查看布防
Util.AddClick(this.btnCheckDefend, function()
local curStage = GuildFightManager.GetCurFightStage()
if curStage == GUILD_FIGHT_STAGE.DEFEND then
GuildFightManager.RequestDefendStageData(function()
UIManager.OpenPanel(UIName.GuildFightDefendInfoPopup)
end)
end
end)
-- 去进攻
Util.AddClick(this.btnAttack, function()
local curStage = GuildFightManager.GetCurFightStage()
if curStage == GUILD_FIGHT_STAGE.ATTACK then
GuildFightManager.RequestAttackStageDefendData(function()
UIManager.OpenPanel(UIName.GuildFightAttackInfoPopup, GUILD_FIGHT_GUILD_TYPE.ENEMY)
end)
end
end)
-- 查看进攻日志
Util.AddClick(this.btnAttackLog, function()
-- 请求排名信息,也就是进攻日志
UIManager.OpenPanel(UIName.GuildFightAttackLogPopup)
end)
-- 查看结果
Util.AddClick(this.btnResult, function()
GuildFightManager.RequestGuildFightResultData(function()
UIManager.OpenPanel(UIName.GuildFightResultPopup)
end)
end)
--公会红包
Util.AddClick(this.btnRedPacket,function()
UIManager.OpenPanel(UIName.RedPacketPanel)
end)
2020-06-13 11:47:13 +08:00
2020-05-09 13:31:21 +08:00
-- 绑定红点
BindRedPointObject(RedPointType.Guild_RedPacket, this.btnRedPacketRedPoint)
end
--添加事件监听(用于子类重写)
function GuildMainCityPanel:AddListener()
2020-06-13 11:47:13 +08:00
-- ctrlView.AddListener()
2020-05-09 13:31:21 +08:00
Game.GlobalEvent:AddEvent(GameEvent.Guild.OnQuitGuild, this.OnQuitGuild)
Game.GlobalEvent:AddEvent(GameEvent.Guild.BeKickOut, this.OnQuitGuild)
Game.GlobalEvent:AddEvent(GameEvent.Guild.DismissStatusChanged, this.RefreshStageShow)
Game.GlobalEvent:AddEvent(GameEvent.GuildFight.FightBaseDataUpdate, this.RefreshStageShow)
Game.GlobalEvent:AddEvent(GameEvent.GuildFight.EnemyBaseDataUpdate, this.RefreshGuildInfo)
Game.GlobalEvent:AddEvent(GameEvent.GuildFight.ResultDataUpdate, this.RefreshGuildInfo)
Game.GlobalEvent:AddEvent(GameEvent.GuildFight.AttackStageDefendDataUpdate, this.RefreshGetStar)
Game.GlobalEvent:AddEvent(GameEvent.GuildRedPacket.OnCloseRedPointClick, this.CloseRedPointClick)
2020-05-11 09:38:52 +08:00
Game.GlobalEvent:AddEvent(GameEvent.Guild.RefreshDeathPosStatus, this.RefreshDeathPos)
2020-05-09 13:31:21 +08:00
end
--移除事件监听(用于子类重写)
function GuildMainCityPanel:RemoveListener()
2020-06-13 11:47:13 +08:00
-- ctrlView.RemoveListener()
2020-05-09 13:31:21 +08:00
Game.GlobalEvent:RemoveEvent(GameEvent.Guild.OnQuitGuild, this.OnQuitGuild)
Game.GlobalEvent:RemoveEvent(GameEvent.Guild.BeKickOut, this.OnQuitGuild)
Game.GlobalEvent:RemoveEvent(GameEvent.Guild.DismissStatusChanged, this.RefreshStageShow)
Game.GlobalEvent:RemoveEvent(GameEvent.GuildFight.FightBaseDataUpdate, this.RefreshStageShow)
Game.GlobalEvent:RemoveEvent(GameEvent.GuildFight.EnemyBaseDataUpdate, this.RefreshGuildInfo)
Game.GlobalEvent:RemoveEvent(GameEvent.GuildFight.ResultDataUpdate, this.RefreshGuildInfo)
Game.GlobalEvent:RemoveEvent(GameEvent.GuildFight.AttackStageDefendDataUpdate, this.RefreshGetStar)
Game.GlobalEvent:RemoveEvent(GameEvent.GuildRedPacket.OnCloseRedPointClick, this.CloseRedPointClick)
2020-05-11 09:38:52 +08:00
Game.GlobalEvent:RemoveEvent(GameEvent.Guild.RefreshDeathPosStatus, this.RefreshDeathPos)
2020-05-09 13:31:21 +08:00
end
--界面打开时调用(用于子类重写)
function GuildMainCityPanel:OnOpen(...)
2020-05-09 13:31:21 +08:00
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function GuildMainCityPanel:OnShow()
2020-06-13 11:47:13 +08:00
this.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.Guild })
this.BtView:OnOpen(self, { sortOrder = self.sortingOrder, panelType = PanelTypeView.GongHui })
2020-07-17 13:38:02 +08:00
CheckRedPointStatus(RedPointType.Guild_Fete)
CheckRedPointStatus(RedPointType.Guild_AidBox)
CheckRedPointStatus(RedPointType.Guild_AidGuild)
CheckRedPointStatus(RedPointType.Guild_AidMy)
2020-08-24 09:48:13 +08:00
CheckRedPointStatus(RedPointType.Guild_Transcript)
2020-10-24 16:18:57 +08:00
CheckRedPointStatus(RedPointType.Celebration)
2020-05-09 13:31:21 +08:00
if not PlayerManager.familyId or PlayerManager.familyId == 0 then
this:ClosePanel()
Log("尚未加入公会")
2020-05-09 13:31:21 +08:00
return
end
2020-05-09 13:31:21 +08:00
-- 刷新一遍公会数据,这里主要是为了刷新玩家位置信息,避免返回地图界面出现的问题
2020-07-24 16:52:36 +08:00
NetManager.RequestMyGuildInfo()
2020-05-09 13:31:21 +08:00
-- 刷新公会战阶段信息
this.RefreshStageShow()
-- 开始定时刷新聊天数据
this.ChatTipView:StartCheck()
MyGuildManager.ReuqsetRedPackage()
2020-05-09 13:31:21 +08:00
-- 刷新十绝阵是否开启
2020-05-11 09:38:52 +08:00
this.RefreshDeathPos()
2020-05-09 13:31:21 +08:00
-- 开始吧
this._TimeUpdate()
if not this._TimeCounter then
this._TimeCounter = Timer.New(this._TimeUpdate, 1, -1, true)
this._TimeCounter:Start()
end
2020-07-31 13:35:15 +08:00
if not RECHARGEABLE or SERVER_VERSION == 1 then--(是否开启充值)
2020-07-31 13:35:15 +08:00
this.btnRedPacket:SetActive(false)
end
2020-08-25 11:18:20 +08:00
this.LiveName = "live2d_huyao"
if not this.LiveGO then
this.LiveGO = poolManager:LoadLive(this.LiveName, this.btntranscriptLive.transform,
2020-08-25 11:18:20 +08:00
Vector3.one * 0.15, Vector3.New(0,0,0))
end
-- 刷新一次编队战斗力
FormationManager.RefreshMainFormationPower()
2020-06-13 11:47:13 +08:00
end
2020-09-25 21:19:01 +08:00
function this:OnSortingOrderChange()
if this.playerInfoView then
this.playerInfoView:SetLayer(self.sortingOrder)
end
2020-09-25 21:19:01 +08:00
end
2020-05-09 13:31:21 +08:00
function this.RefreshStageShow()
-- 关闭按钮显示
this.btnOneKeyDefend:SetActive(false)
this.btnCheckDefend:SetActive(false)
this.btnMatching:SetActive(false)
this.btnAttack:SetActive(false)
this.btnAttackLog:SetActive(false)
this.btnResult:SetActive(false)
2020-06-08 13:57:30 +08:00
this.stageView:SetActive(false)--原公会战关闭暂时 可惜了~
2020-05-09 13:31:21 +08:00
local curStage = GuildFightManager.GetCurFightStage()
-- 阶段名称显示
this.stageName.gameObject:SetActive(_StageNameIcon[curStage] ~= nil)
if _StageNameIcon[curStage] then
this.stageName.gameObject:SetActive(true)
2021-04-21 13:12:04 +08:00
this.stageName.sprite = this.spLoader:LoadSprite(_StageNameIcon[curStage][1])
2020-05-09 13:31:21 +08:00
this.stageName:SetNativeSize()
end
-- 按钮显示,及特殊阶段处理
if curStage == GUILD_FIGHT_STAGE.UN_START then
elseif curStage == GUILD_FIGHT_STAGE.DEFEND then
this.btnCheckDefend:SetActive(true)
elseif curStage == GUILD_FIGHT_STAGE.MATCHING then
elseif curStage == GUILD_FIGHT_STAGE.ATTACK then
this.btnAttack:SetActive(true)
this.btnAttackLog:SetActive(true)
elseif curStage == GUILD_FIGHT_STAGE.COUNTING then
this.btnResult:SetActive(true)
local result = GuildFightManager.GetGuildFightResultData()
-- 显示结算完成
if result and _StageNameIcon[curStage] then
2021-04-21 13:12:04 +08:00
this.stageName.sprite = this.spLoader:LoadSprite(_StageNameIcon[curStage][2])
2020-05-09 13:31:21 +08:00
end
elseif curStage == GUILD_FIGHT_STAGE.EMPTEY then
end
-- 刷新展示信息
this.RefreshGuildInfo()
end
-- 刷新公会信息展示
function this.RefreshGuildInfo()
local enemyInfo = GuildFightManager.GetEnemyBaseData()
if not enemyInfo then
this.myGuild:SetActive(false)
this.enemyGuild:SetActive(false)
else
this.myGuild:SetActive(true)
this.enemyGuild:SetActive(true)
-- 敌方数据显示
this.GuildBaseInfoAdapter(this.enemyGuild, enemyInfo)
-- 我方数据显示
local myGuildData = GuildFightManager.GetMyBaseData()
this.GuildBaseInfoAdapter(this.myGuild, myGuildData)
end
-- 刷新获取的星数
this.RefreshGetStar()
-- 检测阶段提示
this.CheckStageTip()
end
-- 公会基础数据匹配
function this.GuildBaseInfoAdapter(node, data)
local nameText = Util.GetGameObject(node, "name"):GetComponent("Text")
local levelText = Util.GetGameObject(node, "level"):GetComponent("Text")
local levelbg = Util.GetGameObject(node, "lvbg")
local logoSpr = Util.GetGameObject(node, "icon"):GetComponent("Image")
levelText.gameObject:SetActive(data ~= nil)
levelbg.gameObject:SetActive(data ~= nil)
if data then
nameText.text = data.name
levelText.text = data.level
local logoName = GuildManager.GetLogoResName(data.pictureId)
2021-04-21 13:12:04 +08:00
logoSpr.sprite = this.spLoader:LoadSprite(logoName)
2020-05-09 13:31:21 +08:00
else
nameText.text = "..."
2021-04-21 13:12:04 +08:00
logoSpr.sprite = this.spLoader:LoadSprite("r_gonghui_pipeiwenhao")
2020-05-09 13:31:21 +08:00
end
end
-- 刷新获取星数的显示
function this.RefreshGetStar()
this.myStar.gameObject:SetActive(false)
this.enemyStar.gameObject:SetActive(false)
local curStage = GuildFightManager.GetCurFightStage()
if curStage == GUILD_FIGHT_STAGE.ATTACK or curStage == GUILD_FIGHT_STAGE.COUNTING then
this.myStar.gameObject:SetActive(true)
this.enemyStar.gameObject:SetActive(true)
local myGetStar, enemyGetStar = GuildFightManager.GetBothGetStarNum()
this.myStar.text = myGetStar
this.enemyStar.text = enemyGetStar
end
end
-- 计时显示
local _BGMFlag = nil
function this._TimeUpdate()
--车迟斗法倒计时显示
local timeDown = -1
if limitTime>GetTimeStamp() then
--LogError("timeStamp=="..limitTime-GetTimeStamp())
local cha =limitTime-GetTimeStamp()
if cha>86400 then
this.timeText.text = string.format("%s天后开启",TimeToD(limitTime-GetTimeStamp()))
elseif cha>3600 then
this.timeText.text = string.format("%s后开启",TimeToH(limitTime-GetTimeStamp()))
else
this.timeText.text = string.format("%s后开启",TimeToMorS(limitTime-GetTimeStamp()))
end
return
end
2022-03-03 14:39:24 +08:00
if GuildCarDelayManager.progress == GuildCarDelayProType.Challenge then
if PrivilegeManager.GetPrivilegeRemainValue(PRIVILEGE_TYPE.GUILD_CAR_DELEAY_CHALLENGE) > 0 then
timeDown = GuildCarDelayManager.ChallengeCdTime
if timeDown > 0 then
2022-03-03 15:14:42 +08:00
this.timeText.text = string.format("%s后可挑战",TimeToMorS(timeDown))
2022-03-03 14:39:24 +08:00
else
this.timeText.text = string.format("挑战中")
end
else
this.timeText.text = string.format("15点开始抢夺")
end
elseif GuildCarDelayManager.progress == GuildCarDelayProType.Loot then
if PrivilegeManager.GetPrivilegeRemainValue(PRIVILEGE_TYPE.GUILD_CAR_DELEAY_LOOT) > 0 then
2022-03-03 16:52:08 +08:00
timeDown = GuildCarDelayManager.LootCdTime
2022-03-03 14:39:24 +08:00
if timeDown > 0 then
2022-03-03 15:14:42 +08:00
this.timeText.text = string.format("%s后可抢夺",TimeToMorS(timeDown))
2022-03-03 14:39:24 +08:00
else
this.timeText.text = string.format("抢夺中")
end
else
this.timeText.text = string.format("每日8点开启")
end
2022-03-03 14:39:24 +08:00
else
this.timeText.text = string.format("每日8点开启")
end
--这个结构不适合做==0的判断无奈写了个Timer
if timeDown == 1 then
Timer.New(function ()
CheckRedPointStatus(RedPointType.LegendExplore)
end,1.5):Start()
end
2020-05-09 13:31:21 +08:00
local curStage = GuildFightManager.GetCurFightStage()
if curStage == GUILD_FIGHT_STAGE.DISSMISS or curStage == GUILD_FIGHT_STAGE.CLOSE then
if not _BGMFlag or _BGMFlag == 1 then
_BGMFlag = 0
SoundManager.PlayMusic(SoundConfig.BGM_Guild)
end
return
end
local guildFightData = GuildFightManager.GetGuildFightData()
local startTime = guildFightData.startTime
local curTime = GetTimeStamp()
if guildFightData.type == GUILD_FIGHT_STAGE.UN_START and curTime < startTime then
local leftTime = startTime - curTime
leftTime = leftTime < 0 and 0 or leftTime
2021-03-02 16:53:12 +08:00
this.stageTime.text = string.format(Language[10913], TimeToHMS(leftTime))
2020-05-09 13:31:21 +08:00
if not _BGMFlag or _BGMFlag == 1 then
_BGMFlag = 0
SoundManager.PlayMusic(SoundConfig.BGM_Guild)
end
else
local roundEndTime = guildFightData.roundEndTime
local leftTime = roundEndTime - curTime
leftTime = leftTime < 0 and 0 or leftTime
2021-03-02 16:53:12 +08:00
this.stageTime.text = string.format(Language[10914], TimeToHMS(leftTime))
2020-05-09 13:31:21 +08:00
if not _BGMFlag or _BGMFlag == 0 then
_BGMFlag = 1
SoundManager.PlayMusic(SoundConfig.BGM_GuildFight)
end
end
end
-- 退出公会回调事件
function this.OnQuitGuild()
this:ClosePanel()
end
--- 检测当前阶段是否需要显示阶段提示界面
function this.CheckStageTip()
-- 获取当前公会战阶段
local isInFight = GuildFightManager.IsInGuildFight()
if not isInFight then return end
local curStage = GuildFightManager.GetCurFightStage()
local curTipStage = GuildFightManager.GetCurTipStage()
-- 轮空状态特殊处理
if curStage == GUILD_FIGHT_STAGE.EMPTEY and curTipStage ~= GUILD_FIGHT_STAGE.EMPTEY then
GuildFightManager.SetCurTipStage(GUILD_FIGHT_STAGE.EMPTEY)
if UIManager.IsOpen(UIName.GuildFightMatchingPopup) then
UIManager.ClosePanel(UIName.GuildFightMatchingPopup)
end
-- 显示轮空提示
UIManager.OpenPanel(UIName.GuildFightMatchSuccessPopup, 2)
return
elseif curStage == GUILD_FIGHT_STAGE.MATCHING then
local enemyInfo = GuildFightManager.GetEnemyBaseData()
if not enemyInfo then
if not curTipStage or curTipStage < curStage - 0.5 then
-- 这里匹配阶段但是未匹配成功的阶段用 匹配阶段减0.5代替 以符合提示显示的规则
-- 阶段设计问题,应该将匹配阶段分开为两个阶段
GuildFightManager.SetCurTipStage(curStage - 0.5)
if UIManager.IsOpen(UIName.GuildFightDefendInfoPopup) then
UIManager.ClosePanel(UIName.GuildFightDefendInfoPopup)
end
UIManager.OpenPanel(UIName.GuildFightMatchingPopup)
end
else
if not curTipStage or curTipStage < curStage then
-- 匹配成功的阶段,显示匹配结果
GuildFightManager.SetCurTipStage(curStage)
if UIManager.IsOpen(UIName.GuildFightMatchingPopup) then
UIManager.ClosePanel(UIName.GuildFightMatchingPopup)
end
UIManager.OpenPanel(UIName.GuildFightMatchSuccessPopup, 1)
end
end
return
end
if not curTipStage or curTipStage < curStage then
GuildFightManager.SetCurTipStage(curStage)
-- 根据不同的阶段显示不同的界面
if curStage == GUILD_FIGHT_STAGE.DEFEND then
if UIManager.IsOpen(UIName.GuildFightResultPopup) then
UIManager.ClosePanel(UIName.GuildFightResultPopup)
end
UIManager.OpenPanel(UIName.GuildFightDefendInfoPopup, true)
elseif curStage == GUILD_FIGHT_STAGE.ATTACK then
if UIManager.IsOpen(UIName.GuildFightMatchSuccessPopup) then
UIManager.ClosePanel(UIName.GuildFightMatchSuccessPopup)
end
UIManager.OpenPanel(UIName.GuildFightAttackTipPopup)
elseif curStage == GUILD_FIGHT_STAGE.COUNTING then
if UIManager.IsOpen(UIName.GuildFightAttackTipPopup) then
UIManager.ClosePanel(UIName.GuildFightAttackTipPopup)
end
UIManager.OpenPanel(UIName.GuildFightResultPopup)
end
end
end
-- 刷新红包红点
function this.CloseRedPointClick()
GuildRedPacketManager.isCheck=false
--CheckRedPointStatus(RedPointType.Guild_RedPacket)
--CheckRedPointStatus(RedPointType.Guid_SendPackage)
--CheckRedPointStatus(RedPointType.Guid_GetPackage)
MyGuildManager.ReuqsetRedPackage()
2020-05-09 13:31:21 +08:00
end
--刷新十绝阵是否开启
function this.RefreshDeathPos()
NetManager.GetDeathPathStatusResponse(function(msg)
LogBlue(tostring("十绝阵开启状态 "..msg.status))
2020-05-11 09:38:52 +08:00
DeathPosManager.status=msg.status
2020-06-08 13:57:30 +08:00
CheckRedPointStatus(RedPointType.Guild_DeathPos)--阶段切换时 检测红点
2020-05-09 13:31:21 +08:00
end)
end
--界面关闭时调用(用于子类重写)
function GuildMainCityPanel:OnClose()
_BGMFlag = nil
-- 计时器关闭
if this._TimeCounter then
this._TimeCounter:Stop()
this._TimeCounter = nil
end
-- 关闭定时刷新数据
this.ChatTipView:StopCheck()
end
--界面销毁时调用(用于子类重写)
function GuildMainCityPanel:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2020-05-09 13:31:21 +08:00
SubUIManager.Close(this.ChatTipView)
SubUIManager.Close(this.UpView)
2020-06-13 11:47:13 +08:00
SubUIManager.Close(this.BtView)
2021-03-31 11:20:45 +08:00
-- SubUIManager.Close(this.playerHead)
2020-05-09 13:31:21 +08:00
-- 移除红点
2020-06-13 11:47:13 +08:00
for type, data in pairs(_GuildBuildConfig) do
if data.btnName then
local btn = Util.GetGameObject(self.gameObject, "Bg/"..data.btnName)
if btn and data.isOpen and data.rpType then
ClearRedPointObject(data.rpType, Util.GetGameObject(btn, "flag/redpot"))
end
end
end
-- 清除红点
ClearRedPointObject(RedPointType.Guild_RedPacket, this.btnRedPacketRedPoint)
2021-03-31 11:20:45 +08:00
-- this.playerHead = nil
2020-08-25 11:18:20 +08:00
if this.LiveGO then
poolManager:UnLoadLive(this.LiveName,this.LiveGO)
this.LiveName = nil
this.LiveGO = nil
end
if this.playerInfoView then
SubUIManager.Close(this.playerInfoView)
this.playerInfoView = nil
end
2020-05-09 13:31:21 +08:00
end
2020-06-23 18:36:24 +08:00
return GuildMainCityPanel