新手引导!quick

前端之家收集整理的这篇文章主要介绍了新手引导!quick前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

新手引导可用,模版。


function UiTaskLayer:newIndex(Box,jumpname)

self.runLayer = display.getRunningScene() self.maskLayer = cc.LayerColor:create(cc.c4b(0,0)):pos(400,300) self.maskLayer:setContentSize(cc.size(300,200)) self.maskLayer:setOpacity(0) self.runLayer:addChild(self.maskLayer,20000) local function onTouchStart(touch,event) local point = touch:getLocation() local rect = Box:convertToWorldSpace(ccp(0,0)) local convert_rectSucc = Box:getBoundingBox() convert_rectSucc.x = rect.x convert_rectSucc.y = rect.y if cc.rectContainsPoint(convert_rectSucc,point) then self.clicklistener:setSwallowTouches(false) else self.clicklistener:setSwallowTouches(true) end return true end self.clicklistener = cc.EventListenerTouchOneByOne:create() self.clicklistener:setSwallowTouches(true) self.clicklistener:registerScriptHandler( onTouchStart,cc.Handler.EVENT_TOUCH_BEGAN ) local eventDispatcher = self.maskLayer:getEventDispatcher() eventDispatcher:addEventListenerWithSceneGraPHPriority(self.clicklistener,self.maskLayer ) end

猜你在找的Cocos2d-x相关文章