From e4c0ea6be5d0bcc348dd29786561e8baa25ccfe6 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Wed, 26 Apr 2023 10:36:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E7=95=8C=E9=9D=A2=E5=AE=9D=E7=AE=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/main_city/component/main_comp.lua | 21 +++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/lua/app/ui/main_city/component/main_comp.lua b/lua/app/ui/main_city/component/main_comp.lua index 1f03e92a..200d763a 100644 --- a/lua/app/ui/main_city/component/main_comp.lua +++ b/lua/app/ui/main_city/component/main_comp.lua @@ -95,7 +95,9 @@ function MainComp:refreshChapter(force) for i = 1, 3 do self.boxObjs[i] = { box = self.uiMap["main_comp.chapter.progress_bg.box_" .. i], - desc = self.uiMap["main_comp.chapter.progress_bg.box_desc_" .. i] + desc = self.uiMap["main_comp.chapter.progress_bg.box_desc_" .. i], + spineObj = self.uiMap["main_comp.chapter.progress_bg.spine_node.ui_spine_obj_" .. i], + boxIcon = self.uiMap["main_comp.chapter.progress_bg.box_" .. i .. ".box_icon"] } end end @@ -121,6 +123,7 @@ function MainComp:refreshChapter(force) local show = boxCount >= index objs.box:setActive(show) objs.desc:setActive(show) + objs.spineObj:setVisible(false) if show then local needWave = DataManager.ChapterData:getChapterBoxNum(rewardChapterId, index) local x = 370 * (index / boxCount) @@ -133,17 +136,25 @@ function MainComp:refreshChapter(force) end objs.box:addClickListener(function() if needWave <= curMaxWave and not rewardGot then - ModuleManager.ChapterManager:openBox(rewardChapterId, index) + objs.spineObj:setVisible(true) + objs.spineObj:playAnimComplete("open", true, false, function() + objs.spineObj:setVisible(false) + ModuleManager.ChapterManager:openBox(rewardChapterId, index) + end) else ModuleManager.TipsManager:showRewardsTips(rewards, nil, objs.box) end end) - objs.box:setSprite(GConst.ATLAS_PATH.COMMON, icon) + objs.boxIcon:setSprite(GConst.ATLAS_PATH.COMMON, icon) objs.box:setAnchoredPositionX(x) if needWave <= curMaxWave and not rewardGot then - objs.box:addRedPoint(26, 20, 0.5) + objs.spineObj:setVisible(true) + objs.spineObj:playAnim("idle", true, false) + objs.spineObj:setAnchoredPositionX(x) + objs.boxIcon:setVisible(false) else - objs.box:removeRedPoint() + objs.spineObj:setVisible(false) + objs.boxIcon:setVisible(true) end objs.desc:setAnchoredPositionX(x) if boxCount == index then