主界面宝箱
This commit is contained in:
parent
5a97438c08
commit
e4c0ea6be5
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user