Пример #1
0
CImageView* CImageView::create(const char *pszFileName)
{
    CImageView *pobSprite = new CImageView();
    if (pobSprite && pobSprite->initWithFile(pszFileName))
    {
		pobSprite->setTouchEnabled(false);
        pobSprite->autorelease();
        return pobSprite;
    }
    CC_SAFE_DELETE(pobSprite);
    return NULL;
}
Пример #2
0
CImageView* CImageView::createWithTexture(CCTexture2D *pTexture, const CCRect& rect)
{
    CImageView *pobSprite = new CImageView();
    if (pobSprite && pobSprite->initWithTexture(pTexture, rect))
    {
		pobSprite->setTouchEnabled(false);
        pobSprite->autorelease();
        return pobSprite;
    }
    CC_SAFE_DELETE(pobSprite);
    return NULL;
}
Пример #3
0
CImageView* CImageView::create()
{
    CImageView *pSprite = new CImageView();
    if (pSprite && pSprite->init())
    {
		pSprite->setTouchEnabled(false);
        pSprite->autorelease();
        return pSprite;
    }
    CC_SAFE_DELETE(pSprite);
    return NULL;
}
Пример #4
0
CImageView* CImageView::createWithSpriteFrame(CCSpriteFrame *pSpriteFrame)
{
    CImageView *pobSprite = new CImageView();
    if (pSpriteFrame && pobSprite && pobSprite->initWithSpriteFrame(pSpriteFrame))
    {
		pobSprite->setTouchEnabled(false);
        pobSprite->autorelease();
        return pobSprite;
    }
    CC_SAFE_DELETE(pobSprite);
    return NULL;
}
Пример #5
0
void CChangeHeadImg::addGridCell(unsigned int uIdx, CGridViewCell* pCell)
{
	CLayout *lay = UICloneMgr::cloneLayout(m_cell);

	for (int i=1; i<=2; i++)
	{
		CCNode *child = lay->getChildByTag(i);
		lay->removeChild(child);
		pCell->addChild(child);

		if (i==1)
		{
			if (m_headIconList.at(uIdx)>0)
			{
				CImageView* pHead = CImageView::create(CCString::createWithFormat("headImg/%d.png", m_headIconList.at(uIdx))->getCString());
				if(!pHead)
				{
					pHead = CImageView::create("headImg/null.png");
					CCLOG("ERROR_____CChangeHeadImg::addGridCell");
				}
				child->addChild(pHead);
				NodeFillParent(pHead);
			}
			else
			{
				UserData *data = DataCenter::sharedData()->getUser()->getUserData();
				string fbName = data->getFbId() +".jpg";
				string fullName = CCFileUtils::sharedFileUtils()->fullPathForFilename(fbName.c_str());
				bool isFileExist = CCFileUtils::sharedFileUtils()->isFileExist(fullName);
				if(isFileExist)
				{
					CCSprite* spr =CCSprite::create(fullName.c_str());
					child->addChild(spr);
					NodeFillParent(spr);
				}
			}
			
		}
		else if(i==2)
		{
			CImageView* pBtn = (CImageView*)child;
			pBtn->setTouchEnabled(true);
			pBtn->setUserData(&m_headIconList.at(uIdx));
			pBtn->setOnClickListener(this,ccw_click_selector(CChangeHeadImg::onChangHeadImg));
		}
	}
}
Пример #6
0
void CSignLayer::updateTotoalSign()
{
	//更新
	//已领取的,宝箱变灰,加对勾
	//未领取的,宝箱变亮,
	//将要领取的,加黄色标题突出

	for (int i = 0; i < m_signData.totalList.size()&&i<4; i++)
	{
		CSign &sign = m_signData.totalList.at(i);

		//宝箱
		CImageView *mask = (CImageView*)m_ui->findWidgetById(CCString::createWithFormat("mask%d",i+1)->getCString());
		mask->setVisible(true);
		//mask->setTexture(CCTextureCache::sharedTextureCache()->addImage(CCString::createWithFormat("sign/box_%d.png", i+1)->getCString()));
		mask->setUserData(&sign);
		mask->setTouchEnabled(true);
		mask->setOnPressListener(this, ccw_press_selector(CSignLayer::onPress));

		//天数
		CLabel *day = (CLabel*)(m_ui->findWidgetById(CCString::createWithFormat("day%d",i+1)->getCString()));
		day->setString(CCString::createWithFormat(GETLANGSTR(209),sign.day)->getCString());

		//获得字样
		CImageView *getspr = (CImageView*)(m_ui->findWidgetById(CCString::createWithFormat("get%d",i+1)->getCString()));

		//已领取
		if (sign.status==1)
		{
			//宝箱变灰
			mask->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
			//加对勾
			getspr->setVisible(true);
		}
		//未领取
		else if(sign.status==2)
		{
			//宝箱变灰
			mask->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderDefault));
			//加对勾
			getspr->setVisible(false);
		}
	}
}
Пример #7
0
void LoginLayerUC::addTableCell( unsigned int uIdx, CTableViewCell * pCell )
{
	CLayout *lay = UICloneMgr::cloneLayout(m_pCell);

	const Server& server = m_serverInfo.server_list().Get(uIdx);

	for (unsigned int i=1; i<=4; i++)
	{
		CCNode *child = lay->getChildByTag(i);
		lay->removeChild(child);
		child->setTag(i);
		pCell->addChild(child);
		pCell->setTag(uIdx);

		switch (i)
		{
		case 1:
			{
				CImageView* pBoard = (CImageView*)child;
				pBoard->setTouchEnabled(true);
				pBoard->setOnClickListener(this, ccw_click_selector(LoginLayerUC::selectServer));
			}
			break;
		case 3:
			{
				CLabel* pLabel = (CLabel*)child;
				pLabel->setString(server.server_name().c_str());
			}
			break;
		case 4:
			{
				CLabel* pLabel = (CLabel*)child;
				int iShowText[5] = {2002, 1184, 1185, 1186, 1187};
				pLabel->setString(GETLANGSTR(iShowText[server.server_status()]));
			}
			break;
		default:
			break;
		}
	}
}
Пример #8
0
void CSignLayer::addGridCell(unsigned int uIdx, CGridViewCell* pCell)
{
// 	CHero *hero = m_currHeroList->at(uIdx);
	CSign &sign = m_signData.signList.at(uIdx);
	CLayout *lay = UICloneMgr::cloneLayout(m_cell);
	pCell->setScale(0.97f);

	for (int i = 1; i <=4; i++)
	{
		CCNode *child = lay->getChildByTag(i);
		lay->removeChild(child);
		pCell->addChild(child);
	}


	CImageView *imagView = (CImageView*)pCell->getChildByTag(1);	
	imagView->setTouchEnabled(true);
	imagView->setEnabled(true);
	imagView->setUserData(&m_signData.signList.at(uIdx));
	imagView->setOnPressListener(this, ccw_press_selector(CSignLayer::onPress));
	


	CCSprite *item = nullptr;
	if (sign.prize.thumb>=0)
	{
		CImageView * pMask = (CImageView*)pCell->getChildByTag(2);
		SmartSetRectPrizeColor(pMask, &sign.prize);
		item = CCSprite::create(GetImageName(sign.prize.type, sign.prize.color, sign.prize.thumb).c_str());
		if(!item)
		{
			item = CCSprite::create("headImg/101.png");
			CCLOG("CSignLayer::addGridCell  error load image %d", sign.prize.thumb);
		}
		item->setPosition(ccp(pMask->getContentSize().width/2, pMask->getContentSize().height/2));
		pMask->addChild(item, -1, 2);
		item->setScale(0.9f);
	

		//加数字
		CCLabelAtlas* haveNum = CCLabelAtlas::create("", "label/no_02.png", 9, 15, 46);
		haveNum->setAnchorPoint(ccp(1.0f, 0.0f));
		haveNum->setPosition(ccp(85, 5));
		pMask->addChild(haveNum, 99, 99);

		haveNum->setString(ToString(sign.prize.num));
		if(sign.prize.num<=1)
		{
			haveNum->setVisible(false);
		}

		//添加星星
		if(sign.prize.quality > 0)
		{
			CLayout* pStarLayout = SmartGetStarLayout(&sign.prize);
			pMask->addChild(pStarLayout, 211, 211);
		}
	}

	//vip icon
	CCSprite *vip = (CCSprite*)pCell->getChildByTag(3);
	if (sign.vip>0)
	{ 
		CCTexture2D *texture = CCTextureCache::sharedTextureCache()
											->addImage(CCString::createWithFormat("public/vip_%d.png",sign.vip)->getCString());
		vip->setVisible(true);
		vip->setTexture(texture);
	}
	else
	{
		vip->setVisible(false);
	}

	switch (sign.status)
	{
		//没签
	case 2:
		{
			//对勾
			pCell->getChildByTag(4)->setVisible(false);
			//考虑是否加个框标示为可签
			if(uIdx == m_signData.sign && 
				(m_signData.bCanSign || (m_signData.bCanResign && m_signData.resign>0) ) )
			{
				CImageView * pMask = (CImageView*)pCell->getChildByTag(2);
				CCSprite* pRect = CCSprite::create("common/box_light.png");
				pRect->setPosition(ccp(pMask->getPositionX()+pMask->getContentSize().width/2, pMask->getPositionY()+pMask->getContentSize().height/2));
				pCell->addChild(pRect, 100);
				pRect->runAction(CCRepeatForever::create(CCSequence::createWithTwoActions(CCScaleTo::create(0.3f, 1.03f), CCScaleTo::create(0.3f, 1.0f))));
			}
		}
		break;
		//已签
	case 1:
		{
			//对勾
			pCell->getChildByTag(4)->setVisible(true);
			//变黑
			pCell->getChildByTag(1)->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
			pCell->getChildByTag(2)->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
			pCell->getChildByTag(2)->getChildByTag(2)->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
			pCell->getChildByTag(3)->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
			//星星
			CLayout * pStarLay = (CLayout*)pCell->getChildByTag(2)->getChildByTag(211);
			if(pStarLay!=nullptr)
			{
				CCArray* pChildren = pStarLay->getChildren();
				for(int i=0; i<pChildren->count(); i++)
				{
					CCSprite* pStar = dynamic_cast<CCSprite*>(pChildren->objectAtIndex(i));
					if(pStar)
					{
						pStar->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
					}
				}
			}
			////数字
			//CCLabelAtlas * pLabel = (CCLabelAtlas*)pCell->getChildByTag(2)->getChildByTag(211);
			//if(pLabel && pLabel->isVisible())
			//{
			//	pLabel->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
			//}
		}
		break;
	default:
		break;
	}

}
Пример #9
0
void CHandBookHeroLayer::addTableCell( unsigned int uIdx, CTableViewCell * pCell )
{
	//先克隆外框条
	CLayout *pLay = UICloneMgr::cloneLayout(m_pCellBlank);

	//对应数据
	AtlasIns *pAtlasIns = m_AtlasResponse.mutable_atlas_list()->Mutable(uIdx);

	//赋值
	for (unsigned int i=1; i<=10; i++)
	{
		CCNode *child = pLay->getChildByTag(i);
		pLay->removeChild(child);
		child->setTag(i);
		pCell->addChild(child);
		pCell->setTag(uIdx);
	}

	//1-活动底板
	{
		CImageView* pBoard = dynamic_cast<CImageView*>(pCell->getChildByTag(1));
		pBoard->setTouchEnabled(true);
		pBoard->setOnClickListener(this, ccw_click_selector(CHandBookHeroLayer::onClickBlank));

		if ( uIdx==m_iSelectIndex )
		{
			pBoard->setTexture(CCTextureCache::sharedTextureCache()->addImage("handBook/bookbg_2.png"));
		}
		else
		{
			pBoard->setTexture(CCTextureCache::sharedTextureCache()->addImage("handBook/bookbg_1.png"));
		}
	}

	//2-组合名字
	{
		CLabel* pLabel = dynamic_cast<CLabel*>(pCell->getChildByTag(2));
	}

	//3-//组合描述
	{
		CLabel* pLabel = dynamic_cast<CLabel*>(pCell->getChildByTag(3));
	}

	//4-礼品背景
	//5-礼品
	//10-文字
	{
		CImageView* pGiftBg = dynamic_cast<CImageView*>(pCell->getChildByTag(4));
		CImageView* pGift = dynamic_cast<CImageView*>(pCell->getChildByTag(5));
		CLabel* pLabel = dynamic_cast<CLabel*>(pCell->getChildByTag(10));

		pLabel->setVisible(false);
		pGift->stopAllActions();

		//奖励领取标志 0未领取(不可领取),1未领取(可领取状态),2 已领取
		switch (pAtlasIns->get_prize())
		{
		case 0:
			{
				pGiftBg->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
				pGift->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));

			}break;
		case 1:
			{
				pGiftBg->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderDefault));
				pGift->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderDefault));
				ResetAnchorPointAndKeepSamePos(pGift, CCPointCenter);
				pGift->runAction(CCRepeatForever::create(CCSequence::createWithTwoActions(CCScaleTo::create(0.3f, 0.75f), CCScaleTo::create(0.3f, 0.7f))));

			}break;
		case 2:
			{
				pGiftBg->setVisible(false);
				pGift->setVisible(false);
				pLabel->setVisible(true);
			}break;
		default:
			break;
		}
	}


	//7-进度条
	//8-进度数字
	//9-进度图标
	{
		CProgressBar* pProgress = dynamic_cast<CProgressBar*>(pCell->getChildByTag(7));

		CLabel* pLabel = dynamic_cast<CLabel*>(pCell->getChildByTag(8));
		pLabel->setTouchEnabled(true);
		pLabel->setOnClickListener(this, ccw_click_selector(CHandBookHeroLayer::onClickScoreIcon));

		CImageView* pIcon = dynamic_cast<CImageView*>(pCell->getChildByTag(9));
		pIcon->setTouchEnabled(true);
		pIcon->setOnClickListener(this, ccw_click_selector(CHandBookHeroLayer::onClickScoreIcon));
	}


	//收集列表
	CCPoint pPos(80, 54);
	int iGapX = 94;
	initListCellIcon( pAtlasIns, pPos, iGapX, pCell );

}
Пример #10
0
void CStrengthenItem::addTableCell(unsigned int uIdx, CTableViewCell * pCell)
{
	CLayout *lay = UICloneMgr::cloneLayout(m_cell);

	CItem &item =  *(m_itemList.at(uIdx));// m_itemData.itemList.at(uIdx);

	pCell->setTag(uIdx);

	const ItemData * itemData = DataCenter::sharedData()->getItemDesc()->getCfg(item.itemId);

	for (int i = 1; i <=11; i++)
	{
		CCNode *child = lay->getChildByTag(i);
		if (!child) continue;
		lay->removeChild(child);
		pCell->addChild(child);

		if (i==1)
		{
			CImageView *bgImg = (CImageView*)child;
			if (m_toHero>0)
			{
				if (!item.canUse&&item.armor.hero!=m_toHero)
				{
					CColorView *colorView = CColorView::create(ccc4(0,0,0,100));
					colorView->setContentSize(bgImg->getContentSize());
 					colorView->setPosition(bgImg->getPosition());
					pCell->addChild(colorView,1);
				}
				
				if(item.armor.hero<=0)
				{
					//记录库存
					m_iCountEquipStock++;
				}
			}
			
			bgImg->setTouchEnabled(true);
			bgImg->setUserData(m_itemList.at(uIdx));
			bgImg->setOnClickListener(this,ccw_click_selector(CStrengthenItem::onTouchItem));
		}
		else if (i==2)
		{
			((CButton*)child)->setEnabled(false);
			CCSprite *mask = CCSprite::createWithTexture(setItemQualityTexture(item.quality));
			mask->setPosition(ccp(child->getContentSize().width/2,child->getContentSize().height/2));
			child->addChild(mask, 10);

			CCSprite *prop = CCSprite::create(GetImageName(1, item.quality, item.iconId).c_str());
			if (!prop)
			{
				prop = CImageView::create("prop/32003.png");
			}
			prop->setPosition(ccp(child->getContentSize().width/2,child->getContentSize().height/2));
			child->addChild(prop);

			//添加星星
			CLayout* pStarLayout = getStarLayout(item.iStar);
			child->addChild(pStarLayout, 10);
		}
		else if (i==3)
		{
			CLabel *label = (CLabel*)child;
			if(itemData)
			{
				label->setString(itemData->itemName.c_str());
			}
		}
		else if (i==4)
		{
			CLabel *label = (CLabel*)child;
			
			if (item.itemLevel==0)
			{
				label->removeFromParent();
			}
			else
			{
				label->setString(CCString::createWithFormat("+%d",item.itemLevel)->getCString());
				label->setPositionX(pCell->getChildByTag(3)->getPositionX()+pCell->getChildByTag(3)->getContentSize().width+10);
			}
		}
		else if (i==5)
		{
			CLabel *label = (CLabel*)child;
			if (item.itemLevel==0)
			{
				label->setVisible(false);
			}
			else
			{
				label->setVisible(true);
				//if (item.itemLevel==item.armor.strenLv)
				//{
				//	label->setString(CCString::createWithFormat("Lv.%s",GETLANGSTR(229))->getCString());
				//}
				//else
				//{
				//	label->setString(CCString::createWithFormat("Lv.%d",item.itemLevel)->getCString());
				//}
				label->setString(CCString::createWithFormat("+%d",item.itemLevel)->getCString());
			}
		}
		else if (i==6)
		{
			CCSprite *head = (CCSprite*)child;
			if (item.armor.hero>0)
			{
				CCSprite *img = CCSprite::create(getImageName(&item.armor).c_str());
				if(!img)
				{
					img = CCSprite::create("headIcon/101.png");
					CCLOG("ERROR CStrengthenItem::addTableCell");
				}

				CCSprite *mask = (CCSprite*) lay->getChildByTag(7);
				lay->removeChild(mask);
				pCell->addChild(mask);

				img->setScale(0.53f);
				img->setPosition(ccp(head->getContentSize().width/2,head->getContentSize().height/2+14));
				head->addChild(img);
			}
			else
			{
				pCell->removeChild(child);
			}
		}
		else if (i==7)
		{
			pCell->removeChild(child);
		}
		else if (i==8)
		{
			child->setVisible(item.stren);
		}
		else if(i==9)
		{
			if (item.itemLevel==0)
			{
				child->setVisible(false);
			}
			else
			{
				child->setVisible(true);
			}
		}
		else if( i ==10)
		{
			CCNode* pCombatTip = (CCNode*)child;
			pCombatTip->setVisible(item.armor.armorType != 5);
		}
		else if (i==11)
		{
			CLabelAtlas* pLabel = (CLabelAtlas*)child;
			pLabel->setAnchorPoint(ccp(0, 0.5f));
			pLabel->setString(ToString(item.armor.combat));
			pLabel->setVisible(item.armor.armorType != 5);
		}
	}
}
Пример #11
0
void CMainCityUI::onEnter()
{
	BaseLayer::onEnter();

	UserData *user = DataCenter::sharedData()->getUser()->getUserData();
	
	//角色信息相对位置处理
	CLayout* headPart = (CLayout*)m_ui->findWidgetById("head_part");
	headPart->setPosition(m_ui->convertToNodeSpace(ccp(VLEFT+headPart->getContentSize().width/2, VTOP-headPart->getContentSize().height/2)));

	//显示角色名,等级,体力,金币
	CLabel *nameLabel = (CLabel*)headPart->getChildByTag(10);
	nameLabel->setString(user->getRoleName().c_str());
	nameLabel->setColor(RGB_ROLE_COLOR);	
	
	CLabel *level = (CLabel*)(headPart->findWidgetById("level"));
	level->setString(CCString::createWithFormat("Lv%d",user->getLevel())->getCString());
	
	CProgressBar *progressBar = (CProgressBar*)(headPart->getChildByTag(11));
	progressBar->setMaxValue(user->getNextExp());
	progressBar->startProgress(user->getExp(),0.3f);

	CLabelAtlas *vip_level = (CLabelAtlas*)(headPart->findWidgetById("level_vip"));
	vip_level->setString(ToString(user->getVip()));
	if (user->getVip()==0)
	{
		vip_level->setVisible(false);
		CLabelAtlas *vip_font = (CLabelAtlas*)(headPart->findWidgetById("vip_font"));
		vip_font->setVisible(false);
	}

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

	CButton *button = nullptr;
	int i = 1;
	for (; i<=9; ++i)
	{
		CCNode *lay = dynamic_cast<CCNode*>( m_ui->getChildByTag(i));
		button = dynamic_cast<CButton*>(lay->getChildByTag(i));
// 			button->setEnabled(false);
		button->setOnClickListener(this, ccw_click_selector(CMainCityUI::onClickBtn));
		button->setSelectedTexture(((CCSprite*)(button->getNormalImage()))->getTexture());
		button->getSelectedImage()->setScale(1.1f);
		m_btnPos[i] = button->getPosition();
	}

	CCSprite* head = (CCSprite*)headPart->getChildByTag(15);

	if (user->getThumb()>0)
	{
		CCTexture2D *texture = CCTextureCache::sharedTextureCache()
		->addImage(CCString::createWithFormat("headIcon/%d.png", user->getThumb())->getCString());
		if (texture)
		{
			head->setTexture(texture);
		}
	}
	else
	{
		string fbName = user->getFbId()+".jpg";
		string fullName = CCFileUtils::sharedFileUtils()->fullPathForFilename(fbName.c_str());
		bool isFileExist = CCFileUtils::sharedFileUtils()->isFileExist(fullName);
		if(isFileExist)
		{
			CCSprite *headBg = (CCSprite *)(headPart->findWidgetById("headbg"));
			CCSprite *sp = CCSprite::create(fbName.c_str());
			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),
				CCCallFuncN::create(this, callfuncN_selector(CMainCityUI::onTimeWaitCityAction)),
				NULL));
			m_bShowChapterFlag = true;
			DataCenter::sharedData()->setCityActionType(CA_None);
		}
		break;
	case CA_GoToStage:
		{
			this->runAction(CCSequence::create(CCDelayTime::create(0.8f),
				CCCallFunc::create(this, callfunc_selector(CMainCityUI::runTollgatepreviewCallBack)),
				NULL));
			DataCenter::sharedData()->setCityActionType(CA_None);
		}break;
	default:
		break;
	}

	//绑定场景隐藏和显示的消息
	NOTIFICATION->addObserver(this, callfuncO_selector(CMainCityUI::show), SHOW_MAIN_SCENE, nullptr);
	NOTIFICATION->addObserver(this, callfuncO_selector(CMainCityUI::hide), HIDE_MAIN_SCENE, nullptr);
	NOTIFICATION->addObserver(this, callfuncO_selector(CMainCityUI::checkShowActivity), "CheckShowActivity", nullptr);


	CCNode *lay = dynamic_cast<CCNode*>( m_ui->getChildByTag(6));
	button = dynamic_cast<CButton*>(lay->getChildByTag(6));
	CCAnimation *batAnim = AnimationManager::sharedAction()->getAnimation("9015");
	batAnim->setDelayPerUnit(0.1f);
	CCSprite *batLight = createAnimationSprite("skill/9015.png",button->getPosition(),batAnim,true);
	batLight->setScale(1.4f);
	m_ui->addChild(batLight);

	showNoticeTip(CTaskControl::getInstance()->getGameTips());
// 	CCSprite *spr = CCSprite::create("headImg/506.png");
// 	spr->setScale(1.2f);
// 	CCSprite *sp = maskedSprite(spr);
// 	CCSprite *headBg = (CCSprite *)(headPart->findWidgetById("headbg"));
// 	sp->setPosition(headBg->getPosition());
// 	headPart->addChild(sp);

	//在线礼包
	int iNexTime = user->getOnlinePrizeTime();
	if (iNexTime!=-1)
	{
		if (m_pTimeGift==nullptr)
		{
			m_pTimeGift = CTimeGift::create();
			m_pTimeGift->setTouchPriority(-3);
			this->addChild(m_pTimeGift, 2);
		}
		m_pTimeGift->setTime(iNexTime);
	}

}