本文整理汇总了C++中NetConnection::setUUU方法的典型用法代码示例。如果您正苦于以下问题:C++ NetConnection::setUUU方法的具体用法?C++ NetConnection::setUUU怎么用?C++ NetConnection::setUUU使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetConnection
的用法示例。
在下文中一共展示了NetConnection::setUUU方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
/*
* 初始化
*/
bool LoginLayer::init() {
if (!CCLayer::init()) {
return false;
}
NetConnection* pNetConnection = NetConnection::getInstance();
pNetConnection->setHandleNetDataDelegate(this);
unsigned int server_id = CCUserDefault::sharedUserDefault()->getIntegerForKey(LOGIN_SERVER_KEY, 0);
/* 更改服务器名 */
if (0 == server_id) {
pNetConnection->setUUU(HTTP_SERVER_URL); /* 默认新浪服务器 */
m_pGameState->setServerId(0);
} else {
pNetConnection->setUUU(HTTP_SERVER_URL1); /* 研发服务器 */
m_pGameState->setServerId(1);
}
/* 初始化UI组件 */
_initComponent();
return true;
}
示例2: option
void LoginLayer::option(CCObject* pSender) {
for (int i = 0; i < 5; ++i) {
CCSprite* spBtnBg = (CCSprite*)this->getChildByTag(SVRBG_SELECT + i);
spBtnBg->setVisible(false);
CCLabelTTF* svrName = (CCLabelTTF*)this->getChildByTag(SVR_NAME + i);
svrName->setColor(ccc3(227, 168, 105));
svrName->setScale(1);
}
CCMenuItemImage* pItemImage = (CCMenuItemImage*)pSender;
switch (pItemImage->getTag() - SVRBG_NORMAL) {
case 0:
{
NetConnection* pNetConnection = NetConnection::getInstance();
pNetConnection->setUUU(HTTP_SERVER_URL);
CCUserDefault::sharedUserDefault()->setIntegerForKey(LOGIN_SERVER_KEY, 0);
CCUserDefault::sharedUserDefault()->flush();
m_pGameState->setServerId(0);
CCSprite* spBtnBg = (CCSprite*)this->getChildByTag(SVRBG_SELECT);
spBtnBg->setVisible(true);
CCLabelTTF* svrName = (CCLabelTTF*)this->getChildByTag(SVR_NAME);
svrName->setColor(ccc3(255, 215, 0));
svrName->setScale(1.1);
}
break;
case 1:
{
NetConnection* pNetConnection = NetConnection::getInstance();
pNetConnection->setUUU(HTTP_SERVER_URL1);
CCUserDefault::sharedUserDefault()->setIntegerForKey(LOGIN_SERVER_KEY, 1);
CCUserDefault::sharedUserDefault()->flush();
m_pGameState->setServerId(1);
CCSprite* spBtnBg = (CCSprite*)this->getChildByTag(SVRBG_SELECT + 1);
spBtnBg->setVisible(true);
CCLabelTTF* svrName = (CCLabelTTF*)this->getChildByTag(SVR_NAME + 1);
svrName->setColor(ccc3(255, 215, 0));
svrName->setScale(1.1);
}
break;
case 2:
{
CCSprite* spBtnBg = (CCSprite*)this->getChildByTag(SVRBG_SELECT+2);
spBtnBg->setVisible(true);
CCLabelTTF* svrName = (CCLabelTTF*)this->getChildByTag(SVR_NAME+2);
svrName->setColor(ccc3(255, 215, 0));
svrName->setScale(1.1);
}
break;
case 3:
{
CCSprite* spBtnBg = (CCSprite*)this->getChildByTag(SVRBG_SELECT+3);
spBtnBg->setVisible(true);
CCLabelTTF* svrName = (CCLabelTTF*)this->getChildByTag(SVR_NAME+2);
svrName->setColor(ccc3(255, 215, 0));
svrName->setScale(1.1);
}
break;
case 4:
{
CCSprite* spBtnBg = (CCSprite*)this->getChildByTag(SVRBG_SELECT+4);
spBtnBg->setVisible(true);
CCLabelTTF* svrName = (CCLabelTTF*)this->getChildByTag(SVR_NAME+2);
svrName->setColor(ccc3(255, 215, 0));
svrName->setScale(1.1);
}
break;
default:
CCAssert(false, "invalid server");
break;
}
}