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

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
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

View File

@ -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)
-- this.bgTime:SetActive(curValue<maxValue)
if this.timer then
this.timer:Stop()
end
this.timer = nil
this.actCountTime.text = ""
-- 初始化是判断一次
if curValue<maxValue then
-- 启动倒计时
this.timer = Timer.New(function ()
local leftTime = AutoRecoverManager.GetRecoverTime(UpViewRechargeType.YunYouVle)
if leftTime<=0 then
BagManager.bagDatas[UpViewRechargeType.YunYouVle].num=BagManager.bagDatas[UpViewRechargeType.YunYouVle].num+1
this.UpdateYunYouVleShow()
end
if 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()

View File

@ -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)
-- this.bgTime:SetActive(curValue<maxValue)
if this.timer then
this.timer:Stop()
end
this.timer = nil
this.actCountTime.text = ""
-- 初始化是判断一次
if curValue<maxValue then
-- 启动倒计时
this.timer = Timer.New(function ()
local leftTime = AutoRecoverManager.GetRecoverTime(UpViewRechargeType.YunYouVle)
if leftTime<=0 then
this.UpdateYunYouVleShow()
end
if 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()