【逍遥游】云游值自动恢复修改

dev_chengFeng
gaoxin 2020-10-20 00:23:42 +08:00
parent d9434f425d
commit f57b10696f
3 changed files with 48 additions and 47 deletions

View File

@ -85,14 +85,12 @@ local _TimeCheckFunc = {
end end
if curCount < maxCount then if curCount < maxCount then
local nextFreshTime = itemData.nextFlushTime local nextFreshTime = itemData.nextFlushTime
Log("云游值刷新时间:"..nextFreshTime) local remationTime = nextFreshTime - PlayerManager.serverTime -- 下一次刷新的时间
local remationTime = nextFreshTime - PlayerManager.serverTime -- 下一次刷新的时间 if remationTime > 0 then
if remationTime<0 then return remationTime
local timeInterval= GameSetting.ItemAdd[7][3]
BagManager.bagDatas[UpViewRechargeType.YunYouVle].num = BagManager.bagDatas[UpViewRechargeType.YunYouVle].num+1
remationTime=timeInterval-(math.abs(remationTime)%timeInterval)
end end
return remationTime -- 需要刷新数量
return -2
else -- 数量已满返回 -1 else -- 数量已满返回 -1
return -1 return -1
end end
@ -146,4 +144,17 @@ function AutoRecoverManager.GetRecoverTime(itemId)
return _TimeCheckFunc[itemId]() return _TimeCheckFunc[itemId]()
end 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 return this

View File

@ -536,32 +536,27 @@ function this.ShowCountTime()
local curValue=BagManager.GetItemCountById(UpViewRechargeType.YunYouVle) local curValue=BagManager.GetItemCountById(UpViewRechargeType.YunYouVle)
local maxValue=PrivilegeManager.GetPrivilegeNumber(39) local maxValue=PrivilegeManager.GetPrivilegeNumber(39)
this.costInfo.text=string.format("%d/%d",curValue,maxValue) this.costInfo.text=string.format("%d/%d",curValue,maxValue)
this.bgTime:SetActive(curValue<maxValue) -- this.bgTime:SetActive(curValue<maxValue)
if this.timer then if this.timer then
this.timer:Stop() this.timer:Stop()
end end
this.timer = nil this.timer = nil
this.actCountTime.text = "" this.actCountTime.text = ""
-- 启动倒计时
-- 初始化是判断一次 this.timer = Timer.New(function ()
if curValue<maxValue then local leftTime = AutoRecoverManager.GetRecoverTime(UpViewRechargeType.YunYouVle)
-- 启动倒计时 local curValue=BagManager.GetItemCountById(UpViewRechargeType.YunYouVle)
this.timer = Timer.New(function () LogPink(curValue)
local leftTime = AutoRecoverManager.GetRecoverTime(UpViewRechargeType.YunYouVle) LogPink(maxValue)
if leftTime<=0 then if curValue>=maxValue then
BagManager.bagDatas[UpViewRechargeType.YunYouVle].num=BagManager.bagDatas[UpViewRechargeType.YunYouVle].num+1 -- 回复满了,在地图外面可以停止计时器
this.UpdateYunYouVleShow() this.actCountTime.text = ""
end else
if curValue>=maxValue then this.UpdateYunYouVleShow()
-- 回复满了,在地图外面可以停止计时器 this.actCountTime.text = GetTimeMaoHaoStrBySeconds(math.floor(leftTime))
this.timer:Stop() end
this.bgTime:SetActive(false) end, 1, -1, true)
else this.timer:Start()
this.actCountTime.text = GetTimeMaoHaoStrBySeconds(math.floor(leftTime))
end
end, 1, -1, true)
this.timer:Start()
end
end end
function this.DownTime() function this.DownTime()

View File

@ -196,31 +196,26 @@ function this.ShowCountTime()
local maxValue=PrivilegeManager.GetPrivilegeNumber(39) local maxValue=PrivilegeManager.GetPrivilegeNumber(39)
LogGreen("curValue:"..curValue.." maxValue:"..maxValue) LogGreen("curValue:"..curValue.." maxValue:"..maxValue)
this.costInfo.text=string.format("%d/%d",curValue,maxValue) this.costInfo.text=string.format("%d/%d",curValue,maxValue)
this.bgTime:SetActive(curValue<maxValue) -- this.bgTime:SetActive(curValue<maxValue)
if this.timer then if this.timer then
this.timer:Stop() this.timer:Stop()
end end
this.timer = nil this.timer = nil
this.actCountTime.text = "" this.actCountTime.text = ""
-- 初始化是判断一次 -- 启动倒计时
if curValue<maxValue then this.timer = Timer.New(function ()
-- 启动倒计时 local leftTime = AutoRecoverManager.GetRecoverTime(UpViewRechargeType.YunYouVle)
this.timer = Timer.New(function () local curValue=BagManager.GetItemCountById(UpViewRechargeType.YunYouVle)
local leftTime = AutoRecoverManager.GetRecoverTime(UpViewRechargeType.YunYouVle) if curValue>=maxValue then
if leftTime<=0 then -- 回复满了,在地图外面可以停止计时器
this.UpdateYunYouVleShow() this.actCountTime.text = ""
end else
if curValue>=maxValue then this.UpdateYunYouVleShow()
-- 回复满了,在地图外面可以停止计时器 this.actCountTime.text = GetTimeMaoHaoStrBySeconds(math.floor(leftTime))
this.timer:Stop() end
this.bgTime:SetActive(false) end, 1, -1, true)
else this.timer:Start()
this.actCountTime.text = GetTimeMaoHaoStrBySeconds(math.floor(leftTime))
end
end, 1, -1, true)
this.timer:Start()
end
end end
--刷新云游值显示栏信息 --刷新云游值显示栏信息
function this.UpdateYunYouVleShow() function this.UpdateYunYouVleShow()