int Container::insertFileList(FileList *fl,UserData *parent)
{
    UserData *ud;
    UserData *first;
    int i,num_items;
    HPOINTER the_icon;
    
    num_items = fl->getNumFiles();
    
    // Build up insertion information
    RECORDINSERT ri;   
    memset(&ri,0,sizeof(RECORDINSERT));
    ri.cb = sizeof(RECORDINSERT);
    ri.zOrder = CMA_END;                    // add on top of siblings
//    ri.fInvalidateRecord = TRUE;            // re-arrange after insert
    ri.pRecordParent = (PRECORDCORE)parent; // set tree hierarchy
    ri.pRecordOrder = (RECORDCORE*)CMA_END; // add to end of list
    
    
    if (num_items > 0)
    {
        ri.cRecordsInsert = num_items;          // number of records to insert
        first = allocateRecords(num_items);
        ud = first;
        if (ud)
        {
            for (i=0; i<num_items; i++)
            {
                num_objects++;
                ud->setName(fl->getFile(i));
                the_icon = determineIcon(fl->getFile(i));
                ud->setIcons(the_icon,the_icon);
                ud->setType(TYPE_FILE);
                ud->setParent(parent);
// NEW STUFF
/*
                    char *kkk = new char[4096];
                    strcpy(kkk,fl->getBasePath());
                    strcat(kkk,fl->getFile(i));
                    
                    the_icon = WinLoadFileIcon(kkk,FALSE);
                    if (the_icon != NULL)
                    {
                        ud->setIcons(the_icon,the_icon);
                        WinSendMsg(cont,CM_INVALIDATERECORD,MPFROMP(&ud),MPFROM2SHORT(1,CMA_TEXTCHANGED|CMA_REPOSITION));
                    }
                    delete[] kkk;
*/
// ENDE NEW STUFF
                    
                PRECORDCORE pr = (PRECORDCORE)ud;
                ud = (UserData*)pr->preccNextRecord;
            }
            
            MRESULT rc = WinSendMsg(cont,CM_INSERTRECORD,MPFROMP((PRECORDCORE)first),MPFROMP(&ri));
            return 1;
        }
    }
    return 0;
}
Example #2
0
UserData read_user_data(std::istream& is)
{
  UserData userData;
  userData.setText(read_string(is));
  userData.setColor(read32(is));
  return userData;
}
Example #3
0
/// Pre-wrap function getMainRenderer.
static inline int pwrapgetMainRenderer(lua_State* l)
{
	UserData* ud;
	(void)ud;
	void* voidp;
	(void)voidp;
	PtrSize size;
	(void)size;

	LuaBinder::checkArgsCount(l, 0);

	// Call the function
	MainRenderer* ret = getMainRenderer(l);

	// Push return value
	if(ANKI_UNLIKELY(ret == nullptr))
	{
		lua_pushstring(l, "Glue code returned nullptr");
		return -1;
	}

	voidp = lua_newuserdata(l, sizeof(UserData));
	ud = static_cast<UserData*>(voidp);
	luaL_setmetatable(l, "MainRenderer");
	ud->initPointed(919289102518575326, const_cast<MainRenderer*>(ret));

	return 1;
}
//! Get user contacts in comma separated names' string.
bool StorageServer::getUserContacts( unsigned int userID, int sessionID, std::string& contacts )
{
    if ( !_connectionEstablished )
        return false;

    std::map< int, UserState* >::iterator p_user = _userCache.find( sessionID );
    if ( p_user == _userCache.end() )
    {
        log_warning << "*** StorageServer: request for user contacts cannot be processed, invalid session ID " << sessionID << std::endl;
        return false;
    }

    if ( p_user->second->_userAccount._userID != userID )
    {
        log_warning << "*** StorageServer: request for user accounts cannot be processed, user / session ID mismatch!" << std::endl;
        return false;
    }

    UserData data;
    if ( !_p_storage->getUserData( userID, data ) )
        return false;

    contacts = data.getContacts();

    return true;
}
Example #5
0
/**
* Debugger callback that handles events that are necessary for profiling.
**/
int debuggerCallback(void *user_data, int notification_code, va_list va)
{
	UserData* userData = (UserData*)user_data;
	IdaFile file;
	Debugger debugger = file.getDebugger();

	if (notification_code == Debugger::EVENT_BREAKPOINT)
	{
		// Get the Thread ID
		thread_id_t tid = va_arg(va, thread_id_t);

		// Get the address of where the breakpoint was hit
		ea_t addr = va_arg(va, ea_t);

		_timeb timebuffer;
		_ftime64_s( &timebuffer );
		userData->getEventList().addEvent(Event(addr, timebuffer));

		debugger.resumeProcess(true);
	}
	else if (notification_code == Debugger::EVENT_PROCESS_SUSPENDED)
	{
		setBreakpoints();

		msg("Resuming target process...\n");

		debugger.resumeProcess(true);
	}
	else if (notification_code == Debugger::EVENT_PROCESS_EXIT)
	{
		handleExitProcess(userData);
	}

	return 0;
}
Example #6
0
File: uuid.cpp Project: suxue/luamm
 bool push(const uuid& u) {
     State st(state);
     UserData ud = st.newUserData<uuid>(std::move(u));
     ud.set(uuid_registry_key);
     ud.index = 0;
     return true;
 }
// if container content-object name does not container the cull string
// then cull it.
void Container::filter(char *cull_string)
{
    UserData *current;
    UserData *first = NULL;
    
    // find the first item (top-level)
    current = (UserData*)WinSendMsg(cont,CM_QUERYRECORD,MPFROMP(NULL),MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER));
    
    if (num_objects > 0)
        do
        {
            if (current != NULL)
            {
                if (!(((PRECORDCORE)current)->flRecordAttr & CRA_FILTERED))
                {
                    if (strstr(current->getName(),cull_string) == NULL)
                    {
                        ((PRECORDCORE)current)->flRecordAttr |= CRA_FILTERED;
                    }
                    else if (first == NULL)
                    {
                        first = current;
                        emphasis(current);
                        // message("Setting emphasis on %s",current->getName());
                    }
                }
                // find all the other servers
                current = (UserData*)WinSendMsg(cont,CM_QUERYRECORD,MPFROMP(current),MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER));
            }
            
        } while(current != NULL);
    
}
Example #8
0
    static DWORD WINAPI WinThreadFunction(LPVOID lpParam)
    {
        UserData* userData = static_cast<UserData*>(lpParam);

        userData->func(userData->param);

        return 0;
    }
Example #9
0
    static void* PThreadFunction(void* lpParam)
    {
        UserData* userData = static_cast<UserData*>(lpParam);

        userData->func(userData->param);

        return 0;
    }
Example #10
0
void CCommandLayer::updateSelectCity(CCity *data)
{
	CCSprite *build = (CCSprite*)(m_comLayer->findWidgetById("build"));
    CCTexture2D *textTure = CCTextureCache::sharedTextureCache()->addImage(CCString::createWithFormat("command/%d.jpg",data->cityId*10+1)->getCString());
	if (textTure)
	{
		build->setTexture(textTure);
	}

	CLabel *food = (CLabel*)(m_comLayer->findWidgetById("food"));
	food->setString(ToString(data->lvFood));

	CLabel *heronum = (CLabel*)(m_comLayer->findWidgetById("heronum"));
	heronum->setString(CCString::createWithFormat("%d/%d",data->haveHeroNum,data->heroNum)->getCString());

	CLabel *note1 = (CLabel*)(m_comLayer->findWidgetById("func1"));

	CLabel *note2 = (CLabel*)(m_comLayer->findWidgetById("func2"));

    CCArray *strArr = strSplit(data->note.c_str(),"|");
	
	if (strArr->count()==1)
	{
		note1->setString(((CCString*)strArr->objectAtIndex(0))->getCString());
		note2->setString("");
	}
	else if (strArr->count()==2)
	{
		note1->setString(((CCString*)strArr->objectAtIndex(0))->getCString());
		note2->setString(((CCString*)strArr->objectAtIndex(1))->getCString());
	}

	CButton *command = (CButton*)(m_comLayer->findWidgetById("strengthen"));

	UserData *user = DataCenter::sharedData()->getUser()->getUserData();
	if (data->cityId != m_commandData.cityInfo.cityId)
	{
		if (user->getRoleFood()>=data->lvFood&&data->level< m_commandData.cityInfo.level)
		{
			command->setEnabled(true);
		}
		else
		{
			command->setEnabled(false);
		}
	}
	else
	{
		if (user->getRoleFood()>=data->lvFood)
		{
			command->setEnabled(true);
		}
		else
		{
			command->setEnabled(false);
		}
	}
}
Example #11
0
void DC2DT6::BoundaryRHS(UserData<real_t>& ud)
{
   _ln->setLocal(-1.0);
   sRHS(1) += OFELI_THIRD*_ln->getDet()*ud.SurfaceForce((*_theSide)(1)->getCoord(),_theSide->getCode(1),_time);
   _ln->setLocal(0.0);
   sRHS(2) += OFELI_THIRD*_ln->getDet()*ud.SurfaceForce((*_theSide)(2)->getCoord(),_theSide->getCode(1),_time);
   _ln->setLocal(1.0);
   sRHS(3) += 4*OFELI_THIRD*_ln->getDet()*ud.SurfaceForce((*_theSide)(3)->getCoord(),_theSide->getCode(1),_time);
}
void UserModel::addUser(const QString &licensePlateNumber, int parkingSpotNumber)
{
    beginInsertRows(QModelIndex(), mUsers.size(), mUsers.size());
    UserData userData;
    userData.setLicensePlateNumber(licensePlateNumber);
    userData.setParkingSpotNumber(parkingSpotNumber);
    mUsers.append(userData);
    endInsertRows();
}
Example #13
0
void IEToolbar::retrieveInitialData() {
  const UserData loggedInUser =
      UserDataObserver::getInstance().getLoggedInUser();
  setProfileName(loggedInUser.getName());
  setStatusText(loggedInUser.getStatusMessage());
  setPokesCount(UserDataObserver::getInstance().getPokesCount());
  setRequestsCount(UserDataObserver::getInstance().getRequestsCount());
  setMessagesCount(UserDataObserver::getInstance().getMessagesCount());
  setEventInvsCount(UserDataObserver::getInstance().getEventsCount());
  setGroupInvsCount(UserDataObserver::getInstance().getGroupsInvsCount());
}
UserData* UserController :: checkIn(std::string ID, std::string passwd)
{
    Logging log("UserController :: checkIn",true);
    UserData* toReturn = findUser(ID);
    if(toReturn)
    {
        if(toReturn->Password() == passwd)
            return toReturn;
        else
            throw PasswordNotCorrectException((std::string)"password wrong!");
    }
    else throw ItemNotFoundException((std::string)"user not exist!");
}
Example #15
0
void CTopLayer::updateActionTime(float dt)
{
	UserData *data = DataCenter::sharedData()->getUser()->getUserData();
	if (data->getRoleAction() < data->getActionLimit())
	{
		data->setRoleAction(data->getRoleAction()+1);
		CLabel *action = (CLabel*)(m_ui->findWidgetById("action"));
		action->setString(CCString::createWithFormat("%d/%d",data->getRoleAction(),data->getActionLimit())->getCString());
		data->setActionTime(data->getActionTime() + data->getInterval()*60*60);
	}
	else
	{
		this->unschedule(schedule_selector(CTopLayer::updateActionTime));
	}
}
Example #16
0
//ʹÓÃmap³õʼ»¯
UserData* UserData::create(Value& value)
{
	UserData* pRet = new(std::nothrow) UserData();
	if (pRet && pRet->init(value))
	{
		pRet->autorelease();
		return pRet;
	}
	else
	{
		delete pRet;
		pRet = NULL;
		return NULL;
	}
}
Example #17
0
void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result) {
    const MTPDmessages_chatFull &d(result.c_messages_chatFull());
    const MTPDchatFull &f(d.vfull_chat.c_chatFull());

    const QVector<MTPChat> &vc(d.vchats.c_vector().v);
    bool badVersion = (!vc.isEmpty() && vc.at(0).type() == mtpc_chat && vc.at(0).c_chat().vversion.v < peer->asChat()->version);

    App::feedUsers(d.vusers, false);
    App::feedChats(d.vchats, false);
    App::feedParticipants(f.vparticipants, false, false);
    const QVector<MTPBotInfo> &v(f.vbot_info.c_vector().v);
    for (QVector<MTPBotInfo>::const_iterator i = v.cbegin(), e = v.cend(); i < e; ++i) {
        switch (i->type()) {
        case mtpc_botInfo: {
            const MTPDbotInfo &b(i->c_botInfo());
            UserData *user = App::userLoaded(b.vuser_id.v);
            if (user) {
                user->setBotInfo(*i);
                App::clearPeerUpdated(user);
                emit fullPeerUpdated(user);
            }
        }
        break;
        }
    }
    PhotoData *photo = App::feedPhoto(f.vchat_photo);
    ChatData *chat = peer->asChat();
    if (chat) {
        if (photo) {
            chat->photoId = photo->id;
            photo->chat = chat;
        } else {
            chat->photoId = 0;
        }
        chat->invitationUrl = (f.vexported_invite.type() == mtpc_chatInviteExported) ? qs(f.vexported_invite.c_chatInviteExported().vlink) : QString();
    }

    App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), f.vnotify_settings);

    _fullPeerRequests.remove(peer);
    if (badVersion) {
        peer->asChat()->version = vc.at(0).c_chat().vversion.v;
        requestPeer(peer);
    }
    App::clearPeerUpdated(peer);
    emit fullPeerUpdated(peer);
    App::emitPeerUpdated();
}
Example #18
0
void CChangeHeadImg::addGridCell(unsigned int uIdx, CGridViewCell* pCell)
{
	CLayout *lay = UICloneMgr::cloneLayout(m_cell);

	for (int i=1; i<=2; i++)
	{
		CCNode *child = lay->getChildByTag(i);
		lay->removeChild(child);
		pCell->addChild(child);

		if (i==1)
		{
			if (m_headIconList.at(uIdx)>0)
			{
				CImageView* pHead = CImageView::create(CCString::createWithFormat("headImg/%d.png", m_headIconList.at(uIdx))->getCString());
				if(!pHead)
				{
					pHead = CImageView::create("headImg/null.png");
					CCLOG("ERROR_____CChangeHeadImg::addGridCell");
				}
				child->addChild(pHead);
				NodeFillParent(pHead);
			}
			else
			{
				UserData *data = DataCenter::sharedData()->getUser()->getUserData();
				string fbName = data->getFbId() +".jpg";
				string fullName = CCFileUtils::sharedFileUtils()->fullPathForFilename(fbName.c_str());
				bool isFileExist = CCFileUtils::sharedFileUtils()->isFileExist(fullName);
				if(isFileExist)
				{
					CCSprite* spr =CCSprite::create(fullName.c_str());
					child->addChild(spr);
					NodeFillParent(spr);
				}
			}
			
		}
		else if(i==2)
		{
			CImageView* pBtn = (CImageView*)child;
			pBtn->setTouchEnabled(true);
			pBtn->setUserData(&m_headIconList.at(uIdx));
			pBtn->setOnClickListener(this,ccw_click_selector(CChangeHeadImg::onChangHeadImg));
		}
	}
}
Example #19
0
void WebProcess::handleInjectedBundleMessage(const String& messageName, const UserData& messageBody)
{
    InjectedBundle* injectedBundle = WebProcess::singleton().injectedBundle();
    if (!injectedBundle)
        return;

    injectedBundle->didReceiveMessage(messageName, transformHandlesToObjects(messageBody.object()).get());
}
Example #20
0
void CHeroExpItem::onRecvTask(CCObject* pSender)
{
	CEvolQuest *evol = (CEvolQuest*)((CCNode*)pSender)->getUserData();

	UserData *data = DataCenter::sharedData()->getUser()->getUserData();
	if (evol->open&&data->getRoleAction()>=evol->action)
	{
		CPlayerControl::getInstance().sendEnterStage(evol->stageId,0,0,0, 0);
	}
	else if (!evol->open)
	{
		ShowPopTextTip(GETLANGSTR(183));
	}
	else if (data->getRoleAction()<evol->action)
	{
		ShowPopTextTip(GETLANGSTR(184));
	}
}
Example #21
0
CLiftableObject::CLiftableObject(Ogre::SceneNode *pNode, CObjectManager &objectManager, btCollisionObject *pCollisionObject, ELiftableObjectTypes eLiftableObjectType, bool bRecreateOnLift, const UserData &userData)
	: CObject(objectManager,LIFTABLE_OBJECT, pCollisionObject, userData.getStringUserData("id")), m_eLiftableObjectType(eLiftableObjectType), m_bRecreateOnLift(bRecreateOnLift) {
    m_eState = LOS_AT_DEFAULT_LOCATION;
    m_InnerObject = InnerObjectGenerator::getInnerObjectByName(userData.getStringUserData("innerObject", "default"));

    switch (eLiftableObjectType) {
    case LOT_VASE:
        m_uiInnerObjectCreateEvent = IOCE_DESTROYED;
        break;
    case LOT_SIGN:
    case LOT_BOMB:
        m_uiInnerObjectCreateEvent = IOCE_NEVER;
        break;
    default:
        m_uiInnerObjectCreateEvent = IOCE_DESTROYED | IOCE_LIFT;
        break;
    }
}
// Insert a Server Object
int Container::insert(char *name,char *user,char *pass,ULONG arg1,ULONG arg2)
{
    UserData *ud;
    UserData *parent = NULL;
    
    ud = allocateRecords(1);
    if (ud)
    {
        last_insert = ud;
        
        num_objects++;
        
        // set all the stuff in our record
        ud->setName(name);
        ud->setUsername(user);
        ud->setPassword(pass);
        ud->setType(TYPE_SERVER);
        ud->setIcons(icon_server,icon_server);
        ud->setCull(arg1);
        ud->setStart(arg2);
        
        // Build up insertion information
        RECORDINSERT ri;   
        memset(&ri,0,sizeof(RECORDINSERT));
        ri.cb = sizeof(RECORDINSERT);
        ri.zOrder = CMA_END;                    // add on top of siblings
        if (!parent || !parent->getCollapsed())
            ri.fInvalidateRecord = TRUE;            // re-arrange after insert
        ri.pRecordParent = (PRECORDCORE)parent; // set tree hierarchy
        ri.cRecordsInsert = 1;                  // number of records to insert
        ri.pRecordOrder = (RECORDCORE*)CMA_END; // add to end of list

        MRESULT rc = WinSendMsg(cont,CM_INSERTRECORD,MPFROMP((PRECORDCORE)ud),MPFROMP(&ri));
        if (rc == 0)
            message("CM_INSERTRECORD returned %d",rc);
        
        return 1;
    }
    else
    {
        DosBeep(100,100);
        return 0;
    }
}
Example #23
0
CDoor::CDoor(Ogre::SceneNode *pDoorNode, CMapManager &mapManager, CObjectManager &objectManager, const UserData &userData, const Ogre::String &id)
	: CObject(objectManager, DOOR_OBJECT),
	CMapLinkInterface(mapManager, MapLocalisationData(userData.getStringUserData("link_path"), userData.getStringUserData("link_name")), userData.getStringUserData("link_id"), id),
	m_vPosition(pDoorNode->getPosition()),
	m_rYaw(pDoorNode->getOrientation().getYaw()) {
	m_PlayerPosition = pDoorNode->getPosition() + 0.5f * pDoorNode->getOrientation().zAxis();
	m_PlayerLookDirection = -pDoorNode->getOrientation().zAxis();
	m_CameraYaw = pDoorNode->getOrientation().getYaw().valueRadians();
	m_CameraPitch = -Ogre::Math::PI * 0.1;
}
Example #24
0
void ContactListener::BeginContact(b2Contact* p_contact)
{
	b2Fixture* fixtureA = p_contact->GetFixtureA();
	b2Fixture* fixtureB = p_contact->GetFixtureB();

	void* bodyUserDataA = fixtureA->GetBody()->GetUserData();
	void* bodyUserDataB = fixtureB->GetBody()->GetUserData();

	if (bodyUserDataA != nullptr && bodyUserDataB != nullptr)
	{
		UserData* userDataA = static_cast<UserData*>(bodyUserDataA);
		UserData* userDataB = static_cast<UserData*>(bodyUserDataB);

		if (userDataA->isType(UserDataType::PLAYER) && userDataB->isType(UserDataType::PLAYER))
		{
			playerContactBegin(userDataA, userDataB);
		}
	}
}
UserData *Container::reInsert(UserData *ud,HPOINTER icon)
{
    PRECORDCORE parent;
    
    parent = (PRECORDCORE)WinSendMsg(cont,CM_QUERYRECORD,MPFROMP(ud),MPFROM2SHORT(CMA_PREV,CMA_ITEMORDER));
    
    if (parent == NULL)
        parent = (PRECORDCORE)CMA_FIRST;
    
    // make a backup of our object
    UserData keep;
    memcpy(&keep,ud,sizeof(UserData));

    // remove AND delete (takes out any kids too!)
    WinSendMsg(cont,CM_REMOVERECORD,MPFROMP(&ud),MPFROM2SHORT(1,CMA_FREE));
    
    ud = allocateRecords(1);
    ud->setName(keep.getName());
    ud->setSkipped(keep.getSkipped());
    ud->setCollapsed(keep.getCollapsed());
    ud->setCull(keep.getCull());
    ud->setStart(keep.getStart());
    ud->setType(keep.getType());
    ud->setParent(keep.getParent());
    ud->setIcons(icon,icon);
    
    RECORDINSERT ri;   
    memset(&ri,0,sizeof(RECORDINSERT));
    ri.cb = sizeof(RECORDINSERT);
    if (!keep.getParent() || !keep.getParent()->getCollapsed())
        ri.fInvalidateRecord = TRUE;
    ri.pRecordParent = (PRECORDCORE)ud->getParent();
    ri.pRecordOrder = (RECORDCORE*)parent;
    ri.cRecordsInsert = 1;                  // number of records to insert
    
    // re-insert
    WinSendMsg(cont,CM_INSERTRECORD,MPFROMP((PRECORDCORE)ud),MPFROMP(&ri));
    setItemFocus(ud);
    
    return ud;
}
Example #26
0
void SessionManager::HandleReqLogin(std::shared_ptr<RawMessage> spMsg)
{
    CHECK_NULL_ASSERT(spMsg);
    ReqLogin req;
    req.ParseFromString(spMsg->strmsg());
    UserData data;

    data.set_id(spMsg->clientid());   // 使用连接id
    data.set_name(req.username());

    DEBUG_LOG("收到了登陆请求!");
    DEBUG_LOG(req.username());

    auto spUser = ServerBase::GetInstance()->GetUserMgr()->CreateUser(data);
    spUser->SetConnId(spMsg->clientid());

    NotifyLoginResult notify;
    notify.set_result(NLR_SUCCESS);

    NetApi::SendPacketToUser(spUser, notify);
}
std::pair<std::string,std::string> UserController :: getDefaultUser()
{
    Logging log("UserController :: getDefaultUser",true);
    std::ifstream input(__defaultUserFile);
    std::string ID,passwd;
    int rem;
    if(input)
    {
        input >> ID >> rem;
        UserData* defaultUser = findUser(ID);
        if(defaultUser)
        {
            log << "INFO now default user " << defaultUser->Name() << std::endl;
            if(rem)
            {
                log << "INFO remember password." << std::endl;
                passwd = defaultUser->Password();
            }
        }
        else ID="";
    }
    return std::make_pair(ID,passwd);
}
void Thread::setUserData(const String& id, void* data, DeinitFunc deinitFunc)
{
    UserData oldData;
    oldData.data = NULL;
    oldData.deinitFunc = NULL;

    UserData newData;
    newData.data = data;
    newData.deinitFunc = deinitFunc;

    // Replace data.

    m_lock.enter();

    UserData* found = m_userData.search(id);
    if (found)
    {
        oldData = *found;
        *found = newData;
    }

    if ((found != NULL) != (data != NULL || deinitFunc != NULL))
    {
        if (found)
            m_userData.remove(id);
        else
            m_userData.add(id, newData);
    }

    m_lock.leave();

    // Deinit old data.

    if (oldData.deinitFunc)
        oldData.deinitFunc(oldData.data);
}
Example #29
0
void CTopLayer::onEnter()
{
	BaseLayer::onEnter();
	this->setTouchPriority(-100);
	UserData *user = DataCenter::sharedData()->getUser()->getUserData();

	m_coinLabel = (CLabel*)m_ui->getChildByTag(13);
	m_coinLabel->setString(ToString(user->getCoin()));

	m_moneyLabel = (CLabel*)m_ui->getChildByTag(14);
	m_moneyLabel->setString(ToString(user->getRoleGold()));
	// 
	m_foodLabel = (CLabel*)m_ui->getChildByTag(17);
	//m_foodLabel->setString(ToString(user->getRoleFood()));
	m_foodLabel->setString(ToString(user->getFriends()));

	CLabel *action = (CLabel*)(m_ui->findWidgetById("action"));
	action->setString(CCString::createWithFormat("%d/%d",user->getRoleAction(),user->getActionLimit())->getCString());

	CButton* add_food = (CButton*)m_ui->findWidgetById("btn_add_food");
	CButton* add_copper = (CButton*)m_ui->findWidgetById("btn_add_copper");
	CButton* add_soul = (CButton*)m_ui->findWidgetById("btn_add_soul");
	CButton* add_gold = (CButton*)m_ui->findWidgetById("btn_add_gold");
	CButton* add_friendship = (CButton*)m_ui->findWidgetById("btn_add_friendship");
	add_food->getSelectedImage()->setScale(1.1f);
	add_copper->getSelectedImage()->setScale(1.1f);
	add_soul->getSelectedImage()->setScale(1.1f);
	add_gold->getSelectedImage()->setScale(1.1f);
	add_friendship->getSelectedImage()->setScale(1.1f);
	add_food->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
	add_copper->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
	add_soul->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
	add_gold->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
	add_friendship->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
	CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_HERO,this,GameMsghandler_selector(CTopLayer::updateRoleProperty));

	//绑定场景隐藏和显示的消息
	NOTIFICATION->addObserver(this, callfuncO_selector(CTopLayer::show), SHOW_TOP_LAYER, nullptr);
	NOTIFICATION->addObserver(this, callfuncO_selector(CTopLayer::hide), HIDE_TOP_LAYER, nullptr);

	CImageView *coin = (CImageView*)(m_ui->findWidgetById("coin"));
	CCAnimation *coinAnim = AnimationManager::sharedAction()->getAnimation("7033");
	coinAnim->setDelayPerUnit(0.3f);
	coin->runAction(CCRepeatForever::create(CCAnimate::create(coinAnim)));

	CImageView *gold = (CImageView*)(m_ui->findWidgetById("gold"));
	CCAnimation *goldAnim = AnimationManager::sharedAction()->getAnimation("7034");
	goldAnim->setDelayPerUnit(0.3f);
	gold->runAction(CCRepeatForever::create(CCAnimate::create(goldAnim)));
}
void UserTracking::GetUserPixels(const UserData& user, xn::SceneMetaData& meta) const
{
      mUserGen.GetUserPixels(user.GetId(), meta);



//      const size_t pixel_count = scene_meta.YRes() * scene_meta.XRes();
//      XnLabel* user_pixels = new XnLabel[pixel_count];
//      const XnLabel* pLabelBuf = scene_meta.Data();
//
////      std::vector<bool> user_pixels(pixel_count, false);
////
////      for (XnUInt i = 0; i < pixel_count; ++i, ++pLabelBuf)
////      {
////         if (*pLabelBuf == userBuf[id])
////         {
////            user_pixels[i] = true;
////         }
////      }
//      memcpy(user_pixels, pLabelBuf, pixel_count * sizeof(XnLabel));
//      user->SetPixels(user_pixels);
}