Esempio n. 1
0
void CCPomelo::dispatchNotify(){
    lockNotifyQeueue();
    CCPomeloNotify_ *ntf = popNotify();
    if (ntf) {
        CCPomeloContent_ * content = NULL;
        if (notify_content.find(ntf->notify)!=notify_content.end()) {
            content = notify_content[ntf->notify];
            notify_content.erase(ntf->notify);
        }
        if (content) {
            CCObject *pTarget = content->pTarget;
            SEL_CallFuncND pSelector = content->pSelector;
            if (pTarget && pSelector)
            {
                CCPomeloReponse resp;
                resp.status = ntf->status;
                resp.docs = NULL;
                (pTarget->*pSelector)((CCNode *)this,&resp);
            }
        }else{
            CCLOG("dispatch notify:\r\nlost content");
        }
        json_decref(ntf->notify->msg);
        pc_notify_destroy(ntf->notify);
        delete ntf;
    }
    unlockNotifyQeueue();
}
Esempio n. 2
0
void CCPomelo::dispatchNotify()
{
    lockNotifyQeueue();
    CCPomeloNotify_ *ntf = popNotify();
    if (ntf)
    {
        std::map<pc_notify_t*, std::function<void(Node*, void*)> >::iterator it = notify_content.find(ntf->notify);
        if (it != notify_content.end())
        {
            CCPomeloReponse resp;
            resp.status = ntf->status;
            resp.docs = NULL;
            (*it).second((Node*)this, &resp);
            notify_content.erase(it);
        }

        json_decref(ntf->notify->msg);
        pc_notify_destroy(ntf->notify);
        delete ntf;
    }
    unlockNotifyQeueue();
}