local GuildWar_Controller = {} local private = {} local EventSystem = require('Event/EventSystem') local chat_pb = require("Proto/chat_pb") local guild_war_enum = require 'Proto/guild_war_enum_pb' local isShowFirstRemind = false local isShowSecondRemind = false local SECOND_BATTLE_SINCE_START = 990 local FIRST_PREVIEW_DURATION = DataSheetManager.ConstData:GetDataByID("GuildWarCrossSeverForecast1").IntValue + DataSheetManager.ConstData:GetDataByID("GuildWarCrossSeverForecast2").IntValue - 1 local GROUPCHANGE_PREVIEW_DURATION = DataSheetManager.ConstData:GetDataByID("GuildWarCrossSeverGroupChangeForecast1").IntValue + DataSheetManager.ConstData:GetDataByID("GuildWarCrossSeverGroupChangeForecast2").IntValue - 1 GuildWar_Controller.GroupName = { [guild_war_enum.Peak] = "IDS_GuildWar_Group1", -- 无双组 [guild_war_enum.king] = "IDS_GuildWar_Group2", -- 巅峰组 [guild_war_enum.Elite] = "IDS_GuildWar_Group3", -- 王者组 [guild_war_enum.Combat] = "IDS_GuildWar_Group4", -- 精英组 [guild_war_enum.Leisure] = "IDS_GuildWar_Group5", -- 休闲组 } local GUILDWAR_TIPS_TYPE_CHONGCHE = 1 local GUILDWAR_TIPS_TYPE_BOMB = 2 local GUILDWAR_TIPS_TYPE_SCORE = 3 local guildwarTipsTypeShow = {} function GuildWar_Controller.OnStartup() EventSystem.Regist(EventID.UI_GuildWarSelfDead, GuildWar_Controller.OnSelfDead) EventSystem.Regist(EventID.UI_GuildWarTips_Help, private.ShowTips_Help) EventSystem.Regist(EventID.GuildWar_KnockCarBorn, private.OnKnockCarBorn) EventSystem.Regist(EventID.GuildWar_DragonBorn, private.OnDragonBorn) EventSystem.Regist(EventID.GuildWar_DragonDisappear, private.OnDragonDisappear) EventSystem.Regist(EventID.TimerWheelEndTimeOver, GuildWar_Controller.SetActivityRedPoint) EventSystem.Regist(EventID.UI_ShowCommonCommandTips, private.ShowCommonCommandTips) EventSystem.Regist(EventID.UI_ShowGuildWarTips, private.ShowGuildWarTips) end function GuildWar_Controller.OpenMainView() if MDL.Guild.IsHasGuild() then UIManager.OpenView(Const_UI_Lua.UIEnum.UIGuildWarMain) else CTL.Sound.PlayGameSound("UI_invalid") CTL.Tips.AddTipsMsg(Const_IDS.IDS_ERRORCODE_1319_InfoCode_Guild_PlayerNotInGuild) CTL.Guild.OpenGuildMain() end end function GuildWar_Controller.OnShutDown() MDL.GuildWar.ResetVolume() end function GuildWar_Controller.GetCountDownTimeBySecondBattleInfo() local info = MDL.GuildWar.GetWarInfo() local battleInfo = MDL.GuildWar.GetBattleInfo() local countDownTimeBySecond local isDuringFirstTrailer = info.fightStage == MDL.GuildWar.FightStages.FirstFighting or info.fightStage == MDL.GuildWar.FightStages.FirstPrepare local isDuringSecondTrailer = info.fightStage == MDL.GuildWar.FightStages.FirstEnd or info.fightStage == MDL.GuildWar.FightStages.SecondPrepare if info.Stage == MDL.GuildWar.Stages.StageTypeBattle then countDownTimeBySecond = info.battleOpenTime + SECOND_BATTLE_SINCE_START - UTL.Time.GetServerTimestamp() local isPassed = battleInfo.enemyCamp.guildInfo and string.isNilOrEmpty(battleInfo.enemyCamp.guildInfo.guildId) if isDuringFirstTrailer then if isPassed or info.isLeave then return true, countDownTimeBySecond end elseif isDuringSecondTrailer then return true, countDownTimeBySecond end end return false, nil end function GuildWar_Controller.IsDuringFirstFight() local info = MDL.GuildWar.GetWarInfo() return info.Stage == MDL.GuildWar.Stages.StageTypeBattle and info.fightStage == MDL.GuildWar.FightStages.FirstFighting end function GuildWar_Controller.CalNextStageTime(info) EventSystem.Dispatch(EventID.UI_GuildWarStageUpdate) local value = info.endTime - UTL.Time.GetServerTimestamp() if value > 0 then TimerUtil.Interval(MDL.GuildWar.SendGetGuildWarInfo, value + 1,1) end if MDL.Guild.IsHasGuild() and info.Stage == MDL.GuildWar.Stages.StageTypeBattle and info.fightStage ~= MDL.GuildWar.FightStages.SecondEnd then if CTL.Activities.IsInActivitySpecificLevel() then private.OpenRemind() end CTL.HomeMain.AddTownHomeDelayFunc(private.OpenRemind) --Const_UI_Lua.UIEnum.UIActivitiesRemind,{LuaConst.ActivityType.GuildWar} end GuildWar_Controller.SetActivityRedPoint() end function private.OpenRemind() local info = MDL.GuildWar.GetWarInfo() if MDL.Guild.IsHasGuild() and info.Stage == MDL.GuildWar.Stages.StageTypeBattle and info.fightStage ~= MDL.GuildWar.FightStages.SecondEnd then if (info.fightStage == MDL.GuildWar.FightStages.FirstPrepare or info.fightStage == MDL.GuildWar.FightStages.FirstFighting ) and not isShowFirstRemind then local battleInfo = MDL.GuildWar.GetBattleInfo() if battleInfo.enemyCamp.guildInfo and not string.isNilOrEmpty(battleInfo.enemyCamp.guildInfo.guildId) then UIManager.OpenView(Const_UI_Lua.UIEnum.UIActivitiesRemind, {LuaConst.ActivityType.GuildWar}) end isShowFirstRemind = true elseif (info.fightStage == MDL.GuildWar.FightStages.SecondPrepare or info.fightStage == MDL.GuildWar.FightStages.SecondFighting ) and not isShowSecondRemind then local battleInfo = MDL.GuildWar.GetBattleInfo() if battleInfo.enemyCamp.guildInfo and not string.isNilOrEmpty(battleInfo.enemyCamp.guildInfo.guildId) then UIManager.OpenView(Const_UI_Lua.UIEnum.UIActivitiesRemind, {LuaConst.ActivityType.GuildWar}) end isShowSecondRemind = true end end end --由于线上偶尔报玩家没打开复活界面 不能复活加一些日志和容错处理 function GuildWar_Controller.OnSelfDead(info) CTL.Sound.PlayGameSound("SFX_die") --如果死亡了又收到一次死亡事件 if private.ReviveViewHandle ~= nil then logging.error(LTAG.ERROR,"[GuildWarReviveError] Interval already existed") TimerUtil.Remove(private.ReviveViewHandle) end private.ReviveViewHandle = TimerUtil.Interval(function () private.ReviveViewHandle = nil CTL.HomeMain.CloseOpenView() UIManager.OpenView(Const_UI_Lua.UIEnum.UIGuildWarRevive, info) end, 3, 1) ---死亡3秒之后打开复活选将界面 --每隔四秒检测一下死亡界面是否打开 如果没打开 带一下 if private.checkReviveHandle then TimerUtil.Remove(private.checkReviveHandle) end private.checkReviveHandle = TimerUtil.Interval(function () local isDead = BattleDataGetter.GetCurEntity() == nil or not BattleDataGetter.GetCurEntity():IsAlive() if isDead and not UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UIGuildWarRevive) then logging.error(LTAG.ERROR,"[GuildWarReviveError] CheckReviveHandle Open View") UIManager.OpenView(Const_UI_Lua.UIEnum.UIGuildWarRevive, info) TimerUtil.Remove(private.checkReviveHandle) private.checkReviveHandle = nil end end, 4, 3) end function GuildWar_Controller.IsCanSignup() if MDL.Guild.IsHasGuild() then local isEndTrialRun = MDL.Guild.GetMyGuildInfo().isEndTriaRun local activeness = MDL.Guild.GetMyGuildInfo().activeness local activityValueLimit = DataSheetManager.ConstData:GetDataByID("GuildWarGuildActivityValueLimit").IntValue return isEndTrialRun and activeness > activityValueLimit end return false end function GuildWar_Controller.CloseAllFuncPanel() UIManager.CloseView(Const_UI_Lua.UIEnum.UIGuildWarRewardIntroduction) UIManager.CloseView(Const_UI_Lua.UIEnum.UIGuildWarPastScoreList) UIManager.CloseView(Const_UI_Lua.UIEnum.UIGuildWarWallOfFame) EventSystem.Dispatch(EventID.UI_CloseAndRecoverView, Const_UI_Lua.UIEnum.UIGuildBossMain) UIManager.CloseView(Const_UI_Lua.UIEnum.UIGuildWarArray) UIManager.CloseView(Const_UI_Lua.UIEnum.UIGuildWarMain) UIManager.CloseView(Const_UI_Lua.UIEnum.UIGuildWarPreparationMap) end function GuildWar_Controller.GetEditTime() local info = MDL.GuildWar.GetWarInfo() local guildWarPrepareDeadlineTime = DataSheetManager.ConstData:GetDataByID("GuildWarPrepareDeadlineTime").IntValue local guildWarPrepareEditTimeLimit = DataSheetManager.ConstData:GetDataByID("GuildWarPrepareEditTimeLimit").IntValue local totalValue = guildWarPrepareDeadlineTime + guildWarPrepareEditTimeLimit if info.endTime - UTL.Time.GetServerTimestamp() < totalValue then return info.endTime - UTL.Time.GetServerTimestamp() - guildWarPrepareDeadlineTime end return guildWarPrepareEditTimeLimit end function GuildWar_Controller.OpenBattleResView(data,mainHeroId,name) UIManager.OpenView(Const_UI_Lua.UIEnum.UIGuildWarPersonalData,{isChat = true, data = data.data ,mainHeroId = data.mainHeroId, name = data.name}) end function GuildWar_Controller.SetActivityRedPoint() local info = MDL.GuildWar.GetWarInfo() if MDL.Guild.IsHasGuild() and info.Stage == MDL.GuildWar.Stages.StageTypeBattle and info.fightStage ~= MDL.GuildWar.FightStages.SecondEnd and info.isSignUp then local time = MDL.RedPoint.GetRedPointTimeByType(MDL.RedPoint.RedPointType.GuildWar) if time and time>0 and info.battleOpenTime <= time then EventSystem.Dispatch(EventID.UI_Activity_Refresh_Single_RedPoint, LuaConst.ActivityType.GuildWar, false) return end EventSystem.Dispatch(EventID.UI_Activity_Refresh_Single_RedPoint, LuaConst.ActivityType.GuildWar, true) else EventSystem.Dispatch(EventID.UI_Activity_Refresh_Single_RedPoint, LuaConst.ActivityType.GuildWar, false) end end function GuildWar_Controller.OnGuildWarGetGuildInfo() if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.Guild) then local guildWarInfo = MDL.GuildWar.GetWarInfo() if guildWarInfo and guildWarInfo.Stage == MDL.GuildWar.Stages.StageTypeBattle and MDL.Guild.IsHasGuild() then if BattleDataGetter.IsGuildWarLevel() or BattleDataGetter.IsGuildWarWaitingArea() then --断线重连 下线再上 MDL.GuildWar.C2GGetGuildWarPrepareInfo() MDL.Guild.GetGuildInfoReq() end elseif guildWarInfo and guildWarInfo.issue<=1 and MDL.Guild.IsHasGuild() then --第一期 主界面有按钮 但是军团战依赖军团信息 需要先请求军团信息 MDL.Guild.GetGuildInfoReq() end end end --这里为了和结算 聊天显示 处理 统一数据结构显示 function GuildWar_Controller.OpenPersonalDataView(selfData,tagId) local guildWarBattleInfo = chat_pb.GuildWarBattleInfo() guildWarBattleInfo.score = selfData.score guildWarBattleInfo.killNum = selfData.killNum guildWarBattleInfo.continuousKilling = selfData.continuousKilling guildWarBattleInfo.assiantNum = selfData.assiantNum guildWarBattleInfo.seriousInjury = selfData.seriousInjury guildWarBattleInfo.occupycamp = selfData.occupycamp guildWarBattleInfo.killBoss = selfData.killBoss guildWarBattleInfo.wallDemage = selfData.wallDemage guildWarBattleInfo.handInResource = selfData.handInResource guildWarBattleInfo.gsSum = MDL.Player.GetLineUpGs() local k1,d1,a1,k2,d2,a2,k3,d3,a3 = BattleDataGetter.GetGuildWar_MySelfHeroRelaxKDA() if k1 == nil then k1,d1,a1,k2,d2,a2,k3,d3,a3 = 0,0,0,0,0,0,0,0,0 end local arrayId = MDL.Player.GetHeroLinUpIds() local kda1 = chat_pb.KDA() kda1.k = k1 kda1.d = d1 kda1.a = a1 kda1.heroId1 = arrayId[1] kda1.heroId2 = arrayId[2] local kda2 = chat_pb.KDA() kda2.k = k2 kda2.d = d2 kda2.a = a2 kda2.heroId1 = arrayId[3] kda2.heroId2 = arrayId[4] local kda3 = chat_pb.KDA() kda3.k = k3 kda3.d = d3 kda3.a = a3 kda3.heroId1 = arrayId[5] kda3.heroId2 = arrayId[6] table.insert(guildWarBattleInfo.kda,kda1) table.insert(guildWarBattleInfo.kda,kda2) table.insert(guildWarBattleInfo.kda,kda3) UIManager.OpenView(Const_UI_Lua.UIEnum.UIGuildWarPersonalData,{data = guildWarBattleInfo,tagId = tagId, mainHeroId = MDL.Player.GetCurShowId(), name = BattleDataGetter.GetPlayerName()}) end function GuildWar_Controller.BeginTips(onlyMiniMap) if BattleDataGetter.CheckCurLevelType(LuaConst.LevelType.SyncGuildWarMapResources) then -- 资源战场 if not onlyMiniMap then private.ShowTips_BattleReport(UIUtils.GetLocalizedTxt(Const_IDS["IDS_GuildWar_BattleReportText2"])) private.ShowTips_Help("IDS_GuildWar_BattleHelpText2") end local xMax, zMax, offsetX, offsetZ = BattleExt.GetCurMapInfo() private.ShowTips_MiniMap(xMax / 2 + offsetX , zMax / 2 + offsetZ) --【中心物资区域】 else -- 左中右战场 if not onlyMiniMap then private.ShowTips_BattleReport(UIUtils.GetLocalizedTxt(Const_IDS["IDS_GuildWar_BattleReportText1"])) private.ShowTips_Help("IDS_GuildWar_BattleHelpText1") end --投石车营地】、【撞车营地】、【敌方城门 for i, v in LevelItemManager.GetItemIterByType(LuaConst.LevelItemType.StrongHold) do local posX, posY = FP.tonumberV2(v.ItemData.ItemPos) private.ShowTips_MiniMap(posX, posY , v.LevelItemID) end local myCampid = BattleDataGetter.GetMyCampID() local baseMonster = LevelItemManager.GetMonsterByItemID(2001) if baseMonster and myCampid ~= baseMonster:GetCampID() then local posX, posY = FP.tonumberV2(baseMonster:GetLogicPos()) private.ShowTips_MiniMap(posX, posY , 2001 ) end local baseMonster2 = LevelItemManager.GetMonsterByItemID(2002) if baseMonster2 and myCampid ~= baseMonster2:GetCampID() then local posX, posY = FP.tonumberV2(baseMonster2:GetLogicPos()) private.ShowTips_MiniMap(posX, posY , 2002 ) end end end --这个是军团战说明信息时间格式化方法 返回值有 顺序敏感 改表后要改代码 -- 周三/周日20:00-20:30 desc1,timeStr1 -- 20:00-20:13 desc2,timeStr2 -- 20:15-20:28 desc3,timeStr3 -- 周二 desc4, timeStr4 -- 周六 desc5, timeStr5 -- 5:00 timeStr6 -- 5:00 timeStr6 -- 5:00-19:00 desc7,timeStr7 -- 19:00-19:55 desc7,timeStr7 function GuildWar_Controller.OpenGuildWarNoteView() local timeData = DataSheetManager.ActivityData:GetDataByID(LuaConst.ActivityType.GuildWar).Time_Table local desc1,timeStr1 = UTL.Time.GetDateDescAndTime(timeData) local desc2,timeStr2 = UTL.Time.GetDateDescAndTime({{StartTime = 1654,EndTime = 1655}}) local desc3,timeStr3 = UTL.Time.GetDateDescAndTime({{StartTime = 1656,EndTime = 1657}}) local desc4, timeStr4 = UTL.Time.GetDateDescAndTime({[1] = 1658}) local desc5, timeStr5 = UTL.Time.GetDateDescAndTime({[1] = 1659}) local desc6, timeStr6 = UTL.Time.GetDateDescAndTime({[1] = 1660}) local desc61, timeStr61 = UTL.Time.GetDateDescAndTime({[1] = 1661}) local desc7,timeStr7 = UTL.Time.GetDateDescAndTime({{StartTime = 1662,EndTime = 1663}}) local desc8,timeStr8 = UTL.Time.GetDateDescAndTime({{StartTime = 1664,EndTime = 1665}}) if GameAppInfo.IsJapanesePackage() then UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.GuildWar, params = {desc1..""..timeStr1, timeStr2,timeStr3,desc4 .. ""..timeStr4,desc5..""..timeStr5,desc6..""..timeStr6,desc61..""..timeStr61,timeStr7,timeStr8}}) else UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.GuildWar, params = {desc1.." "..timeStr1, timeStr2,timeStr3,desc4 .. " "..timeStr4,desc5.." "..timeStr5,desc6.." "..timeStr6,desc61.." "..timeStr61,timeStr7,timeStr8}}) end end --region------------------- 势力战跨服相关 -------------------------------------------- function GuildWar_Controller.IsFirstCrossServer() local crossInfo = MDL.GuildWar.GetCrossServerInfo() return crossInfo.noticeTime and crossInfo.noticeTime > 0 and crossInfo.isFirst end -- 跨服第一次预告节点之后 function GuildWar_Controller.IsCrossServerSettled() return MDL.GuildWar.GetWarInfo().isCross end -- 势力战跨服isCross为true 并且 势力战活动开始 function GuildWar_Controller.IsShowCrossServerUI() local activityTimeStamp = MDL.GuildWar.GetCrossServerInfo().startTime local guildWarInfo = MDL.GuildWar.GetWarInfo() -- 已定跨服活动开服时间 if activityTimeStamp and activityTimeStamp > 0 then if UTL.Time.GetServerTimestamp() < activityTimeStamp then return guildWarInfo.Stage >= MDL.GuildWar.Stages.StageTypeSignUp and guildWarInfo.isCross else return guildWarInfo.isCross end end return false end -- 是否处于跨服打脸图弹出阶段 function GuildWar_Controller.IsGuildWarCrossServerPushInterface() local crossInfo = MDL.GuildWar.GetCrossServerInfo() local duration = crossInfo.isFirst and FIRST_PREVIEW_DURATION or GROUPCHANGE_PREVIEW_DURATION local previewStartTimestamp = crossInfo.noticeTime if not previewStartTimestamp or previewStartTimestamp <= 0 then return false end local endTimestamp = previewStartTimestamp + UTL.Time.TotalSecondsOneDay * duration if UTL.Time.GetServerTimestamp() >= previewStartTimestamp and UTL.Time.GetServerTimestamp() <= endTimestamp then return true end return false end --endregion ---------------------------------------------------------------------------------------- -- 冲车出生 function private.OnKnockCarBorn(entity) local campID = entity:GetCampID() if campID == BattleDataGetter.GetMyCampID() then local str = UIUtils.GetLocalizedTxt(Const_IDS["IDS_GuildWar_BattleReportText7"]) private.ShowTips_BattleReport(str) else local str = UIUtils.GetLocalizedTxt(Const_IDS["IDS_GuildWar_BattleReportText8"]) private.ShowTips_BattleReport(str) end local posX, posY = FP.tonumberV2(entity:GetLogicPos()) private.ShowTips_MiniMap(posX, posY , nil , entity) end -- 大小龙出生 function private.OnDragonBorn(entity) if LogicUpdateManager.IsInReconnectFastPlay() then return end local nameIDS = entity:GetOriginCharacterData().MonsterNameIDS local str = string.FormatByIdsKey("IDS_GuildWar_BattleReportText10" , UIUtils.GetLocalizedTxt(Const_IDS[nameIDS])) private.ShowTips_BattleReport(str) local posX, posY = FP.tonumberV2(entity:GetLogicPos()) private.ShowTips_MiniMap(posX, posY , entity._logicInitData.OriginBornItemID , entity) end -- 大小龙自动消失了 (不是被打死!) function private.OnDragonDisappear(entity) if LogicUpdateManager.IsInReconnectFastPlay() then return end if LevelItemManager.Global:IsLevelFinished() then return end local nameIDS = entity:GetOriginCharacterData().MonsterNameIDS local str = string.FormatByIdsKey("IDS_GuildWar_BattleReportText13", UIUtils.GetLocalizedTxt(Const_IDS[nameIDS])) private.ShowTips_BattleReport(str) end -- 显示战报 function private.ShowTips_BattleReport(str) GuildWar_Controller.ShowTips_BattleReport(str) end function GuildWar_Controller.ShowTips_BattleReport(str) --print("战报:" ,str) UIManager.CloseView(Const_UI_Lua.UIEnum.UIDialogueTopReportView) UIManager.OpenView(Const_UI_Lua.UIEnum.UIDialogueTopReportView,{str = str}) end -- 显示小地图提示 function private.ShowTips_MiniMap(posx , posy , levelItemId , otherParam) --print("地图:" ) EventSystem.Dispatch(EventID.UI_MiniMapMain_ShowEffect, posx , posy , levelItemId , otherParam) end -- 显示帮助提示 function private.ShowTips_Help(ids) --print("帮助:" ,ids) CTL.Tips.AddHelpTips(Const_IDS[ids]) end function private.GetEquipBoxParam(...) local param = {} local count = select('#',...) for i = 1, count do local value = select(i,...) if value > 0 then table.insert(param, value .. "%") end end return table.unpack(param) end --势力战装备宝箱的描述需要等级自适应显示概率 function GuildWar_Controller.GetEquipBoxDesc(itemId) if GameAppInfo.IsOverseaPackage() and DataSheetManager.GuildEquipBoxShow:TryGetDataByID_Level(itemId) then local curLev = MDL.HeroSelect.GetTeamLevel() local targetData local lastData for i, v in DataSheetManager.GuildEquipBoxShow:GetDataByID_Level(itemId) do if curLev < v.Level then targetData = lastData break else lastData = v end end if targetData == nil then targetData = lastData end return string.FormatByIdsId(Const_IDS[targetData.EquipShow], private.GetEquipBoxParam(targetData.Probity1, targetData.Probity2, targetData.Probity3, targetData.Probity4)) end return nil end function private.ShowCommonCommandTips(data) UIManager.CloseView(Const_UI_Lua.UIEnum.UICommonComandView) UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonComandView, data) end function private.ShowGuildWarTips(tipIds, tipType) if guildwarTipsTypeShow[tipType] then return end UIManager.OpenView(Const_UI_Lua.UIEnum.UIGuildWarTips, {str = UIUtils.GetLocalizedTxt(tipIds) , tipType = tipType}) guildwarTipsTypeShow[tipType] = true end function GuildWar_Controller.OnCloseTipsView(tipType) guildwarTipsTypeShow[tipType] = false end function GuildWar_Controller.ShowResources(self, newNum, oldNum, paramsDict) if not paramsDict.isPlayIng then local addNum = newNum - oldNum if addNum == 0 then return end paramsDict.oldNum = oldNum paramsDict.newNum = newNum UIUtils.SetLabel(paramsDict.txt_Num, tostring(oldNum)) if addNum > 0 then UIUtils.SetLabel(paramsDict.Txt_AddNum, UTL.Color.FormatGreenColor("+"..tostring(addNum))) else UIUtils.SetLabel(paramsDict.Txt_AddNum, UTL.Color.FormatTextByColor("FFB02F", tostring(addNum))) end paramsDict.addNum = addNum paramsDict.isPlayIng = true UIUtils.SetActive(paramsDict.Txt_AddNum, true) self:StartRepeatFunc(paramsDict.updateFun, 0) else paramsDict.nexNewNum = newNum end end function GuildWar_Controller.ShowResourcesUpdateFun(deltaTime, timeSinceUpdate, paramsDict, self) --总动画时长1.5 0.5秒播放完数字变化 if timeSinceUpdate >= 1.5 then paramsDict.isPlayIng = nil if paramsDict.nexNewNum then local newNum = paramsDict.nexNewNum paramsDict.nexNewNum = nil GuildWar_Controller.ShowResources(self, newNum, paramsDict.newNum, paramsDict) end elseif timeSinceUpdate >= 0.5 then paramsDict.txt_Num.text = paramsDict.newNum UIUtils.SetActive(paramsDict.Txt_AddNum, false) elseif timeSinceUpdate <= 0.5 then local ratio = timeSinceUpdate / 0.5 paramsDict.txt_Num.text = math.ceil(paramsDict.oldNum + ratio * paramsDict.addNum) end end function GuildWar_Controller.RefreshShopRp(products, resources) local isHasJob = MDL.Guild.JobHasPermission(MDL.Guild.GetMyGuildInfo().jobTitle,MDL.Guild.AuthorityEnum.GuildWarCommander) if isHasJob then for i,v in DataSheetManager.GuildWarBattleShop:GetEnumerator() do for _, product in ipairs(products) do if product.productId == v.ID then if product.level < v.MaxNum and resources >= v.cost[ product.level + 1] then EventSystem.Dispatch(EventID.UI_GuildWarCanBuyNotify, true) MDL.GuildWar.SetCanBuyNotify(true) return end end end end end MDL.GuildWar.SetCanBuyNotify(false) EventSystem.Dispatch(EventID.UI_GuildWarCanBuyNotify, false) end return GuildWar_Controller