示例#1
0
bool UILaoHuJi::init()
{
	m_fileName = "LaoHuJi.ExportJson";
	topLight = 0;
	bottomLight = 0;
	topDtime = 0;
	buttomDtime = 0;
	bLinkTime = 0;
	runDtime = 0;

	state = LaoHuJi_Hiddent;

	if( UIBase::init() )
	{
		// parse
		UIImageView* bgImage = static_cast<UIImageView*>(m_pWidget->getChildByName("bg"));
		m_pLeftListView = static_cast<ListView*>(bgImage->getChildByName("leftListView"));
		m_pRightListView = static_cast<ListView*>(bgImage->getChildByName("rightListView"));

		m_pCloseBtn = static_cast<UIButton*>(m_pWidget->getChildByName("closeBtn"));
		m_pDrawBtn =  static_cast<UIButton*>(m_pWidget->getChildByName("drawBtn"));
		m_pFreeImg =  static_cast<UIImageView*>(m_pDrawBtn->getChildByName("freeImg"));

		UIPanel* buttomPanel = static_cast<UIPanel*>(m_pWidget->getChildByName("buttomPanel"));
		
		CCString* str;
		for( int i = 0 ; i < 24 ; i++ )
		{
			str = CCString::createWithFormat("normalLight_%d",(i+1));
			m_pNormalLight[i] = static_cast<UIImageView*>(buttomPanel->getChildByName(str->getCString()));
			m_pOnLight[i] = static_cast<UIImageView*>(m_pNormalLight[i] ->getChildByName("onLight"));

			m_pOnLight[i]->setVisible( false );
		}

		UIPanel* topPanel = static_cast<UIPanel*>(m_pWidget->getChildByName("topPanel"));
		for( int i = 0 ; i < 5 ; i++ )
		{
			str = CCString::createWithFormat("noramStar_%d",(i+1));
			m_pNormalStar[i] = static_cast<UIImageView*>(topPanel->getChildByName(str->getCString()));
			m_pOnStar[i] = static_cast<UIImageView*>(m_pNormalStar[i] ->getChildByName("onStar"));
			m_pOnStarBg[i] = static_cast<UIImageView*>(m_pNormalStar[i] ->getChildByName("onStarBg"));
		
			m_pOnStarBg[i]->setVisible( false );
			m_pOnStar[i]->setVisible( false );
		}

		// register event
		m_pCloseBtn->addTouchEventListener( this , toucheventselector( UILaoHuJi::closeLaoHuJi));
		m_pDrawBtn->addTouchEventListener( this , toucheventselector( UILaoHuJi::starLaoHuJi));

		m_pUILayer->retain();
		m_pWidget->retain();
	}

	this->setHiddent( true );
	return true;
}
示例#2
0
bool GestureScene::init() {
    if ( !CCLayer::init() ) 
        return false;
    CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
    CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
	this->setTouchEnabled(true);

	UILayer* uiLayer = UILayer::create();  
    uiLayer->addWidget(GUIReader::shareReader()->widgetFromJsonFile("UI/GestureUI/GestureUI.json"));  

	UIPanel* rootPanel = (UIPanel*)uiLayer->getWidgetByName("rootPanel");
	xLabel = (UILabel*) rootPanel->getChildByName("touchXLabel");
	yLabel = (UILabel*) rootPanel->getChildByName("touchYLabel");
	resultLabel = (UILabel*) rootPanel->getChildByName("gestureNameLabel");

    this->addChild(uiLayer, 2);

    return true;
}