From ea52d01112eabdef51c4c2bc8d329d9812641229 Mon Sep 17 00:00:00 2001 From: jiaoyangna <3046463818@qq.com> Date: Mon, 27 Sep 2021 17:26:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A5=BD=E6=84=9F=E5=BA=A6=E6=96=B0=E6=89=8B?= =?UTF-8?q?=E5=BC=95=E5=AF=BC=E4=BF=AE=E6=94=B9=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Guide/GuidePanel.lua | 25 ++++++++ .../Likability/HeroLikeAbilityPanel.lua | 59 ++++++++++--------- .../Modules/Likability/LikabilityManager.lua | 2 - 3 files changed, 55 insertions(+), 31 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Guide/GuidePanel.lua b/Assets/ManagedResources/~Lua/Modules/Guide/GuidePanel.lua index b2a9793395..2d49000f4f 100644 --- a/Assets/ManagedResources/~Lua/Modules/Guide/GuidePanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Guide/GuidePanel.lua @@ -471,6 +471,31 @@ function this.ExecuteBehavior(beType, beArgs) Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnUpdateData, OnUpdateData) end Game.GlobalEvent:AddEvent(GameEvent.UI.OnUpdateData, OnUpdateData) + elseif beType == 17 then + local HeroLikeAbilityPanel = UIManager.GetOpenPanel(UIName.HeroLikeAbilityPanel) + this.button:GetComponent("Button").onClick:RemoveAllListeners() + local _trigger = Util.GetEventTriggerListener(this.button) + local startFunc + local endFunc + local timePressStarted + _trigger.onPointerDown = _trigger.onPointerDown + HeroLikeAbilityPanel.OnPointerDo + startFunc = function() + timePressStarted = Time.realtimeSinceStartup + end + _trigger.onPointerDown = _trigger.onPointerDown + startFunc + + _trigger.onPointerUp = _trigger.onPointerUp + HeroLikeAbilityPanel.OnPointerUp + endFunc = function() + _trigger.onPointerDown = _trigger.onPointerDown - HeroLikeAbilityPanel.OnPointerDo + _trigger.onPointerDown = _trigger.onPointerDown - startFunc + _trigger.onPointerUp = _trigger.onPointerUp - HeroLikeAbilityPanel.OnPointerUp + _trigger.onPointerUp = _trigger.onPointerUp - endFunc + this.NextGuide() + this.button:GetComponent("Button").onClick:RemoveAllListeners() + Util.AddClick(this.button, this.NextGuide) + end + _trigger.onPointerUp = _trigger.onPointerUp + endFunc + this.SetBtnGOPosition(HeroLikeAbilityPanel.giveBtn.gameObject:GetComponent("RectTransform").position) end end diff --git a/Assets/ManagedResources/~Lua/Modules/Likability/HeroLikeAbilityPanel.lua b/Assets/ManagedResources/~Lua/Modules/Likability/HeroLikeAbilityPanel.lua index bdcf6ac4e7..83137969aa 100644 --- a/Assets/ManagedResources/~Lua/Modules/Likability/HeroLikeAbilityPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Likability/HeroLikeAbilityPanel.lua @@ -63,6 +63,7 @@ function HeroLikeAbilityPanel:InitComponent() self.giveBtn = Util.GetGameObject(self.transform, "giveBtn") self.trigger = Util.GetEventTriggerListener(self.giveBtn) + self.OnPointerDo = function(go, data) self:OnPointerDown1(go, data) end @@ -80,10 +81,6 @@ function HeroLikeAbilityPanel:OnPointerDown1(go, data) self.effect.gameObject:SetActive(false) self.num = 0 self.numCount = 0 - LogGreen(curselectId) - if not curselectId or not self.itemListNum[curselectId] then - return - end if LikabilityManager.CheckIsMaxLv(curHeroData.Id) then PopupTipPanel.ShowTip("神将好感度最达最佳,无需更多赠予~") return @@ -92,6 +89,10 @@ function HeroLikeAbilityPanel:OnPointerDown1(go, data) PopupTipPanel.ShowTip("今日赠予次数已用尽~") return end + if not curselectId or not self.itemListNum[curselectId] then + PopupTipPanel.ShowTip("礼物数量不足,无法赠予~") + return + end if self.itemListNum[curselectId] < 1 then PopupTipPanel.ShowTip("礼物数量不足,无法赠予~") return @@ -186,32 +187,32 @@ function HeroLikeAbilityPanel:BindEvent() UIManager.OpenPanel(UIName.RoleLikeabilityPopup,curHeroData) end) - --查看 - Util.AddClick(self.giveBtn, function() - self.effect.gameObject:SetActive(false) - self.num = 0 - self.numCount = 0 - LogGreen(curselectId) + -- --查看 + -- Util.AddClick(self.giveBtn, function() + -- self.effect.gameObject:SetActive(false) + -- self.num = 0 + -- self.numCount = 0 + -- LogGreen(curselectId) - if LikabilityManager.CheckIsMaxLv(curHeroData.Id) then - PopupTipPanel.ShowTip("神将好感度最达最佳,无需更多赠予~") - return - end - if LikabilityManager.GetRemainTimes() < 1 then - PopupTipPanel.ShowTip("今日赠予次数已用尽~") - return - end - if not curselectId or not self.itemListNum[curselectId] then - PopupTipPanel.ShowTip("礼物数量不足,无法赠予~") - return - end - if self.itemListNum[curselectId] < 1 then - PopupTipPanel.ShowTip("礼物数量不足,无法赠予~") - return - end - self.isShortPress = true - self:Refresh(true) - end) + -- if LikabilityManager.CheckIsMaxLv(curHeroData.Id) then + -- PopupTipPanel.ShowTip("神将好感度最达最佳,无需更多赠予~") + -- return + -- end + -- if LikabilityManager.GetRemainTimes() < 1 then + -- PopupTipPanel.ShowTip("今日赠予次数已用尽~") + -- return + -- end + -- if not curselectId or not self.itemListNum[curselectId] then + -- PopupTipPanel.ShowTip("礼物数量不足,无法赠予~") + -- return + -- end + -- if self.itemListNum[curselectId] < 1 then + -- PopupTipPanel.ShowTip("礼物数量不足,无法赠予~") + -- return + -- end + -- self.isShortPress = true + -- self:Refresh(true) + -- end) end --添加事件监听(用于子类重写) function HeroLikeAbilityPanel:AddListener() diff --git a/Assets/ManagedResources/~Lua/Modules/Likability/LikabilityManager.lua b/Assets/ManagedResources/~Lua/Modules/Likability/LikabilityManager.lua index 5188a85b47..e4963c2f0d 100644 --- a/Assets/ManagedResources/~Lua/Modules/Likability/LikabilityManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Likability/LikabilityManager.lua @@ -428,13 +428,11 @@ function this.SetProvalue(prolist,proType,tag,nextLv,indexType,_color) end end else - LogGreen("k:"..k) local config = ConfigManager.TryGetConfigDataByKey(ConfigName.PrivilegeTypeConfig,"PrivilegeType",k) if config then str1 = string.format(config.Name,string.format("%s\n",_color,GetEquipPropertyFormatStr(config.IfFloat, v))) end end - LogGreen("str1:"..str1) table.insert(newProList,str1) end str = string.format(tag,color1,(newProList[1] or ""),(newProList[2] or ""))