From c55aad07df990170da525b56cf89bbf7dc3f0325 Mon Sep 17 00:00:00 2001 From: ZhangBiao Date: Fri, 9 Oct 2020 18:59:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8D=90=E7=8C=AE=E9=95=BF=E6=8C=89=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/DynamicActivity/SheJiDaDian.lua | 61 +++++++++++++++---- 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/DynamicActivity/SheJiDaDian.lua b/Assets/ManagedResources/~Lua/Modules/DynamicActivity/SheJiDaDian.lua index e184e90639..29eea93af9 100644 --- a/Assets/ManagedResources/~Lua/Modules/DynamicActivity/SheJiDaDian.lua +++ b/Assets/ManagedResources/~Lua/Modules/DynamicActivity/SheJiDaDian.lua @@ -7,6 +7,10 @@ local ActInfo={} local numList = {} local btnAddList = {} local donateList = {} +local triggerList = {} +local isLongPress = false +local isPress = false +local numCount = 0 function this:ctor(mainPanel, gameObject) this.mainPanel = mainPanel.transform @@ -61,6 +65,9 @@ function this:InitComponent(gameObject) numList[i] = Util.GetGameObject(this.items,"item"..i.."/text/num"):GetComponent("Text") btnAddList[i] = Util.GetGameObject(this.items,"item"..i.."/btnAdd") donateList[i] = Util.GetGameObject(this.items,"item"..i.."/Image") + triggerList[i] = Util.GetEventTriggerListener(donateList[i]) + triggerList[i].onPointerDown = triggerList[i].onPointerDown + this.OnPointerDown + triggerList[i].onPointerUp = triggerList[i].onPointerUp + this.OnPointerUp end end @@ -112,12 +119,6 @@ function SheJiDaDian:BindEvent() Util.AddOnceClick(btnAddList[i],function () PopupTipPanel.ShowTip("跳转到珍奇宝阁") end) - Util.AddOnceClick(donateList[i],function () - PopupTipPanel.ShowTip("捐献") - end) - Util.AddLongPressClick(donateList[i], function() - PopupTipPanel.ShowTip("捐献献献献献献献献献献献献") - end, 0.3) end end @@ -125,6 +126,7 @@ end function this:OnShow(sortingOrder,_parent) parent = _parent orginLayer = sortingOrder + FixedUpdateBeat:Add(this.OnUpdate, this)--长按方法注册 this:Refresh() end @@ -138,6 +140,34 @@ function this:Refresh() end +function this.OnPointerDown(Pointgo,data)--按下 + numCount = 0 + isLongPress = true + +end +function this.OnPointerUp(Pointgo,data)--抬起 + if isPress then + PopupTipPanel.ShowTip("捐献") + end + isLongPress = false + isPress = false +end + +--升级处理 +function this.OnUpdate() + if isLongPress then + numCount = numCount + 1 + if numCount > 20 then + PopupTipPanel.ShowTip("捐献献献献献献献献献献献") + isPress = false + else + if not isPress then + isPress = true + end + end + end +end + function this:LeftUpShow(ActInfo,_curRankType) local allRankData,myRankData,rankType if _curRankType then @@ -185,13 +215,13 @@ function this:TimeCountDown(ActInfo) local giftTime=CalculateSecondsNowTo_N_OClock(5)--领取按钮的倒计时 this.centerTime.text = TimeToFelaxible(giftTime) - this.timer = Timer.New(function() + this.timer1 = Timer.New(function() this.leftTime.text = Language[10028]..TimeToFelaxible(actTime) this.centerTime.text = TimeToFelaxible(giftTime) if actTime < 1 then - this.timer:Stop() - this.timer = nil + this.timer1:Stop() + this.timer1 = nil parent:ClosePanel() return end @@ -201,7 +231,7 @@ function this:TimeCountDown(ActInfo) actTime = actTime -1 giftTime = giftTime - 1 end, 1, -1, true) - this.timer:Start() + this.timer1:Start() end function this:OnSortingOrderChange(_sortingOrder) @@ -209,10 +239,15 @@ function this:OnSortingOrderChange(_sortingOrder) end function this:OnHide() - if this.timer then - this.timer:Stop() - this.timer = nil + FixedUpdateBeat:Remove(this.OnUpdate, this) + if this.timer1 then + this.timer1:Stop() + this.timer1 = nil end + -- if this.timer2 then + -- this.timer2:Stop() + -- this.timer2 = nil + -- end if this.shopView then this.shopView = SubUIManager.Close(this.shopView) this.shopView = nil