コード例 #1
0
ファイル: CVipCard.cpp プロジェクト: 54993306/Classes
void CVipCard::onEnter()
{
	BaseLayer::onEnter();
	//确定
	CButton* pConfirm = (CButton*)m_ui->findWidgetById("confirm");
	pConfirm->setOnClickListener(this, ccw_click_selector(CVipCard::onConfirm));

	CButton* cancel = (CButton*)m_ui->findWidgetById("cancel");
	cancel->setOnClickListener(this, ccw_click_selector(CVipCard::onCancel));

	CButton* pClose = CButton::create("common/back.png", "common/back.png");
	pClose->getSelectedImage()->setScale(1.1f);
	pClose->setPosition(VLEFT+50, VTOP-50);
	pClose->setOnClickListener(this,ccw_click_selector(CVipCard::onClose));
	this->addChild(pClose, 999);
	
	CImageViewScale9* pRect1 = (CImageViewScale9*)m_ui->findWidgetById("rect1");
	m_cardText = CursorTextField::textFieldWithPlaceHolder("", FONT_NAME, 29, CCSize(690, 110), ccBLACK);
	m_cardText->setPriority(this->getTouchPriority());
	m_cardText->setLimitNum(17);
	m_cardText->setAnchorPoint(ccp(0, 0.5f));
	m_cardText->setPosition( ccp(pRect1->getPositionX()-440, pRect1->getPositionY()));
	m_ui->addChild(m_cardText, 999);

	//展示区图片
	CLayout *pShowInfo = CLayout::create();

	CScrollView *pScroll = (CScrollView*)m_ui->findWidgetById("scroll_info");
	pScroll->setDirection(eScrollViewDirectionVertical);
	pScroll->setBounceable(false);
	pScroll->getContainer()->addChild(pShowInfo);

	CCSize size = CCSize(957, 471);
	pShowInfo->setContentSize(size);
	pScroll->setContainerSize(size);
	pShowInfo->setPosition(ccp(pScroll->getContainerSize().width*0.5f, pScroll->getContainerSize().height*0.5f));
	pScroll->setContentOffsetToTop();

	//嫁接内容
	CLayout* pLayout = (CLayout*)findWidgetById("layer_info");
	pLayout->retain();
	pLayout->removeFromParent();
	pShowInfo->addChild(pLayout);
	pLayout->release();
	pLayout->setPosition(ccp(size.width/2, size.height/2+10));

}