From b7c51cbf480688e1f048cd5ea5354d3faedccfcb Mon Sep 17 00:00:00 2001 From: ZhangBiao Date: Thu, 25 Mar 2021 16:05:57 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=89=9B=E6=B0=94=E5=86=B2=E5=A4=A9?= =?UTF-8?q?=E3=80=91=E7=BA=A2=E7=82=B9bug=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit af8f9e0f409980ed6c85b205cb2c0503b4c9e301) --- .../NiuQiChongTian/NiuQiChongTianPanel.lua | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/NiuQiChongTian/NiuQiChongTianPanel.lua b/Assets/ManagedResources/~Lua/Modules/NiuQiChongTian/NiuQiChongTianPanel.lua index 617c5b8baf..4a3edbb3cd 100644 --- a/Assets/ManagedResources/~Lua/Modules/NiuQiChongTian/NiuQiChongTianPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/NiuQiChongTian/NiuQiChongTianPanel.lua @@ -13,9 +13,9 @@ local curPage = 1 local redPointList = {} local TabBox = require("Modules/Common/TabBox") -local _TabData={ [1] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "诸神" }, - [2] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "地煞" }, - [3] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "天罡" },} +local _TabData={ [1] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "诸神" ,rpType = RedPointType.NiuQiChongTian_1}, + [2] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "地煞" ,rpType = RedPointType.NiuQiChongTian_2}, + [3] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "天罡" ,rpType = RedPointType.NiuQiChongTian_3},} local _TabFontColor = { default = Color.New(130 / 255, 128 / 255, 120 / 255, 1), select = Color.New(243 / 255, 235 / 255, 202 / 255, 1)} local curIndex = 1 @@ -86,8 +86,14 @@ end -- tab节点显示自定义 function this.TabAdapter(tab, index, status) local tabLab = Util.GetGameObject(tab, "Text") - redPointList[index] = Util.GetGameObject(tab, "Redpot") - BindRedPointObject(RedPointType.NiuQiChongTian + index,redPointList[index]) + local redPoint = Util.GetGameObject(tab, "Redpot") + if _TabData[index].rpType > 0 then + if redPointList[_TabData[index].rpType] then + ClearRedPointObject(_TabData[index].rpType, redPointList[_TabData[index].rpType]) + end + BindRedPointObject(_TabData[index].rpType,redPoint) + redPointList[_TabData[index].rpType] = redPoint + end Util.GetGameObject(tab,"Image"):GetComponent("Image").sprite = Util.LoadSprite(_TabData[index][status]) tabLab:GetComponent("Text").text = _TabData[index].name tabLab:GetComponent("Text").color = _TabFontColor[status] @@ -199,8 +205,8 @@ end --界面关闭时调用(用于子类重写) function NiuQiChongTian:OnClose() - for i = 1, 3 do - ClearRedPointObject(RedPointType.NiuQiChongTian + i, redPointList[i]) + for key, value in pairs(redPointList) do + ClearRedPointObject(key, value) end redPointList = {} end