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

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
local timeInterval= GameSetting.ItemAdd[7][3]
BagManager.bagDatas[UpViewRechargeType.YunYouVle].num = BagManager.bagDatas[UpViewRechargeType.YunYouVle].num+1
remationTime=timeInterval-(math.abs(remationTime)%timeInterval)
end
return remationTime return remationTime
end
-- 需要刷新数量
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 = ""
-- 初始化是判断一次
if curValue<maxValue then
-- 启动倒计时 -- 启动倒计时
this.timer = Timer.New(function () this.timer = Timer.New(function ()
local leftTime = AutoRecoverManager.GetRecoverTime(UpViewRechargeType.YunYouVle) local leftTime = AutoRecoverManager.GetRecoverTime(UpViewRechargeType.YunYouVle)
if leftTime<=0 then local curValue=BagManager.GetItemCountById(UpViewRechargeType.YunYouVle)
BagManager.bagDatas[UpViewRechargeType.YunYouVle].num=BagManager.bagDatas[UpViewRechargeType.YunYouVle].num+1 LogPink(curValue)
this.UpdateYunYouVleShow() LogPink(maxValue)
end
if curValue>=maxValue then if curValue>=maxValue then
-- 回复满了,在地图外面可以停止计时器 -- 回复满了,在地图外面可以停止计时器
this.timer:Stop() this.actCountTime.text = ""
this.bgTime:SetActive(false)
else else
this.UpdateYunYouVleShow()
this.actCountTime.text = GetTimeMaoHaoStrBySeconds(math.floor(leftTime)) this.actCountTime.text = GetTimeMaoHaoStrBySeconds(math.floor(leftTime))
end end
end, 1, -1, true) end, 1, -1, true)
this.timer:Start() 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 () this.timer = Timer.New(function ()
local leftTime = AutoRecoverManager.GetRecoverTime(UpViewRechargeType.YunYouVle) local leftTime = AutoRecoverManager.GetRecoverTime(UpViewRechargeType.YunYouVle)
if leftTime<=0 then local curValue=BagManager.GetItemCountById(UpViewRechargeType.YunYouVle)
this.UpdateYunYouVleShow()
end
if curValue>=maxValue then if curValue>=maxValue then
-- 回复满了,在地图外面可以停止计时器 -- 回复满了,在地图外面可以停止计时器
this.timer:Stop() this.actCountTime.text = ""
this.bgTime:SetActive(false)
else else
this.UpdateYunYouVleShow()
this.actCountTime.text = GetTimeMaoHaoStrBySeconds(math.floor(leftTime)) this.actCountTime.text = GetTimeMaoHaoStrBySeconds(math.floor(leftTime))
end end
end, 1, -1, true) end, 1, -1, true)
this.timer:Start() this.timer:Start()
end
end end
--刷新云游值显示栏信息 --刷新云游值显示栏信息
function this.UpdateYunYouVleShow() function this.UpdateYunYouVleShow()