这篇教程C++ toucheventselector函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中toucheventselector函数的典型用法代码示例。如果您正苦于以下问题:C++ toucheventselector函数的具体用法?C++ toucheventselector怎么用?C++ toucheventselector使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了toucheventselector函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: addChildbool PopupLanguage::init(){ bool ret = CCScene::init(); extension::UILayer* ul = extension::UILayer::create(); extension::GUIReader reader; ul->addWidget(reader.widgetFromJsonFile("MainMenu/LangSelect.ExportJson")); addChild(ul); extension::UIWidget* button; button = ul->getWidgetByName("popup_button_cancel"); if (button) { button->addTouchEventListener(this, toucheventselector(PopupLanguage::_onCancel)); } button = ul->getWidgetByName("button_en"); if (button) { button->addTouchEventListener(this, toucheventselector(PopupLanguage::_onLangEn)); } button = ul->getWidgetByName("button_ru"); if (button) { button->addTouchEventListener(this, toucheventselector(PopupLanguage::_onLangRu)); } return ret;}
开发者ID:timur-losev,项目名称:HungryChameleon,代码行数:30,
示例2: toucheventselectorbool UIScrollViewTest_ScrollToPercentBothDirection_Bounce_Editor::init(){ if (UIScene_Editor::init()) { _layout = static_cast<Layout*>(GUIReader::shareReader()->widgetFromJsonFile("cocosgui/UITest/UITest.json")); _touchGroup->addWidget(_layout); CCSize screenSize = CCDirector::sharedDirector()->getWinSize(); CCSize rootSize = _layout->getSize(); _touchGroup->setPosition(CCPoint((screenSize.width - rootSize.width) / 2, (screenSize.height - rootSize.height) / 2)); Layout* root = static_cast<Layout*>(_touchGroup->getWidgetByName("root_Panel")); ui::Label* back_label = static_cast<ui::Label*>(UIHelper::seekWidgetByName(root, "back")); back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); _sceneTitle = static_cast<ui::Label*>(UIHelper::seekWidgetByName(root, "UItest")); Button* left_button = static_cast<Button*>(UIHelper::seekWidgetByName(root, "left_Button")); left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); Button* middle_button = static_cast<Button*>(UIHelper::seekWidgetByName(root, "middle_Button")); middle_button->setVisible(false); Button* right_button = static_cast<Button*>(UIHelper::seekWidgetByName(root, "right_Button")); right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); return true; } return false;}
开发者ID:birdcpe25,项目名称:cocos2d-x,代码行数:32,
示例3: initUIButtonbool Dialog::init(){ Layer::init(); m_pUILayer = Layer::create(); m_pRootLayer = dynamic_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("Scenes/Dialog.ExportJson")); m_pUILayer->addChild(m_pRootLayer); m_pLeft = initUIButton(LEFT, toucheventselector(Dialog::onButton), m_pRootLayer, this); m_pRight = initUIButton(RIGHT, toucheventselector(Dialog::onButton), m_pRootLayer, this); m_pTxt = (Label*)m_pRootLayer->getChildByTag(TEXT); m_pLeftBtnOldPoint = m_pLeft->getPosition(); addChild(m_pUILayer); auto screenSize = Director::getInstance()->getWinSize(); auto rootSize = m_pRootLayer->getSize(); setPosition(Point((screenSize.width - rootSize.width) / 2, (screenSize.height - rootSize.height) / 2)); return true; }
开发者ID:aababy,项目名称:Begins,代码行数:26,
示例4: addChildbool DetailScene::init(){ if (CCLayer::init()) { _uiLayer = Layer::create(); addChild(_uiLayer); _widget = dynamic_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("Scenes/DetailScene.ExportJson")); _uiLayer->addChild(_widget); auto screenSize = CCDirector::getInstance()->getWinSize(); auto rootSize = _widget->getSize(); _uiLayer->setPosition(Point((screenSize.width - rootSize.width) / 2, (screenSize.height - rootSize.height) / 2)); btnOK = initUIButton(OK, toucheventselector(DetailScene::onButton), _widget, this); btnCancel = initUIButton(CANCEL, toucheventselector(DetailScene::onButton), _widget, this); btnFrequency = initUIButton(FREQUENCY, toucheventselector(DetailScene::onButton), _widget, this); txtMissionDetail = static_cast<TextField*>(_widget->getChildByTag(MISSION_DETAIL)); txtMissionName = static_cast<Text*>(_widget->getChildByTag(MISSION_NAME)); Mission *mission = xMissionPool->_vMissions.at(xMissionPool->_iTodayIdx); txtMissionName->setText(mission->sName); return true; } return false;}
开发者ID:aababy,项目名称:Begins,代码行数:28,
示例5: toucheventselectorbool AheadChapter::init(){ if (!CCLayerRGBA::init()) return false; _aUILayer = UILayer::create(); this->addChild(_aUILayer); _ahead_root = static_cast<Layout *>(CCUIHELPER->createWidgetFromJsonFile(CG_GamePathes[kAheadChapter].c_str())); _aUILayer->addWidget(_ahead_root); UIButton *startButt = static_cast<UIButton *>(_ahead_root->getChildByName("start_butt")); startButt->setTouchEnable(true); startButt->addTouchEventListener(this, toucheventselector(AheadChapter::startGame)); UIButton *resetButt = static_cast<UIButton *>(_ahead_root->getChildByName("reset_butt")); resetButt->setTouchEnable(true); resetButt->addTouchEventListener(this, toucheventselector(AheadChapter::reSetGame)); UIButton *settingButt = static_cast<UIButton *>(_ahead_root->getChildByName("setting_butt")); settingButt->setTouchEnable(true); settingButt->addTouchEventListener(this, toucheventselector(AheadChapter::settingGame)); UIImageView *map_image = static_cast<UIImageView *>(_ahead_root->getChildByName("gMap_image")); map_image->setTouchEnable(true); map_image->addTouchEventListener(this, toucheventselector(AheadChapter::enterAcountManager)); return true;}
开发者ID:GHunique,项目名称:CrazyGeography1,代码行数:28,
示例6: addChildbool MainMenu::init(void){ if ( !Layer::init() ) { return false; } _uiLayer = Layer::create(); _uiLayer->setPosition(Point(D_display.getLeftBottom())); addChild(_uiLayer); auto spBg = Sprite::create("images/mainmenu_bg.jpg"); spBg->setPosition(D_display.getCenterPoint()); _uiLayer->addChild(spBg); auto btnStart = Button::create(); btnStart->setTouchEnabled(true); btnStart->loadTextures("images/btn_start.png", "", ""); btnStart->setPosition(Point(D_display.cx, D_display.cy+43)); btnStart->setTag(1); btnStart->addTouchEventListener(this, toucheventselector(MainMenu::touchEvent)); _uiLayer->addChild(btnStart); auto btnExit = Button::create(); btnExit->setTouchEnabled(true); btnExit->loadTextures("images/btn_exit.png", "", ""); btnExit->setPosition(Point(D_display.cx, D_display.cy-43)); btnExit->addTouchEventListener(this, toucheventselector(MainMenu::touchEvent)); btnExit->setTag(2); _uiLayer->addChild(btnExit); return true;}
开发者ID:qing7ling0,项目名称:LQProjects,代码行数:34,
示例7: toucheventselectorbool PhotoLayer::init(){ ////////////////////////////// // 1. super init first if ( !Layer::init() ) { return false; } ///////////////////////////////// Widget *node = cocostudio::GUIReader::getInstance()->widgetFromJsonFile("ElfYourSelfUi/ElfYourSelfUi_4.ExportJson"); if (node == nullptr) { return nullptr; } Button* btnBack = (Button*)node->getChildByName("btnBack"); btnBack->addTouchEventListener(this, toucheventselector(PhotoLayer::goBack)); Button* okBtn = (Button*)node->getChildByName("okBtn"); okBtn->addTouchEventListener(this, toucheventselector(PhotoLayer::changeOk)); this->head = (ImageView*)node->getChildByName("head"); this->headBg = (ImageView*)node->getChildByName("Image_4"); touchId1 = -1; touchId2 = -1; this->addChild(node, 0, 1); return true;}
开发者ID:angezhao,项目名称:ElfCopy,代码行数:31,
示例8: toucheventselectorbool LoginLayer::init(){ if (!Layer::init()) { return false; } _layerout = GUIReader::getInstance()->widgetFromJsonFile("login/DemoLogin.json"); this->addChild(_layerout); _closeButton = static_cast<ui::Button*>(_layerout->getChildByName("close_Button")); _closeButton->addTouchEventListener(this,toucheventselector(LoginLayer::closeButtonCheck)); _loginButton = static_cast<ui::Button*>(_layerout->getChildByName("login_Button")); _loginButton->addTouchEventListener(this, toucheventselector(LoginLayer::loginButtonCheck)); _userNameTextField = static_cast<ui::TextField*>(_layerout->getChildByName("name_TextField")); _userNameTextField->setText("test"); _passwordTextField01 = static_cast<ui::TextField*>(_layerout->getChildByName("password_TextField")); _passwordTextField01->setText("test"); _passwordTextField02 = static_cast<ui::TextField*>(_layerout->getChildByName("confirm_TextField")); _passwordTextField02->setText("test"); _loginButtonText = static_cast<ui::TextBMFont*>(_loginButton->getChildByName("login_LabelBMFont")); _loginButtonText->setText("test"); //KeyboardNotificationLayer* keyboradLayer = TextFieldTTFDefaultTest::create(); //this->addKeyboardNotificationLayer(keyboradLayer); return true;}
开发者ID:jun199004,项目名称:Cocos2dxTest,代码行数:35,
示例9: InitSkillBtnsbool CMainUIFight::InitSkillBtns(){ m_NormalAtk.btn = (Button*)Helper::seekWidgetByName(m_pWidget,"NormalAtk"); m_NormalAtk.btn->setTag(Normal_Attack_ID); m_NormalAtk.btn->addTouchEventListener(this,toucheventselector(CMainUIFight::ClickSkill)); Size size = m_NormalAtk.btn->getSize(); m_NormalAtk.cd = CdCtrol::create(skill_cd_path); m_NormalAtk.cd->setSize(size-Size(10,10)); m_NormalAtk.cd->setPosition(Point(size.width/2,size.height/2)); m_NormalAtk.btn->addChild(m_NormalAtk.cd); for (int i=0; i<Skill_Max_Num; ++i) { m_SkillBtns[i].btn = (Button*)Helper::seekWidgetByName(m_pWidget,CCString::createWithFormat("Skill_%d",i)->getCString()); m_SkillBtns[i].lock = (ImageView*)Helper::seekWidgetByName(m_pWidget,CCString::createWithFormat("LockImg_%d",i)->getCString()); m_SkillBtns[i].desc = (Text*)Helper::seekWidgetByName(m_pWidget,CCString::createWithFormat("UnlockDesc_%d",i)->getCString()); m_SkillBtns[i].icon = (ImageView*)Helper::seekWidgetByName(m_pWidget,CCString::createWithFormat("Icon_%d",i)->getCString()); m_SkillBtns[i].btn->addTouchEventListener(this,toucheventselector(CMainUIFight::ClickSkill)); Size size = m_SkillBtns[i].icon->getSize(); m_SkillBtns[i].cd = CdCtrol::create(skill_cd_path); m_SkillBtns[i].cd->setPosition(Point(size.width/2,size.height/2)); m_SkillBtns[i].cd->setSize(size); m_SkillBtns[i].icon->addChild(m_SkillBtns[i].cd); m_SkillBtns[i].enable = false; } return true;}
开发者ID:SmallRaindrop,项目名称:LocatorApp,代码行数:31,
示例10: initWithLayerbool PreActionBar::initWithLayer(cocos2d::Node* node){ do { m_dMinCall = 0; //让或弃 m_pMenuItemCheckOrFold = static_cast<Button*>(Tools::getWidgetByName(node,"gt_bt_preactionbar_ranghuoqi")); m_pMenuItemCheckOrFold->addTouchEventListener(this,toucheventselector(PreActionBar::onMenuItemSelected) ) ; //自动让牌 m_pMenuItemCall = static_cast<Button*>(Tools::getWidgetByName(node,"gt_bt_preactionbar_autorangpai")); m_pMenuItemCall->addTouchEventListener(this,toucheventselector(PreActionBar::onMenuItemSelected) ) ; //自动跟住 m_pMenuItemCallAny = static_cast<Button*>(Tools::getWidgetByName(node,"gt_bt_preactionbar_autogengzhu")); m_pMenuItemCallAny->addTouchEventListener(this,toucheventselector(PreActionBar::onMenuItemSelected) ) ; m_pMenuItemCheckOrFoldText = static_cast<Text*>(Tools::getWidgetByName(node,"gt_text_preactionbar_ranghuoqi")); m_pMenuItemCallText = static_cast<Text*>(Tools::getWidgetByName(node,"gt_text_preactionbar_rautorangpai")); m_pMenuItemCallAnyText = static_cast<Text*>(Tools::getWidgetByName(node,"gt_text_preactionbar_aotugengzhu")); setVisible(false) ; return true; } while (0); return false ;}
开发者ID:windtrack,项目名称:onlinedezhou,代码行数:31,
示例11: menu_selector// on "init" you need to initialize your instancebool HelloWorld::init(){ ////////////////////////////// // 1. super init first if ( !CCLayer::init() ) { return false; } CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize(); CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin(); ///////////////////////////// // 2. add a menu item with "X" image, which is clicked to quit the program // you may modify it. // add a "close" icon to exit the progress. it's an autorelease object CCMenuItemImage *pCloseItem = CCMenuItemImage::create( "CloseNormal.png", "CloseSelected.png", this, menu_selector(HelloWorld::menuCloseCallback)); pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 , origin.y + pCloseItem->getContentSize().height/2)); // create menu, it's an autorelease object CCMenu* pMenu = CCMenu::create(pCloseItem, NULL); pMenu->setPosition(CCPointZero); this->addChild(pMenu, 1); ///////////////////////////// // 3. add your codes below... CCNode* gameScene = SceneReader::sharedSceneReader()->createNodeWithSceneFile("DemoCowboy.json"); addChild(gameScene); //Create player CCNode* playerNode = gameScene->getChildByTag(10004); player = new Player(playerNode); //Assign callbacks to the buttons CCNode* uiNode = gameScene->getChildByTag(10005); UILayer* ui = (UILayer*)uiNode->getComponent("GUIComponent")->getNode(); UIButton* btnLeft = (UIButton*)ui->getWidgetByName("LeftButton"); btnLeft->addTouchEventListener(this, toucheventselector(HelloWorld::onMoveLeft)); UIButton* btnRight = (UIButton*)ui->getWidgetByName("RightButton"); btnRight->addTouchEventListener(this, toucheventselector(HelloWorld::onMoveRight)); UIButton* btnFire = (UIButton*)ui->getWidgetByName("FireButton");// btnFire->addReleaseEvent(this, coco_releaseselector(HelloWorld::onFire)); btnFire->addTouchEventListener(this, toucheventselector(HelloWorld::onFire)); //Enable update loop this->scheduleUpdate(); return true;}
开发者ID:NSJang,项目名称:CocoStudioSamples,代码行数:60,
示例12: initButtonvoid MissInfoDetailMediator::initButton(){ UtilCocostudio::getInstance()->addEventRelease(this,toucheventselector(MissInfoDetailMediator::callback),"Button_65",downmenuToolbarUi); //ui->getChildByName("Button_134"); UtilCocostudio::getInstance()->addEventRelease(this,toucheventselector(MissInfoDetailMediator::callback),"Button_102_0_0",ui); //UtilCocostudio::getInstance()->addEventRelease(this,toucheventselector(MissInfoDetailMediator::callback),"login_Button",ui);}
开发者ID:178435865,项目名称:game,代码行数:8,
示例13: sprintfvoid PlayScene::ShowProperty(bool visiable) { if(visiable) { char b[8] = {}; sprintf(b, "%d", stageid_+2); Finger::Instance().Show(ui_layer_, this, toucheventselector(PlayScene::onUseFinger)); Replay::Instance().Show(ui_layer_, this, toucheventselector(PlayScene::onUseReplay), b); } else { Finger::Instance().Disappear(ui_layer_); Replay::Instance().Disappear(ui_layer_); }}
开发者ID:f17qh,项目名称:crazyass,代码行数:11,
示例14: CCLOGvoid 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,
示例15: initContentWithJsonFilebool LoginDialog::init(){ if (!Dialog::init()) return false; initContentWithJsonFile("UI4DialogLogin.ExportJson"); Widget * tmp = _uilayer->getWidgetByName("panel_account"); _account = CCEditBox::create(CCSize(300, 35), CCScale9Sprite::create("green_edit.png")); addChild(_account); _account->setMaxLength(16); _account->setTouchPriority(0); _account->setFontColor(ccWHITE); _account->setPlaceHolder("联众账号"); _account->setPlaceholderFontColor(ccWHITE); _account->setInputMode(kEditBoxInputModeSingleLine); _account->setReturnType(kKeyboardReturnTypeDone); _account->setInputFlag(kEditBoxInputFlagSensitive); CCPoint tmpPoint = tmp->convertToWorldSpace(ccp(tmp->boundingBox().size.width/2+47,0)); _account->setPosition(tmpPoint); tmp = _uilayer->getWidgetByName("panel_password"); _password = CCEditBox::create(CCSize(300, 35), CCScale9Sprite::create("green_edit.png")); _password->setMaxLength(16); _password->setTouchPriority(0); _password->setFontColor(ccWHITE); _password->setPlaceHolder("密码"); _password->setPlaceholderFontColor(ccWHITE); _password->setReturnType(kKeyboardReturnTypeDone); _password->setInputFlag(kEditBoxInputFlagPassword); tmpPoint = tmp->convertToWorldSpace(ccp(tmp->boundingBox().size.width/2+47, 0)); _password->setPosition(tmpPoint); addChild(_password); string text = CCUserDefault::sharedUserDefault()->getStringForKey(SAVE_H_ACCOUNT,"fishtest007"); _account->setText(text.c_str()); text = CCUserDefault::sharedUserDefault()->getStringForKey(SAVE_H_PASSWORD,"fishtest007"); _password->setText(text.c_str()); bindTouchEvent("btn_login", this, toucheventselector(LoginDialog::onClickedLogin)); bindTouchEvent("btn_register", this, toucheventselector(LoginDialog::onClickedRegister)); return true;}
开发者ID:mrktj,项目名称:SlotGame,代码行数:51,
示例16: toucheventselectorvoid MsgContentDialog::setPrize(int num){ string texture = "button_confirm.png"; SEL_TouchEvent func = toucheventselector(MsgContentDialog::close); //奖励物品数量大于0 并且 奖励物品的范围,以防奖励不存在的物品 if (num > 0 && _data->mailType > 0 && _data->mailType < 5) { int d; string prizeStr; switch (_data->mailType) { case 1://宠物奖励 { d = _data->itemId - 1;//宠物图片从0开始计数,服务端数据从1开始计数 prizeStr = "pethead%d.png"; break; } case 2://道具奖励 { d = _data->itemId; prizeStr = "prop%d.png"; break; } default: { d = _data->mailType; prizeStr = "prize%d.png"; break; } } prizeStr = CCString::createWithFormat(prizeStr.c_str(),d)->getCString(); _number->setText(CCString::createWithFormat("%d",num)->getCString()); _prize->loadTexture(prizeStr.c_str(),UI_TEX_TYPE_PLIST); if ( !_data->isOK ) { texture = "button_receive.png"; func = toucheventselector(MsgContentDialog::clickedReceive); } } else { _wprize->setVisible(false); } _button->loadTextures(texture.c_str(), NULL, NULL , UI_TEX_TYPE_PLIST);//确定 _button->addTouchEventListener(this, func);}
开发者ID:mrktj,项目名称:SlotGame,代码行数:51,
示例17: sprintfvoid SelectMenuView::noticeShowLock(int beautyIndex, int needHeart){ _panelUnlock->setVisible(true); _panelUnlock->setTouchEnabled(true); // setting head UIImageView* head = (UIImageView*)_panelUnlock->getChildByName("panelLock_head"); char tmp[32]; sprintf(tmp,"head_%d.png",beautyIndex); head->loadTexture(tmp,UI_TEX_TYPE_PLIST); // setting heart number for(int i=0; i<MAX_HEART; i++) { sprintf(tmp,"panelLock_heart_%d",i+1); if(i<needHeart) { _panelUnlock->getChildByName(tmp)->setVisible(true); } else { _panelUnlock->getChildByName(tmp)->setVisible(false); } } // setting beauty name UILabelBMFont* labelName = (UILabelBMFont*) _panelUnlock->getChildByName("panelLock_txt_name"); labelName->setText(BeautyStaticData::getInstance()->getName(beautyIndex)); // setting unlock price UILabelBMFont* labelPrice = (UILabelBMFont*) _panelUnlock->getChildByName("panelLock_txt_price"); sprintf(tmp,"$%d",BeautyStaticData::getInstance()->getRequiement(beautyIndex+1)); labelPrice->setText(tmp); // animation UIWidget* bg = _panelUnlock->getChildByName("panelLock_bg"); bg->setScale(0.1f); bg->runAction(CCScaleTo::create(0.3f,1)); UIButton* button = (UIButton*)_panelUnlock->getChildByName("panelLock_btn_back"); button->setTouchEnabled(true); button->setPressedActionEnabled(true); button->addTouchEventListener(this,toucheventselector(SelectMenuView::onTouchUnlock)); button = (UIButton*)_panelUnlock->getChildByName("panelLock_btn_unlock"); button->setTouchEnabled(true); button->setPressedActionEnabled(true); button->addTouchEventListener(this,toucheventselector(SelectMenuView::onTouchUnlock)); this->addWidget(_panelUnlock);}
开发者ID:pplasto,项目名称:SleepBeauty,代码行数:50,
示例18: addWidgetvoid MainFrame::Init(){ mMainUILayout = static_cast<ui::Layout*>(GUIReader::shareReader()->widgetFromJsonFile("MainFrame/MainFrame.ExportJson")); addWidget(mMainUILayout); Button* btn = (Button*)mMainUILayout->getChildByTag(ThreatenButtonTag); btn->addTouchEventListener(this, toucheventselector(MainFrame::ThreatenSkill)); btn = (Button*)mMainUILayout->getChildByTag(AddSkillTag); btn->addTouchEventListener(this, toucheventselector(MainFrame::AddSkillUI)); mLevelText = (LabelAtlas*)mMainUILayout->getChildByTag(LevelTag); mExperienceBar = (LoadingBar*)mMainUILayout->getChildByTag(ExperienceTag);}
开发者ID:YameteYY,项目名称:Cocos2DFishGame,代码行数:14,
示例19: enableKeypadbool MainLayer::init(){ if (!CCLayer::init()) return false; enableKeypad(); m_uiLayer = UILayer::create(); addChild(m_uiLayer); m_layoutWidget = dynamic_cast<UILayout *>(GUIReader::shareReader()->widgetFromJsonFile("StartLayer.json")); if (!m_layoutWidget) { return false; } m_uiLayer->addWidget(m_layoutWidget); m_petUIImage = dynamic_cast<UIImageView *>(m_uiLayer->getWidgetByName("petImage")); m_petUIImage->addTouchEventListener(this, toucheventselector(MainLayer::pressPetImageCallback)); m_petUIImage->setTouchEnabled(true); m_centerPos = m_petUIImage->getPosition(); m_startUIImage = dynamic_cast<UIImageView *>(m_uiLayer->getWidgetByName("startbutton")); m_startUIImage->addTouchEventListener(this, toucheventselector(MainLayer::pressStartButtonCallback)); m_startUIImage->setTouchEnabled(true); m_changeLabel = dynamic_cast<UILabelBMFont *>(m_uiLayer->getWidgetByName("changeLabel")); m_changeLabel->addTouchEventListener(this, toucheventselector(MainLayer::pressChangeRoleCallback)); m_changeLabel->setTouchEnabled(true); m_priceTipsLabel = dynamic_cast<UILabel *>(m_uiLayer->getWidgetByName("feeLabel")); m_cherryLabel = dynamic_cast<UILabelBMFont *>(m_uiLayer->getWidgetByName("cherryLabel")); m_bestScoreLabel = dynamic_cast<UILabelBMFont *>(m_uiLayer->getWidgetByName("bestScoreLabel")); m_gameTimesScoreLabel = dynamic_cast<UILabelBMFont *>(m_uiLayer->getWidgetByName("gametimesScoreLabel")); m_petType = (PetType)Config::instance()->petType(); setPriceTipText(m_petType); updatePetImage(m_petType); int cherryNum = Config::instance()->cherryNum(); int gameTimes = Config::instance()->gameTimes(); int highScore = Config::instance()->highScore(); updateMainText(cherryNum, gameTimes, highScore); WebSocketManager::instance(); return true;}
开发者ID:xiangtone,项目名称:xtone-public-base,代码行数:50,
示例20: toucheventselectorvoid MainScene::updateList(CCObject *sender){ if (xCurAtk == NULL || m_state != CS_MAIN_PLIST) { return; } listView->removeAllItems(); for (int i = 0; i < xCurAtk->getPartsCount(); ++i) { listView->pushBackDefaultItem(); } CCArray* items = listView->getItems(); for (int i = 0; i < items->count(); i++) { Layout * bg = (Layout*)items->objectAtIndex(i); bg->addTouchEventListener(this, toucheventselector(MainScene::touchEvent)); bg->setTag(LIST_BG + i); Label *label = (Label*)UIHelper::seekWidgetByTag(bg, 22); label->setText(xCurAtk->getPartNameByIndex(i)); } makeAFocusOfList(); updateCheckBox();}
开发者ID:aababy,项目名称:Tool,代码行数:25,
示例21: bindTouchEventbool SettingDialog::init(){ if ( !Dialog::initContentWithJsonFile("UI4DialogSet.ExportJson") ) return false; button_music = dynamic_cast<Button*>(getWidgetByName("Button_music")); button_effect = dynamic_cast<Button*>(getWidgetByName("Button_effect")); progress_music = dynamic_cast<LoadingBar*>(getWidgetByName("ProgressBar_music")); progress_effect = dynamic_cast<LoadingBar*>(getWidgetByName("ProgressBar_effect")); bindTouchEvent("Button_switchAccount", this, toucheventselector(SettingDialog::clickedSwitchAccount)); button_music->addTouchEventListener(this, toucheventselector(SettingDialog::regulateSound)); return true;}
开发者ID:mrktj,项目名称:SlotGame,代码行数:16,
示例22: scheduleUpdatebool UILoadingBarTest_Editor::init(){ if (UIScene_Editor::init()) { scheduleUpdate(); _layout = static_cast<Layout*>(GUIReader::shareReader()->widgetFromJsonFile("cocosgui/UIEditorTest/UILoadingBar_Editor/ui_loadingbar_editor_1.json")); _touchGroup->addWidget(_layout); CCSize screenSize = CCDirector::sharedDirector()->getWinSize(); CCSize rootSize = _layout->getSize(); _touchGroup->setPosition(CCPoint((screenSize.width - rootSize.width) / 2, (screenSize.height - rootSize.height) / 2)); Layout* root = static_cast<Layout*>(_touchGroup->getWidgetByName("root_Panel")); ui::Label* back_label = static_cast<ui::Label*>(UIHelper::seekWidgetByName(root, "back")); back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); _sceneTitle = static_cast<ui::Label*>(UIHelper::seekWidgetByName(root, "UItest")); LoadingBar* loadingBar_left_to_right = dynamic_cast<LoadingBar*>(UIHelper::seekWidgetByName(root, "LoadingBar_856")); loadingBar_left_to_right->setPercent(0); LoadingBar* loadingBar_right_to_left = dynamic_cast<LoadingBar*>(UIHelper::seekWidgetByName(root, "LoadingBar_857")); loadingBar_right_to_left->setPercent(0); return true; } return false;}
开发者ID:1901,项目名称:cocos2d-x,代码行数:31,
示例23: ifvoid PlayScene::onBtnClothes(CCObject *target, TouchEventType e) { UIButton* btn = (UIButton *)ui_layer_->getWidgetByName(btn_name[sub_stage_id_]); if (btn) { if(e == TOUCH_EVENT_BEGAN) { btn_start_pos_ = btn->getPosition(); } else if(e == TOUCH_EVENT_ENDED) { CCPoint pos = btn->getPosition(); if(btn_start_pos_.fuzzyEquals(pos, 100.0f)) { btn->setPosition(btn_start_pos_); } else { if(!all_finish_) { btn->setEnabled(false); btn = (UIButton *)ui_layer_->getWidgetByName("BtnStartPlay"); btn->setEnabled(true); } else { btn->setEnabled(false); User::CurrentUser()->set_stageid(stageid_ + 1); User::CurrentUser()->Flush(); PopWin::Instance().ShowPopScene(this, true, toucheventselector(PlayScene::onPopBack)); } } } } CCLOG("%s/n", __FUNCTION__);}
开发者ID:f17qh,项目名称:crazyass,代码行数:25,
示例24: addChildbool IntroScene::init(){ //super init if (!Layer::init()) { return false; } Size visibleSize = Director::getInstance()->getVisibleSize(); Point origin = Director::getInstance()->getVisibleOrigin(); ///////////////////////////////////////////////////// AudioEngine::getInstance()->createLoop("bgm/intro.ogg"); auto sceneNode = cocostudio::SceneReader::getInstance()->createNodeWithSceneFile("introScene.json"); addChild(sceneNode); auto UINode = sceneNode->getChildByTag(10003); auto UIComponent = (cocostudio::ComRender*) UINode->getComponent("GUIComponent"); auto UIlayer = UIComponent->getNode(); auto background = dynamic_cast<ImageView*>(UIlayer->getChildByTag(INTROSCENE_BG)); auto buttonStart = dynamic_cast<Button*>(UIlayer->getChildByTag(INTROSCENE_START)); auto title = dynamic_cast<ImageView*>(UIlayer->getChildByTag(INTROSCENE_ECHO)); title->runAction(RepeatForever::create(Sequence::create(FadeIn::create(3), FadeOut::create(3), NULL))); buttonStart->runAction(RepeatForever::create(Sequence::create(FadeIn::create(1), DelayTime::create(1), FadeOut::create(1), NULL))); buttonStart->addTouchEventListener(this, toucheventselector(IntroScene::touchEvent)); auto logo = Sprite::create("introSceneUI/logo.png"); logo->setPosition(Point(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y)); logo->setLocalZOrder(1); sceneNode->addChild(logo); logo->runAction(Sequence::create(DelayTime::create(1), CallFunc::create(CC_CALLBACK_0(IntroScene::playIntro, this)), FadeOut::create(2), NULL));//logo C++ touchwin函数代码示例 C++ touch_nmi_watchdog函数代码示例
|