Cocos2dx --- about Button response in modal pop-up window
In the custom modal pop-up window, because you have registered:
Void WWDialog: registerWithTouchDispatcher () {cocos2d: ccctor ctor: sharedDirector ()-> getTouchDispatcher ()-> addTargetedDelegate (this, allow, true );}Therefore, all lower-layer touch events are blocked.
In this case, the following code is added to a pop-up window:
Ui: UILayer * _ pLayer = UILayer: create (); _ pLayer-> setPosition (CCPointZero); this-> addChild (_ pLayer); ui :: widget * _ root = GUIReader: shareReader ()-> widgetFromJsonFile ("login_ui_1.json"); _ pLayer-> addWidget (_ root );
All the buttons in _ root and the touch events of other components do not respond, and the events are truncated.
Add:
_ PLayer-> setTouchPriority (kCCMenuHandlerPriority );
Manually set the touch priority to fix the problem.