示例#1
0
//----------------------------------------------------------------------------
UIFrame *LP_Manager::CreateHeadFrame()
{
	UIFrame *headFrame = new0 UIFrame();
	headFrame->SetPivot(0.0f, 0.5f);
	headFrame->SetAnchorHor(0.0f, 0.0f);
	headFrame->SetAnchorVer(0.0f, 1.0f);
	headFrame->SetSize(200.0f, 0.0f);

	UIButton *headBut = new0 UIButton();
	headFrame->AttachChild(headBut);
	headBut->SetAnchorHor(0.0f, 0.0f);
	headBut->SetAnchorVer(0.5f, 0.5f);
	headBut->SetSize(60.0f, 60.0f);
	headBut->SetAnchorParamHor(40.0f, 0.f);
	headBut->GetPicBoxAtState(UIButtonBase::BS_NORMAL)->SetTexture(
		"DataLauncher/images/icons/h_brid_72.png");
	headBut->SetStateColor(UIButtonBase::BS_NORMAL, Float3::WHITE);
	headBut->SetStateColor(UIButtonBase::BS_HOVERED, Float3::WHITE);
	headBut->SetStateColor(UIButtonBase::BS_PRESSED, Float3::WHITE);
	headBut->SetStateBrightness(UIButtonBase::BS_NORMAL, 1.0f);
	headBut->SetStateBrightness(UIButtonBase::BS_HOVERED, 1.0f);
	headBut->SetStateBrightness(UIButtonBase::BS_PRESSED, 1.05f);

	UIFText *nameText = new0 UIFText();
	headBut->AttachChild(nameText);
	nameText->LocalTransform.SetTranslateY(-2.0f);
	nameText->SetAnchorHor(0.5f, 0.5f);
	nameText->SetAnchorVer(0.0f, 0.0f);
	nameText->SetAnchorParamVer(7.0f, 0.0f);
	nameText->GetText()->SetFont("DataLauncher/fonts/msyh.ttc", 24, 24);
	nameText->GetText()->SetFontScale(0.5f);
	nameText->GetText()->SetFontColor(Float3::WHITE);
	nameText->GetText()->SetDrawStyle(FD_BORDER);
	nameText->GetText()->SetBorderShadowAlpha(0.5f);
	nameText->GetText()->SetText(PX2_LMVAL("mrtime"));

	return headFrame;
}
示例#2
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;
}