There is now a major problem with custom event in Cocos Creator 1.4
They now return an empty listener ID so the system can’t find them and send the trigger:
New function:
var __getListenerID = function (event) {
var eventType = cc.Event, type = event.type;
if (type === eventType.ACCELERATION)
return cc._EventListenerAcceleration.LISTENER_ID;
if (type === eventType.KEYBOARD)
return cc._EventListenerKeyboard.LISTENER_ID;
if (type.startsWith(eventType.MOUSE))
return cc._EventListenerMouse.LISTENER_ID;
if (type === eventType.FOCUS)
return cc._EventListenerFocus.LISTENER_ID;
if (type.startsWith(eventType.TOUCH)){
// Touch listener is very special, it contains two kinds of listeners, EventListenerTouchOneByOne and EventListenerTouchAllAtOnce.
// return UNKNOWN instead.
cc.logID(2000);
}
return “”;
};
Old function:
var __getListenerID = function (event) {
var eventType = cc.Event, type = event.getType();
if (type === eventType.ACCELERATION)
return cc._EventListenerAcceleration.LISTENER_ID;
if (type === eventType.KEYBOARD)
return cc._EventListenerKeyboard.LISTENER_ID;
if (type.startsWith(eventType.MOUSE))
return cc._EventListenerMouse.LISTENER_ID;
if (type === eventType.FOCUS)
return cc._EventListenerFocus.LISTENER_ID;
if (type.startsWith(eventType.TOUCH)){
// Touch listener is very special, it contains two kinds of listeners, EventListenerTouchOneByOne and EventListenerTouchAllAtOnce.
// return UNKNOWN instead.
cc.log(cc._LogInfos._getListenerID);
}
return type;
};
The return is now changed to “”.
This is a major road block to us upgrading to Cocos Creator because our game use a lot of custom event, and none of them can trigger anymore.
Is it an oversight or wanted behavior ?