コード例 #1
0
ファイル: ChatInput.cpp プロジェクト: chaosren/HHHH
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();
}
コード例 #2
0
ファイル: UIDialog.cpp プロジェクト: chaosren/HHHH
void CUIDlgOptBtn::Initialization()
{
	NDUIButton::Initialization();
	this->CloseFrame();
	
	CCSize winsize	= CCDirector::sharedDirector()->getWinSizeInPixels();
	CCRect rect		= CCRectMake(0, 0, winsize.width * 0.15, winsize.height * 0.15);
	
	m_sprTip = new CUISpriteNode;
	m_sprTip->Initialization();
	m_sprTip->SetFrameRect(rect);
	//m_sprTip->ChangeSprite(NDPath::GetAniPath("button.spr").c_str());//modified by ZhangDi 这个控件不需要做显示,但是其他地方有依赖到控件的框体大小,所以把显示的动画给屏蔽掉

	//新增提示图片
	NDPicture *test =  NDPicturePool::DefaultPool()->AddPicture(NDPath::GetSMImgPath("General/arrows/icon_arrows4.png"));
	test->Cut(CCRectMake(0.0f, 0.0f, 72.0f, 32.0f));
	NDUIImage *testimg = new NDUIImage;
	testimg->Initialization();
	testimg->SetPicture(test);
	testimg->SetFrameRect(CCRectMake(0.0f, winsize.height*0.015, 72.0f*ANDROID_SCALE, 32.0f*ANDROID_SCALE));

	this->AddChild(testimg, 1000);

	this->AddChild(m_sprTip);
	
	m_textHpyerlink = new CUIHyperlinkText;
	m_textHpyerlink->Initialization();
	m_textHpyerlink->SetFrameRect(CCRectMake(winsize.width*0.8f, 0, 0, 0));
	m_textHpyerlink->EnableLine(NO);// EnableLine
	this->AddChild(m_textHpyerlink);
}
コード例 #3
0
ファイル: ChatInput.cpp プロジェクト: chaosren/HHHH
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();
}
コード例 #4
0
ファイル: NDUIChatText.cpp プロジェクト: chaosren/HHHH
NDPicture* CUIChatText::CreateFacePicture(unsigned int index)
{
	NDPicture* result = NULL;
	if (index < 36) 
	{
		int row = index / 6;
		int col = index % 6;

		result = NDPicturePool::DefaultPool()->AddPicture(NDPath::GetImgPath("Res00/sm_face.png"));	
		result->Cut(CCRectMake(80 * col, 80 * row , 80, 80));
	}
	return result;
}
コード例 #5
0
ファイル: DramaUI.cpp プロジェクト: chaosren/HHHH
void DramaChatLayer::SetFigure(std::string filename, bool bReverse, int nCol, int nRow)
{
	NDNode* node = GetChild(m_nTagFigure);

	if (node && node->IsKindOfClass(RUNTIME_CLASS(NDUIImage)))
	{
		NDPicture* pic = NDPicturePool::DefaultPool()->AddPicture(
				filename);
		pic->SetReverse(bReverse);

		int nCutX= nCol * 256;
		int nCutY= nRow * 256;
		pic->Cut(CCRectMake(nCutX+1, nCutY+1, 255, 255));

		((NDUIImage*) node)->SetPicture(pic);
	}
}
コード例 #6
0
ファイル: NDControlHelp.cpp プロジェクト: korman/Temp
NDPicture* CtrlBase::GetPicture(string& filename, CTRL_UV& uv)
{
	if (filename.empty()) return NULL;

	const string imgPath = NDPath::GetGameResPath(filename.c_str());
	
	NDPicture* pkPicture = NDPicturePool::DefaultPool()->AddPicture(imgPath.c_str());

	if (pkPicture)
	{		
		pkPicture->Cut(CCRectMake(uv.x, uv.y, uv.w, uv.h ) );

		return pkPicture;
	}

	return NULL;
}