Example #1
0
CImageView *TuiManager::createImage(float tag, const char* file, float scaleX, float scaleY,float x, float y, float rotation){
	CImageView *pImg = m_isUseSpriteFrame ? CImageView::createWithSpriteFrameName(file) : CImageView::create(file);
	Size size = pImg->getContentSize();
	pImg->setPosition(Point(x,-y));
	pImg->setScale(scaleX, scaleY);
	pImg->setRotation(rotation);
	pImg->setTag(tag);
	return pImg;
}
Example #2
0
CImageView *TuiManager::createImage(float tag, const char* file, float scaleX, float scaleY, int flipX, int flipY, float x, float y, float rotation, int isUseFrame){
	CImageView *pImg = isUseFrame ? CImageView::createWithSpriteFrameName(file) : CImageView::create(file);
	Size size = pImg->getContentSize();
	pImg->setPosition(Vec2(x,-y));
	pImg->setFlippedX(flipX == 1);
	pImg->setFlippedY(flipY == 1);
	pImg->setScale(scaleX, scaleY);
	pImg->setRotation(rotation);
	pImg->setTag(tag);
	return pImg;
}
Example #3
0
void CSmeltArmor::onEnter()
{
	BaseLayer::onEnter();

	//四个选择框
	for (unsigned int i=0; i<4; ++i)
	{
		CCheckBox *checkBtn = (CCheckBox*)(m_pBaseInfo[i]->findWidgetById("check"));
		checkBtn->setOnCheckListener(this,ccw_check_selector(CSmeltArmor::onCheckAttr));
	}

	//选择武器
	CButton *select = (CButton*)(m_ui->findWidgetById("select"));
	select->setOnClickListener(this, ccw_click_selector(CSmeltArmor::onSelectItem));

	//洗练
	CButton *refine = (CButton*)(m_ui->findWidgetById("refine"));
	refine->setOnClickListener(this, ccw_click_selector(CSmeltArmor::onRefineItem));
	
	//初始化火
	initFire();

	//旋转圈
	CImageView *circleFire = (CImageView*)(m_ui->findWidgetById("fire_circle"));
	circleFire->setScale(1.95f);
	circleFire->runAction(CCRepeatForever::create(CCRotateBy::create(1.0f, 60)));
	circleFire->runAction(CCRepeatForever::create(CCSequence::createWithTwoActions(CCScaleTo::create(1.2f, 2.1f), CCScaleTo::create(1.2f, 1.95f))));


	GetTcpNet->registerMsgHandler(SmeltArmorMsg,this,CMsgHandler_selector(CSmeltArmor::proceesMessage));
	GetTcpNet->registerMsgHandler(SmeltDataRequestMsg,this,CMsgHandler_selector(CSmeltArmor::proceesMessage));

	CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_HERO, this, GameMsghandler_selector(CSmeltArmor::roleUpdate));
	
	CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_ITEM_DATA, this, GameMsghandler_selector(CSmeltArmor::updateStar));
}