예제 #1
0
void Popup::popupLayer(){
    // 定义一个弹出层,传入一张背景图
    PopupLayer* pl = PopupLayer::create("popuplayer/BackGround.png");
    // ContentSize 是可选的设置,可以不设置,如果设置把它当作 9 图缩放
    pl->setContentSize(CCSizeMake(400, 350));
    pl->setTitle("吾名一叶");
    pl->setContentText("娇兰傲梅世人赏,却少幽芬暗里藏。不看百花共争艳,独爱疏樱一枝香。", 20, 60, 250);
    // 设置回调函数,回调传回一个 CCNode 以获取 tag 判断点击的按钮
    // 这只是作为一种封装实现,如果使用 delegate 那就能够更灵活的控制参数了
    pl->setCallbackFunc(this, callfuncN_selector(Popup::buttonCallback));
    // 添加按钮,设置图片,文字,tag 信息
    pl->addButton("popuplayer/pop_button.png", "popuplayer/pop_button.png", "确定", 0);
    pl->addButton("popuplayer/pop_button.png", "popuplayer/pop_button.png", "取消", 1);
    // 添加到当前层
    this->addChild(pl);
}
void HelloWorld::popupLayer(){
    // 定义一个弹出层,传入一张背景图
    PopupLayer* pl = PopupLayer::create("bg.png");
    // ContentSize 是可选的设置,可以不设置,如果设置把它当作 9 图缩放
    pl->setContentSize(CCSizeMake(400, 280));
//    pl->setTitle("吾名一叶");
    pl->setContentText("有招聘信息的HR可以联系管理员发群公告!望管理员也给予积极配合,谢谢!群号:389970612   C/C++/OC/C#/JAVA/PHP/SQL....", 12, 10, 250);
    pl->setColor(Color3B(250, 60, 60));
    // 设置回调函数,回调传回一个 CCNode 以获取 tag 判断点击的按钮
    // 这只是作为一种封装实现,如果使用 delegate 那就能够更灵活的控制参数了
    pl->setCallbackFunc(this, callfuncN_selector(HelloWorld::buttonCallback));
    // 添加按钮,设置图片,文字,tag 信息
    pl->addButton("bt1.png", "bt2", "确定", 0);
    pl->addButton("bt1.png", "bt2.png", "取消", 1);
    // 添加到当前层
    this->addChild(pl);
}
예제 #3
0
void CollageScene::popupLayer(Node* baseLayer,Vec2 popPos,const char *sTitle,string sContent){

    PopupLayer* pl = PopupLayer::create("popup_sq.png");
	
    pl->setContentSize(Size(450, 250));
	//auto sizeLayer = baseLayer->getContentSize();

	pl->setAnchorPoint(Vec2(.5,.5));
	pl->setPosition(popPos.x,popPos.y);
	pl->setTitle(sTitle,Color3B(106,72,36));
	pl->setContentText(sContent.c_str(),Color3B(106,72,36), 24, 20, 150);
	
    pl->setCallbackFunc(this, callfuncND_selector(CollageScene::popupCallback),NULL);
    // 添加按钮,设置图片,文字,tag 信息
	pl->addButton("button_normal.png", "button_dis.png", "RETURN",Color3B(255,255,255), 1);
    // 添加到指定层
	baseLayer->addChild(pl);
}
예제 #4
0
void HelloWorld::keyBackClicked() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
	CCMessageBox("You pressed the close button. Windows Store Apps do not implement a close button.","Alert");
#else
	PopupLayer* pl = PopupLayer::create("pop_bg.png");
	// ContentSize 是可选的设置,可以不设置,如果设置把它当作 9 图缩放
	pl->setContentSize(CCSizeMake(400, 300));
	pl->setTitle("确认");
	pl->setContentText("要离开游戏吗?", 28, 60, 250);
	// 设置回调函数,回调传回一个 CCNode 以获取 tag 判断点击的按钮
	// 这只是作为一种封装实现,如果使用 delegate 那就能够更灵活的控制参数了
	pl->setCallbackFunc(this, callfuncN_selector(HelloWorld::popupCallback));
	// 添加按钮,设置图片,文字,tag 信息
	pl->addButton("pop_button.png", "pop_button.png", "退出", 0);
	pl->addButton("pop_button.png", "pop_button.png", "取消", 1);
	// 添加到当前层
	this->addChild(pl, 5);
#endif
}