From 88aa6a6cf33b0e1cbec30eb4edb9c9a40b139580 Mon Sep 17 00:00:00 2001 From: chenxi Date: Tue, 30 May 2023 15:58:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A2=8E=E7=89=87tips=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/tips/hero_fragment_tips.lua | 2 +- lua/app/userdata/hero/hero_data.lua | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/app/ui/tips/hero_fragment_tips.lua b/lua/app/ui/tips/hero_fragment_tips.lua index e1d6dc21..5c5053a1 100644 --- a/lua/app/ui/tips/hero_fragment_tips.lua +++ b/lua/app/ui/tips/hero_fragment_tips.lua @@ -23,7 +23,7 @@ function HeroFragmentTips:onLoadRootComplete() end self.heroList = {} for _, v in ipairs(drop) do - if DataManager.HeroData:getHeroIsActive(v.id) then + if DataManager.HeroData:getHeroIsUnlock(v.id) then table.insert(self.heroList, v.id) end end diff --git a/lua/app/userdata/hero/hero_data.lua b/lua/app/userdata/hero/hero_data.lua index 5f6c9964..32f6be65 100644 --- a/lua/app/userdata/hero/hero_data.lua +++ b/lua/app/userdata/hero/hero_data.lua @@ -84,6 +84,15 @@ function HeroData:getHeroIsActive(id) return entity:isActived() end + +function HeroData:getHeroIsUnlock(id) + local entity = self.heroes[id] + if entity == nil then + return false + end + return entity:isUnlock() +end + function HeroData:getUnlockHeroCount() local count = 0 for id, entity in pairs(self.heroes) do