예제 #1
0
void NodeFriendCircleComment::setCommentInfoShow(std::vector<msg::CommentInfo> commentInfo ,int index )
{
    int i=index;
    auto allInfo=commentInfo;
    auto userinfo=commentInfo[i].userinfo();
    userID=userinfo.userid();
    auto nickname =userinfo.nickname();
    auto infoma=commentInfo.at(i);
    auto type =infoma.type();
    this->setCommentID(infoma.commentid());
    this->setParentID(infoma.parentcomment());
    this->setIfDelete(infoma.isdelete());
    
    std::map<int,std::string> alluserinfo;
    for(auto itor:commentInfo)
    {
        if(itor.type()!=msg::CommentType::LIKE)
        {
            alluserinfo[itor.commentid()]=itor.userinfo().nickname();
        }
    }
    if(type==1)
    {
        textReplay->setString(nickname+":");
    }
    else if(type ==3)
    {
        std::string replyName=alluserinfo[infoma.parentcomment()];
    textReplay->setString(nickname+" "+tools::local_string("reply","回复")+" "+replyName+" :");
    }
    auto info = commentInfo[i];
    textDate->setString(getStringFromInt(commentInfo[i].time()));
    textComment->setString(commentInfo[i].content());
    textComment->setContentSize(Size(117,38));
    std::string time = getStringFromInt(commentInfo[i].time());
    std::string text = "";
    const std::string& text1=time;
    double time2 = tools::stod(text1);
    time2 /= 1000;
    text = tools::time_display(time2);
    texthour->setString(text);
    textDate->setVisible(false);
    
    auto imgName=userinfo.picname();
    
    if(imgName == "")
    {
        imgName = "Default/image_defualt_user_icon_small48X48.png";
    }
    ShaderSprite *imgIcon = ShaderSprite::createAndDownload(imgName, "Default/image_defualt_user_icon_small48X48.png", "Default/image_defualt_user_icon_small48X48.png");
    imgIcon->setAnchorPoint(Vec2(0,0.5));
    imgIcon->setPosition(headImage->getPosition());
    headImage->setVisible(false);
    this->addChild(imgIcon);
    
    
}
예제 #2
0
ShaderSprite* ShaderSprite::create(const char* pszFileName)
{
    ShaderSprite *pRet = new(std::nothrow) ShaderSprite();
    if (pRet && pRet->initWithFile(pszFileName)) {
        pRet->autorelease();
        return pRet;
    }
    else
    {
        delete pRet;
        pRet = NULL;
        return NULL;
    }
}
예제 #3
0
void TileMapLoader::refreshTiles()
{
	int x,y;

	// 更新TILE
	for ( size_t i = 0;i<m_vTiles.size();++i )
	{
		TileInfoAsync* pInfo = m_vTiles[i];
		if ( pInfo->img )
		{
			Texture2D* pTexture = new Texture2D();
			if( pTexture && pTexture->initWithImage(pInfo->img) )
			{
				Rect rect = Rect::ZERO;
				rect.size = pTexture->getContentSizeInPixels();

				ShaderSprite* pSprite = NULL;
				if ( m_pMap->getGrey() )
				{
					pSprite = ShaderSprite::createWithTexture(pTexture,rect,-1.0f);
				}
				else
				{
					pSprite = ShaderSprite::createWithTexture(pTexture,rect,1.0f);
				}
				
				if ( pSprite )
				{
					TileInfo* pTile = m_pMap->getTileMgrNear()->getTile(pInfo->tag);
					pTile->spr = pSprite;
					pTile->flag = TileFlagShowing;
					m_pMap->getTileMgrNear()->index2Tile(pTile->tag,x,y);
					m_pMap->getTileMgrNear()->tile2World(x,y);
					pSprite->setAnchorPoint(Point(0,0));
					pSprite->setPosition(Point(x,y));
					m_pMap->getTerrainLayer()->addChild(pSprite,0,pTile->tag);
				}
			}

			CC_SAFE_RELEASE(pTexture);
		}
	}
}