parent
fa24af770b
commit
3262a6203c
|
@ -11,7 +11,6 @@ local canGetRewardList = {} --可领取的宝箱
|
|||
|
||||
local isPressed = false--是否按下
|
||||
local isShortPress = false--点击捐献
|
||||
local trigger = false --道具不足的trigger
|
||||
local t = 20 --用来区分长按和点击的临界值
|
||||
|
||||
local curItemIndex = nil
|
||||
|
@ -180,7 +179,6 @@ end
|
|||
|
||||
--刷新整个页面
|
||||
function this:Refresh()
|
||||
trigger = false
|
||||
this.effect:SetActive(true)
|
||||
this.effect2:SetActive(false)
|
||||
|
||||
|
@ -190,7 +188,7 @@ function this:Refresh()
|
|||
this:RefreshItemsData()
|
||||
this:TimeCountDown()--时间
|
||||
this:LeftUpShow()
|
||||
this:RefreshBottom()--刷新下部数字
|
||||
this:RefreshBottom1()--刷新下部数字
|
||||
this:RefreshRewardBox()--刷新奖励宝箱数据
|
||||
end
|
||||
|
||||
|
@ -230,6 +228,10 @@ function this.OnPointerDown(Pointgo,data,i)--按下
|
|||
return
|
||||
end
|
||||
curItemIndex = i
|
||||
if itemData[i].leftNum == 0 then
|
||||
PopupTipPanel.ShowTip(Language[11197])
|
||||
return
|
||||
end
|
||||
numCount = 1
|
||||
isPressed = true
|
||||
end
|
||||
|
@ -237,10 +239,13 @@ function this.OnPointerUp(Pointgo,data)--抬起
|
|||
if PlayerManager.level < 50 or PlayerManager.familyId == 0 then
|
||||
return
|
||||
end
|
||||
if itemData[curItemIndex].leftNum == 0 then
|
||||
return
|
||||
end
|
||||
if isShortPress then
|
||||
numCount = 1
|
||||
this:RefreshBottom(numCount)
|
||||
this:RequestDonate(numCount)
|
||||
this:RefreshBottom1()
|
||||
else
|
||||
if itemData[curItemIndex].leftNum > 0 then
|
||||
this:RequestDonate(numCount-t)
|
||||
|
@ -251,15 +256,13 @@ function this.OnPointerUp(Pointgo,data)--抬起
|
|||
end
|
||||
function this.OnUpdate()
|
||||
if isPressed then
|
||||
numCount = numCount + 1
|
||||
if numCount > t then
|
||||
isShortPress = false
|
||||
this:RefreshBottom(numCount-t)
|
||||
this:RefreshBottom2(numCount-t)
|
||||
else
|
||||
if not isShortPress then
|
||||
isShortPress = true
|
||||
end
|
||||
end
|
||||
numCount = numCount + 1
|
||||
end
|
||||
end
|
||||
--发送捐献请求
|
||||
|
@ -268,17 +271,11 @@ function this:RequestDonate(numCount)
|
|||
PopupTipPanel.ShowTip(Language[11197])
|
||||
return
|
||||
end
|
||||
if trigger and numCount == 1 then
|
||||
trigger = false
|
||||
this:Refresh()
|
||||
else
|
||||
NetManager.SheJiDonateItemRequest(itemData[curItemIndex].id,numCount,function()
|
||||
PopupTipPanel.ShowTip("成功献出"..(itemData[curItemIndex].value * numCount).."点贡献!")
|
||||
trigger = false
|
||||
this:Refresh()
|
||||
CheckRedPointStatus(RedPointType.Celebration)
|
||||
end)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
@ -305,34 +302,33 @@ function this:LeftUpShow(_curRankType)
|
|||
this.thirdName.text = allRankData[3] and allRankData[3].guildName or Language[11073]
|
||||
end
|
||||
local t = myRankData.param1 > 0 and myRankData.param1 or 0
|
||||
-- LogPink("t:"..t)
|
||||
-- LogPink("ActInfo.mission[1].progress :"..ActInfo.mission[1].progress )
|
||||
this.score.text = curRankType == RANK_TYPE.GOLD_EXPER and t or ActInfo.mission[1].progress
|
||||
myRank = myRankData.rank
|
||||
end)
|
||||
end
|
||||
|
||||
--刷新进度条和剩余数量
|
||||
function this:RefreshBottom(num)
|
||||
local score = 0
|
||||
if num == nil then--初始、刷新进度条显示
|
||||
num = 0
|
||||
--刷新一次
|
||||
function this:RefreshBottom1()
|
||||
for i = 1, 3 do
|
||||
itemData[i].num.text = itemData[i].leftNum
|
||||
end
|
||||
this.scoreText.text = (curScore%(actReward[1].Values[2][1])).."/"..actReward[1].Values[2][1]
|
||||
else--实时更新进度条
|
||||
this.scoreText.text = ((curScore)%(actReward[1].Values[2][1])).."/"..actReward[1].Values[2][1]
|
||||
this.value.value = (((curScore))%(actReward[1].Values[2][1]))/actReward[1].Values[2][1]
|
||||
this.level.text = math.floor((curScore)/(actReward[1].Values[2][1])) .. Language[10072]
|
||||
end
|
||||
|
||||
--刷新进度条和剩余数量
|
||||
function this:RefreshBottom2(num)
|
||||
local score = 0
|
||||
--实时更新进度条
|
||||
--要判断是否还有道具进行捐献
|
||||
if itemData[curItemIndex].leftNum - num < 0 then
|
||||
this:RequestDonate(num - 1)
|
||||
trigger = true
|
||||
if itemData[curItemIndex].leftNum - num <= 0 then
|
||||
isPressed = false
|
||||
-- return
|
||||
this:RequestDonate(num)
|
||||
end
|
||||
itemData[curItemIndex].num.text = itemData[curItemIndex].leftNum - num
|
||||
score = itemData[curItemIndex].value * num
|
||||
this.scoreText.text = ((curScore + score)%(actReward[1].Values[2][1])).."/"..actReward[1].Values[2][1]
|
||||
end
|
||||
this.value.value = (((curScore + score))%(actReward[1].Values[2][1]))/actReward[1].Values[2][1]
|
||||
this.level.text = math.floor((curScore + score)/(actReward[1].Values[2][1])) .. Language[10072]
|
||||
end
|
||||
|
@ -362,13 +358,6 @@ function this:TimeCountDown()
|
|||
local t1 = GetTimeStamp() - Today_N_OClockTimeStamp(setting.TimePointList[1])
|
||||
local t2 = GetTimeStamp() - Today_N_OClockTimeStamp(setting.TimePointList[2])
|
||||
|
||||
-- LogGreen("dao 12 dian:"..t1)
|
||||
-- LogGreen("dao 20 dian:"..t2)
|
||||
-- LogGreen("ActInfo.value:"..ActInfo.value)
|
||||
-- LogGreen("GetTimeStamp():"..GetTimeStamp())
|
||||
-- LogGreen("GetTimeStamp() - ActInfo.value"..(GetTimeStamp() - ActInfo.value))
|
||||
-- LogGreen("giftTime:"..giftTime)
|
||||
|
||||
if ActInfo.value == 0 then
|
||||
if (t1 > 0 and t1 < 1800) or (t2 > 0 and t2 < 1800) then
|
||||
canGet = true
|
||||
|
@ -386,9 +375,6 @@ function this:TimeCountDown()
|
|||
canGet = false
|
||||
end
|
||||
end
|
||||
-- LogGreen("canGet:"..tostring(canGet))
|
||||
|
||||
|
||||
|
||||
this.centerTime.text = canGet == false and TimeToFelaxible(giftTime) or Language[12183]
|
||||
|
||||
|
|
Loading…
Reference in New Issue