diff --git a/Assets/ManagedResources/~Lua/Modules/Player/AutoRecoverManager.lua b/Assets/ManagedResources/~Lua/Modules/Player/AutoRecoverManager.lua index e0365eeca4..a0edd19e56 100644 --- a/Assets/ManagedResources/~Lua/Modules/Player/AutoRecoverManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Player/AutoRecoverManager.lua @@ -85,14 +85,12 @@ local _TimeCheckFunc = { end if curCount < maxCount then local nextFreshTime = itemData.nextFlushTime - Log("云游值刷新时间:"..nextFreshTime) - local remationTime = nextFreshTime - PlayerManager.serverTime -- 下一次刷新的时间 - if remationTime<0 then - local timeInterval= GameSetting.ItemAdd[7][3] - BagManager.bagDatas[UpViewRechargeType.YunYouVle].num = BagManager.bagDatas[UpViewRechargeType.YunYouVle].num+1 - remationTime=timeInterval-(math.abs(remationTime)%timeInterval) + local remationTime = nextFreshTime - PlayerManager.serverTime -- 下一次刷新的时间 + if remationTime > 0 then + return remationTime end - return remationTime + -- 需要刷新数量 + return -2 else -- 数量已满返回 -1 return -1 end @@ -146,4 +144,17 @@ function AutoRecoverManager.GetRecoverTime(itemId) return _TimeCheckFunc[itemId]() end + + + + +function AutoRecoverManager.CostRecoverItem(itemId, num, maxNum) + if this.IsAutoRecover(itemId) then + local curCount = BagManager.GetItemCountById(itemId) + if curCount >= maxNum then + + end + end +end + return this \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoMapPanel.lua b/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoMapPanel.lua index 82b2f89dd0..183456f8d3 100644 --- a/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoMapPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoMapPanel.lua @@ -536,32 +536,27 @@ function this.ShowCountTime() local curValue=BagManager.GetItemCountById(UpViewRechargeType.YunYouVle) local maxValue=PrivilegeManager.GetPrivilegeNumber(39) this.costInfo.text=string.format("%d/%d",curValue,maxValue) - this.bgTime:SetActive(curValue=maxValue then - -- 回复满了,在地图外面可以停止计时器 - this.timer:Stop() - this.bgTime:SetActive(false) - else - this.actCountTime.text = GetTimeMaoHaoStrBySeconds(math.floor(leftTime)) - end - end, 1, -1, true) - this.timer:Start() - end + -- 启动倒计时 + this.timer = Timer.New(function () + local leftTime = AutoRecoverManager.GetRecoverTime(UpViewRechargeType.YunYouVle) + local curValue=BagManager.GetItemCountById(UpViewRechargeType.YunYouVle) + LogPink(curValue) + LogPink(maxValue) + if curValue>=maxValue then + -- 回复满了,在地图外面可以停止计时器 + this.actCountTime.text = "" + else + this.UpdateYunYouVleShow() + this.actCountTime.text = GetTimeMaoHaoStrBySeconds(math.floor(leftTime)) + end + end, 1, -1, true) + this.timer:Start() end function this.DownTime() diff --git a/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoYouPanel.lua b/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoYouPanel.lua index 1dc79cbbc9..d7d9a7cf50 100644 --- a/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoYouPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoYouPanel.lua @@ -196,31 +196,26 @@ function this.ShowCountTime() local maxValue=PrivilegeManager.GetPrivilegeNumber(39) LogGreen("curValue:"..curValue.." maxValue:"..maxValue) this.costInfo.text=string.format("%d/%d",curValue,maxValue) - this.bgTime:SetActive(curValue=maxValue then - -- 回复满了,在地图外面可以停止计时器 - this.timer:Stop() - this.bgTime:SetActive(false) - else - this.actCountTime.text = GetTimeMaoHaoStrBySeconds(math.floor(leftTime)) - end - end, 1, -1, true) - this.timer:Start() - end + -- 启动倒计时 + this.timer = Timer.New(function () + local leftTime = AutoRecoverManager.GetRecoverTime(UpViewRechargeType.YunYouVle) + local curValue=BagManager.GetItemCountById(UpViewRechargeType.YunYouVle) + if curValue>=maxValue then + -- 回复满了,在地图外面可以停止计时器 + this.actCountTime.text = "" + else + this.UpdateYunYouVleShow() + this.actCountTime.text = GetTimeMaoHaoStrBySeconds(math.floor(leftTime)) + end + end, 1, -1, true) + this.timer:Start() end --刷新云游值显示栏信息 function this.UpdateYunYouVleShow()