Example #1
0
void NDUIVerticalScrollBar::Initialization()
{
    NDUINode::Initialization();

    m_picUp = NDPicturePool::DefaultPool()->AddPicture(GetImgPath("scroll_arrow.png"));
    m_picDown = NDPicturePool::DefaultPool()->AddPicture(GetImgPath("scroll_arrow.png"));
    m_picDown->Rotation(PictureRotation180);
}
Example #2
0
void ChatInput::ShowItems()
{
	if (!m_itemLayer) 
	{
		m_itemLayer = new NDUIMenuLayer();
		m_itemLayer->Initialization();
		m_itemLayer->GetCancelBtn()->SetDelegate(this);
		m_itemLayer->SetDelegate(this);
		
		NDUIRecttangle* bkg = new NDUIRecttangle();
		bkg->Initialization();
		bkg->SetColor(ccc4(253, 253, 253, 255));
		bkg->SetFrameRect(CCRectMake(0, m_itemLayer->GetTitleHeight(), 480, m_itemLayer->GetTextHeight()));
		m_itemLayer->AddChild(bkg);
		
		NDPicture* picItem = NDPicturePool::DefaultPool()->AddPicture(GetImgPath("titles.png"));
		picItem->Cut(CCRectMake(76, 120, 103, 19));
		
		NDUIImage* image = new NDUIImage();
		image->Initialization();
		image->SetPicture(picItem, true);
		image->SetFrameRect(CCRectMake(190, 5, picItem->GetSize().width, picItem->GetSize().height));
		m_itemLayer->AddChild(image);
		
		m_itemBag = new GameItemBag();
		m_itemBag->Initialization(ItemMgrObj.GetPlayerBagItems());
		m_itemBag->SetPageCount(ItemMgrObj.GetPlayerBagNum());
		m_itemBag->SetDelegate(this);
		m_itemBag->SetFrameRect(CCRectMake(100, 30, ITEM_BAG_W, ITEM_BAG_H));
		m_itemLayer->AddChild(m_itemBag);
	}
	NDDirector::DefaultDirector()->GetRunningScene()->AddChild(m_itemLayer, CHAT_INPUT_Z);
	this->Hide();
}
Example #3
0
void ChatInput::ShowExpressions()
{
	if (!m_expressionLayer) 
	{
		m_expressionLayer = new NDUIMenuLayer();
		m_expressionLayer->Initialization();
		m_expressionLayer->GetCancelBtn()->SetDelegate(this);
		m_expressionLayer->SetDelegate(this);
		
		NDUIRecttangle* bkg = new NDUIRecttangle();
		bkg->Initialization();
		bkg->SetColor(ccc4(253, 253, 253, 255));
		bkg->SetFrameRect(CCRectMake(0, m_expressionLayer->GetTitleHeight(), 480, m_expressionLayer->GetTextHeight()));
		m_expressionLayer->AddChild(bkg);
		
		NDPicture* picExpression = NDPicturePool::DefaultPool()->AddPicture(GetImgPath("titles.png"));
		picExpression->Cut(CCRectMake(180, 120, 100, 19));
		
		NDUIImage* image = new NDUIImage();
		image->Initialization();
		image->SetPicture(picExpression, true);
		image->SetFrameRect(CCRectMake(190, 5, picExpression->GetSize().width, picExpression->GetSize().height));
		m_expressionLayer->AddChild(image);
		
		for (int index = 0; index < 25; index++) 
		{
			NDUIButton* btn = new NDUIButton();
			btn->Initialization();
			btn->SetTag(tag_expression_begin + index);
			btn->SetDelegate(this);
			
			NDPicture* pic = NDPicturePool::DefaultPool()->AddPicture(GetImgPath("face.png"));				
			int row = index / 5;
			int col = index % 5;
			pic->Cut(CCRectMake(15 * col, 15 * row , 15, 15));
			
			btn->SetImage(pic, false, CCRectZero, true);
			btn->SetFrameRect(CCRectMake(80 + col * 60, 35 + row * 50, 40, 40));			
			m_expressionLayer->AddChild(btn);
		}		
	}
	NDDirector::DefaultDirector()->GetRunningScene()->AddChild(m_expressionLayer, CHAT_INPUT_Z);
	this->Hide();
}
Example #4
0
    void FsImgStorage::Write(ImgInfo& img) const {
        Utils::Contract::Assert(img.GetId() != IMGID_UNDEFINED);
        Utils::Contract::Assert(!img.GetFileExtension().empty());

        boost::filesystem::path uploadFilePath = GetImgPath(img.GetId(), img.GetFileExtension());

        Magick::Blob magickBlob;
        img.GetMagickImage().write(&magickBlob);

        Utils::FileSystem::WriteAllBytes((const char*)magickBlob.data(), magickBlob.length(), uploadFilePath);
    }
	bool ServerObject::HandleImagePath (Entity& e, const QVariantMap& hints)
	{
		auto path = GetImgPath (hints);
		if (path.isEmpty ())
			return false;

		if (QFile::exists (path))
			e.Additional_ ["NotificationPixmap"] = QPixmap (path);
		else if (path.startsWith ("file:"))
			e.Additional_ ["NotificationPixmap"] = QPixmap (QUrl (path).toLocalFile ());
		else
			return false;

		return true;
	}