示例#1
0
void StageSelectScene::InitStageBut()
{
	int dailyStageLev = KMainPlayer::RealPlayer()->GetDailyStageLev();
	int towerPos = KMainPlayer::RealPlayer()->GetPlayerRecord()->_gameData._tower.GetPos();
	bool bTowerShow =KMainPlayer::RealPlayer()->GetPlayerRecord()->_gameData._tower._bShow;
	for(int i=0;i<MAX_PAGE_STAGE_NUM;i++){
		char sz[64];
		sprintf(sz,"but_stage_%d",i);
		UIWidget* pBut = this->getWidgetByName(sz);
		pBut->setTouchEnabled(true);
		pBut->setTag(i+1);
		pBut->addPushDownEvent(this, coco_pushselector(StageSelectScene::DoClickStage));
		KUIAssist::_setButVisible(pBut, i<dailyStageLev);
		sprintf(sz,"stage_txt_%d",i);
		UILabelAtlas* stageNumLabel = (UILabelAtlas*)this->getWidgetByName(sz);
		if(!bTowerShow && towerPos==(i+1)){
			stageNumLabel->setColor(ccc3(240, 55, 11));
		}else{
			stageNumLabel->setColor(ccc3(255, 255, 255));
		}
		sprintf(sz,"%d",i+1);
		stageNumLabel->setStringValue(sz);
		stageNumLabel->setVisible(i<dailyStageLev);
	}
}
示例#2
0
void Bag::initUILayer()
{
	UIWidget* widget = dynamic_cast<Layout*>(cocos2d::extension::GUIReader::shareReader()->widgetFromJsonFile("SampleChangeEquip_UI_1/SampleChangeEquip_UI_1.ExportJson"));
	uiLayer = UILayer::create();
	uiLayer->addWidget(widget);
	this->addChild(uiLayer);

	UIWidget* closeButton = dynamic_cast<UIWidget*>(uiLayer->getWidgetByName("closebutton"));
	closeButton->addPushDownEvent(this,coco_pushselector(Bag::closeCallback));
}
示例#3
0
cocos2d::extension::UIWidget* HeroBrowseScene::GetPanel()
{
	if(!m_ui){
		m_ui =  KJsonDictMgr::getSingleton().widgetFromJsonFile("GUI/heroBrowse.json");
		
		
		UIWidget* pBut = UIHelper::seekWidgetByName(m_ui,"back_but");
		pBut->addPushDownEvent(this,coco_pushselector(HeroBrowseScene::onCloseCallback));
		
		pBut = UIHelper::seekWidgetByName(m_ui,"page_down_but");
		pBut->addPushDownEvent(this,coco_pushselector(HeroBrowseScene::onClickPageDown));

		pBut = UIHelper::seekWidgetByName(m_ui,"page_up_but");
		pBut->addPushDownEvent(this,coco_pushselector(HeroBrowseScene::onClickPageUp));

		
		m_pPageInfo = (UILabel*)UIHelper::seekWidgetByName(m_ui,"page_info");

		char sz[32];
		for(int i=0;i<PAGE_CARD_NUM;i++){
			

			sprintf(sz,"Levup_but_%d",i);
			pBut = UIHelper::seekWidgetByName(m_ui,sz);
			pBut->setTag(i);
			pBut->addPushDownEvent(this,coco_pushselector(HeroBrowseScene::onClickHeroLevUp));


			sprintf(sz,"break_but_%d",i);
			pBut = UIHelper::seekWidgetByName(m_ui,sz);
			pBut->setTag(i);
			pBut->addPushDownEvent(this,coco_pushselector(HeroBrowseScene::onClickBreakHero));

		}
		m_radioRace.AddGroupBut("check_race",6,m_ui,this,coco_pushselector(HeroBrowseScene::onClickRace),0);
		
		m_curCardGroup = m_curPage = 0;
		m_depot = NULL;

	}
	return m_ui;
}
示例#4
0
void StageSelectScene::InitTower()
{
	UIWidget* pBut = this->getWidgetByName("but_tower");
	pBut->addPushDownEvent(this, coco_pushselector(StageSelectScene::DoClickTower));
	bool bShowTower = KMainPlayer::RealPlayer()->IsShowTower();

	KUIAssist::_setButVisible(pBut, bShowTower);
	UILabelAtlas* pLayer = (UILabelAtlas*)this->getWidgetByName("tower_layer_txt");
	char sz[64];
	sprintf(sz,"%d",  KTowerAssist::_getLayer());
	pLayer->setStringValue(sz);
	pLayer->setVisible(bShowTower);
}
示例#5
0
bool KSceneSlidePicture::init()
{
	if ( !CCLayer::init() )
    {
        return false;
    }

	m_ui = KJsonDictMgr::getSingleton().widgetFromJsonFile("GUI/Slider.json"); 
	UIWidget* pBut = UIHelper::seekWidgetByName(m_ui,"bk");
	pBut->addPushDownEvent(this, coco_pushselector(KSceneSlidePicture::onClickNext));

	CreateCheckSlideRadio();
	cocos2d::extension::UILayer* layer = cocos2d::extension::UILayer::create();
	layer->addWidget(m_ui);
	addChild(layer, 1);
	CreateCloseBut();
	UpdatePanel();
	return true;
}