版本3.3 项目类型Lua
-- 活动NPC面板点击事件处理 function Home_NPCPanelClick(sender,eventType) if eventType == ccui.TouchEventType.ended then AudioManager:playButtonEffect() local cnt = table.getn(Home.tabNPCActivityBtn) Home.PanelNpc:setTouchEnabled(false) if Home.superStar then for i = 1,cnt do for i = 1,cnt do Home.tabNPCActivityBtn[i]:setTouchEnabled(false) end local actionFadout = cc.FadeOut:create(0.5) local moveTo = cc.MoveTo:create(0.5,cc.p(175,175)) local function actionCallFunc(sender) if i == cnt then Home.PanelNpc:setTouchEnabled(true) end end Home.tabNPCActivityBtn[i]:runAction(cc.Sequence:create(moveTo,actionFadout,cc.CallFunc:create(actionCallFunc))) Home.tabNPCActivityBtn[i]:runAction(actionFadout) end Home.superStar = not(Home.superStar) else Home.PanelNpc:setTouchEnabled(false) for i = 1,cnt do local actionFadeIn = cc.FadeIn:create(0.5) local moveTo = cc.MoveTo:create(0.5,Home.tabNPCBtnActivityBtnPos[i]) local function actionCallFunc(sender) sender:setTouchEnabled(true) if i == cnt then Home.PanelNpc:setTouchEnabled(true) end end Home.tabNPCActivityBtn[i]:runAction(cc.Sequence:create(moveTo,actionFadeIn,cc.CallFunc:create(actionCallFunc)) end Home.superStar = not(Home.superStar) end end end原文链接:https://www.f2er.com/cocos2dx/341169.html