主界面宝箱
This commit is contained in:
parent
5a97438c08
commit
e4c0ea6be5
@ -95,7 +95,9 @@ function MainComp:refreshChapter(force)
|
|||||||
for i = 1, 3 do
|
for i = 1, 3 do
|
||||||
self.boxObjs[i] = {
|
self.boxObjs[i] = {
|
||||||
box = self.uiMap["main_comp.chapter.progress_bg.box_" .. 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
|
||||||
end
|
end
|
||||||
@ -121,6 +123,7 @@ function MainComp:refreshChapter(force)
|
|||||||
local show = boxCount >= index
|
local show = boxCount >= index
|
||||||
objs.box:setActive(show)
|
objs.box:setActive(show)
|
||||||
objs.desc:setActive(show)
|
objs.desc:setActive(show)
|
||||||
|
objs.spineObj:setVisible(false)
|
||||||
if show then
|
if show then
|
||||||
local needWave = DataManager.ChapterData:getChapterBoxNum(rewardChapterId, index)
|
local needWave = DataManager.ChapterData:getChapterBoxNum(rewardChapterId, index)
|
||||||
local x = 370 * (index / boxCount)
|
local x = 370 * (index / boxCount)
|
||||||
@ -133,17 +136,25 @@ function MainComp:refreshChapter(force)
|
|||||||
end
|
end
|
||||||
objs.box:addClickListener(function()
|
objs.box:addClickListener(function()
|
||||||
if needWave <= curMaxWave and not rewardGot then
|
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
|
else
|
||||||
ModuleManager.TipsManager:showRewardsTips(rewards, nil, objs.box)
|
ModuleManager.TipsManager:showRewardsTips(rewards, nil, objs.box)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
objs.box:setSprite(GConst.ATLAS_PATH.COMMON, icon)
|
objs.boxIcon:setSprite(GConst.ATLAS_PATH.COMMON, icon)
|
||||||
objs.box:setAnchoredPositionX(x)
|
objs.box:setAnchoredPositionX(x)
|
||||||
if needWave <= curMaxWave and not rewardGot then
|
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
|
else
|
||||||
objs.box:removeRedPoint()
|
objs.spineObj:setVisible(false)
|
||||||
|
objs.boxIcon:setVisible(true)
|
||||||
end
|
end
|
||||||
objs.desc:setAnchoredPositionX(x)
|
objs.desc:setAnchoredPositionX(x)
|
||||||
if boxCount == index then
|
if boxCount == index then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user