当前位置: 首页>>代码示例>>C++>>正文


C++ UserData::getActionLimit方法代码示例

本文整理汇总了C++中UserData::getActionLimit方法的典型用法代码示例。如果您正苦于以下问题:C++ UserData::getActionLimit方法的具体用法?C++ UserData::getActionLimit怎么用?C++ UserData::getActionLimit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserData的用法示例。


在下文中一共展示了UserData::getActionLimit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateActionTime

void CTopLayer::updateActionTime(float dt)
{
	UserData *data = DataCenter::sharedData()->getUser()->getUserData();
	if (data->getRoleAction() < data->getActionLimit())
	{
		data->setRoleAction(data->getRoleAction()+1);
		CLabel *action = (CLabel*)(m_ui->findWidgetById("action"));
		action->setString(CCString::createWithFormat("%d/%d",data->getRoleAction(),data->getActionLimit())->getCString());
		data->setActionTime(data->getActionTime() + data->getInterval()*60*60);
	}
	else
	{
		this->unschedule(schedule_selector(CTopLayer::updateActionTime));
	}
}
开发者ID:54993306,项目名称:Classes,代码行数:15,代码来源:TopLayer.cpp

示例2: onEnter

void CTopLayer::onEnter()
{
	BaseLayer::onEnter();
	this->setTouchPriority(-100);
	UserData *user = DataCenter::sharedData()->getUser()->getUserData();

	m_coinLabel = (CLabel*)m_ui->getChildByTag(13);
	m_coinLabel->setString(ToString(user->getCoin()));

	m_moneyLabel = (CLabel*)m_ui->getChildByTag(14);
	m_moneyLabel->setString(ToString(user->getRoleGold()));
	// 
	m_foodLabel = (CLabel*)m_ui->getChildByTag(17);
	//m_foodLabel->setString(ToString(user->getRoleFood()));
	m_foodLabel->setString(ToString(user->getFriends()));

	CLabel *action = (CLabel*)(m_ui->findWidgetById("action"));
	action->setString(CCString::createWithFormat("%d/%d",user->getRoleAction(),user->getActionLimit())->getCString());

	CButton* add_food = (CButton*)m_ui->findWidgetById("btn_add_food");
	CButton* add_copper = (CButton*)m_ui->findWidgetById("btn_add_copper");
	CButton* add_soul = (CButton*)m_ui->findWidgetById("btn_add_soul");
	CButton* add_gold = (CButton*)m_ui->findWidgetById("btn_add_gold");
	CButton* add_friendship = (CButton*)m_ui->findWidgetById("btn_add_friendship");
	add_food->getSelectedImage()->setScale(1.1f);
	add_copper->getSelectedImage()->setScale(1.1f);
	add_soul->getSelectedImage()->setScale(1.1f);
	add_gold->getSelectedImage()->setScale(1.1f);
	add_friendship->getSelectedImage()->setScale(1.1f);
	add_food->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
	add_copper->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
	add_soul->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
	add_gold->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
	add_friendship->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
	CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_HERO,this,GameMsghandler_selector(CTopLayer::updateRoleProperty));

	//绑定场景隐藏和显示的消息
	NOTIFICATION->addObserver(this, callfuncO_selector(CTopLayer::show), SHOW_TOP_LAYER, nullptr);
	NOTIFICATION->addObserver(this, callfuncO_selector(CTopLayer::hide), HIDE_TOP_LAYER, nullptr);

	CImageView *coin = (CImageView*)(m_ui->findWidgetById("coin"));
	CCAnimation *coinAnim = AnimationManager::sharedAction()->getAnimation("7033");
	coinAnim->setDelayPerUnit(0.3f);
	coin->runAction(CCRepeatForever::create(CCAnimate::create(coinAnim)));

	CImageView *gold = (CImageView*)(m_ui->findWidgetById("gold"));
	CCAnimation *goldAnim = AnimationManager::sharedAction()->getAnimation("7034");
	goldAnim->setDelayPerUnit(0.3f);
	gold->runAction(CCRepeatForever::create(CCAnimate::create(goldAnim)));
}
开发者ID:54993306,项目名称:Classes,代码行数:50,代码来源:TopLayer.cpp

示例3: updateRoleProperty

void CTopLayer::updateRoleProperty(const TMessage& tMsg)
{
	UserData *user = DataCenter::sharedData()->getUser()->getUserData();

	CCScaleTo* sc1 = CCScaleTo::create(0.15f,1.3f);
	CCScaleTo* sc2 = CCScaleTo::create(0.35f,1.0f);
	CCSequence* sqes = CCSequence::create(sc1,sc2,nullptr);

	if (user->getCoin()!=atoi(m_coinLabel->getString()))
	{
		CProgressLabel *prolab = CProgressLabel::create();
		prolab->setLabel(m_coinLabel);
		prolab->changeValueTo(user->getCoin(),0.5f);
		CCSequence* sqes1 = (CCSequence*)sqes->copy();
		m_coinLabel->runAction(sqes1);
		this->addChild(prolab);

		CLabel *label = (CLabel*)m_ui->getChildByTag(130);
		int coin = user->getCoin()-atoi(m_coinLabel->getString());
		changeLabel(label, coin);
	}
	
	if (user->getRoleGold()!=atoi(m_moneyLabel->getString()))
	{
		CProgressLabel *prolab = CProgressLabel::create();
		prolab->setLabel(m_moneyLabel);
		prolab->changeValueTo(user->getRoleGold(),0.5f);
		CCSequence* sqes1 = (CCSequence*)sqes->copy();
		m_moneyLabel->runAction(sqes1);
		this->addChild(prolab);

		CLabel *label = (CLabel*)m_ui->getChildByTag(140);
		int coin = user->getRoleGold()-atoi(m_moneyLabel->getString());
		changeLabel(label, coin);
	}
	/*
	if (user->getRoleFood()!=atoi(m_foodLabel->getString()))
	{
		CProgressLabel *prolab = CProgressLabel::create();
		prolab->setLabel(m_foodLabel);
		prolab->changeValueTo(user->getRoleFood(),0.5f);
		CCSequence* sqes1 = (CCSequence*)sqes->copy();
		m_foodLabel->runAction(sqes1);
		this->addChild(prolab);

		CLabel *label = (CLabel*)m_ui->getChildByTag(170);
		int coin = user->getRoleFood()-atoi(m_foodLabel->getString());
		changeLabel(label, coin);
	}
	*/
	if (user->getFriends()!=atoi(m_foodLabel->getString()))
	{
		CProgressLabel *prolab = CProgressLabel::create();
		prolab->setLabel(m_foodLabel);
		prolab->changeValueTo(user->getFriends(),0.5f);
		CCSequence* sqes1 = (CCSequence*)sqes->copy();
		m_foodLabel->runAction(sqes1);
		this->addChild(prolab);

		CLabel *label = (CLabel*)m_ui->getChildByTag(170);
		int coin = user->getFriends()-atoi(m_foodLabel->getString());
		changeLabel(label, coin);
	}

	CLabel *action = (CLabel*)(m_ui->findWidgetById("action"));
	if (user->getRoleAction()!=atoi(action->getString()))
	{
		CCSequence* sqes2 = (CCSequence*)sqes->copy();
		action->runAction(sqes2);
		action->setString(CCString::createWithFormat("%d/%d",user->getRoleAction(), user->getActionLimit())->getCString());
	}

}
开发者ID:54993306,项目名称:Classes,代码行数:73,代码来源:TopLayer.cpp

示例4: onEnter


//.........这里部分代码省略.........
			CCSprite* spr = MakeFaceBookHeadToCircle(sp);
			spr->setPosition(headBg->getPosition());
			headPart->removeChild(head);
		    spr->setTag(15);
			headPart->addChild(spr);
		}
		else
		{
			HttpLoadImage::getInstance()->bindUiTarget(this);
			CCString *imgUrl = CCString::createWithFormat(FACEBOOKIMG_106,user->getFbId().c_str());
			HttpLoadImage::getInstance()->requestUrlImage(imgUrl->getCString(),user->getFbId().c_str());
		}
	}

	CImageView* vip = (CImageView*)headPart->findWidgetById("vip");
	vip->setTouchEnabled(true);
	vip->setOnClickListener(this,ccw_click_selector(CMainCityUI::onVip));

	//添加签到,充值等其他入口
	CAccessLayer* pAccess = CAccessLayer::create();
	this->addChild(pAccess, 99);

	CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_HERO,this,GameMsghandler_selector(CMainCityUI::updateRoleProperty));
	CSceneManager::sharedSceneManager()->addMsgObserver(TASK_NOTICE,this,GameMsghandler_selector(CMainCityUI::updateTaskNotice));
	CSceneManager::sharedSceneManager()->addMsgObserver(MAIL_NOTICE,this,GameMsghandler_selector(CMainCityUI::updateMailNotice));
	CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_FUNCTIONOPEN,this,GameMsghandler_selector(CMainCityUI::updateFuctionOpen));
	CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_GAMETIP,this,GameMsghandler_selector(CMainCityUI::updateGameTip));
	CSceneManager::sharedSceneManager()->addMsgObserver(SHOW_HEAD,this,GameMsghandler_selector(CMainCityUI::showHead));

	CCSprite *red = (CCSprite*)(m_ui->findWidgetById("redPoint"));

	CCSprite *mailPoint = (CCSprite*)(m_ui->findWidgetById("mailPoint"));

	if (user->getRoleAction()<user->getActionLimit())
	{
		this->schedule(schedule_selector(CMainCityUI::updateActionTime),user->getInterval()*60);
	}
    GetTcpNet->registerMsgHandler(FriendReqNumMsg,this,CMsgHandler_selector(CMainCityUI::processNetMsg));
	GetTcpNet->registerMsgHandler(CBExchangeMsg,this,CMsgHandler_selector(CMainCityUI::exchangeMsg));

	//正在引导,不自动弹窗
	if(user->getNewStep()==2||user->getNewStep()==17/*CGuideManager::getInstance()->getIsRunGuide()*/)
	{
		DataCenter::sharedData()->setCityActionType(CA_None);
	}
	else if(user->getNewStep()<=0 || user->getNewStep()>=100)
	{
		//自动弹签到
		runAction(CCSequence::createWithTwoActions(CCDelayTime::create(0.7f), CCCallFunc::create(this, callfunc_selector(CMainCityUI::autoShowSign))));
	}

	switch (DataCenter::sharedData()->getCityActionType())
	{
	case CA_Levelup:
		{
			CButton *btn = (CButton*)m_ui->getChildByTag(HeroInfo_Btn);
			btn->runAction(CCSequence::create(CCDelayTime::create(0.6f),
				CCCallFuncN::create(this, callfuncN_selector(CMainCityUI::onTimeWaitCityAction)),
				NULL));
			DataCenter::sharedData()->setCityActionType(CA_None);
		}
		break;
	case CA_GoToChapater:
		{
			CButton *btn = (CButton*)m_ui->getChildByTag(Battle_Btn);
			btn->runAction(CCSequence::create(CCDelayTime::create(0.2f),
开发者ID:54993306,项目名称:Classes,代码行数:67,代码来源:mainCityUI.cpp


注:本文中的UserData::getActionLimit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。