コード例 #1
0
ファイル: PopupLayer.cpp プロジェクト: coolshou/richer
PopupLayer* PopupLayer::create(const char *backgroundImage)
{
    PopupLayer* ml = PopupLayer::create();
    ml->setSpriteBackGround(Sprite::create(backgroundImage));
    ml->setSprite9BackGround(Scale9Sprite::create(backgroundImage));
    return ml;
}
コード例 #2
0
PopupLayer* PopupLayer::create(HelloWorld* const & parent)
{
        PopupLayer* pPopupLayer = new PopupLayer(parent);
        pPopupLayer->init();
        pPopupLayer->autorelease();
        return pPopupLayer;
} 
コード例 #3
0
void MainLayer::startGame()
{
	if (isPetOpen(m_petType))
	{
		CCNotificationCenter::sharedNotificationCenter()->postNotification(
			MSG_BUTTON_PRESS_ID, (CCObject *)(CCInteger::create(MSG_ID_STARTLAYER_BUTTON_PRESS)));
	}
	else
	{
		int price = s_pet_price[m_petType];
		int cherryNum = Config::instance()->cherryNum();
		if (cherryNum < price)
		{
			m_uiLayer->setTouchEnabled(false);

			PopupLayer *popLayer = PopupLayer::create();
			this->addChild(popLayer);

			popLayer->setParam(m_uiLayer);
		}
		else
		{
			Config::instance()->useCherry(price);

			CCNotificationCenter::sharedNotificationCenter()->postNotification(
				MSG_BUTTON_PRESS_ID, (CCObject *)(CCInteger::create(MSG_ID_STARTLAYER_BUTTON_PRESS)));
		}
	}
}
コード例 #4
0
ファイル: wg_menubar.cpp プロジェクト: tordj/WonderGUI
	bool Menubar::_openMenu( int nb )
	{
		MenuBarItem * pItem = m_items.get(nb-1);
		if( pItem == 0 || !pItem->m_pMenu )
			return false;
	
		Coord pos = toLocal( Coord(0, 0) );
	
		if( m_pSkin )
			pos = m_pSkin->contentRect( pos, StateEnum::Normal ).pos();
	
		int bordersWidth = _getEntryBorder().width();
	
		MenuBarItem * pI = m_items.first();
		while( pI != pItem )
		{
			if( pI->isVisible() )
				pos.x += pI->m_width + bordersWidth;
	
			pI = pI->next();
		}
	
		Rect	r(pos, pI->m_width+bordersWidth, size().h );
	
	
		PopupLayer * pLayer = 0;
		if( parent() )
			pLayer = parent()->_getPopupLayer();
		if( !pLayer )
			return false;
	
		pLayer->openPopup( pItem->m_pMenu, this, r - pLayer->globalPos(), Origo::SouthWest );
		return true;
	}
コード例 #5
0
ファイル: PopupLayer.cpp プロジェクト: jintongyao/HelloBlocks
PopupLayer* PopupLayer::createGameoverLayer(int gameType, int score) {
    PopupLayer *layer = new PopupLayer();
    if (layer && layer->init()) {
        layer->autorelease();
        layer->initGameoverLayer(gameType, score);
        return layer;
    }
    CC_SAFE_DELETE(layer);
    return NULL;
}
コード例 #6
0
ファイル: PopupLayer.cpp プロジェクト: bacnd/Cocos2dx-V3-Game
PopupLayer* PopupLayer::create(string pBackgroundImage,
                               string pExitNormalImage,
                               string pExitSelectedImage,
                               const Point &pExitPostion) {
    PopupLayer *pRet = new PopupLayer();
    pRet->init(pBackgroundImage, pExitNormalImage, pExitSelectedImage, pExitPostion);
    pRet->autorelease();
    
    return pRet;
}
コード例 #7
0
ファイル: PopupLayer.cpp プロジェクト: jintongyao/HelloBlocks
PopupLayer* PopupLayer::createSuspendLayer(int gameType) {
    PopupLayer *layer = new PopupLayer();
    if (layer && layer->init()) {
        layer->autorelease();
        layer->initSuspendLayer(gameType);
        return layer;
    }
    CC_SAFE_DELETE(layer);
    return NULL;
}
コード例 #8
0
PopupLayer* PopupLayer::create(const char* backgroundImage, Size dialogSize){
	
	PopupLayer* layer = PopupLayer::create();
	
//	layer->setSpriteBackGround(Sprite::create(backgroundImage));
	layer->setSprite9BackGround(Scale9Sprite::create(backgroundImage));

	layer->m_dialogContentSize = dialogSize;

	return layer;
}
コード例 #9
0
ファイル: PopupLayer.cpp プロジェクト: funemy/yutianGame
PopupLayer* PopupLayer::create(Layer * targetLayer,const int type)
{
    PopupLayer* popupLayer = new PopupLayer();
    if (popupLayer && popupLayer->init(targetLayer, type))
    {
        popupLayer->autorelease();
        return popupLayer;
    }
    else
    {
        CC_SAFE_DELETE(popupLayer);
        return nullptr;
    }
}
コード例 #10
0
ファイル: WikipediaItem.cpp プロジェクト: KDE/marble
void WikipediaItem::openBrowser( )
{
    if ( m_marbleWidget ) {
        PopupLayer* popup = m_marbleWidget->popupLayer();
        popup->setCoordinates( coordinate(), Qt::AlignRight | Qt::AlignVCenter );
        popup->setSize(QSizeF(520, 570));
        popup->setUrl( url() );
        popup->popup();
    } else {
        if ( !m_browser ) {
            m_browser = new TinyWebBrowser();
        }
        m_browser->load( url() );
        m_browser->show();
    }
}
コード例 #11
0
ファイル: PhotoPluginItem.cpp プロジェクト: Earthwings/marble
void PhotoPluginItem::openBrowser()
{
    if ( m_marbleWidget ) {
        PopupLayer* popup = m_marbleWidget->popupLayer();
        popup->setCoordinates( coordinate(), Qt::AlignRight | Qt::AlignVCenter );
        popup->setSize( QSizeF( 700, 450 ) );
        popup->setUrl( QUrl( QString( "http://m.flickr.com/photos/%1/%2/" )
                                  .arg( owner() ).arg( id() ) ) );
        popup->setVisible( true );
    } else {
        if( !m_browser ) {
            m_browser = new TinyWebBrowser();
        }

        QString url = "http://www.flickr.com/photos/%1/%2/";
        m_browser->load( QUrl( url.arg( owner() ).arg( id() ) ) );
        m_browser->show();
    }
}
コード例 #12
0
ファイル: wg_menubar.cpp プロジェクト: tordj/WonderGUI
	bool Menubar::_closeMenu( int nb )
	{
		if( nb == 0 )
			return false;
	
		MenuBarItem * pItem = m_items.get(m_selectedItem-1);
		if( !pItem || !pItem->m_pMenu )
			return false;
	
	
		PopupLayer * pLayer = 0;
		Widget_p pMenu = pItem->m_pMenu;
		if( parent() )
			pLayer = parent()->_getPopupLayer();
	
		if( !pLayer || !pMenu )
			return false;
	
		pLayer->closePopup( pMenu );
	
		return true;
	}
コード例 #13
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);
}
コード例 #14
0
ファイル: PopupScene.cpp プロジェクト: HUjinshuai/-
void Popup::popupLayer(){
    // 定义一个弹出层,传入一张背景图
    PopupLayer* pl = PopupLayer::create("popuplayer/BackGround.png");
    // ContentSize 是可选的设置,可以不设置,如果设置把它当作 9 图缩放
    pl->setContentSize(CCSizeMake(400, 350));
    pl->setTitle("Message Tile");
    pl->setContentText("Text content test", 20, 60, 250);
    // 设置回调函数,回调传回一个 CCNode 以获取 tag 判断点击的按钮
    // 这只是作为一种封装实现,如果使用 delegate 那就能够更灵活的控制参数了
    pl->setCallbackFunc(this, callfuncN_selector(Popup::buttonCallback));
    // 添加按钮,设置图片,文字,tag 信息
    pl->addButton("popuplayer/pop_button.png", "popuplayer/pop_button.png", "YES", 0);
    pl->addButton("popuplayer/pop_button.png", "popuplayer/pop_button.png", "NO", 1);
    // 添加到当前层
    this->addChild(pl);
}
コード例 #15
0
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);
}
コード例 #16
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
}
コード例 #17
0
PopupLayer* PopupLayer::create(const char *backgroundImage){
    PopupLayer* ml = PopupLayer::create();
    ml->setSpriteBackGround(CCSprite::create(backgroundImage));
    //ml->setSpriteBackGround(extension::Scale9Sprite::create(backgroundImage));
    return ml;
}
コード例 #18
0
ファイル: T2.cpp プロジェクト: a1l9e8x6/Hello
bool T2::checkGameOver()
{

	isRightOver = isLeftOver  = false;
	 isUpOver = isDownOver  =false;
	 over_check_move_right = over_check_heti_right =false;
	 over_check_move_left = over_check_heti_left = false;
	 over_check_move_up = over_check_heti_up= false;
	 over_check_move_down = 	 over_check_heti_down = false;

	//check right
	for (int i=0;i<MAX_ROW;i++)
	{
		for (int j = MAX_COL-2; j >=0 ; --j)
		{
			if(arr_Num[i][j]>-1&&arr_Num[i][j+1]==-1)//¬ª√ÅœÄÀö‚Äù‚Äú¬±Ô¨Ç¬†¬´√∏‚Äô¬µ∆?
				over_check_move_right = true;
		}
	}

	for (int i=0;i<MAX_ROW;i++)
	{
		for (int j=MAX_COL-1;j>0;j--)
		{
			if(arr_Num[i][j]>=0&&arr_Num[i][j]==arr_Num[i][j-1])
				over_check_heti_right = true;

		}
	}
	if(!over_check_move_right&&!over_check_heti_right)
	{
		isRightOver = true;
	}



	//check -left
	for (int i=0;i<MAX_ROW;i++)
	{
		for (int j =1; j < MAX_COL ; j++)
		{
			if(arr_Num[i][j]>-1&&arr_Num[i][j-1]==-1)//¬ª√ÅœÄÀö‚Äù‚Äú¬±Ô¨Ç¬†¬´√∏‚Äô¬µ∆?
				over_check_move_left = true;
		}
	}

	for (int i=0;i<MAX_ROW;i++)
	{
		for (int j=0;j<MAX_COL-1;j++)
		{
			if(arr_Num[i][j]>=0&&arr_Num[i][j]==arr_Num[i][j+1])
				over_check_heti_left = true;
		}
	}

	if(!over_check_move_left&&!over_check_heti_left)
		isLeftOver = true;



	//check -up
	for (int j =0; j < MAX_COL ; j++)//lie
	{
		for (int i= MAX_ROW-2;i>=0;i--)//hang
		{
			if(arr_Num[i][j]>-1&&arr_Num[i+1][j]==-1)//¬ª√ÅœÄÀö‚Äù‚Äú¬±Ô¨Ç¬†¬´√∏‚Äô¬µ∆?
			{
				over_check_move_up = true;
			}
		}
	}


	for (int j=0;j<MAX_COL;j++)
	{
		for (int i=MAX_ROW-1;i>0;i--)
		{
			if(arr_Num[i][j]>=0&&arr_Num[i][j]==arr_Num[i-1][j])
			{
				over_check_heti_up = true;
			}
		}
	}

	if(!over_check_move_up&&!over_check_heti_up)
		isUpOver = true;

	//check-down
	for (int j =0; j < MAX_COL ; j++)//lie
	{
		for (int i= 1;i< MAX_ROW;i++)//hang
		{
			if(arr_Num[i][j]>-1&&arr_Num[i-1][j]==-1)//¬ª√ÅœÄÀö‚Äù‚Äú¬±Ô¨Ç¬†¬´√∏‚Äô¬µ∆?
			{
				over_check_move_down = true;
			}
		}

	}


	for (int j=0;j<MAX_COL;j++)
	{
		for (int i=0;i<MAX_ROW-1;i++)
		{
			if(arr_Num[i][j]>=0&&arr_Num[i][j]==arr_Num[i+1][j])
			{
				over_check_heti_down = true;
			}
		}
	}
	if(!over_check_move_down&&!over_check_heti_down)
		isDownOver = true;


	MyCCLog::verbose("isUpOver = %d isDownOver = %d isLeftOver = %d isRightOver= %d",isUpOver,isDownOver,isLeftOver,isRightOver);

	if(isUpOver&&isDownOver&&isLeftOver&&isRightOver){
		CCLog("game----over------over");
		game_state = GAME_OVER;
        
		PopupLayer* popLayer = PopupLayer::create("2048/gameover_bg.png");
        popLayer->setContentSize(CCSizeMake(400,400));
        popLayer->setTitle("Game Over",20);
        popLayer->setCallbackFunc(this,callfuncN_selector(T2::gameover_btnCallback));
        popLayer->addButton("2048/restart.png", "2048/restart.png", "",0);
        popLayer->addButton("2048/exit.png", "2048/exit.png", "",1);
        
        this->addChild(popLayer);
        
		return true;
	}

	return false;
}