示例#1
0
//----------------------------------------------------------------------------
UIFrame *LP_Manager::AddTabFrame(const std::string &name, 
	const std::string &title)
{
	UIFrame *uiFrame = new0 UIFrame();
	uiFrame->SetAnchorHor(0.0f, 1.0f);
	uiFrame->SetAnchorVer(0.0f, 1.0f);
	uiFrame->SetActivateSelfCtrled(true);

	UIFPicBox *fpicBox = new0 UIFPicBox();
	uiFrame->AttachChild(fpicBox);
	fpicBox->LocalTransform.SetTranslateY(-10.0f);
	fpicBox->SetAnchorHor(0.0f, 1.0f);
	fpicBox->SetAnchorVer(1.0f, 1.0f);
	fpicBox->SetPivot(0.5f, 1.0f);
	fpicBox->SetSize(0.0f, 3.0f);
	UIPicBox *picBox = fpicBox->GetUIPicBox();
	picBox->SetTexture("Data/engine/white.png");
	picBox->SetColor(Float3::YELLOW);
	
	mTableFrame->AddTab(name, title, uiFrame);
	UIText *text = mTableFrame->GetTabButton(name)->GetText();
	text->SetColorSelfCtrled(true);
	text->SetBrightnessSelfCtrled(true); 
	text->SetFontScale(0.65f);
	text->SetFontColor(Float3::WHITE);
	text->SetColor(Float3::WHITE);
	text->SetDrawStyle(FD_SHADOW);
	text->SetBorderShadowAlpha(0.8f);

	if ("ManyKit" == name)
	{
		text->SetFont("DataLauncher/fonts/msyh.ttc", 24, 24);
	}
	else
	{
		text->SetFont("DataLauncher/fonts/msyhl.ttc", 24, 24);
	}

	UIButton *tabBut = mTableFrame->GetTabButton(name);

	Float3 color = Float3::MakeColor(237, 28, 36);
	if ("ManyKit" == name)
	{
		color = Float3::MakeColor(237, 28, 36);
	}
	else if ("Edu" == name)
	{
		color = Float3::MakeColor(0, 162, 233);
	}
	else if ("Toys" == name)
	{
		color = Float3::MakeColor(255, 127, 39);
	}
	else if ("Games" == name)
	{
		color = Float3::MakeColor(24, 177, 76);
	}

	picBox->SetColor(color);

	tabBut->SetStateColor(UIButtonBase::BS_NORMAL, color);
	tabBut->SetStateColor(UIButtonBase::BS_HOVERED, color);
	tabBut->SetStateBrightness(UIButtonBase::BS_HOVERED, 1.2f);
	tabBut->SetStateColor(UIButtonBase::BS_PRESSED, color);
	tabBut->SetStateBrightness(UIButtonBase::BS_PRESSED, 1.0f);
	tabBut->SetActivateColor(color);

	return uiFrame;
}