CCObject* CTableViewBindingDataAndVertical::tableviewDataSource(CCObject* pConvertView, unsigned int idx) { CTableViewCell* pCell = (CTableViewCell*)pConvertView; CButton* pButton = NULL; if(!pCell) { pCell = new CTableViewCell(); pCell->autorelease(); pButton = CButton::createWith9Sprite(CCSizeMake(150, 50), "sprite9_btn1.png", "sprite9_btn2.png"); pButton->setOnClickListener(this, ccw_click_selector(CTableViewBindingDataAndVertical::onClick)); pButton->setPosition(CCPoint(150.0f / 2, 54.0f / 2)); pButton->getLabel()->setFontSize(25.0f); pButton->setTag(1); pCell->addChild(pButton); } else { pButton = (CButton*) pCell->getChildByTag(1); } pButton->getLabel()->setString(m_vDatas[idx].c_str()); pButton->setUserTag(idx); return pCell; }
void CSharpTollgate::onEnter() { BaseLayer::onEnter(); CButton* pClose = CButton::create("common/back.png", "common/back.png"); pClose->getSelectedImage()->setScale(1.1f); pClose->setPosition(VLEFT+50, VTOP-50); pClose->setOnClickListener(this,ccw_click_selector(CSharpTollgate::onClose)); this->addChild(pClose, 999); m_cell = (CLayout*)(m_ui->findWidgetById("Cell")); // m_cell->retain(); // m_ui->removeChild(m_cell); CCAnimation *bgAnim = AnimationManager::sharedAction()->getAnimation("8055"); bgAnim->setDelayPerUnit(0.05f); CCSprite *bg = createAnimationSprite("skill/8055.png",VCENTER,bgAnim,true); bg->setScale(3.0f); m_ui->addChild(bg); m_tableView = (CTableView *)(m_ui->findWidgetById("scroll")); m_tableView->setDirection(eScrollViewDirectionHorizontal); m_tableView->setSizeOfCell(m_cell->getContentSize()); //m_tableView->setSizeOfCell(CCSizeMake(790,115)); m_tableView->setCountOfCell(0); m_tableView->setBounceable(false); m_tableView->setDataSourceAdapter(this,ccw_datasource_adapter_selector(CSharpTollgate::tableviewDataSource)); m_tableView->reloadData(); }
bool CButtonChangeSizeTest::init() { CButtonTestSceneBase::init(); setTitle("CButtonChangeSizeTest"); setDescription("click the button for change anothor one"); m_lData.push_back("a"); m_lData.push_back("ab"); m_lData.push_back("abc"); m_lData.push_back("abcd"); m_lData.push_back("abcde"); m_lData.push_back("abcdef"); m_lData.push_back("abcdefg"); m_lData.push_back("abcdefgi"); m_lData.push_back("abcdefgj"); m_lData.push_back("hahahahaha\nhehehehehe"); m_lData.push_back("hahahahaha\nhehehehehe\nkukukukukukukuku"); m_pButton = CButton::create(); m_pButton->setScale9Enabled(true); m_pButton->setNormalImage("sprite9_btn1.png"); m_pButton->setSelectedImage("sprite9_btn2.png"); m_pButton->initText("none", "", 30.0f); m_pButton->setCascadeTextSizeEnabled(true, CCSize(50, 30)); m_pButton->setPosition(CCPoint(480, 320)); m_pWindow->addChild(m_pButton); CButton* pBtn = CButton::createWith9Sprite(CCSizeMake(150, 50), "sprite9_btn1.png", "sprite9_btn2.png"); pBtn->setPosition(CCPoint(250, 320)); pBtn->initText("click me", "", 27.0f); pBtn->setOnClickListener(this, ccw_click_selector(CButtonChangeSizeTest::onClick)); m_pWindow->addChild(pBtn); return true; }
void CVipCard::onEnter() { BaseLayer::onEnter(); //确定 CButton* pConfirm = (CButton*)m_ui->findWidgetById("confirm"); pConfirm->setOnClickListener(this, ccw_click_selector(CVipCard::onConfirm)); CButton* cancel = (CButton*)m_ui->findWidgetById("cancel"); cancel->setOnClickListener(this, ccw_click_selector(CVipCard::onCancel)); CButton* pClose = CButton::create("common/back.png", "common/back.png"); pClose->getSelectedImage()->setScale(1.1f); pClose->setPosition(VLEFT+50, VTOP-50); pClose->setOnClickListener(this,ccw_click_selector(CVipCard::onClose)); this->addChild(pClose, 999); CImageViewScale9* pRect1 = (CImageViewScale9*)m_ui->findWidgetById("rect1"); m_cardText = CursorTextField::textFieldWithPlaceHolder("", FONT_NAME, 29, CCSize(690, 110), ccBLACK); m_cardText->setPriority(this->getTouchPriority()); m_cardText->setLimitNum(17); m_cardText->setAnchorPoint(ccp(0, 0.5f)); m_cardText->setPosition( ccp(pRect1->getPositionX()-440, pRect1->getPositionY())); m_ui->addChild(m_cardText, 999); //展示区图片 CLayout *pShowInfo = CLayout::create(); CScrollView *pScroll = (CScrollView*)m_ui->findWidgetById("scroll_info"); pScroll->setDirection(eScrollViewDirectionVertical); pScroll->setBounceable(false); pScroll->getContainer()->addChild(pShowInfo); CCSize size = CCSize(957, 471); pShowInfo->setContentSize(size); pScroll->setContainerSize(size); pShowInfo->setPosition(ccp(pScroll->getContainerSize().width*0.5f, pScroll->getContainerSize().height*0.5f)); pScroll->setContentOffsetToTop(); //嫁接内容 CLayout* pLayout = (CLayout*)findWidgetById("layer_info"); pLayout->retain(); pLayout->removeFromParent(); pShowInfo->addChild(pLayout); pLayout->release(); pLayout->setPosition(ccp(size.width/2, size.height/2+10)); }
void CSignLayer::onEnter() { BaseLayer::onEnter(); //签到grid的cell m_cell = (CLayout*)(m_ui->findWidgetById("Cell")); m_cell->retain(); m_ui->removeChild(m_cell); m_gridView = (CGridView*)m_ui->findWidgetById("scroll"); m_gridView->setDirection(eScrollViewDirectionVertical); m_gridView->setCountOfCell(0); m_gridView->setSizeOfCell(m_cell->getContentSize()); m_gridView->setAnchorPoint(ccp(0,0)); m_gridView->setColumns(5); m_gridView->setAutoRelocate(false); m_gridView->setDeaccelerateable(true); m_gridView->setDataSourceAdapter(this,ccw_datasource_adapter_selector(CSignLayer::gridviewDataSource)); m_gridView->reloadData(); m_signLay = (CLayout*)(m_ui->findWidgetById("Sign")); //退出 CButton* pClose = CButton::create("common/back.png", "common/back.png"); pClose->getSelectedImage()->setScale(1.1f); pClose->setPosition(VLEFT+50, VTOP-50); pClose->setOnClickListener(this,ccw_click_selector(CSignLayer::onClose)); this->addChild(pClose, 999); //book CCheckBox* pBook = (CCheckBox*)(m_ui->findWidgetById("book")); pBook->setOnCheckListener(this,ccw_check_selector(CSignLayer::showHeroBook)); //按钮补签 CButton* pResign = (CButton*)m_ui->findWidgetById("buqian_btn"); pResign->setOnClickListener(this, ccw_click_selector(CSignLayer::onBtnResignDay)); //按钮签到 CButton* pSign = (CButton*)m_ui->findWidgetById("qiandao_btn"); pSign->setOnClickListener(this, ccw_click_selector(CSignLayer::onBtnSignDay)); GetTcpNet->registerMsgHandler(SignDataMsg,this, CMsgHandler_selector(CSignLayer::ProcessMsg)); GetTcpNet->registerMsgHandler(SignReqMsg,this, CMsgHandler_selector(CSignLayer::ProcessMsg)); }
void CSharpTollgate::addTableCell(unsigned int uIdx, CTableViewCell * pCell) { const vector<StageWidget> *data = DataCenter::sharedData()->getStageData() ->getStageWidgets(m_chapter); CStage &stage = m_stageList.at(uIdx); for (int i = 0; i < 2; i++) { CCNode * node = (CCNode*)m_cell->getChildren()->objectAtIndex(i); if (node->getTag()==1) { const StageWidget *widget = nullptr; CCString *strId = CCString::createWithFormat("hero%d",uIdx+1); for (int j=0; j<data->size();++j) { widget = &data->at(j); if (widget->widgetId!=""&&widget->widgetId.compare(strId->getCString())==0) { CButton *btn = CButton::create(widget->normalImage.c_str()); btn->setScaleX(widget->scaleX); btn->setScaleY(widget->scaleY); btn->setPosition(ccp(100, 80/*btn->boundingBox().size.height*/)); btn->setAnchorPoint(ccp(0.5, 0.0)); btn->setUserData(&m_stageList.at(uIdx)); btn->setOnClickListener(this,ccw_click_selector(CSharpTollgate::onBattle)); btn->setTag(1); pCell->addChild(btn); if (!stage.isOpen) { btn->getNormalImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone)); // btn->getSelectedImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone)); } break; } } } else if (node->getTag()==2) { CImageView *image = UICloneMgr::cloneImageView((CImageView*)node); if (stage.star>0) { image->setTexture(CCTextureCache::sharedTextureCache()->addImage(CCString::createWithFormat("tollgate/star_%d.png",stage.star)->getCString())); } else { image->setTexture(CCTextureCache::sharedTextureCache()->addImage("tollgate/star_3.png")); image->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone)); } image->setAnchorPoint(ccp(0.5f,0)); pCell->addChild(image); } } pCell->setVisible(false); pCell->setScale(1.15f); pCell->runAction(CCSequence::create(CCDelayTime::create(0.1f+0.15f*uIdx),CCShow::create(),CCScaleTo::create(0.05f,1.0f),CCCallFuncN::create(this,callfuncN_selector(CSharpTollgate::heroCall)),nullptr)); }
void Mapui::onLoadScene() { TuiManager::getInstance()->parseScene(this,"panel_map",PATH_MAP); CMapView* pMapView = (CMapView*)this->getControl(PANEL_MAP,MAP_TEST); pMapView->setRole(Sprite::create("map/img_icon.png"),Vec2(0,0),5); CButton* pBtnBack = (CButton*)this->getControl(PANEL_MAP,BTN_BACK); pBtnBack->setOnClickListener(this, ccw_click_selector(Mapui::event_btn_back)); }
bool CTableViewReloadTest::init() { CTableViewTestSceneBase::init(); setTitle("CTableViewReloadTest"); setDescription("click button will pop a string into vector and reload\n table with auto relocate"); m_lDataQueue.push_back("B"); m_lDataQueue.push_back("C"); m_lDataQueue.push_back("D"); m_lDataQueue.push_back("E"); m_lDataQueue.push_back("F"); m_lDataQueue.push_back("G"); m_lDataQueue.push_back("H"); m_lDataQueue.push_back("I"); m_lDataQueue.push_back("J"); m_lDataQueue.push_back("K"); m_lDataQueue.push_back("L"); m_lDataQueue.push_back("M"); m_lDataQueue.push_back("N"); m_lDataQueue.push_back("O"); m_lDataQueue.push_back("P"); m_lDataQueue.push_back("Q"); m_lDataQueue.push_back("R"); m_lDataQueue.push_back("S"); m_lDataQueue.push_back("T"); m_lDataQueue.push_back("U"); m_lDataQueue.push_back("V"); m_lDataQueue.push_back("W"); m_lDataQueue.push_back("X"); m_lDataQueue.push_back("Y"); m_lDataQueue.push_back("Z"); m_vDatas.push_back("A"); pTable = CTableView::create( Size(150.0f, 54.0f * 5), Size(150.0f, 54.0f), m_vDatas.size(), this, ccw_datasource_adapter_selector(CTableViewReloadTest::tableviewDataSource)); pTable->setDirection(eScrollViewDirectionVertical); pTable->setAutoRelocate(true); pTable->setPosition(Vec2(480, 320)); m_pWindow->addChild(pTable); pTable->reloadData(); CButton* pButton = CButton::createWith9Sprite(Size(150, 50), "sprite9_btn1.png", "sprite9_btn2.png"); pButton->setOnClickListener(this, ccw_click_selector(CTableViewReloadTest::onClick)); pButton->setPosition(Vec2(200, 320)); //pButton->getLabel()->setFontSize(25.0f); pButton->getLabel()->setString("reloadData"); m_pWindow->addChild(pButton); return true; }
NS_MAIN_BEGIN void Mainui::onLoadScene() { SpriteFrameCache::getInstance()->addSpriteFramesWithFile("main/mainui.plist"); TuiManager::getInstance()->parseScene(this,"panel_main",PATH_MAIN); //注册事件 CControlView *ctlv = (CControlView*)this->getControl(PANEL_MAIN,CTLV_LEFT); ctlv->setOnControlListener(this,ccw_control_selector(Mainui::event_ctlv_left)); CButton *pBtnOk = (CButton*)this->getControl(PANEL_MAIN,BTN_OK); pBtnOk->setOnClickListener(this,ccw_click_selector(Mainui::event_btn_ok)); CButton *pBtnGo = (CButton*)this->getControl(PANEL_MAIN,BTN_GO); pBtnGo->setOnClickListener(this,ccw_click_selector(Mainui::event_btn_go)); CButton *pBtnPhone = (CButton*)this->getControl(PANEL_MAIN, BTN_SHOWPHONE); pBtnPhone->setOnClickListener(this, ccw_click_selector(Mainui::event_btn_showphone)); CButton *pBtnBag = (CButton*)this->getControl(PANEL_MAIN, BTN_BAG); pBtnBag->setOnClickListener(this, ccw_click_selector(Mainui::event_btn_bag)); CButton *pBtnRecombine = (CButton*)this->getControl(PANEL_MAIN, BTN_RECOMBINE); pBtnRecombine->setOnClickListener(this, ccw_click_selector(Mainui::event_btn_recombine)); CToggleView *pTgvA = (CToggleView*)this->getControl(PANEL_MAIN, TGV_A); pTgvA->setOnCheckListener(this, ccw_check_selector(Mainui::event_tgvA_check)); CToggleView *pTgvB = (CToggleView*)this->getControl(PANEL_MAIN, TGV_B); pTgvB->setOnCheckListener(this, ccw_check_selector(Mainui::event_tgvB_check)); MovieView *pMovie = (MovieView*)this->getControl(PANEL_MAIN, MOVIE_TEST); map<string, function<void()>> m; m["finish"] = bind(&Mainui::event_movie_finish, this); pMovie->setCallBack(m); //播放骨骼动画(默认不播放) Armature *armature = (Armature*)this->getControl(PANEL_MAIN,ARMATURE_BOSS1); armature->getAnimation()->play("live",-1,1); }
void Recomebineui::onLoadScene() { SpriteFrameCache::getInstance()->addSpriteFramesWithFile("recombine/recombineui.plist"); TuiManager::getInstance()->parseScene(this, "panel_recombine", PATH_RECOMBINEUI); CGridPageView *pGpvBag = (CGridPageView*)this->getControl(PANEL_RECOMBINE, GPV_BAG); pGpvBag->setDataSourceAdapter(this,ccw_datasource_adapter_selector(Recomebineui::adapt_gpv_bag)); pGpvBag->reloadData(); CButton *pBtnBack = (CButton*)this->getControl(PANEL_RECOMBINE, BTN_BACK); pBtnBack->setOnClickListener(this, ccw_click_selector(Recomebineui::event_btn_back)); }
NS_MAIN_BEGIN void MsgBox::onLoadScene() { SpriteFrameCache::getInstance()->addSpriteFramesWithFile("main/mainui.plist"); TuiManager::getInstance()->parseScene(this,"panel_msgbox",PATH_MAIN); //注册事件 CButton *pBtnClose = (CButton*)getControl(PANEL_MSGBOX, BTN_CLOSE); pBtnClose->setOnClickListener(this,ccw_click_selector(MsgBox::event_btn_close)); CSlider *pSlider = (CSlider*)getControl(PANEL_MSGBOX,SLIDER_TEST); pSlider->setOnValueChangedListener(this,ccw_valuechanged_selector(MsgBox::event_slider_test)); }
void CStrengthenItem::onEnter() { BaseLayer::onEnter(); m_cell = (CLayout*)(m_ui->findWidgetById("Cell")); m_cell->retain(); m_ui->removeChild(m_cell); m_tableView = (CTableView *)(m_ui->findWidgetById("scroll")); m_tableView->setDirection(eScrollViewDirectionVertical); m_tableView->setSizeOfCell(m_cell->getContentSize()); m_tableView->setCountOfCell(0); m_tableView->setBounceable(false); m_tableView->setDataSourceAdapter(this,ccw_datasource_adapter_selector(CStrengthenItem::tableviewDataSource)); m_tableView->reloadData(); CButton *select = (CButton*)(m_ui->findWidgetById("select")); select->setOnClickListener(this,ccw_click_selector(CStrengthenItem::onSelectItem)); CButton *filter = (CButton*)(m_ui->findWidgetById("filter")); filter->setOnClickListener(this,ccw_click_selector(CStrengthenItem::onFilterItem)); //退出 CButton* pClose = CButton::create("common/back.png", "common/back.png"); pClose->getSelectedImage()->setScale(1.1f); pClose->setPosition(VLEFT+50, VTOP-50); pClose->setOnClickListener(this,ccw_click_selector(CStrengthenItem::onClose)); this->addChild(pClose, 999); m_selectCellImg = (CCSprite*)m_ui->findWidgetById("selimg"); m_selectCellImg->retain(); GetTcpNet->registerMsgHandler(RoleBag,this,CMsgHandler_selector(CStrengthenItem::recItemData)); GetTcpNet->registerMsgHandler(ArmorListMsg,this,CMsgHandler_selector(CStrengthenItem::processNetMessage)); CSceneManager::sharedSceneManager()->addMsgObserver("updateFilter",this,GameMsghandler_selector(CStrengthenItem::onSetFilter)); }
void CSmeltArmor::onEnter() { BaseLayer::onEnter(); //四个选择框 for (unsigned int i=0; i<4; ++i) { CCheckBox *checkBtn = (CCheckBox*)(m_pBaseInfo[i]->findWidgetById("check")); checkBtn->setOnCheckListener(this,ccw_check_selector(CSmeltArmor::onCheckAttr)); } //选择武器 CButton *select = (CButton*)(m_ui->findWidgetById("select")); select->setOnClickListener(this, ccw_click_selector(CSmeltArmor::onSelectItem)); //洗练 CButton *refine = (CButton*)(m_ui->findWidgetById("refine")); refine->setOnClickListener(this, ccw_click_selector(CSmeltArmor::onRefineItem)); //初始化火 initFire(); //旋转圈 CImageView *circleFire = (CImageView*)(m_ui->findWidgetById("fire_circle")); circleFire->setScale(1.95f); circleFire->runAction(CCRepeatForever::create(CCRotateBy::create(1.0f, 60))); circleFire->runAction(CCRepeatForever::create(CCSequence::createWithTwoActions(CCScaleTo::create(1.2f, 2.1f), CCScaleTo::create(1.2f, 1.95f)))); GetTcpNet->registerMsgHandler(SmeltArmorMsg,this,CMsgHandler_selector(CSmeltArmor::proceesMessage)); GetTcpNet->registerMsgHandler(SmeltDataRequestMsg,this,CMsgHandler_selector(CSmeltArmor::proceesMessage)); CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_HERO, this, GameMsghandler_selector(CSmeltArmor::roleUpdate)); CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_ITEM_DATA, this, GameMsghandler_selector(CSmeltArmor::updateStar)); }
NS_MAIN_BEGIN void MsgBox::onLoadScene() { //setAutoRemoveUnusedTexture(true); TuiManager::getInstance()->parseScene(this,"panel_msgbox",PATH_MAIN); //注册事件 CButton *pBtnClose = (CButton*)getControl(PANEL_MSGBOX,BTN_CLOSE); pBtnClose->setOnClickListener(this,ccw_click_selector(MsgBox::event_btn_close)); CSlider *pSlider = (CSlider*)getControl(PANEL_MSGBOX,SLIDER_TEST); pSlider->setOnValueChangedListener(this,ccw_valuechanged_selector(MsgBox::event_slider_test)); CProgressBar *pProg = (CProgressBar*)this->getControl(PANEL_MSGBOX,PROG_HP); pProg->setShowValueLabel(true); }
bool CListViewOperateTest::init() { CListViewTestSceneBase::init(); setTitle("CListViewOperateTest"); setDescription("Add or Remove operate"); m_pListView = CListView::create(Size(480, 320)); m_pListView->setBackgroundImage("background.png"); m_pListView->setPosition(Vec2(480, 320)); m_pListView->setDirection(eScrollViewDirectionVertical); m_pWindow->addChild(m_pListView); CButton* pButton = CButton::createWith9Sprite(Size(150, 50), "sprite9_btn1.png", "sprite9_btn2.png"); pButton->setPosition(Vec2(150, 450)); pButton->setUserTag(1); pButton->setOnClickListener(this, ccw_click_selector(CListViewOperateTest::onClick)); pButton->initText("Add Last", "", 30); m_pWindow->addChild(pButton); CButton* pButton2 = CButton::createWith9Sprite(Size(150, 50), "sprite9_btn1.png", "sprite9_btn2.png"); pButton2->setPosition(Vec2(150, 380)); pButton2->setUserTag(2); pButton2->setOnClickListener(this, ccw_click_selector(CListViewOperateTest::onClick)); pButton2->initText("Add Front", "", 30); m_pWindow->addChild(pButton2); CButton* pButton3 = CButton::createWith9Sprite(Size(150, 50), "sprite9_btn1.png", "sprite9_btn2.png"); pButton3->setPosition(Vec2(150, 310)); pButton3->setUserTag(3); pButton3->setOnClickListener(this, ccw_click_selector(CListViewOperateTest::onClick)); pButton3->initText("Remove Last", "", 30); m_pWindow->addChild(pButton3); CButton* pButton4 = CButton::createWith9Sprite(Size(150, 50), "sprite9_btn1.png", "sprite9_btn2.png"); pButton4->setPosition(Vec2(150, 240)); pButton4->setUserTag(4); pButton4->setOnClickListener(this, ccw_click_selector(CListViewOperateTest::onClick)); pButton4->initText("Remove Front", "", 30); m_pWindow->addChild(pButton4); return true; }
NS_STORE_BEGIN void Storeui::onLoadScene() { setAutoRemoveUnusedTexture(true); TuiManager::getInstance()->parseScene(this,"panel_store",PATH_STORE); CListView *pListGoods = (CListView*)this->getControl(PANEL_STORE, LIST_GOODS); Vector<Node*> vet = pListGoods->getContainer()->getChildren(); for (Node *pNode : vet){ CButton *pBtnPay = dynamic_cast<CButton*>(pNode->getChildByTag(BTN_PAY)); pBtnPay->setOnClickListener(this, ccw_click_selector(Storeui::event_btn_pay)); } ArmatureBtn *pBtn = (ArmatureBtn*)this->getControl(PANEL_STORE,ARMBTN_TEST2); pBtn->setOnClickListener(this,ccw_click_selector(Storeui::event_btn_test)); }
Ref* Bagui::event_adapt_gvBag(Ref* pConvertCell, unsigned int uIdx) { CGridViewCell* pCell = (CGridViewCell*)pConvertCell; CButton *btn = nullptr; if (!pCell) { pCell = new CGridViewCell(); pCell->autorelease(); TuiManager::getInstance()->parseCell(pCell, "cell_grid", PATH_BAG); btn = (CButton*)pCell->getChildByTag(BTN_GRID); btn->setOnClickListener(this, ccw_click_selector(Bagui::event_btn_gv)); }else{ btn = (CButton*)pCell->getChildByTag(BTN_GRID); } btn->setUserTag(uIdx); return pCell; }
bool CCheckBoxExclusionTest::init() { CCheckBoxTestSceneBase::init(); setTitle("CCheckBoxExclusionTest"); setDescription("checkbox exclusion test"); CREATE_CHECKBOX(pCheckBox1, CCPoint(480, 490)); pCheckBox1->setTag(1); pCheckBox1->setExclusion(1); pCheckBox1->setChecked(true); pCheckBox1->setEnabled(false); m_pWindow->addChild(pCheckBox1); CREATE_CHECKBOX(pCheckBox2, CCPoint(480, 425)); pCheckBox2->setExclusion(1); m_pWindow->addChild(pCheckBox2); CREATE_CHECKBOX(pCheckBox3, CCPoint(480, 360)); pCheckBox3->setExclusion(1); m_pWindow->addChild(pCheckBox3); CREATE_CHECKBOX(pCheckBox4, CCPoint(480, 295)); pCheckBox4->setExclusion(1); m_pWindow->addChild(pCheckBox4); CREATE_CHECKBOX(pCheckBox5, CCPoint(480, 230)); pCheckBox5->setExclusion(1); m_pWindow->addChild(pCheckBox5); CREATE_CHECKBOX(pCheckBox6, CCPoint(480, 165)); pCheckBox6->setExclusion(1); m_pWindow->addChild(pCheckBox6); CButton* pButton = CButton::createWith9Sprite(CCSize(280, 60), "sprite9_btn1.png", "sprite9_btn2.png"); pButton->setPosition(CCPoint(200, 450)); pButton->setUserTag(1); pButton->setOnClickListener(this, ccw_click_selector(CCheckBoxExclusionTest::onClick)); pButton->initText("set true for first", "", 30); m_pWindow->addChild(pButton); return true; }
bool CListViewBasicTest::init() { CListViewTestSceneBase::init(); setTitle("CListViewBasicTest"); setDescription("ListView Test"); //test data tagItem tag1 = { Size(480, 10), Color3B::WHITE }; tagItem tag2 = { Size(480, 20), Color3B::RED }; tagItem tag3 = { Size(480, 30), Color3B::GREEN }; tagItem tag4 = { Size(100, 40), Color3B::ORANGE }; tagItem tag5 = { Size(480, 50), Color3B::MAGENTA }; tagItem tag6 = { Size(400, 60), Color3B::BLUE }; tagItem tag7 = { Size(300, 80), Color3B::RED }; tagItem tag8 = { Size(480, 30), Color3B::GRAY }; tagItem tag9 = { Size(480, 40), Color3B::YELLOW }; m_lDatas.push_back(tag1); m_lDatas.push_back(tag2); m_lDatas.push_back(tag3); m_lDatas.push_back(tag4); m_lDatas.push_back(tag5); m_lDatas.push_back(tag6); m_lDatas.push_back(tag7); m_lDatas.push_back(tag8); m_lDatas.push_back(tag9); //<< m_pListView = CListView::create(Size(480, 320)); m_pListView->setBackgroundImage("background.png"); m_pListView->setPosition(Vec2(480, 320)); m_pListView->setDirection(eScrollViewDirectionVertical); m_pWindow->addChild(m_pListView); CButton* pButton = CButton::createWith9Sprite(Size(150, 50), "sprite9_btn1.png", "sprite9_btn2.png"); pButton->setPosition(Vec2(150, 320)); pButton->setOnClickListener(this, ccw_click_selector(CListViewBasicTest::onClick)); pButton->initText("Add", "", 30); m_pWindow->addChild(pButton); return true; }
void CHandBookPanel::onEnter() { BaseLayer::onEnter(); //选项卡 CRadioBtnGroup *radioGroup = (CRadioBtnGroup *)m_ui->findWidgetById("radio"); for (unsigned int i=0; i<HandBookTabMax; i++) { CRadioButton *radioBtn= (CRadioButton*)(radioGroup->getChildByTag(i)); radioBtn->setOnCheckListener(this,ccw_check_selector(CHandBookPanel::onSwitchBtn)); } //退出 CButton* pClose = CButton::create("common/back.png", "common/back.png"); pClose->getSelectedImage()->setScale(1.1f); pClose->setPosition(VLEFT+50, VTOP-50); pClose->setOnClickListener(this,ccw_click_selector(CHandBookPanel::onClose)); this->addChild(pClose, 999); //默认选择一个 selectTabPanel(HandBookTabHero); }
NS_BAG_BEGIN void Bagui::onLoadScene() { SpriteFrameCache::getInstance()->addSpriteFramesWithFile("bag/bagui.plist"); TuiManager::getInstance()->parseScene(this, "panel_bag", PATH_BAG); CGridView* pGridView = (CGridView*)this->getControl(PANEL_BAG, GV_BAG); pGridView->setDataSourceAdapter(this, ccw_datasource_adapter_selector(Bagui::event_adapt_gvBag)); pGridView->reloadData(); CTableView* pTblView = (CTableView*)this->getControl(PANEL_BAG, TBL_BAG); pTblView->setDataSourceAdapter(this, ccw_datasource_adapter_selector(Bagui::event_adapt_tblBag)); pTblView->reloadData(); CPageView* pPageView = (CPageView*)this->getControl(PANEL_BAG, PV_BAG); pPageView->setDataSourceAdapter(this, ccw_datasource_adapter_selector(Bagui::event_adapt_pageBag)); pPageView->reloadData(); CButton* pBtnView = (CButton*)this->getControl(PANEL_BAG, BTN_BACK); pBtnView->setOnClickListener(this, ccw_click_selector(Bagui::event_btn_back)); }
CCObject* MainScene::gridviewDataSource(CCObject* pConvertView, unsigned int idx){ CGridViewCell* pCell = (CGridViewCell*) pConvertView; CButton* pButton = NULL; CCLog("idx %d",idx); if(!pCell) { pCell = new CGridViewCell(); pCell->autorelease(); pButton = CButton::create("strangedesign/main_clincher.png","strangedesign/main_clincher_down.png"); pButton->setPosition(CCPoint(360/2, 350-pButton->getContentSize().height/2)); pButton->getLabel()->setFontSize(40.0f); pButton->setTag(1); pCell->addChild(pButton,10); CCSprite* sprite = CCSprite::create("strangedesign/table4mul4.png"); sprite->setContentSize(CCSize(320,320)); sprite->setPosition(CCPoint(360/2,350/2)); pCell->addChild(sprite,1); CCLog("idx %d",idx); vector<vector<string> > groupCharacter = SQLiteData::getUnit(unit_ids.at(idx)); CCPoint positions[16] = {ccp(40,280),ccp(120,280),ccp(200,280),ccp(280,280), ccp(40,200),ccp(120,200),ccp(200,200),ccp(280,200), ccp(40,120),ccp(120,120),ccp(200,120),ccp(280,120), ccp(40,40),ccp(120,40),ccp(200,40),ccp(280,40) }; for (unsigned int i = 0; i < groupCharacter.size(); i++) { string hanzi = groupCharacter.at(i).at(0); CCLabelTTF* clabel = CCLabelTTF::create(hanzi.c_str(),"Arial",40); clabel->setPosition(positions[i]); clabel->setColor(ccc3(0,0,0)); sprite->addChild(clabel); } } else { pButton = CButton::create("strangedesign/main_clincher.png","strangedesign/main_clincher_down.png"); pButton->setPosition(CCPoint(360/2, 350-pButton->getContentSize().height/2)); pButton->getLabel()->setFontSize(40.0f); pButton->setTag(1); pCell->addChild(pButton,10); CCSprite* sprite = CCSprite::create("strangedesign/table4mul4.png"); sprite->setContentSize(CCSize(320,320)); sprite->setPosition(CCPoint(360/2,350/2)); pCell->addChild(sprite,1); CCLog("idx %d",idx); vector<vector<string> > groupCharacter = SQLiteData::getUnit(unit_ids.at(idx)); CCPoint positions[16] = {ccp(40,280),ccp(120,280),ccp(200,280),ccp(280,280), ccp(40,200),ccp(120,200),ccp(200,200),ccp(280,200), ccp(40,120),ccp(120,120),ccp(200,120),ccp(280,120), ccp(40,40),ccp(120,40),ccp(200,40),ccp(280,40) }; for (unsigned int i = 0; i < groupCharacter.size(); i++) { string hanzi = groupCharacter.at(i).at(0); CCLabelTTF* clabel = CCLabelTTF::create(hanzi.c_str(),"Arial",40); clabel->setPosition(positions[i]); clabel->setColor(ccc3(0,0,0)); sprite->addChild(clabel); } } char buff[64]; unsigned int labelidx = idx+1; sprintf(buff, "%u", labelidx); pButton->getLabel()->setString(buff); pButton->setUserTag(idx); pButton->setOnClickListener(this,ccw_click_selector(MainScene::buttonClick)); pButton->setOnLongClickListener(this,ccw_longclick_selector(MainScene::buttonLongClick)); return pCell; }
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); } }
void LoginLayerUC::initLogin() { CCLOG("LoginLayerUC::initLogin"); if(m_ui!=nullptr) { return; } //播放背景音乐 PlayBackgroundMusic(BGM_Login,true); m_ui = LoadComponent("EnterGameUC.xaml"); m_ui->setTag(1); m_ui->setPosition(VCENTER); m_LayoutRoot->addChild(m_ui, 2); //自己的登陆框隐藏 m_pLoginLay = (CLayout *)m_ui->getChildByTag(10); m_pLoginLay->setVisible(false); //选择好的服务器列表 m_pCurrentServerUI = (CLayout *)m_ui->findWidgetById("current_server"); m_pCurrentServerUI->setVisible(true); //默认服务器 updateSelectServer(); //服务器选区 CLayout* pLayout = (CLayout*)m_ui->findWidgetById("serverCell"); pLayout->retain(); m_ui->removeChild(pLayout); m_pCell = pLayout; //获取空的滑动列表Scroll m_pTableView = (CTableView*)m_ui->findWidgetById("serverScroll"); m_pTableView->setDirection(eScrollViewDirectionVertical); m_pTableView->setSizeOfCell(m_pCell->getContentSize()); m_pTableView->setCountOfCell(m_serverInfo.server_list().size()); m_pTableView->setBounceable(true); m_pTableView->setDataSourceAdapter(this, ccw_datasource_adapter_selector(LoginLayerUC::tableviewDataSource)); m_pTableView->reloadData(); //按钮打开服务器列表 CImageView* pBtnServer = (CImageView*)m_ui->findWidgetById("serverBtn"); //快速登录按钮 CButton * pQuickLogin = (CButton *)m_ui->getChildByTag(1); pQuickLogin->setOnClickListener(this,ccw_click_selector(LoginLayerUC::onQuickLogin)); CCActionInterval *scaleSmall = CCScaleTo::create(0.9f,0.98f); CCFadeTo *out = CCFadeTo::create(0.9f,60); CCSpawn *spawn = CCSpawn::createWithTwoActions(scaleSmall,out); CCActionInterval *scaleBig = CCScaleTo::create(1.2f,1.0f); CCFadeTo *in = CCFadeTo::create(1.2f,255); CCSpawn *spawn1 = CCSpawn::createWithTwoActions(scaleBig,in); CCSequence *seque = CCSequence::createWithTwoActions(spawn,spawn1); CCRepeatForever *action = CCRepeatForever::create(seque); pQuickLogin->runAction(action); pQuickLogin->setVisible(true); //清除用户信息 DataCenter::sharedData()->getUser()->clear(); //版本做相对位置处理 CLabel* pLabel = (CLabel *)m_ui->findWidgetById("version"); pLabel->setAnchorPoint(ccp(1.0f, 0.0f)); pLabel->setPosition(ccp(VRIGHT-20, VBOTTOM+20)); CC_SAFE_RETAIN(pLabel); pLabel->removeFromParentAndCleanup(true); this->addChild(pLabel); CC_SAFE_RELEASE(pLabel); pLabel->setString(CCString::createWithFormat("Version:%s", m_serverInfo.game_version().c_str())->getCString()); //隐藏服务器列表 showServerList(); hideServerList(); //TODO //初始化UC_SDK?-放在最前面 //还是点击登录再初始化? //点击登录再初始化吧 //初始化完直接请求登录 //先连接连接服务器 const Server& gameServer = m_serverInfo.server_list().Get(m_iSelectServerIndex); //检查服务器是否可用 if(!checkServerStatus(gameServer)) { return; } LinkedGameServer(gameServer); }
CCObject* ViewScene::gridViewDataSource(CCObject* pContentView, unsigned int idx){ CGridViewCell* pCell = (CGridViewCell*) pContentView; CButton* pButton = NULL; CCheckBox* pCheckbox = NULL; Notes = SQLiteData::getNote(unit_id,zi_id); vector<string> oneNote = Notes.at(idx); //oneNote 中第一个元素为ID,第二个元素为笔画序列 if (!pCell) { pCell = new CGridViewCell(); pCell->autorelease(); pButton = CButton::create("strangedesign/Dlg_cancel_button.png","strangedesign/Dlg_cancel_button_down.png"); pButton->setPosition(CCPoint(360/2, 350-pButton->getContentSize().height/2)); pCheckbox = CCheckBox::create(); pCheckbox->setNormalImage("ckb_normal_01.png"); pCheckbox->setNormalPressImage("ckb_normal_02.png"); pCheckbox->setCheckedImage("ckb_selected_01.png"); pCheckbox->setCheckedPressImage("ckb_selected_02.png"); pCheckbox->setDisabledNormalImage("ckb_disable_01.png"); pCheckbox->setDisabledCheckedImage("ckb_disable_02.png"); pCheckbox->setPosition(CCPoint(360-pCheckbox->getContentSize().width, 350-pButton->getContentSize().height/2)); pCell->addChild(pCheckbox,10); //pCell->addChild(pButton,10); HcharacterDrawnode* handwritingHz = HcharacterDrawnode::create(); vector< vector<CCPoint> > strokesvec = DataTool::spliteString(oneNote.at(1)); for (unsigned int i = 0; i < strokesvec.size(); i++) { vector<CCPoint> oneStrokeVec = strokesvec[i]; Stroke stroke(oneStrokeVec); handwritingHz->addStroke(stroke); } handwritingHz->setContentSize(CCSize(320,320)); CCPoint position = ccp(360/2- handwritingHz->getContentSize().width/2, 350/2- handwritingHz->getContentSize().height/2); handwritingHz->setPosition(position); pCell->addChild(handwritingHz,1); }else { pButton = CButton::create("strangedesign/Dlg_cancel_button.png","strangedesign/Dlg_cancel_button_down.png"); pButton->setPosition(CCPoint(360/2, 350-pButton->getContentSize().height/2)); pCheckbox = CCheckBox::create(); pCheckbox->setNormalImage("ckb_normal_01.png"); pCheckbox->setNormalPressImage("ckb_normal_02.png"); pCheckbox->setCheckedImage("ckb_selected_01.png"); pCheckbox->setCheckedPressImage("ckb_selected_02.png"); pCheckbox->setDisabledNormalImage("ckb_disable_01.png"); pCheckbox->setDisabledCheckedImage("ckb_disable_02.png"); pCheckbox->setPosition(CCPoint(360-pCheckbox->getContentSize().width, 350-pButton->getContentSize().height/2)); pCell->addChild(pCheckbox,10); //pCell->addChild(pButton,10); HcharacterDrawnode* handwritingHz = HcharacterDrawnode::create(); vector<string> oneNote = Notes.at(idx); //oneNote 中第一个元素为ID,第二个元素为笔画序列 vector< vector<CCPoint> > strokesvec = DataTool::spliteString(oneNote.at(1)); for (unsigned int i = 0; i < strokesvec.size(); i++) { vector<CCPoint> oneStrokeVec = strokesvec[i]; Stroke stroke(oneStrokeVec); handwritingHz->addStroke(stroke); } handwritingHz->setContentSize(CCSize(320,320)); CCPoint position = ccp(360/2- handwritingHz->getContentSize().width/2, 350/2- handwritingHz->getContentSize().height/2); handwritingHz->setPosition(position); pCell->addChild(handwritingHz,1); } char buff[64]; sprintf(buff, "%u", idx); pButton->getLabel()->setString(buff); int userTag = DataTool::stringToInt(oneNote.at(0)); pButton->setUserTag(userTag); pCheckbox->setUserTag(userTag); pButton->setOnClickListener(this,ccw_click_selector(ViewScene::buttonClick)); pCheckbox->setOnClickListener(this,ccw_click_selector(ViewScene::checkBoxClick)); return pCell; }
bool CProgressBarBasicTest::init() { CProgressBarTestSceneBase::init(); setTitle("CProgressBarBasicTest"); setDescription("click the button to changed progress"); Sprite* m_pBg = Sprite::create("background.png"); m_pBg->setScale(1.3f); m_pBg->setPosition(Vec2(480, 320)); m_pWindow->addChild(m_pBg); m_pProgressBar = CProgressBar::create("progress.png"); m_pProgressBar->setBackgroundImage("progress_bg.png"); m_pProgressBar->setPosition(Vec2(480, 320)); m_pProgressBar->setMaxValue(100); m_pProgressBar->setMinValue(0); m_pProgressBar->setDirection(eProgressBarDirectionLeftToRight); m_pProgressBar->setOnValueChangedListener( this, ccw_valuechanged_selector(CProgressBarBasicTest::onProgressing)); m_pProgressBar->setContentSize(Size(960, 640)); m_pWindow->addChild(m_pProgressBar); CButton* pButton = CButton::createWith9Sprite(Size(150, 60), "sprite9_btn1.png", "sprite9_btn2.png"); pButton->setPosition(Vec2(250, 450)); pButton->setUserTag(1); pButton->setOnClickListener(this, ccw_click_selector(CProgressBarBasicTest::onClick)); pButton->initText("Add", "", 30); m_pWindow->addChild(pButton); CButton* pButton2 = CButton::createWith9Sprite(Size(150, 60), "sprite9_btn1.png", "sprite9_btn2.png"); pButton2->setPosition(Vec2(450, 450)); pButton2->setUserTag(2); pButton2->setOnClickListener(this, ccw_click_selector(CProgressBarBasicTest::onClick)); pButton2->initText("Less", "", 30); m_pWindow->addChild(pButton2); CButton* pButton3 = CButton::createWith9Sprite(Size(200, 60), "sprite9_btn1.png", "sprite9_btn2.png"); pButton3->setPosition(Vec2(670, 450)); pButton3->setUserTag(3); pButton3->setOnClickListener(this, ccw_click_selector(CProgressBarBasicTest::onClick)); pButton3->initText("change direction", "", 30); m_pWindow->addChild(pButton3); CButton* pButton4 = CButton::createWith9Sprite(Size(150, 60), "sprite9_btn1.png", "sprite9_btn2.png"); pButton4->setPosition(Vec2(350, 200)); pButton4->setUserTag(4); pButton4->setOnClickListener(this, ccw_click_selector(CProgressBarBasicTest::onClick)); pButton4->initText("startProgress", "", 30); pButton4->setCascadeTextSizeEnabled(true, Size(50, 30)); m_pWindow->addChild(pButton4); CButton* pButton5 = CButton::createWith9Sprite(Size(150, 60), "sprite9_btn1.png", "sprite9_btn2.png"); pButton5->setPosition(Vec2(650, 200)); pButton5->setUserTag(5); pButton5->setOnClickListener(this, ccw_click_selector(CProgressBarBasicTest::onClick)); pButton5->initText("stopProgress", "", 30); pButton5->setCascadeTextSizeEnabled(true, Size(50, 30)); m_pWindow->addChild(pButton5); m_pText = CLabel::create(); m_pText->setAnchorPoint(Vec2(0, 0.5)); m_pText->setPosition(Vec2(200, 400)); //m_pText->setFontSize(35.0f); m_pText->setString("none"); m_pWindow->addChild(m_pText); return true; }