• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ UIPanel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CCARRAY_FOREACH

void Bag::initEquips()
{
	UIPanel* equipPanel = dynamic_cast<UIPanel*>(uiLayer->getWidgetByName("equippanel"));
	CCArray* equips = equipPanel->getChildren();
	CCObject* object = NULL;

	int bagGridCount = 1;

	int equipType = EQUIP_TYPE_HELMET;		//the first type of equip

	CCARRAY_FOREACH(equips,object)
	{
		UIPanel* equipChildPanel = (UIPanel*)object;
		CCArray* equips = equipChildPanel->getChildren();

		int equipStartNum = 1;

		CCARRAY_FOREACH_REVERSE(equips, object)
		{
			UIWidget* equip = dynamic_cast<UIWidget*>(object);
			equip->addTouchEventListener(this,toucheventselector(Bag::touchEvent));
			initEquipID(equip,equipType,equipStartNum);
			
			UIWidget* bagGrid = getBagGrid(bagGridCount++);
			changeParent(bagGrid,equip);

			equipStartNum++;
		}
开发者ID:bartly,项目名称:hero_project,代码行数:28,代码来源:Bag.cpp


示例2: init

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;
}
开发者ID:alldnnwanglu,项目名称:PopoStar,代码行数:58,代码来源:UILaoHuJi.cpp


示例3: callback

	void callback(UIBase *base)
	{
		if (window)
		{
			UIPanel * target = window->showPanel(gloabFileName.c_str());
			if (target)
			{
				target->makeXmlFile(gloabFileName.c_str());
			}
		}
	}
开发者ID:jijinlong,项目名称:SyGame,代码行数:11,代码来源:StartScene.cpp


示例4: parent_p_bind

/**
 * 设置父类的bind
 */
int UILib::parent_p_bind(UIStub* stub,script::tixmlCodeNode * node)
{
	if (stub && stub->base)
	{
		UIPanel *panel = stub->base->getPanel();
		if (panel)
		{
			panel->bindBtnClick(node->getAttr("btnname"),UICALLBACK(node->getAttr("event")));
		}
	}
	return 1;
}
开发者ID:jijinlong,项目名称:SyGame,代码行数:15,代码来源:UILib.cpp


示例5: parent_p_label_set_value

/**
 * 设置父类
 */
int UILib::parent_p_label_set_value(UIStub* stub,script::tixmlCodeNode * node)
{
	if (stub && stub->base)
	{
		UIPanel *panel = stub->base->getPanel();
		if (panel)
		{
			panel->setUILabelvalue(node->getAttr("labelname"),node->getAttr("value"));
		}
	}
	return 1;
}
开发者ID:jijinlong,项目名称:SyGame,代码行数:15,代码来源:UILib.cpp


示例6: CCLOG

void PlayScene::onEnter() {
  CCScene::onEnter();

  CCLOG("%s", __FUNCTION__);
  // load ui
  ui_layer_ = UILayer::create();
  ui_layer_text_ = UILayer::create();
  char path[1024];
  snprintf(path, 1024, "MainScene/GirlScene%d.json",
           stageid_);

  Layout *layout = dynamic_cast<Layout*>(CCUIHELPER->createWidgetFromJsonFile(path));
  ui_layer_->addWidget(layout);

  card_mgr_.CreateLayer(this);
  this->addChild(ui_layer_, 0, 100);
  this->addChild(card_mgr_.card_layer(), 1, 101);
  this->addChild(ui_layer_text_, 2, 100);

  card_mgr_.Init(stageid_);

  UIButton *btn = (UIButton *)ui_layer_->getWidgetByName("BtnBack");
  if (btn) {
    btn->addTouchEventListener(this, toucheventselector(PlayScene::onBtnBack));
    btn->setPressedActionEnabled(true);
  }

  UIPanel *panel = (UIPanel *)ui_layer_->getWidgetByName("PanelSecond");
  if(panel == NULL) {
    return;
  }
  panel->setVisible(false);
  panel->setTouchEnable(false);

  btn = (UIButton *)ui_layer_->getWidgetByName("BtnStartPlay");
  if (btn) {
    btn->addTouchEventListener(this, toucheventselector(PlayScene::onBtnStartPlay));
    CCScaleTo* scale1 = CCScaleTo::create( 1.0f, 1.2f);
    CCScaleTo* scale2 = CCScaleTo::create( 1.0f, 0.8f);
    CCSequence* scale = CCSequence::createWithTwoActions(scale1, scale2);
    btn->getVirtualRenderer()->runAction(CCRepeatForever::create(scale));
  }
  btn = (UIButton *)ui_layer_->getWidgetByName("BtnShirt");
  if (btn) {
    btn->setTouchEnable(false);
  }
  card_mgr_.SetEnable(false);

  be_back_ = false;
  property_state_ = -1;
}
开发者ID:f17qh,项目名称:crazyass,代码行数:51,代码来源:play_scene.cpp


示例7: init

bool GameLayer_GoldMarket::init()
{
    if (!CCLayer::init()) {
        return false;
    }
    //系统设置界面.
    goldMarket = UILayer::create();
    auto layout = dynamic_cast<Layout*>(GUIReader::shareReader()->widgetFromJsonFile("./CocoStudioResources/GoldMarket.json"));
    goldMarket->addWidget(layout);
    //    sysSet->setVisible(true);
    this->addChild(goldMarket, 0, 101);
    
    UIPanel* panel = dynamic_cast<UIPanel*>(goldMarket->getWidgetByName("Panel"));
    panel->setBackGroundColor(ccBLACK);
    panel->setBackGroundColorOpacity(150);
    //关闭按钮
    UIButton* closeBtn = dynamic_cast<UIButton*>(goldMarket->getWidgetByName("CloseBtn"));
    closeBtn->setTouchEnable(true);
    closeBtn->addReleaseEvent(this, coco_releaseselector(GameLayer_GoldMarket::closeBtnCallback));
    closeBtn->setPressedActionEnabled(true);
    
    //购买按钮.
    UIButton* buyBtn_0 = dynamic_cast<UIButton*>(goldMarket->getWidgetByName("BuyBtn_0"));
    buyBtn_0->setTag(Buy_0);
    buyBtn_0->setPressedActionEnabled(true);
    buyBtn_0->addReleaseEvent(this, coco_releaseselector(GameLayer_GoldMarket::buyBtnCallback));
    UIButton* buyBtn_1 = dynamic_cast<UIButton*>(goldMarket->getWidgetByName("BuyBtn_1"));
    buyBtn_1->setTag(Buy_1);
    buyBtn_1->setPressedActionEnabled(true);
    buyBtn_1->addReleaseEvent(this, coco_releaseselector(GameLayer_GoldMarket::buyBtnCallback));
    UIButton* buyBtn_2 = dynamic_cast<UIButton*>(goldMarket->getWidgetByName("BuyBtn_2"));
    buyBtn_2->setTag(Buy_2);
    buyBtn_2->setPressedActionEnabled(true);
    buyBtn_2->addReleaseEvent(this, coco_releaseselector(GameLayer_GoldMarket::buyBtnCallback));
    UIButton* buyBtn_3 = dynamic_cast<UIButton*>(goldMarket->getWidgetByName("BuyBtn_3"));
    buyBtn_3->setTag(Buy_3);
    buyBtn_3->setPressedActionEnabled(true);
    buyBtn_3->addReleaseEvent(this, coco_releaseselector(GameLayer_GoldMarket::buyBtnCallback));
    //UIButton* buyBtn_4 = dynamic_cast<UIButton*>(goldMarket->getWidgetByName("BuyBtn_4"));
    //buyBtn_4->setTag(Buy_4);
    //buyBtn_4->setPressedActionEnabled(true);
    //buyBtn_4->addReleaseEvent(this, coco_releaseselector(GameLayer_GoldMarket::buyBtnCallback));
    
    
    this->setValue();

    //添加兑换按钮
    this->setVisible(true);
    return true;
}
开发者ID:anzhongliu,项目名称:SmallGame_Cocos2dx,代码行数:50,代码来源:GameLayer_GoldMarket.cpp


示例8: setNoLogin

void GameLayer_Menu::setNoLogin(bool visiable)
{
    UIPanel* dayLoginPanel = dynamic_cast<UIPanel*>(gameMenu->getWidgetByName("MenuBtn"));
    dayLoginPanel->setVisible(visiable);
    UIButton* taskBtn = dynamic_cast<UIButton*>(gameMenu->getWidgetByName("SysInfoBtn"));
    taskBtn->setTouchEnable(visiable);
    UIButton* emailBtn = dynamic_cast<UIButton*>(gameMenu->getWidgetByName("EmailBtn"));
    emailBtn->setTouchEnable(visiable);
    UIButton* addFriendBtn = dynamic_cast<UIButton*>(gameMenu->getWidgetByName("AddFriendBtn"));
    addFriendBtn->setTouchEnable(visiable);
    UIButton* rankBtn = dynamic_cast<UIButton*>(gameMenu->getWidgetByName("RankBtn"));
    rankBtn->setVisible(visiable);
    rankBtn->setTouchEnable(visiable);
}
开发者ID:anzhongliu,项目名称:SmallGame_Cocos2dx,代码行数:14,代码来源:GameLayer_Menu.cpp


示例9: hideparentpanel

int UILib::hideparentpanel(UIStub* stub,script::tixmlCodeNode * node)
{
	if (stub && stub->base)
	{
		UIPanel *panel = stub->base->getPanel();
		if (panel)
		{
			if (panel)
			{
				panel->hide();
			}
		}
	}
	return 1;
}
开发者ID:jijinlong,项目名称:SyGame,代码行数:15,代码来源:UILib.cpp


示例10: hidepanel

/**
* 隐藏Panel
*/
int UILib::hidepanel(UIStub* stub,script::tixmlCodeNode * node)
{
	if (stub && stub->base)
	{
		UIWindow *window = stub->base->getDepthWindow();
		if (window)
		{
			UIPanel *target = window->getPanel(node->getAttr("name"));
			if (target)
			{
				target->hide();
			}
		}
	}
	return 1;
}
开发者ID:jijinlong,项目名称:SyGame,代码行数:19,代码来源:UILib.cpp


示例11: callback

	virtual void callback(UIBase *base)
	{
		if (dialog && window)
		{
			// 创建图片
			UIPanel *panel = window->getNowTouchPanel();
			if (panel)
			{
				UIImage *image = (UIImage*) panel->createImage(ccp(0,300),CCSizeMake(0,0),"defaultimg.png",panel);
				if (image)
				{
					image->setEditable(true);
					image->bind(UIBase::EVENT_EDIT_DOWN,new stShowProp());
				}
			}
		}
	}
开发者ID:jijinlong,项目名称:SyGame,代码行数:17,代码来源:StartDialog.cpp


示例12: panelbind

/**
 * 绑定自身panel 的处理逻辑 C++ 写的逻辑
 */
int UILib::panelbind(UIStub* stub,script::tixmlCodeNode * node)
{
	if (stub && stub->base)
	{
		UIPanel *panel = stub->base->getPanel();
		if (panel)
		{
			UIWindow *window = panel->getWindow();
			if (window)
			{
				UIPanel *target = window->getPanel(node->getAttr("name"));
				if (target)
					target->bindBtnClick(node->getAttr("btnname"),UICALLBACK(node->getAttr("event")));
			}	
		}
	}
	return 1;
}
开发者ID:jijinlong,项目名称:SyGame,代码行数:21,代码来源:UILib.cpp


示例13: showpanel

/**
* 展示panel 
*/
int UILib::showpanel(UIStub* stub,script::tixmlCodeNode * node)
{
	if (stub && stub->base)
	{
		UIWindow *window = stub->base->getDepthWindow();
		if (window)
		{
			UIPanel *panel = window->showPanel(node->getAttr("name"));
			std::string tag = node->getAttr("model");
			if (tag == "true" && panel)
			{
				window->pushModel(panel);
			}
			if (panel)
			panel->setVisible(true);
		}
	}
	return 1;
}
开发者ID:jijinlong,项目名称:SyGame,代码行数:22,代码来源:UILib.cpp


示例14: init

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;
}
开发者ID:b99902062,项目名称:PaintHunter,代码行数:19,代码来源:GestureScene.cpp


示例15: panel_label_set_value

/**
 * 设置panel 上UILabel 的值
 */
int UILib::panel_label_set_value(UIStub* stub,script::tixmlCodeNode * node)
{
	if (stub && stub->base)
	{
		UIPanel *panel = stub->base->getPanel();
		if (panel)
		{
			UIWindow *window = panel->getWindow();
			if (window)
			{
				UIPanel *target = window->getPanel(node->getAttr("name"));
				if (target)
				{
					target->setUILabelvalue(node->getAttr("labelname"),node->getAttr("value"));
				}
			}	
		}
	}
	return 1;
}
开发者ID:jijinlong,项目名称:SyGame,代码行数:23,代码来源:UILib.cpp


示例16: UIManager

void Application::InitGUI()
{
    m_UIManager = new UIManager(m_Renderer);
    m_Renderer->SetUIManager(m_UIManager);
    m_UIManager->Initialize();
    m_UIManager->SetZClipPlanes(0.0f,200.0f);

    Byte* fDat = Load("Common/font24px/Font.fnt");
    Font* Fnt = new Font();
    Fnt->Load(fDat);
    Fnt->SetFontImage(LoadTexture("Common/font24px/Font.png"));
    m_UIManager->SetFont(Fnt);

    UIPanel* p = new UIPanel(Vec2(20,20));
    p->SetBackgroundColor(Vec4(1,1,1,1));
    p->SetBackgroundImage(LoadTexture("Common/Cursor.png"));
    m_Cursor = p;
    m_UIManager->AddElement(m_Cursor);

    glfwSetInputMode          (m_Window->GetWindow(),GLFW_CURSOR,GLFW_CURSOR_DISABLED);
    glfwSetMouseButtonCallback(m_Window->GetWindow(),OnClick     );
    glfwSetCursorPosCallback  (m_Window->GetWindow(),OnCursorMove);
    glfwSetKeyCallback        (m_Window->GetWindow(),OnKey       );
}
开发者ID:mdecicco,项目名称:HelloWorld,代码行数:24,代码来源:Application.cpp


示例17: init

bool UIPanelTest_Color::init()
{
    if (UIScene::init())
    {
        CCSize screenSize = CCDirector::sharedDirector()->getWinSize();        
        
        // Add the alert
        UILabel *alert = UILabel::create();
        alert->setText("Panel color render");
        alert->setFontName("Marker Felt");
        alert->setFontSize(30);
        alert->setColor(ccc3(159, 168, 176));
        alert->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f - alert->getRect().size.height * 2.925));
        m_pUiLayer->addWidget(alert);
        
        UIPanel *background = dynamic_cast<UIPanel*>(m_pUiLayer->getWidgetByName("background_Panel"));
        
        // Create the panel with color render
        UIPanel* panel = UIPanel::create();
        panel->setBackGroundColorType(PANEL_COLOR_SOLID);
        panel->setBackGroundColor(ccc3(128, 128, 128));
        panel->setClippingEnable(true);
        panel->setSize(CCSizeMake(280, 150));
        CCSize backgroundSize = background->getContentSize();
        panel->setPosition(ccp((screenSize.width - backgroundSize.width) / 2 +
                               (backgroundSize.width - panel->getRect().size.width) / 2,
                               (screenSize.height - backgroundSize.height) / 2 +
                               (backgroundSize.height - panel->getRect().size.height) / 2));
        m_pUiLayer->addWidget(panel);
        
        UIButton* button = UIButton::create();
        button->setTouchEnable(true);
        button->setTextures("cocosgui/animationbuttonnormal.png", "cocosgui/animationbuttonpressed.png", "");
        button->setPosition(ccp(button->getRect().size.width / 2, panel->getRect().size.height - button->getRect().size.height / 2));
        panel->addChild(button);
        
        UITextButton* textButton = UITextButton::create();
        textButton->setTouchEnable(true);
        textButton->setTextures("cocosgui/backtotopnormal.png", "cocosgui/backtotoppressed.png", "");
        textButton->setText("Text Button");
        textButton->setPosition(ccp(panel->getRect().size.width / 2, panel->getRect().size.height / 2));
        panel->addChild(textButton);
        
        UIZoomButton* zoomButton = UIZoomButton::create();
        zoomButton->setTouchEnable(true);
        zoomButton->setTextures("cocosgui/button.png", "cocosgui/buttonHighlighted.png", "cocosgui/button.png");
        zoomButton->setTitle("ControlButton", "ControlButton", "ControlButton");
        zoomButton->setNormalFontSize(16);
        zoomButton->setNormalFontName("Marker Felt");
        zoomButton->setPressedFontSize(16);
        zoomButton->setPressedFontName("Marker Felt");
        zoomButton->setDisabledFontSize(16);
        zoomButton->setDisabledFontName("Marker Felt");
        zoomButton->setPreferredSize(CCSizeMake(100, zoomButton->getContentSize().height * 2.0f));
        zoomButton->setPosition(ccp(panel->getRect().size.width - zoomButton->getRect().size.width / 2,
                                       zoomButton->getRect().size.height / 2));
        panel->addChild(zoomButton);
        
        return true;
    }
    return false;
}
开发者ID:chenxu111,项目名称:Cocos2d-x-For-CocoStudio,代码行数:62,代码来源:UIPanelTest.cpp


示例18: toucheventselector

bool UIStrengthen::init()
{
	if (!CCLayer::init())
	{
		return false;
	}

	uiLayer = UILayer::create();

	UILayout* strengthenRoot = dynamic_cast<UILayout*>(GUIReader::shareReader()->widgetFromJsonFile("ui/UIStrengthen.ExportJson"));
	uiLayer->addWidget(strengthenRoot);

	UIButton* closeButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("CloseButton"));
	closeButton->addTouchEventListener(this, toucheventselector(UIStrengthen::closeButtonClicked));

	UIButton* strengthenButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("StrengthenButton"));
	strengthenButton->addTouchEventListener(this, toucheventselector(UIStrengthen::strengthenButtonClicked));

	UIButton* pageLeftButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("PageLeftButton"));
	pageLeftButton->addTouchEventListener(this, toucheventselector(UIStrengthen::pageLeftButtonClicked));

	UIButton* pageRightButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("PageRightButton"));
	pageRightButton->addTouchEventListener(this, toucheventselector(UIStrengthen::pageRightButtonClicked));

	for (int i = 0; i < 4; i++)
	{
		const char* s = CCString::createWithFormat("EquipmentButton_%d", i+1)->getCString();
		UIButton* equipmentButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName(s));
		equipmentButton->addTouchEventListener(this, toucheventselector(UIStrengthen::equipmentButtonClicked));
	}

	for (int i = 0; i < 2; i++)
	{
		const char* s = CCString::createWithFormat("GemButton_%d", i+1)->getCString();
		UIButton* gemButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName(s));
		gemButton->addTouchEventListener(this, toucheventselector(UIStrengthen::gemButtonClicked));
	}

	for (int i = 0; i < 4; i++)
	{
		const char* s = CCString::createWithFormat("EquipmentImageView_%d", i+1)->getCString();
		equipmentImageView[i] = dynamic_cast<UIImageView*>(uiLayer->getWidgetByName(s));
	}

	for (int i = 0; i < 3; i++)
	{
		const char* s = CCString::createWithFormat("GemImageView_%d", i+1)->getCString();
		gemImageView[i] = dynamic_cast<UIImageView*>(uiLayer->getWidgetByName(s));
	}

	for (int i = 0; i < 2; i++)
	{
		const char* s = CCString::createWithFormat("GemFrontImageView_%d", i+1)->getCString();
		gemFrontImageView[i] = dynamic_cast<UIImageView*>(uiLayer->getWidgetByName(s));
	}

	strengthenfeatureImageView = dynamic_cast<UIImageView*>(uiLayer->getWidgetByName("FeatureImageView"));

	strengthenTestButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("StrengthenTestButton"));

	selectFrameImageView = dynamic_cast<UIImageView*>(uiLayer->getWidgetByName("SelectFrameImageView"));

	UIPanel* tableViewPanel = dynamic_cast<UIPanel*>(uiLayer->getWidgetByName("TableViewPanel"));

	CCTableView* strengthenTableView = CCTableView::create(this, CCSizeMake(strengthenTestButton->getContentSize().width, tableViewPanel->getContentSize().height));
	strengthenTableView->setDirection(kCCScrollViewDirectionVertical);
	strengthenTableView->setVerticalFillOrder(kCCTableViewFillTopDown);

	CCPoint strengthenTestPosition = strengthenTestButton->getPosition();
	strengthenTableView->setPosition(ccp(strengthenTestPosition.x, strengthenTestPosition.y - tableViewPanel->getContentSize().height));
	strengthenTableView->setDelegate(this);
	strengthenTableView->reloadData();

	addChild(uiLayer);
	addChild(strengthenTableView);

	setVisible(false);
	refresh();
	return true;
}
开发者ID:joyfish,项目名称:tianxiadiyi,代码行数:80,代码来源:UIStrengthen.cpp


示例19: init

bool UIPageViewTest::init()
{
    if (UIScene::init())
    {
        CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
        
        // Add a label in which the dragpanel events will be displayed
        m_pDisplayValueLabel = UILabel::create();
        m_pDisplayValueLabel->setText("Move by horizontal direction");
        m_pDisplayValueLabel->setFontName("Marker Felt");
        m_pDisplayValueLabel->setFontSize(32);
        m_pDisplayValueLabel->setAnchorPoint(ccp(0.5f, -1));
        m_pDisplayValueLabel->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f + m_pDisplayValueLabel->getContentSize().height * 1.5));
        m_pUiLayer->addWidget(m_pDisplayValueLabel);
        
        // Add the black background
        UILabel *alert = UILabel::create();
        alert->setText("PageView");
        alert->setFontName("Marker Felt");
        alert->setFontSize(30);
        alert->setColor(ccc3(159, 168, 176));
        alert->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f - alert->getRect().size.height * 2.925));
        m_pUiLayer->addWidget(alert);
        
        UIPanel *background = dynamic_cast<UIPanel*>(m_pUiLayer->getWidgetByName("background_Panel"));        
        
        // Create the page view
        UIPageView* pageView = UIPageView::create();
        pageView->setTouchEnable(true);
        pageView->setSize(CCSizeMake(240, 130));
        CCSize backgroundSize = background->getContentSize();
        pageView->setPosition(ccp((screenSize.width - backgroundSize.width) / 2 +
                                  (backgroundSize.width - pageView->getRect().size.width) / 2,
                                  (screenSize.height - backgroundSize.height) / 2 +
                                  (backgroundSize.height - pageView->getRect().size.height) / 2));
        
        for (int i = 0; i < 3; ++i)
        {
            UIPanel* panel = UIPanel::create();
            panel->setSize(CCSizeMake(240, 130));
            
            UIImageView* imageView = UIImageView::create();
            imageView->setTouchEnable(true);
            imageView->setScale9Enable(true);
            imageView->setTexture("cocosgui/scrollviewbg.png");
            imageView->setScale9Size(CCSizeMake(240, 130));
            imageView->setPosition(ccp(panel->getRect().size.width / 2, panel->getRect().size.height / 2));
            panel->addChild(imageView);
            
            UILabel* label = UILabel::create();
            label->setText(CCString::createWithFormat("page %d", (i + 1))->getCString());
            label->setFontName("Marker Felt");
            label->setFontSize(30);
            label->setColor(ccc3(192, 192, 192));
            label->setPosition(ccp(panel->getRect().size.width / 2, panel->getRect().size.height / 2));
            panel->addChild(label);
            
            pageView->addPage(panel);
        }
        
        m_pUiLayer->addWidget(pageView);
        
        return true;
    }
    return false;
}
开发者ID:chenxu111,项目名称:Cocos2d-x-For-CocoStudio,代码行数:66,代码来源:UIPageViewTest.cpp


示例20: SetResultPanelState

void PlayScene::SetResultPanelState(int state) {
  UIPanel *panel = (UIPanel *)ui_layer_->getWidgetByName("PanelSecond");
  if(panel == NULL) {
    return;
  }

  switch(state) {
  case RESULT_PANEL_NORMAL:
    panel->setVisible(false);
    panel->setTouchEnable(false);
    break;
  case RESULT_PANEL_WIN:
    {
      panel->setVisible(true);
      panel->setTouchEnable(true);
      SetIamgeView("WinOrLose", true, "play_banner_win.png");
      char name[32] = {};
      sprintf(name,"girl%d_face_0004.png",stageid_);
      SetIamgeView("WinOrLoseGirl", true, name);
      ShowTips(true, TIPS_TYPE_RESULT_END);
      panel->addTouchEventListener(this, toucheventselector(PlayScene::onPanelSecond));
      break;
    }
  case RESULT_PANEL_LOSE:
    {
      panel->setVisible(true);
      panel->setTouchEnable(true);
      SetIamgeView("WinOrLose", true, "play_banner_lose.png");
      char name[32] = {};
      sprintf(name,"girl%d_face_0005.png",stageid_);
      SetIamgeView("WinOrLoseGirl", true, name);
      ShowTips(true, TIPS_TYPE_RESULT_END);
      panel->addTouchEventListener(this, toucheventselector(PlayScene::onPanelSecond));
      break;
    }
  case RESULT_PANEL_START:
    {
      panel->setVisible(true);
      panel->setTouchEnable(false);
      SetIamgeView("WinOrLose", false);
      SetIamgeView("WinOrLoseGirl", false);
      ShowTips(true, TIPS_TYPE_ACTION_BEGIN);
    }
  default:
    break;
  }
}
开发者ID:f17qh,项目名称:crazyass,代码行数:47,代码来源:play_scene.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ UISlider类代码示例发布时间:2022-05-31
下一篇:
C++ UINode类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap