本文整理汇总了C++中callfuncND_selector函数的典型用法代码示例。如果您正苦于以下问题:C++ callfuncND_selector函数的具体用法?C++ callfuncND_selector怎么用?C++ callfuncND_selector使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了callfuncND_selector函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: App42StorageResponse
void StorageService::DeleteDocumentsById(string dbName, string collectionName, string docId, CCObject* pTarget, cocos2d::SEL_CallFuncND pSelector)
{
App42StorageResponse *response = new App42StorageResponse(pTarget,pSelector);
try
{
Util::throwExceptionIfStringNullOrBlank(dbName, "Database Name");
Util::throwExceptionIfStringNullOrBlank(collectionName, "Collection Name");
Util::throwExceptionIfStringNullOrBlank(docId, "Doc ID");
Util::throwExceptionIfTargetIsNull(pTarget, "Callback's Target");
Util::throwExceptionIfCallBackIsNull(pSelector, "Callback");
}
catch (App42Exception *e)
{
std::string ex = e->what();
response->httpErrorCode = e->getHttpErrorCode();
response->appErrorCode = e->getAppErrorCode();
response->errorDetails = ex;
response->isSuccess = false;
if (pTarget && pSelector)
{
(pTarget->*pSelector)((cocos2d::CCNode *)pTarget, response);
}
delete e;
e = NULL;
return;
}
string resource = "storage/deleteDocById/dbName/";
resource.append(dbName+ "/collectionName/");
resource.append(collectionName+ "/docId/");
resource.append(docId);
string url = getBaseUrl(resource);
string timestamp = Util::getTimeStamp();
map<string, string> getMap;
Util::BuildGetSigningMap(apiKey, timestamp, VERSION, getMap);
getMap["dbName"] = dbName;
getMap["collectionName"] = collectionName;
getMap["docId"] = docId;
string signature = Util::signMap(secretKey, getMap);
url.append("?");
std::vector<std::string> headers;
map<string, string> metaHeaders;
populateMetaHeaderParams(metaHeaders);
Util::BuildHeaders(metaHeaders, headers);
Util::BuildHeaders(apiKey, timestamp, VERSION, signature, headers);
Util::executeDelete(url,headers, response, callfuncND_selector(App42StorageResponse::onComplete));
}
示例2: HS_GET_BattleLayer
void HSBalloonSprite::PlayDestroyBalloonEffect()
{
this->setVisible(false);
CCParticleSystemQuad* pParticle = CCParticleSystemQuad::create("Particle/DestroyBalloon.plist");
pParticle->setPosition(m_destroyPos);
HS_GET_BattleLayer()->addChild(pParticle,1100);
CCDelayTime* pDelayTime = CCDelayTime::create(1.f);
CCCallFuncND* pCall_01 = CCCallFuncND::create(this,callfuncND_selector(HSBalloonSprite::Call_PlayDestroyBalloonEffect),NULL);
pParticle->runAction(CCSequence::create(pDelayTime,pCall_01,NULL));
}
示例3: callfuncND_selector
void CJMultimedia::playEffectWithDelay(CCNode* sender, std::string fileName, float delay)
{
if (delay != 0) {
sender->runAction(CCSequence::create(CCDelayTime::create(delay),
CCCallFuncND::create(sender, callfuncND_selector(CJMultimedia::_playEffectWithDelayCallfunc),new CCString(fileName)),
NULL));
}
else{
playEffect(fileName);
}
}
示例4: memcpy
void RCDataCenter::handleMessage(void* data, int length)
{
RCDataNode* dataNode = RCDataNode::create();
dataNode->retain();
memcpy(dataNode->getMessageStruct(), data, length);
dataNode->setDataLength(length);
CCCallFuncND* callback = CCCallFuncND::create(this, callfuncND_selector(RCDataCenter::processMessage), dataNode);
CCFiniteTimeAction* seq = CCSequence::create(CCDelayTime::create(PROCESS_MESSAGE_DELAY), callback, NULL);
CCDirector::sharedDirector()->getRunningScene()->runAction(seq);
}
示例5: callfuncND_selector
void ChessBoard::ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent)
{
CCPoint pos;
CCSetIterator i;
CCTouch* touch;
ChessBall* sprite;
_cancelling = true;
if (_roundEnd)
{
return;
}
int count = _chessArray->count();
for (i = pTouches->begin(); i != pTouches->end(); i++)
{
touch = (CCTouch*)(*i);
if (touch != NULL)
{
pos = touch->getLocation();
_pickedChess->setPositionX(pos.x);
_pickedChess->setPositionY(pos.y + _chessYOffset);
for (int j = 0; j < count; j++)
{
sprite = (ChessBall*)_chessArray->objectAtIndex(j);
if (sprite->boundingBox().containsPoint(pos))
{
// sprite->setOpacity(128);
if (_activeCell->ball != NULL && _activeCell->ball != sprite)
{
CCMoveTo * move = CCMoveTo::create(0.1f, _activeCell->ball->getPosition());
CCCallFuncND * end = CCCallFuncND::create(this, callfuncND_selector(ChessBoard::chessMoveEnd), _activeCell->ball);
CCAction * action = CCSequence::create(move, end,NULL);
_moveChess->setVisible(true);
_moveChess->setChessProperty(sprite->getChessProperty());
_moveChess->setPosition(sprite->getPosition());
_moveChess->runAction(action);
_activeCell->ball->setOpacity(0);
_activeCell->ball->setChessProperty(sprite->getChessProperty());
_activeCell->ball = sprite;
_activeCell->ball->setOpacity(128);
_activeCell->ball->setChessProperty(_pickedChess->getChessProperty());
}
}
}
}
}
}
示例6: ceil
void ChatFacingDialog::init(int dummy)
{
float fw,fh,iw,ih;
int colnum,rownum;
fw = fh = 80;
iw = ih = 60;
UiThemeDef *uiDef = UiThemeMgrProxy::getInstance()->getThemeByName(m_theme);
const std::vector<std::string> &hasFacing = uiDef->getFacing();
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
colnum = winSize.width / (fw + 2);
m_size.width = winSize.width;
rownum = ceil(hasFacing.size() * 1.0 / colnum);
m_size.height = rownum * (fh + 2);
setWidth(m_size.width);
setHeight(m_size.height);
int index = 0;
std::string facebg;
uiDef->getNormalData()->getImg(m_facingBg,facebg);
for(int i = 0;i < rownum;i++){
for(int k = 0;k < colnum;k++,index++){
if(index >= hasFacing.size())
break;
const std::string &name = hasFacing[index];
std::string firstFrame = name;
if(UiThemeMgrProxy::getInstance()->getThemeMgr()->getFrameSpriteFirstFrame(firstFrame)){
CCSprite *bg = CCSprite::createWithSpriteFrameName(facebg.data());
CCSprite *frame = CCSprite::createWithSpriteFrameName(firstFrame.data());
CCSize bgsize = bg->getContentSize();
bg->addChild(frame);
frame->setAnchorPoint(ccp(0.5,0.5));
frame->setPosition(ccp(bgsize.width/2,bgsize.height/2));
CCSize fsize = frame->getContentSize();
frame->setScaleX(iw / fsize.width);
frame->setScaleY(ih / fsize.height);
BasButton *button = new BasButton;
button->setName(name);
button->setButtonInfo("","","",CCSizeMake(fw,fh));
button->setClickCB(this,callfuncND_selector(ChatFacingDialog::onFaceClicked));
this->addChild(button);
button->CCNode::addChild(bg);
bg->setAnchorPoint(ccp(0.5,0.5));
bg->setPosition(ccp(fw/2,fh/2));
button->setHorizontal("parent",(2*k + 1) * 1.0 / (colnum * 2));
button->setVertical("parent",(2*i + 1) * 1.0 / (rownum * 2));
}
}
}
layout(true);
setAnchorPoint(ccp(0,0));
setPosition(ccp(0,m_pos.y));
}
示例7: CCHttpRequest
void HttpClientTest::onMenuPostTestClicked(cocos2d::CCObject *sender)
{
// test 1
{
CCHttpRequest* request = new CCHttpRequest();
request->setUrl("http://www.httpbin.org/post");
request->setRequestType(CCHttpRequest::kHttpPost);
request->setResponseCallback(this, callfuncND_selector(HttpClientTest::onHttpRequestCompleted));
// write the post data
const char* postData = "visitor=cocos2d&TestSuite=Extensions Test/NetworkTest";
request->setRequestData(postData, strlen(postData));
request->setTag("POST test1");
CCHttpClient::getInstance()->send(request);
request->release();
}
// test 2: set Content-Type
{
CCHttpRequest* request = new CCHttpRequest();
request->setUrl("http://www.httpbin.org/post");
request->setRequestType(CCHttpRequest::kHttpPost);
std::vector<std::string> headers;
headers.push_back("Content-Type: application/json; charset=utf-8");
request->setHeaders(headers);
request->setResponseCallback(this, callfuncND_selector(HttpClientTest::onHttpRequestCompleted));
// write the post data
const char* postData = "visitor=cocos2d&TestSuite=Extensions Test/NetworkTest";
request->setRequestData(postData, strlen(postData));
request->setTag("POST test2");
CCHttpClient::getInstance()->send(request);
request->release();
}
// waiting
m_labelStatusCode->setString("waiting...");
}
示例8: catch
void RewardService::CreateReward(string rewardName,string description, cocos2d::CCObject* pTarget, cocos2d::SEL_CallFuncND pSelector)
{
App42RewardResponse *response = new App42RewardResponse::App42RewardResponse(pTarget,pSelector);
try
{
Util::throwExceptionIfStringNullOrBlank(description, "Description");
Util::throwExceptionIfStringNullOrBlank(rewardName, "Reward Name");
Util::throwExceptionIfTargetIsNull(pTarget, "Callback's Target");
Util::throwExceptionIfCallBackIsNull(pSelector, "Callback");
}
catch (App42Exception *e)
{
std::string ex = e->what();
response->httpErrorCode = e->getHttpErrorCode();
response->appErrorCode = e->getAppErrorCode();
response->errorDetails = ex;
response->isSuccess = false;
if (pTarget && pSelector)
{
(pTarget->*pSelector)((cocos2d::CCNode *)pTarget, response);
}
delete e;
e = NULL;
return;
}
map<string, string> postMap;
populateSignParams(postMap);
string rewardbody = BuildCreateRewardBody(rewardName, description);
postMap["body"] = rewardbody;
string signature = Util::signMap(secretKey, postMap);
string baseUrl = getBaseUrl("game/reward");
baseUrl.append("?");
//Util::app42Trace("\n baseUrl = %s",baseUrl.c_str());
//Util::app42Trace("\n createRewardbody = %s",rewardbody.c_str());
std::vector<std::string> headers;
map<string, string> metaHeaders;
populateMetaHeaderParams(metaHeaders);
Util::BuildHeaders(metaHeaders, headers);
string timestamp = Util::getTimeStamp();
Util::BuildHeaders(apiKey, timestamp, VERSION, signature, headers);
Util::executePost(baseUrl, headers, rewardbody.c_str(), response, callfuncND_selector(App42RewardResponse::onComplete));
}
示例9: CCHttpRequest
void GameState::sendGetHttp(CCObject* sender)
{
CCHttpRequest* request = new CCHttpRequest();
request->setUrl("http://deploydjango1.herokuapp.com/?text=32");
request->setRequestType(CCHttpRequest::kHttpGet);
CCHttpClient::getInstance()->send(request); //보내고 나서
request->setResponseCallback(this,callfuncND_selector(GameState::onHttpRequestCompleted));//받습니다
request->release();
}
示例10: callfuncND_selector
void MoreDiamondDialog::shareCallback( CCObject* pSender )
{
PLAY_BUTTON_EFFECT;
bool isLogIn = DataManager::sharedDataManager()->GetFbIsLogIn();
if (isLogIn)
{
NDKHelper::AddSelector("MoreDiamondDialog",
"onPublishFeedCompleted",
callfuncND_selector(MoreDiamondDialog::onPublishFeedCompleted),
this);
string message = "Game này được, có bạn chơi cùng thì khỏi chê!";
string name = "The Croods";
string caption = "Thánh thức cùng bạn bè";
string description = "Game hay, thuộc thể loại này nọ...";
string picture = "http://vfossa.vn/tailen/news/2012_01/knowledge.jpg";
string link = "https://play.google.com/store/apps/details?id=com.supercell.hayday";
CCDictionary* prms = CCDictionary::create();
prms->setObject(CCString::create(message), "message");
prms->setObject(CCString::create(name), "name");
prms->setObject(CCString::create(caption), "caption");
prms->setObject(CCString::create(description), "description");
prms->setObject(CCString::create(picture), "picture");
prms->setObject(CCString::create(link), "link");
SendMessageWithParams(string("PublishFeed"), prms);
}
else
{
m_curOperator = string("share");
NDKHelper::AddSelector("MoreDiamondDialog",
"onLogInCompleted",
callfuncND_selector(MoreDiamondDialog::onLogInCompleted),
this);
SendMessageWithParams(string("LogIn"), NULL);
}
}
示例11: while
void HallPage::onSendMsgClicked()
{
if(m_sendMsgDialog != 0){
m_sendMsgDialog->destroy();
m_sendMsgDialog = 0;
}
CCNode *root = this->getParent();
while(root->getParent())
root = root->getParent();
if(m_sendMsgDialog == 0){
m_sendMsgDialog = new SendMsgDialog(root,ccc4(0,0,0,128));
m_sendMsgDialog->setCloseCB(this,callfuncND_selector(HallPage::onSendMsgCloseClicked));
m_sendMsgDialog->setSendCB(this,callfuncND_selector(HallPage::onSendMsgSendClicked));
m_sendMsgDialog->setInitShowPage(true);
m_sendMsgDialog->setInitPage(true,false);
std::string name = m_headNick;
if(name.empty())
mailToNickName(m_headMail,name);
m_sendMsgDialog->setRecInfo(m_headId,name,"");
m_sendMsgDialog->exec();
}
}
示例12: CCLOG
void Room_Manager::Request_RoomUpdate(Room_Callback *del)
{
if(curMatchRoom == NULL)
{
CCLOG("CurRoom = NULL");
if(callBack != NULL) callBack->Callback_RoomUpdate();
}
callBack = del;
WebRequest_RoomInfo(this, callfuncND_selector(Room_Manager::onHttpRequestCompleted_RoomUpdate), "Post RoomUpdate",
curMatchRoom->user_ID->getCString(), curMatchRoom->other_user_ID->getCString(), curMatchRoom->room_Index);
}
示例13: CCLOG
void MoreDiamondDialog::onGetProfileCompleted( CCNode *sender, void *data )
{
CCLOG("onGetProfileCompleted");
if (data != NULL)
{
CCDictionary *convertedData = (CCDictionary *)data;
CCString* s = (CCString*)convertedData->objectForKey("isSuccess");
if (s->boolValue())
{
CCLOG("CPP Get Profile Completed: TRUE");
string fbId = ((CCString*)convertedData->objectForKey("id"))->getCString();
string firstName = ((CCString*)convertedData->objectForKey("firstName"))->getCString();
string name = ((CCString*)convertedData->objectForKey("name"))->getCString();
string username = ((CCString*)convertedData->objectForKey("username"))->getCString();
string birthday = ((CCString*)convertedData->objectForKey("birthday"))->getCString();
string picture50x50 = ((CCString*)convertedData->objectForKey("picture"))->getCString();
//save
DataManager::sharedDataManager()->SetFbID(fbId);
DataManager::sharedDataManager()->SetFbFullName(name);
DataManager::sharedDataManager()->SetName(name);
DataManager::sharedDataManager()->SetFbUserName(username);
//////////////////////////////////////////////////////////////////////////
NDKHelper::AddSelector("MoreDiamondDialog",
"onGetAvatarCompleted",
callfuncND_selector(MoreDiamondDialog::onGetAvatarCompleted),
this);
string w = "128";
string h = "128";
CCDictionary* prms = CCDictionary::create();
prms->setObject(CCString::create(fbId), "fbId");
prms->setObject(CCString::create(w), "width");
prms->setObject(CCString::create(h), "height");
SendMessageWithParams(string("GetAvatar"), prms);
}
else
{
CCLOG("CPP Get Profile Completed: FALSE");
CCMessageBox("Không thể kết nối", "Lỗi");
}
NDKHelper::RemoveSelector("MoreDiamondDialog", "onGetProfileCompleted");
}
}
示例14: addChild
void RankScene::HeroLevelUpHTTP(int _HeroIndex,int _HeroLevel){
MessageBox = AsMessageBox::createMessageBox("通信中,请稍候", 1, 0);
MessageBox->setPosition(CCPointZero);
addChild(MessageBox,1000);
CCHttpRequest* request = new CCHttpRequest();
string UrlData = "http://115.29.168.228/roles/" + int2string(_HeroIndex) + "?role[level]=" + int2string(_HeroLevel) + "&token=" + MainUser->UserTokenStr;
request->setUrl(UrlData.c_str());
request->setRequestType(CCHttpRequest::kHttpPut);
request->setResponseCallback(this, callfuncND_selector(RankScene::HeroLevelUpRequestCompleted));
CCHttpClient::getInstance()->send(request);
request->release();
}
示例15: init
void ChatPhraseDialog::init(int dummy)
{
UiThemeDef *uiDef = UiThemeMgrProxy::getInstance()->getThemeByName(m_theme);
m_hasPhrases = uiDef->getPhrase();
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
float pw,ph;
pw = ph = 0;
std::vector<BasButton *> buttons;
CCSize size;
size.width = winSize.width;
size.height = 40;
for(unsigned int i = 0;i < m_hasPhrases.size();i++){
BasButton *button = new BasButton;
button->setButtonInfo("","","",size);
button->setButtonIndex(i);
button->setClickCB(this,callfuncND_selector(ChatPhraseDialog::onPhraseClicked));
buttons.push_back(button);
this->addChild(button);
button->setLeftMargin(6);
button->setRightMargin(6);
ph += size.height;
if(pw < size.width)
pw = size.width;
BasLabel *label = new BasLabel();
label->setLabelInfo(m_hasPhrases[i],"","",CCSizeMake(0,0));
button->addChild(label);
label->setLeft("parent",uilib::Left);
label->setVertical("parent",0.5);
}
setWidth(winSize.width);
setHeight(ph);
std::string topName;
for(unsigned int i = 0;i < buttons.size();i++){
BasButton *button = buttons[i];
if(topName.empty()){
button->setLeft("parent",uilib::Left);
button->setRight("parent",uilib::Right);
button->setTop("parent",uilib::Top);
}else{
button->setLeft("parent",uilib::Left);
button->setRight("parent",uilib::Right);
button->setTop(topName,uilib::Bottom);
}
topName = button->getName();
}
layout(true);
setAnchorPoint(ccp(0,0));
setPosition(ccp(0,m_pos.y));
}