miduo_client/Assets/ManagedResources/~Lua/Modules/Guild/CarDelay/GuildCarDelayManager.lua

47 lines
1.9 KiB
Lua
Raw Normal View History

2020-05-09 13:31:21 +08:00
GuildCarDelayManager = {};
local this = GuildCarDelayManager
function this.Initialize()
end
--后端更新车迟进度
function this.SetProgressData(msg)
this.progress = msg.carDelayProgressIndication.progress--阶段 -1未开 1 挑战 2 空挡期 3抢夺
this.endTime = msg.carDelayProgressIndication.endTime--结束时间
this.bossIndexId = msg.carDelayProgressIndication.bossIndexId--boss索引id
this.battleStartTime = msg.carDelayProgressIndication.battleStartTime--挑战boss开启时间
this.grabStartTime = msg.carDelayProgressIndication.grabStartTime--抢夺开启时间
--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
elseif this.progress == 3 then
monsterId = this.heroDid
fightType = 1
type = 2
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