111 lines
4.4 KiB
Lua
111 lines
4.4 KiB
Lua
GuildTranscriptManager = {};
|
||
local this = GuildTranscriptManager
|
||
local guildCheckpointConfig = ConfigManager.GetConfig(ConfigName.GuildCheckpointConfig)
|
||
local allChapterConfigData = {}
|
||
local curBoss = 1--当前bossId
|
||
local blood = 0--剩余血量万分比
|
||
local canSweep = 0--是否能扫荡,今天是否挑战过这个boss
|
||
local isKill = 0 --当场战斗boss 是否击杀
|
||
local buffCount = 0--当前buff到多少索引
|
||
local buffTime = 0--buff结束时间
|
||
|
||
this.damage = 0
|
||
this.drop = nil--当场战斗掉落
|
||
this.shopGoodId = 10031--公会副本挑战价格
|
||
function this.Initialize()
|
||
for _, configInfo in ConfigPairs(guildCheckpointConfig) do
|
||
table.insert(allChapterConfigData,configInfo)
|
||
end
|
||
end
|
||
function this.GetAllConFigData()
|
||
return allChapterConfigData
|
||
end
|
||
--请求当前副本章节
|
||
function this.GetGuildChallengeInfoRequest(fun)
|
||
NetManager.GetGuildChallengeInfoRequest(function (msg)
|
||
curBoss = msg.curBoss--当前bossId
|
||
blood = msg.blood--剩余血量万分比
|
||
canSweep = msg.canSweep--是否能扫荡,今天是否挑战过这个boss
|
||
buffCount = msg.buffCount
|
||
buffTime = msg.buffTime
|
||
LogPink("curBoss "..curBoss.." blood "..blood.." canSweep "..canSweep.." buffCount "..buffCount.." buffTime "..buffTime)
|
||
Game.GlobalEvent:DispatchEvent(GameEvent.Guild.RefreshGuildTranscript)
|
||
Game.GlobalEvent:DispatchEvent(GameEvent.Guild.RefreshGuildTranscriptBuff)
|
||
end)
|
||
end
|
||
--请求战斗
|
||
function this.GuildChallengeRequest(attackType,callBack)
|
||
if attackType == 0 then
|
||
NetManager.GuildChallengeRequest(this.GetCurBoss(),attackType,function (msg)
|
||
local fightData = BattleManager.GetBattleServerData(msg)
|
||
this.damage = msg.damage
|
||
this.drop = msg.drop
|
||
canSweep = 1
|
||
PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BATTLENUM, 1)--更新特权
|
||
UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.GuildTranscript, callBack)
|
||
end)
|
||
elseif attackType == 1 then--快速战斗 扫荡
|
||
NetManager.GuildChallengeRequest(this.GetCurBoss(),attackType,function (msg)
|
||
this.damage = msg.damage
|
||
PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BATTLENUM, 1)--更新特权
|
||
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop, 1,function()
|
||
if callBack then
|
||
callBack()
|
||
end
|
||
end, 6,true,true)
|
||
end)
|
||
end
|
||
end
|
||
function this.RefreshGuildTranscriptInfo(msg)
|
||
local oldBossId = curBoss
|
||
curBoss = msg.curBoss--当前bossId
|
||
blood = msg.blood--剩余血量万分比
|
||
-- canSweep = msg.canSweep--是否能扫荡,今天是否挑战过这个boss
|
||
isKill = msg.isKill--是否击杀
|
||
if msg.isKill == 1 then
|
||
PopupTipPanel.ShowTip("已击败【首领名称】!")
|
||
-- canSweep = 0
|
||
end
|
||
if oldBossId ~= curBoss then--前后ID不等认为是击杀
|
||
canSweep = 0
|
||
isKill = 1
|
||
PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BATTLENUM, - PrivilegeManager.GetPrivilegeUsedTimes(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BATTLENUM))
|
||
PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BUY_BATTLENUM, - PrivilegeManager.GetPrivilegeUsedTimes(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BUY_BATTLENUM))
|
||
end
|
||
Game.GlobalEvent:DispatchEvent(GameEvent.Guild.RefreshGuildTranscript)
|
||
end
|
||
function this.RefreshGuildTranscriptBuffInfo(msg)
|
||
buffCount = msg.buffCount
|
||
buffTime = msg.buffTime
|
||
Game.GlobalEvent:DispatchEvent(GameEvent.Guild.RefreshGuildTranscriptBuff)
|
||
end
|
||
-- 获取剩余挑战次数 特权
|
||
function this.GetCanBattleCount()
|
||
return PrivilegeManager.GetPrivilegeRemainValue(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BATTLENUM)
|
||
end
|
||
-- 获取剩余挑战购买次数 特权
|
||
function this.GetCanBuyBattleCount()
|
||
return PrivilegeManager.GetPrivilegeRemainValue(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BUY_BATTLENUM)
|
||
end
|
||
function this.GetRedPointState()
|
||
return PrivilegeManager.GetPrivilegeRemainValue(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BATTLENUM) > 0
|
||
end
|
||
function this.GetCurBoss()
|
||
return curBoss
|
||
end
|
||
function this.GetBlood()
|
||
return blood
|
||
end
|
||
function this.GetCanSweep()
|
||
return canSweep
|
||
end
|
||
function this.GetbuffTime()
|
||
return buffTime
|
||
end
|
||
function this.GetbuffCount()
|
||
return buffCount
|
||
end
|
||
function this.GetCurBattleIsSkillBoss()
|
||
return isKill == 1
|
||
end
|
||
return this |