Notification effect enhancement

This commit is contained in:
ZhangMenghe 2015-08-21 10:20:59 +08:00
parent 9fe278b31f
commit 1bcc2dec37
2 changed files with 17 additions and 2 deletions

View File

@ -1252,8 +1252,18 @@ void Director::setContentScaleFactor(float scaleFactor)
void Director::setNotificationNode(Node *node)
{
if (_notificationNode != nullptr){
_notificationNode->onExitTransitionDidStart();
_notificationNode->onExit();
_notificationNode->cleanup();
}
CC_SAFE_RELEASE(_notificationNode);
_notificationNode = node;
if (node == nullptr)
return;
_notificationNode->onEnter();
_notificationNode->onEnterTransitionDidFinish();
CC_SAFE_RETAIN(_notificationNode);
}

View File

@ -45,7 +45,12 @@ var SceneTestLayer1 = cc.Layer.extend({
}, this);
var item4 = new cc.MenuItemFont("setNotificationNode", function () {
var layerTemp = new cc.LayerColor(cc.color(0, 255, 255, 120));
var sprite = new cc.Sprite(s_pathGrossini);
sprite.setPosition(cc.p(winSize.width/2,winSize.height/2));
layerTemp.addChild(sprite);
cc.director.setNotificationNode(layerTemp);
var rotation = cc.rotateBy(2,360);
sprite.runAction(rotation.repeatForever());
cc.log("setNotificationNode!");
}, this);
var item5 = new cc.MenuItemFont("clearNotificationNode", function () {