2020-05-09 13:31:21 +08:00
|
|
|
|
GuildCarDelayManager = {};
|
|
|
|
|
local this = GuildCarDelayManager
|
|
|
|
|
function this.Initialize()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
--后端更新车迟进度
|
|
|
|
|
function this.SetProgressData(msg)
|
2020-05-11 09:38:52 +08:00
|
|
|
|
this.progress = msg.progress--阶段 -1:未开 1 : 挑战 2 空挡期 3:抢夺
|
|
|
|
|
this.endTime = msg.endTime--结束时间
|
|
|
|
|
this.bossIndexId = msg.bossIndexId--boss索引id
|
|
|
|
|
this.battleStartTime = msg.battleStartTime--挑战boss开启时间
|
|
|
|
|
this.grabStartTime = msg.grabStartTime--抢夺开启时间
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--LogError("progress "..this.progress.." endTime "..this.endTime.." bossIndexId "..this.bossIndexId)
|
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Guild.CarDelayProgressChanged)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--开始战斗
|
|
|
|
|
this.score = 0
|
|
|
|
|
this.hurt = 0
|
|
|
|
|
this.heroDid = 0--抢夺是向后端传的id
|
|
|
|
|
function this.SetheroDid(_heroDid)
|
|
|
|
|
this.heroDid = _heroDid
|
|
|
|
|
end
|
|
|
|
|
function this.FightBattle( callBack)
|
|
|
|
|
local type = 0
|
|
|
|
|
local fightType = 0
|
|
|
|
|
local monsterId = 0
|
|
|
|
|
if this.progress == 1 then
|
|
|
|
|
local worldBossConfig = ConfigManager.GetConfigData(ConfigName.WorldBossConfig,GuildCarDelayManager.bossIndexId)
|
|
|
|
|
if worldBossConfig and worldBossConfig.MonsterId then
|
|
|
|
|
monsterId = worldBossConfig.MonsterId
|
|
|
|
|
end
|
|
|
|
|
fightType = 0
|
|
|
|
|
type = 1
|
2020-05-11 09:38:52 +08:00
|
|
|
|
PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.GUILD_CAR_DELEAY_CHALLENGE, 1)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
elseif this.progress == 3 then
|
|
|
|
|
monsterId = this.heroDid
|
|
|
|
|
fightType = 1
|
|
|
|
|
type = 2
|
2020-05-11 09:38:52 +08:00
|
|
|
|
PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.GUILD_CAR_DELEAY_LOOT, 1)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
NetManager.FastFightChallengeRequest(type,monsterId,function (msg)
|
|
|
|
|
this.score = msg.score
|
|
|
|
|
this.hurt = msg.hurt
|
|
|
|
|
local fightData, seed, fightType, maxTime = BattleManager.GetBattleServerData(msg,fightType)
|
|
|
|
|
UIManager.OpenPanel(UIName.BattlePanel, fightData, seed, fightType, maxTime, "guildcardelay", nil, callBack)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
return this
|