本文整理汇总了C++中UILayer类的典型用法代码示例。如果您正苦于以下问题:C++ UILayer类的具体用法?C++ UILayer怎么用?C++ UILayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UILayer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: movementEvent_selector
void HelloWorld::update(float delta)
{
if(m_bStart)
{
CCArmature *pHero = (CCArmature*)(m_pGameScene->getChildByTag(10005)->getComponent("CCArmature")->getNode());
pHero->getParent()->setPositionX(pHero->getParent()->getPositionX() + m_fSpeed);
CCArmature *pEnemy = (CCArmature*)(m_pGameScene->getChildByTag(10006)->getComponent("CCArmature")->getNode());
if(ccpDistance(ccp(pHero->getParent()->getPositionX(), 0), ccp(pEnemy->getParent()->getPositionX(), 0)) < m_fAttackDis)
{
pHero->getAnimation()->play("attack");
pHero->getAnimation()->setMovementEventCallFunc(this,
movementEvent_selector(HelloWorld::animationEvent));
m_bStart = false;
}
}
if(m_bDead)
{
CCComRender *pUIRender = static_cast<CCComRender*>(m_pGameScene->getChildByTag(10007)->getComponent("GUIComponent"));
UILayer *pUILayer = static_cast<UILayer*>(pUIRender->getNode());
UILoadingBar *pHPLoadingBar = static_cast<UILoadingBar*>(pUILayer->getWidgetByName("hp02_LoadingBar"));
UILoadingBar *pMPLoadingBar = static_cast<UILoadingBar*>(pUILayer->getWidgetByName("mp02_LoadingBar"));
pHPLoadingBar->setPercent(m_fPercentage);
pMPLoadingBar->setPercent(m_fPercentage);
m_fPercentage -= 2.0f;
if (m_fPercentage < 0.0f) {
unscheduleUpdate();
}
}
}
开发者ID:shujunqiao,项目名称:CocoStudioSamples,代码行数:34,代码来源:HelloWorldScene.cpp
示例2: addChild
bool UIImageViewTest_Scale9::init()
{
if (UIScene::init())
{
CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
UILabel *alert = UILabel::create();
alert->setText("ImageView scale9 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 * 1.75));
m_pUiLayer->addWidget(alert);
// Create the ui layer
UILayer *ul = UILayer::create();
ul->scheduleUpdate();
addChild(ul);
// Create the imageview
UIImageView *imageView = UIImageView::create();
imageView->setScale9Enabled(true);
imageView->loadTexture("cocosgui/buttonHighlighted.png");
// imageView->setScale9Size(CCSizeMake(200, 85));
// imageView->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f + imageView->getRect().size.height / 4.0f));
ul->addWidget(imageView);
return true;
}
return false;
}
开发者ID:nutty898,项目名称:Cocos2d-x-For-CocoStudio,代码行数:31,代码来源:UIImageViewTest.cpp
示例3: S_ReqSyncTime
//--------------------------------------------------------------------------
/// <CODE-GENERATE>{GlobalClientFuncImpl}
void TexasPokerHallAgentC::C_RecLogin(const LoginResult& tResult)
{
/// <CODE-IMPLEMENT>{RecLogin}
if(tResult <= LOGIN_CREATE)
{
S_ReqSyncTime();
UILayer* pkMainLayer = g_pLayerManager->GetCurrentMainLayer();
if(!VeStrcmp(pkMainLayer->GetName(), Login::GetName()))
{
static_cast<Login*>(pkMainLayer)->IntoHall();
}
else
{
GetPlayer()->S_ReqInitHall();
UILayer* pkLayer = g_pLayerManager->GetCurrentMainLayer();
if(pkLayer)
{
pkLayer->OnForceUpdate();
}
}
}
else
{
g_pkGame->ShowAlert(VE_NEW HallLoginFailed(tResult));
}
/// </CODE-IMPLEMENT>{RecLogin}
}
开发者ID:snailwork,项目名称:Texas-cs,代码行数:29,代码来源:TexasPokerHallAgentC.cpp
示例4: menu_selector
// on "init" you need to initialize your instance
bool 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,代码来源:HelloWorldScene.cpp
示例5: repaint
void UILabel::repaint(EngineInternals &internals, const UILayer &ui)
{
_elements.clear();
_elementPointers.clear();
_textures.clear();
float x = 0;
float y = 0;
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> convert;
std::wstring result = convert.from_bytes(_text);
Vector2 resolution(size.x * ui.getRatio(), size.y * ui.getRatio());
for (std::wstring::const_iterator i = result.begin(); i != result.end(); i++)
{
auto &g = _typeEngine.getGlyph(*i, (unsigned int)resolution.y);
float x2 = x + (float)g.bitmap.left;
float y2 = y + (resolution.y - (float)g.bitmap.top);
Texture2D *tex;
if (_textures.find(*i) != _textures.end())
{
tex = _textures[*i].get();
}
else
{
_textures[*i] = std::make_shared<Texture2D>(g.bitmap.buffer, Pixmap::Information(Metric2(g.bitmap.width, g.bitmap.height), Pixmap::Information::Format::ALPHA, 8));
tex = _textures[*i].get();
}
UIElement glyph = UIElement(Vector2((float)g.bitmap.width / ui.getRatio(), (float)g.bitmap.height / ui.getRatio()), Alignment::TOP_LEFT, Vector2(x2 / ui.getRatio(), y2 / ui.getRatio()), tex);
glyph.uvs[0] = Vector2(0, 0);
glyph.uvs[1] = Vector2(1, 0);
glyph.uvs[2] = Vector2(1, 1);
glyph.uvs[3] = Vector2(0, 1);
x += g.advance.x;
y += g.advance.y;
_elements.push_back(glyph);
}
for (auto &element : _elements)
{
_elementPointers.push_back(&element);
}
if (!_fixed)
{
size.x = x / ui.getRatio();
}
}
开发者ID:Zogzer,项目名称:LysOld,代码行数:52,代码来源:uilabel.cpp
示例6: onEnter
// on "init" you need to initialize your instance
void GameLoginLayer::onEnter()
{
UILayer* uiLayer = UILayer::create();
uiLayer->scheduleUpdate();
UILayout* ui_root =dynamic_cast<UILayout*>(GUIReader::shareReader()->widgetFromJsonFile("plane_1.json"));
uiLayer->addWidget(ui_root);
UIButton *left_button = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("TextButton_34"));
left_button->addReleaseEvent(this, SEL_ReleaseEvent(&GameLoginLayer::loginBtnCallback));
m_CCLayer->addChild(uiLayer);
}
开发者ID:hetter,项目名称:planeX_Project,代码行数:14,代码来源:GameLoginLayer.cpp
示例7: UILayer
UILayer* UILayer::create(void)
{
UILayer *pRet = new UILayer();
if (pRet && pRet->init())
{
pRet->autorelease();
return pRet;
}
else
{
CC_SAFE_DELETE(pRet);
return NULL;
}
}
开发者ID:studio501,项目名称:BlockPuzzle,代码行数:14,代码来源:UILayer.cpp
示例8: init
bool LoginScene::init()
{
if (!CCLayer::init()) {
return false;
}
UILayer* ui = UILayer::create();
ui->setTag(LOGIN_UI_TAG);
this->addChild(ui);
auto pUI = CCUIHELPER->createWidgetFromJsonFile("UI/DemoLogin/DemoLogin.json");
pUI->setTag(LOGIN_UI_WIDGET_TAG);
ui->addWidget(pUI);
auto pLoginBtn = dynamic_cast<UIButton*>(pUI->getChildByName("login_Button"));
pLoginBtn->addReleaseEvent(this, coco_releaseselector(LoginScene::loginRelease));
auto pCloseBtn = dynamic_cast<UIButton*>(pUI->getChildByName("close_Button"));
pCloseBtn->addReleaseEvent(this, coco_releaseselector(LoginScene::closeGame));
return true;
}
开发者ID:zhubenwuzui,项目名称:monkey_project_x,代码行数:18,代码来源:LoginScene.cpp
示例9: 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
示例10: CCLog
bool TestView::init(){
if ( !CCLayer::init() )
{
return false;
}
CCSize size = CCDirector::sharedDirector()->getVisibleSize();
CCLog("winSize %f %f", size.width, size.height);
UILayer *lay = UILayer::create();
addChild(lay);
Widget *w = GUIReader::shareReader()->widgetFromJsonFile("testgui/LoginSence.json");
lay->addWidget(w);
w->setSizeType(SIZE_ABSOLUTE);
w->setSize(size);
return true;
}
开发者ID:liyonghelpme,项目名称:ballpartyAllCode,代码行数:19,代码来源:TestView.cpp
示例11: DelLayer
void UILayerManager::DelLayer(const VeChar8* pcName)
{
if(pcName)
{
VeUInt32* it = m_kLayerMap.Find(pcName);
if(it)
{
VeUInt32 u32Index = *it;
if(u32Index < (m_kLayerSet.Size() - 1))
{
UILayer* pkLayer = m_kLayerSet[u32Index];
UILayer* pkMove = m_kLayerSet.Back();
m_kLayerMap[pkMove->GetName()] = u32Index;
m_kLayerSet[u32Index] = pkMove;
m_kLayerSet.Back() = pkLayer;
}
m_kLayerMap.Remove(pcName);
VE_SAFE_DELETE(m_kLayerSet.Back());
m_kLayerSet.PopBack();
}
}
}
开发者ID:snailwork,项目名称:Texas-cs,代码行数:22,代码来源:UILayerManager.cpp
示例12: switch
void Scene_GameItem::onEnter()
{
CCLayer::onEnter();
this->initData();
//隐藏pk界面
this->setPkView(false);
CCSprite* pSpriteBG = (CCSprite*)getChildByTag(eGameItemTagBg);
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
//pSpriteBG->setPosition(ccp(visibleSize.width/2 , pSpriteBG->getContentSize().height/2 + origin.y));
char str1[100]={0};
switch(GameShare_Global::shareGlobal()->gameType)
{
case 1:
sprintf(str1,"GameSceneBg1.json");
break;
case Game_Jelly:
sprintf(str1,"GameSceneBg2.json");
break;
case Game_Fruit:
sprintf(str1,"GameSceneBg3.json");
break;
case Game_Link:
sprintf(str1,"GameSceneBg4.json");
break;
case Game_TaiKo:
sprintf(str1,"GameSceneBg5.json");
break;
case Game_Cir:
sprintf(str1,"GameSceneBg1.json");
break;
default:
break;
}
UILayer* ul = UILayer::create();
auto myLayout = dynamic_cast<Layout*>(GUIReader::shareReader()->widgetFromJsonFile(CStringUtil::convertToUIResPath(str1).c_str()));
ul->addWidget(myLayout);
this->addChild(ul, 0, 100);
ul->setTouchEnabled(false);
int nGameType = GameShare_Global::shareGlobal()->gameType;
if (nGameType==1)
{
UIImageView* pHill = dynamic_cast<UIImageView*>(ul->getWidgetByName("san"));
UIImageView* pHill2 = dynamic_cast<UIImageView*>(ul->getWidgetByName("san2"));
//CCActionInterval* actionTo = CCScaleTo::create(2.0f, 0.5f);
CCActionInterval* actionBy = CCScaleBy::create(1.0f, 1.0f, 1.1f);
CCActionInterval* actionBy2 = CCScaleBy::create(1.0f, 1.1f, 1.0f);
CCFiniteTimeAction* seq = CCSequence::create(actionBy, actionBy->reverse(),NULL);
CCActionInterval * repeatForever =CCRepeatForever::create((CCActionInterval* )seq);
CCFiniteTimeAction* seq1 = CCSequence::create(actionBy2, actionBy2->reverse(),NULL);
CCActionInterval * repeatForever2 =CCRepeatForever::create((CCActionInterval* )seq1);
pHill->runAction(repeatForever);
pHill2->runAction(repeatForever2);
}
else if (nGameType==2)
{
UIImageView* pCloud = dynamic_cast<UIImageView*>(ul->getWidgetByName("yun2"));
UIImageView* pCloud2 = dynamic_cast<UIImageView*>(ul->getWidgetByName("yun3"));
CCActionInterval* actionBy = CCScaleBy::create(1.5f, 1.2f, 1.0f);
CCActionInterval* actionBy2 = CCScaleBy::create(1.5f, 1.2f, 1.0f);
CCFiniteTimeAction* seq1 = CCSequence::create(actionBy, actionBy->reverse(),NULL);
CCFiniteTimeAction* seq2 = CCSequence::create(actionBy2, actionBy2->reverse(),NULL);
CCActionInterval * repeatForever1 =CCRepeatForever::create((CCActionInterval* )seq1);
CCActionInterval * repeatForever2 =CCRepeatForever::create((CCActionInterval* )seq2);
pCloud->runAction(repeatForever1);
pCloud2->runAction(repeatForever2);
}
else if (nGameType==3)
{
UIImageView* pSugar = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_15"));
UIImageView* pSugar1 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_20"));
CCRotateBy* actionBy2 = CCRotateBy::create(1.5f, -25.0f, -25.0f);
CCRotateBy* actionBy1 = CCRotateBy::create(1.5f, -25.0f, -25.0f);
CCFiniteTimeAction* seq1 = CCSequence::create(actionBy2, actionBy2->reverse(), NULL);
CCFiniteTimeAction* seq2 = CCSequence::create(actionBy1, actionBy1->reverse(), NULL);
CCActionInterval * repeatForever1 =CCRepeatForever::create((CCActionInterval* )seq1);
CCActionInterval * repeatForever2 =CCRepeatForever::create((CCActionInterval* )seq2);
pSugar->runAction(repeatForever1);
pSugar1->runAction(repeatForever2);
//星星
UIImageView* pXx1 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_23"));
UIImageView* pXx2 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_32"));
UIImageView* pXx3 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_35"));
UIImageView* pXx4 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_39"));
CCActionInterval* actionBy3 = CCScaleBy::create(1.2f, 1.3f, 1.3f);
CCActionInterval* actionBy4 = CCScaleBy::create(1.2f, 1.3f, 1.3f);
CCActionInterval* actionBy5 = CCScaleBy::create(1.2f, 1.3f, 1.3f);
CCActionInterval* actionBy6 = CCScaleBy::create(1.2f, 1.3f, 1.3f);
CCFiniteTimeAction* seq3 = CCSequence::create(actionBy3, actionBy3->reverse(),NULL);
CCFiniteTimeAction* seq4 = CCSequence::create(actionBy4, actionBy4->reverse(),NULL);
CCFiniteTimeAction* seq5 = CCSequence::create(actionBy5, actionBy5->reverse(),NULL);
CCFiniteTimeAction* seq6 = CCSequence::create(actionBy6, actionBy6->reverse(),NULL);
//.........这里部分代码省略.........
开发者ID:anzhongliu,项目名称:SmallGame_Cocos2dx,代码行数:101,代码来源:Scene_GameItem.cpp
示例13: ccp
bool GameLayerPk2::init()
{
if (!CCLayer::init()) {
return false;
}
UILayer* ul = UILayer::create();
auto myLayout = dynamic_cast<Layout*>(GUIReader::shareReader()->widgetFromJsonFile(CStringUtil::convertToUIResPath("Pk2.json").c_str()));
ul->addWidget(myLayout);
this->addChild(ul, 0, 100);
UIButton* sureBtn = dynamic_cast<UIButton*>(ul->getWidgetByName("Sure"));
sureBtn->setPressedActionEnabled(true);
sureBtn->addReleaseEvent(this, coco_releaseselector(GameLayerPk2::sureBtnCallback));
//设置自己的头像.
UIImageView* cellBg = dynamic_cast<UIImageView*>(ul->getWidgetByName("Avatar1Bg"));
CCSprite* img = CCSprite::create();
img->setContentSize(CCSize(145, 145));
img->setAnchorPoint(ccp(0, 0));
cellBg->addRenderer(img, 10);
CImageDownloader::GetInstance()->SendHttpRequest(CPlayerInfoMan::sharedInstance().getPlayerInfo().strImg.c_str(), img, "1000", 1000);
//设置自己的名字
UILabel* nameLabel = dynamic_cast<UILabel*>(ul->getWidgetByName("Name1Label"));
nameLabel->setText(CPlayerInfoMan::sharedInstance().getPlayerInfo().strName.c_str());
//设置对方的头像
UIImageView* cellBg2 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Avatar2Bg"));
CCSprite* img2 = CCSprite::create();
img2->setContentSize(CCSize(145, 145));
img2->setAnchorPoint(ccp(0, 0));
cellBg2->addRenderer(img2, 10);
CImageDownloader::GetInstance()->SendHttpRequest(CPkSysManager::sharedInstance().playerUrl.c_str(), img2, "1000", 1000);
//设置对方名字
UILabel* nameLabel2 = dynamic_cast<UILabel*>(ul->getWidgetByName("Name2Label"));
nameLabel2->setText(CPkSysManager::sharedInstance().playerName.c_str());
//设置自己的分数.
CCSprite* score = NumSprite::getNumSprite(CPkSysManager::sharedInstance().myScore, "./CocoStudioResources/FriendListTimeNum", 17.0);
score->setPosition(ccp(-35, 0));
UIImageView* scoreBg1 = dynamic_cast<UIImageView*>(ul->getWidgetByName("ScoreBg"));
scoreBg1->addRenderer(score, 10);
//等待迎战;
m_iSetTime = 1;
Deng = dynamic_cast<UIImageView*>(ul->getWidgetByName("Label1"));
Dai = dynamic_cast<UIImageView*>(ul->getWidgetByName("Label2"));
Ying = dynamic_cast<UIImageView*>(ul->getWidgetByName("Label3"));
Zhan = dynamic_cast<UIImageView*>(ul->getWidgetByName("Label4"));
Dain1 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Label5"));
Dain2 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Label6"));
Dain3 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Label7"));
CCActionInterval* actionTo = CCJumpTo::create(2, ccp(200,200),50, 4);
CCActionInterval* actionBy = CCJumpBy::create(2, ccp(300,0), 50, 4);
actionUp = CCJumpBy::create(0.3f, ccp(0,0), 20,1);
CCActionInterval* actionByBack = actionUp->reverse();
//设置光效旋转
UIImageView* Ray2 = dynamic_cast<UIImageView*>(ul->getWidgetByName("lightimg"));
CCActionInterval * rotateto = CCRotateBy::create(6.0f, 360);
CCFiniteTimeAction* seq1 = CCSequence::create(rotateto,NULL);
CCActionInterval * repeatForever2 =CCRepeatForever::create((CCActionInterval* )seq1);
Ray2->runAction(repeatForever2);
//Deng->runAction( CCSequence::create(actionUp, NULL));
//Dai->runAction( CCSequence::create(actionUp, NULL));
// for(int i = 0;i<10;i++)
// {
// if(i%2==0)
// {
//
// Deng->runAction(actionByBack);
// }
// else{
//
// Dai->runAction(actionByBack);
// }
// }
//this->schedule(schedule_selector(GameLayerPk2::SetDDTime), 0.2f);
Deng->runAction( CCSequence::create((CCActionInterval*)actionUp->copy(),NULL));
Dai->runAction( CCSequence::create((CCActionInterval*)actionUp->copy(),NULL));
Ying->runAction( CCSequence::create((CCActionInterval*)actionUp->copy(),NULL));
Zhan->runAction( CCSequence::create((CCActionInterval*)actionUp->copy(),NULL));
Dain1->runAction( CCSequence::create((CCActionInterval*)actionUp->copy(),NULL));
Dain2->runAction( CCSequence::create((CCActionInterval*)actionUp->copy(),NULL));
Dain3->runAction( CCSequence::create((CCActionInterval*)actionUp->copy(),NULL));
return true;
}
开发者ID:anzhongliu,项目名称:SmallGame_Cocos2dx,代码行数:88,代码来源:GameLayerPk2.cpp
示例14: init
bool LayerBaCayAvatar::init()
{
if (!CCLayer::init()) return false;
myself = GameServer::getSingleton().getSmartFox()->MySelf();
UILayer *ul = UILayer::create();
this->myName = SceneManager::getSingleton().getMyName();
this->myAI = SceneManager::getSingleton().getMyName().c_str();
this->isSpector = GameServer::getSingleton().getSmartFox()->UserManager()->GetUserByName(myName)->IsSpectator();
btn_vaochoi = UIButton::create();
btn_vaochoi->setTouchEnabled(true);
btn_vaochoi->loadTextures("ready.png", "ready_selected.png", "");
btn_vaochoi->setTitleText("Vào bàn");
btn_vaochoi->setScale(0.8);
btn_vaochoi->setPosition(ccp(65,87));
btn_vaochoi->setTitleFontSize(20);
btn_vaochoi->addTouchEventListener(this,toucheventselector(LayerBaCayAvatar::vaoBanChoi));
btn_vaochoi->setEnabled(false);
btn_vaochoi->setTag(0);
btn_dungday = UIButton::create();
btn_dungday->setTouchEnabled(true);
btn_dungday->loadTextures("ready.png", "ready_selected.png", "");
btn_dungday->setTitleText("Đứng dậy");
btn_dungday->setScale(0.8);
btn_dungday->setPosition(ccp(65,87));
btn_dungday->setTitleFontSize(20);
btn_dungday->addTouchEventListener(this,toucheventselector(LayerBaCayAvatar::vaoBanChoi));
btn_dungday->setEnabled(false);
btn_dungday->setTag(1);
ul->addWidget(btn_dungday);
ul->addWidget(btn_vaochoi);
this->addChild(ul);
this->setAnchorPoint(ccp(0, 0));
this->setPosition(ccp(0, 0));
this->myName = SceneManager::getSingleton().getMyName();
Avatar *me = new Avatar(false);
// me->setTouchEnabled(false);
Avatar *user1 = new Avatar(false);
Avatar *user2 = new Avatar(false);
Avatar *user3 = new Avatar(false);
Avatar *user4 = new Avatar(false);
Avatar *user5 = new Avatar(false);
Avatar *user6 = new Avatar(false);
me->autorelease();
user1->autorelease();
user2->autorelease();
user3->autorelease();
user4->autorelease();
user5->autorelease();
user6->autorelease();
me->setPosition(ccp(WIDTH_DESIGN/2-me->getSizeThis().width/2+25,10));
user1->setPosition(ccp(40, 110));
user2->setPosition(ccp(40, HEIGHT_DESIGN-200));
user3->setPosition(ccp(250, 360));
user4->setPosition(ccp(WIDTH_DESIGN-320, 360));
user5->setPosition(ccp(WIDTH_DESIGN-120, HEIGHT_DESIGN-200));
user6->setPosition(ccp(WIDTH_DESIGN-120,110));
me->setTag(kuser0);
user1->setTag(kuser1);
user2->setTag(kuser2);
user3->setTag(kuser3);
user4->setTag(kuser4);
user5->setTag(kuser5);
user6->setTag(kuser6);
me->setScale(0.7);
user1->setScale(0.7);
user2->setScale(0.7);
user3->setScale(0.7);
user4->setScale(0.7);
user5->setScale(0.7);
user6->setScale(0.7);
this->addChild(me);
this->addChild(user1);
this->addChild(user2);
this->addChild(user3);
this->addChild(user4);
this->addChild(user5);
this->addChild(user6);
chuong = UIImageView::create();
chuong->loadTexture("Chuong.png");
chuong->setScale(0.7);
chuong->setTouchEnabled(false);
chuong->setVisible(false);
//.........这里部分代码省略.........
开发者ID:mrktj,项目名称:iCasino_v2,代码行数:101,代码来源:LayerAvatar_BaCay.cpp
示例15: addChild
TanSuoLayer::TanSuoLayer()
{
m_nFontSize = 24;
m_nMaxCountDestroy = 3;
m_bIsJieFeng = false;
m_nSelectProId = -1;
mBg = BaseSprite::create("xunbao_bg.png");
addChild(mBg);
mBg->setPosition(ccp(mWinSize.width/2, mBg->getContentSize().height/2));
mMainMenu = CCMenu::create();
mBg->addChild(mMainMenu, 10);
mMainMenu->setPosition(ccp(0,0));
CCMenuItemImage *yijian = CCMenuItemImage::create(
"xunbao_anniu_yijianxunbao.png",
"xunbao_anniu_yijianxunbao_select.png",
this, menu_selector(TanSuoLayer::menuItemClicked_TanSuo));
mMainMenu->addChild(yijian, 0, Tag_MenuItem_YiJianTanSuo);
yijian->setPosition(ccp(548,mBg->getContentSize().height-674));
Button *tansuo = Button::create();
tansuo->loadTextures("xunbao_anniu_xunbao.png","xunbao_anniu_xunbao_select.png","xunbao_anniu_xunbao_select.png",UI_TEX_TYPE_LOCAL);
/*CCMenuItemImage *tansuo = CCMenuItemImage::create(
"xunbao_anniu_xunbao.png",
"xunbao_anniu_xunbao_select.png",
this, menu_selector(TanSuoLayer::menuItemClicked_TanSuo));*/
tansuo->addTouchEventListener(this,SEL_TouchEvent(&TanSuoLayer::clickXunBao));
UILayer* layer = UILayer::create();
layer->ignoreAnchorPointForPosition(false);
layer->setContentSize(tansuo->getContentSize());
layer->setAnchorPoint(ccp(0.5,0.5));
layer->addWidget(tansuo);
layer->setPosition(320,mBg->getContentSize().height-674);//以前cpp(x,y) 现在左边 都是Point 比如颜色 ccWHITE 也改成了Color3B::WHITE
mBg->addChild(layer);
tansuo->setPosition(ccp(tansuo->getContentSize().width / 2 , tansuo->getContentSize().height / 2));
m_sXunBaoSpr = CCSprite::create("xunbao_anniu_xunbao_xiaoguo.png");
m_sXunBaoSpr->setPosition(ccp(320,mBg->getContentSize().height-674));
mBg->addChild(m_sXunBaoSpr);
m_sXunBaoSpr->runAction(CCRepeatForever::create(CCSequence::create(CCFadeOut::create(1.0f),CCFadeIn::create(1.0f),NULL)));
//mMainMenu->addChild(tansuo, 0, Tag_MenuItem_TanSuo);
//tansuo->setPosition(ccp(320,mBg->getContentSize().height-674));
{
CCMenuItemImage *jiefen = CCMenuItemImage::create(
"xunbao_anniu_jiechufengyin.png",
"xunbao_anniu_jiechufengyin_select.png",
this, menu_selector(TanSuoLayer::menuItemClicked_TanSuo));
mMainMenu->addChild(jiefen, 0, Tag_MenuItem_JieFen);
jiefen->setPosition(ccp(320,mBg->getContentSize().height-437));
jiefen->setVisible(false);
CCSprite *img = CCSprite::create("xunbao_anniu_jiechufengyin_xiaoguo.png");
jiefen->addChild(img);
img->setPosition(ccp(jiefen->getContentSize().width/2, jiefen->getContentSize().height/2));
img->runAction(CCRepeatForever::create(CCSequence::create(
CCFadeTo::create(1, 50), CCFadeTo::create(1, 255), NULL)));
}
mMainMenu->setVisible(false);
//title
CCLabelTTF *tilte = CCLabelTTF::create(LFStrings::getValue("XunBaoShuoMing").c_str(), fontStr_kaiti, m_nFontSize);
mBg->addChild(tilte);
tilte->setColor(fonColor_PuTong);
tilte->setPosition(ccp(mBg->getContentSize().width/2, mBg->getContentSize().height-110));
//2
CCLabelTTF *la1 = CCLabelTTF::create(LFStrings::getValue("XunBaoJieFeng").c_str(), fontStr_kaiti, m_nFontSize);
mBg->addChild(la1);
la1->setAnchorPoint(ccp(0, 0.5));
la1->setColor(fonColor_CiYao);
la1->setPosition(ccp(134, mBg->getContentSize().height-140));
CCLabelTTF *la2 = CCLabelTTF::create((LFStrings::getValue("shenbing")+LFStrings::getValue("zhuangbei")).c_str()
, fontStr_kaiti, m_nFontSize);
la1->addChild(la2);
la2->setColor(ImageManager::getManager()->getShowColor(ZhuangbeiColour_Chuanqi, false, false));
la2->setPosition(ccp(la1->getContentSize().width+la2->getContentSize().width/2, la1->getContentSize().height/2));
la1->setPositionX((mBg->getContentSize().width-la1->getContentSize().width-la2->getContentSize().width)/2);
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:80,代码来源:TanSuoLayer.cpp
示例16: setTouchEnabled
bool LoginLayer::init()
{
if ( !BaseLayer::init() )
return false;
setTouchEnabled(true);
CCSize visibleSize = CCDirector::sharedDirector()->getWinSize();
addContentWithJsonFile("UI4Login.ExportJson");
_msg = static_cast<Label*>(getWidgetByName("Label_msg"));
_list = static_cast<ListView*>(getWidgetByName("ListView_list"));
CCSize size = CCSize(450, 85);
_account = CCEditBox::create(size,CCScale9Sprite::createWithSpriteFrameName("input_login.png"));
_password = CCEditBox::create(size,CCScale9Sprite::createWithSpriteFrameName("input_login.png"));
_account->setPosition(ccp(visibleSize.width/2,visibleSize.height/2 + 68));
_password->setPosition(ccp(_account->getPositionX(),_account->getPositionY()-105));
ccColor3B color = {147,140,115};
_account->setFont("TrebuchetMS-Bold",30);
_account->setFontColor(color);
_account->setPlaceholderFontColor(color);
_account->setPlaceHolder("联众账号");
_account->setMaxLength(19);
_account->setSelected(true);
_account->setReturnType(kKeyboardReturnTypeDone);
_password->setFont("TrebuchetMS-Bold",30);
_password->setFontColor(color);
_password->setPlaceholderFontColor(color);
_password->setPlaceHolder("密码");
_password->setMaxLength(15);
_password->setInputFlag(kEditBoxInputFlagPassword);
_password->setInputMode(kEditBoxInputModeSingleLine);
_password->setZOrder(-1);
_uilayer->addChild(_account);
_uilayer->addChild(_password);
_up = Button::create();
_down = Button::create();
_up->loadTextures("button_up.png", "", "",UI_TEX_TYPE_PLIST);
_down->loadTextures("button_down.png", "", "",UI_TEX_TYPE_PLIST);
CCPoint point = ccp(_account->getContentSize().width - 40, _account->getContentSize().height/2);
_up->setPosition(point);
_down->setPosition(point);
UILayer* layer = UILayer::create();
layer->addWidget(_down);
layer->addWidget(_up);
_account->addChild(layer);
_list->setAnchorPoint(ccp(0, 1));
_list->setItemModel(GUIReader::shareReader()->widgetFromJsonFile("UI4ItemAccount.ExportJson"));
_list->addEventListenerListView(this, listvieweventselector(LoginLayer::onListViewEvent));
bindTouchEvent("btn_login", this, toucheventselector(LoginLayer::onClickedLogin));
bindTouchEvent("btn_register", this, toucheventselector(LoginLayer::onClickedRegister));
_up->addTouchEventListener(this, toucheventselector(LoginLayer::onClickedUp));
_down->addTouchEventListener(this, toucheventselector(LoginLayer::onClickedDown));
setAccountAndPwd();
UserAccountService userAccountService;
userAccountService.createTable();
toggleAccouts(false);
return true;
}
开发者ID:mrktj,项目名称:SlotGame,代码行数:75,代码来源:LoginLayer.cpp
示例17: CCLog
bool ConfigView::init(){
if ( !CCLayer::init() )
{
return false;
}
//初次进入 获取 其它用户或者自己的 信息
isOtherUser = Logic::getInstance()->getLookOther();
if (isOtherUser) {
Logic::getInstance()->fetchInfoState = 0;
}
getYet = false;
CCSize size = CCDirector::sharedDirector()->getVisibleSize();
CCLog("winSize %f %f", size.width, size.height);
UILayer *lay = UILayer::create();
addChild(lay);
//lay->setPosition(ccp(size.width/2, size.height/2));
//lay->setContentSize(size);
w = GUIReader::shareReader()->widgetFromJsonFile("gui/ballUI_7_0.json");
lay->addWidget(w);
w->setSize(size);
Button *head = static_cast<Button*>(UIHelper::seekWidgetByName(w, "head"));
head->setVisible(false);
Button *back = static_cast<Button*>(UIHelper::seekWidgetByName(w, "back"));
back->addTouchEventListener(this, toucheventselector(ConfigView::onBack));
Button *loginOut = static_cast<Button*>(UIHelper::seekWidgetByName(w, "quit"));
loginOut->addTouchEventListener(this, toucheventselector(ConfigView::onQuit));
if (isOtherUser) {
loginOut->setEnabled(false);
}
if (isOtherUser) {
TextField *team = static_cast<TextField*>(UIHelper::seekWidgetByName(w, "team"));
team->setTouchEnabled(false);
team->setVisible(false);
Label *tuijian = static_cast<Label*>(UIHelper::seekWidgetByName(w, "Label_22_0_1_2"));
tuijian->setEnabled(false);
ImageView *div = static_cast<ImageView*>(UIHelper::seekWidgetByName(w, "div_0_1_2"));
div->setEnabled(false);
}
if (isOtherUser) {
TextField *nn = static_cast<TextField*>(UIHelper::seekWidgetByName(w, "nickname"));
nn->setTouchEnabled(false);
Label *nicheng = static_cast<Label*>(UIHelper::seekWidgetByName(w, "Label_22_0_1"));
nicheng->setText("推荐人");
TextField *account = static_cast<TextField*>(UIHelper::seekWidgetByName(w, "account"));
account->setTouchEnabled(false);
}
scheduleUpdate();
return true;
}
开发者ID:liyonghelpme,项目名称:ballpartyAllCode,代码行数:71,代码来源:ConfigView.cpp
示例18: CCLog
bool WorldCup::init(){
if ( !CCLayer::init() )
{
return false;
}
showYet = false;
inUpdateData = false;
oldOrNew = 0;
lastRefreshTime = 0;
inRefresh = false;
lastUpdateIndex = 0;
dict = CCDictionary::create();
dict->retain();
CCSize size = CCDirector::sharedDirector()->getVisibleSize();
CCLog("winSize %f %f", size.width, size.height);
UILayer *lay = UILayer::create();
addChild(lay);
//lay->setPosition(ccp(size.width/2, size.height/2));
//lay->setContentSize(size);
//w = GUIReader::shareReader()->widgetFromJsonFile("gui/ballUI_1.json");
w = GUIReader::shareReader()->widgetFromJsonFile("gui/ballUI_1_0.json");
lay->addWidget(w);
CCSize rs = w->getSize();
CCLog("rootSize %f %f", rs.width, rs.height);
w->setSizeType(SIZE_ABSOLUTE);
w->setSize(size);
Button *conf = static_cast<Button*>(UIHelper::seekWidgetByName(w, "selfinfo"));
conf->addTouchEventListener(this, toucheventselector(WorldCup::onConf));
/*
*/
/*
Button *fri = static_cast<Button*>(UIHelper::seekWidgetByName(w, "Button_5"));
fri->addTouchEventListener(this, toucheventselector(WorldCup::onFri));
*/
lv = static_cast<UIListView*>(UIHelper::seekWidgetByName(w, "listView"));
lv->addEventListenerListView(this, listvieweventselector(WorldCup::onListview));
lv->addEventListenerScrollView(this, scrollvieweventselector(WorldCup::onScroll));
UIPanel *pan = static_cast<UIPanel*>(UIHelper::seekWidgetByName(w, "dayPanel"));
pan->setEnabled(false);
pc = pan->clone();
pc->setVisible(true);
pc->setEnabled(true);
pc->retain();
dlab = static_cast<UILabel*>(UIHelper::seekWidgetByName(pc, "date"));
UIPanel *cupPanel = static_cast<UIPanel*>(UIHelper::seekWidgetByName(w, "cupPanel"));
cupPanel->setEnabled(false);
//整个Panel 大小一样的 按钮
//Button *full = static_cast<Button*>(UIHelper::seekWidgetByName(cupPanel, "full"));
//full->setVisible(false);
cp = cupPanel->clone();
cp->setVisible(true);
cp->setEnabled(true);
cp->retain();
/*
UIPanel *pan = static_cast<UIPanel*>(UIHelper::seekWidgetByName(w, "dayPanel"));
UIListView *lv = static_cast<UIListView*>(UIHelper::seekWidgetByName(w, "listView"));
UIWidget *pc = pan->clone();
pc->setVisible(true);
lv->pushBackCustomItem(pc);
UIPanel *cupPanel = static_cast<UIPanel*>(UIHelper::seekWidgetByName(w, "cupPanel"));
UIWidget *cp = cupPanel->clone();
cp->setVisible(true);
lv->pushBackCustomItem(cp);
lv->pushBackCustomItem(pc->clone());
lv->pushBackCustomItem(cp->clone());
lv->pushBackCustomItem(cp->clone());
lv->pushBackCustomItem(cp->clone());
*/
scheduleUpdate();
return true;
}
开发者ID:liyonghelpme,项目名称:iosApplication,代码行数:97,代码来源:WorldCup.cpp
示例19: addChild
void TaoZhuangInfoUI::onEnter()
{
CCLayer::onEnter();
CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this,-2014,true);
CCSize size = CCDirector::sharedDirector()->getWinSize();
//m_lNodeList.push_back(spr);
ccColor4B color = {0,0,0,100};
CCLayerColor *colorLayer1 = CCLayerColor::create(color);
colorLayer1->setPosition(CCPointZero);
colorLayer1->setContentSize(size);
addChild(colorLayer1);
UILayer* uiLayer = UILayer::create();
///auto myLayout = dynamic_cast<Layout*>(CCUIHELPER->createWidgetFromJsonFile("testUI.ExportJson")); //alpha0中使用
Widget* myLayout = GUIReader::shareReader()->widgetFromJsonFile("NewFriendAddUI_2.ExportJson"); //alpha1中使用
uiLayer->addWidget(myLayout);
this->addChild(uiLayer);
//CCSize size = CCDirector::sharedDirector()->getWinSize();
myLayout->ignoreAnchorPointForPosition(false);
myLayout->setAnchorPoint(ccp(0.5,0.5));
myLayout->setPosition(ccp(size.width / 2,size.height / 2));
//BaseSprite* getFullPhotoOfActor()
unsigned int curGroupId = getZhuangbeiGroupID(m_sProfessionid);
OneSuitInfo suitInfo;
if(SuitPool::getPool()->getSuitInforByZBGroupId(curGroupId, suitInfo))
{
//ImageManager::getManager()->
Label *name = dynamic_cast<Label*>(myLayout->getChildByName("Name"));
if (name)
{
name->setText(suitInfo.suit_name.c_str());
}
int index = 0;
for (vector<SuitPart>::iterator iter = suitInfo.parts_of_
|
请发表评论