86 lines
2.8 KiB
Text
86 lines
2.8 KiB
Text
// for hud config
|
|
Class OptionMenuItemUTHudPreview : OptionMenuItem
|
|
{
|
|
TextureID tex[2];
|
|
CVar mColorP, mColorC, mOpacity, mPTeam, mPColor;
|
|
|
|
OptionMenuItemUTHudPreview Init( String label )
|
|
{
|
|
Super.Init(label,"",true);
|
|
mColorP = CVar.FindCVar("flak_colorprefs");
|
|
mColorC = CVar.FindCVar("flak_colorcustom");
|
|
mOpacity = CVar.FindCVar("flak_opacity");
|
|
mPTeam = CVar.FindCVar("team");
|
|
mPColor = CVar.FindCVar("color");
|
|
tex[0] = TexMan.CheckForTexture("graphics/HudPreviewBG.png",TexMan.Type_Any);
|
|
tex[1] = TexMan.CheckForTexture("graphics/HudPreview.png",TexMan.Type_Any);
|
|
return self;
|
|
}
|
|
|
|
override bool Selectable()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
override int Draw( OptionMenuDescriptor desc, int y, int indent, bool selected )
|
|
{
|
|
int xpos = indent + CursorSpace();
|
|
int ypos = y+OptionMenuSettings.mLinespacing*CleanYfac_1;
|
|
Screen.DrawFrame(xpos,ypos,64*CleanXFac_1,64*CleanYFac_1);
|
|
Screen.DrawTexture(tex[0],false,xpos,ypos,DTA_CleanNoMove_1,true);
|
|
Color tintcolor = Color("White");
|
|
switch ( mColorP.GetInt() )
|
|
{
|
|
case 0:
|
|
int t = mPTeam.GetInt();
|
|
if ( t < Teams.Size() )
|
|
tintcolor = Color(Teams[t].mName);
|
|
break;
|
|
case 1:
|
|
tintcolor = Color(mPColor.GetString());
|
|
break;
|
|
case 2:
|
|
tintcolor = Color(mColorC.GetString());
|
|
break;
|
|
}
|
|
int opacity = mOpacity.GetInt();
|
|
if ( opacity >= 16 ) Screen.DrawTexture(tex[1],false,xpos,ypos,DTA_CleanNoMove_1,true,DTA_FillColor,Color("Black"));
|
|
double alpha = clamp(opacity/15.,0.,1.);
|
|
Screen.DrawTexture(tex[1],false,xpos,ypos,DTA_CleanNoMove_1,true,DTA_FillColor,tintcolor,DTA_Alpha,alpha,DTA_LegacyRenderStyle,STYLE_AddShaded);
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
// changes to Tahoma
|
|
Class UTMessageBox : MessageBoxMenu
|
|
{
|
|
override void Init( Menu parent, String message, int messagemode, bool playsound, Name cmd, voidptr native_handler )
|
|
{
|
|
Super.Init(parent,message,messagemode,playsound,cmd,native_handler);
|
|
Font NFont = Font.GetFont('Tahoma10');
|
|
if ( !generic_ui )
|
|
{
|
|
if ( NFont && NFont.CanPrint(message) && NFont.CanPrint("$TXT_YES") && NFont.CanPrint("$TXT_NO") ) textFont = NFont;
|
|
else if ( OriginalSmallFont && OriginalSmallFont.CanPrint(message) && OriginalSmallFont.CanPrint("$TXT_YES") && OriginalSmallFont.CanPrint("$TXT_NO") ) textFont = OriginalSmallFont;
|
|
}
|
|
if ( !textFont )
|
|
{
|
|
arrowFont = textFont = NewSmallFont;
|
|
int factor = (CleanXfac+1)/2;
|
|
destWidth = screen.GetWidth()/factor;
|
|
destHeight = screen.GetHeight()/factor;
|
|
selector = "▶";
|
|
}
|
|
else
|
|
{
|
|
arrowFont = ConFont;
|
|
destWidth = CleanWidth;
|
|
destHeight = CleanHeight;
|
|
selector = "\xd";
|
|
}
|
|
int mr1 = destWidth/2+10+textFont.StringWidth(Stringtable.Localize("$TXT_YES"));
|
|
int mr2 = destWidth/2+10+textFont.StringWidth(Stringtable.Localize("$TXT_NO"));
|
|
mMouseRight = MAX(mr1,mr2);
|
|
mMessage = textFont.BreakLines(Stringtable.Localize(message),generic_ui?600:300);
|
|
}
|
|
}
|