KF2-Server-Extension/ServerExt/Classes/KFGUI_Button_CD.uc

56 lines
1.6 KiB
Ucode
Raw Normal View History

Class KFGUI_Button_CD extends KFGUI_Button;
function DrawMenu()
{
local float XL,YL,TS;
local byte i, FrameOpacity;
FrameOpacity = 200;
2020-11-28 20:12:58 +00:00
if (bDisabled)
Canvas.SetDrawColor(10, 10, 10, FrameOpacity);
2020-11-28 20:12:58 +00:00
else if (bPressedDown)
Canvas.SetDrawColor(20, 20, 20, FrameOpacity);
2020-11-28 20:12:58 +00:00
else if (bFocused)
Canvas.SetDrawColor(75, 75, 75, FrameOpacity);
else Canvas.SetDrawColor(45, 45, 45, FrameOpacity);
2020-11-28 20:12:58 +00:00
if (bIsHighlighted)
{
Canvas.DrawColor.R = Min(Canvas.DrawColor.R + 25, FrameOpacity);
2020-11-28 19:53:57 +00:00
Canvas.DrawColor.G = Min(Canvas.DrawColor.G + 25, FrameOpacity);
Canvas.DrawColor.B = Min(Canvas.DrawColor.B + 25, FrameOpacity);
}
Canvas.SetPos(0.f,0.f);
2020-11-28 20:12:58 +00:00
if (ExtravDir==255)
Owner.CurrentStyle.DrawWhiteBox(CompPos[2],CompPos[3]);
else Owner.CurrentStyle.DrawRectBox(0,0,CompPos[2],CompPos[3],Min(CompPos[2],CompPos[3])*0.2,ExtravDir);
2020-11-28 20:12:58 +00:00
if (OverlayTexture.Texture!=None)
{
Canvas.SetPos(0.f,0.f);
Canvas.DrawTile(OverlayTexture.Texture,CompPos[2],CompPos[3],OverlayTexture.U,OverlayTexture.V,OverlayTexture.UL,OverlayTexture.VL);
}
2020-11-28 20:12:58 +00:00
if (ButtonText!="")
{
// Chose the best font to fit this button.
i = Min(FontScale+Owner.CurrentStyle.DefaultFontSize,Owner.CurrentStyle.MaxFontScale);
2020-11-28 20:12:58 +00:00
while (true)
{
Canvas.Font = Owner.CurrentStyle.PickFont(i,TS);
Canvas.TextSize(ButtonText,XL,YL,TS,TS);
2020-11-28 20:12:58 +00:00
if (i==0 || (XL<(CompPos[2]*0.95) && YL<(CompPos[3]*0.95)))
break;
--i;
}
Canvas.SetPos((CompPos[2]-XL)*0.5,(CompPos[3]-YL)*0.5);
2020-11-28 20:12:58 +00:00
if (bDisabled)
Canvas.DrawColor = TextColor*0.5f;
else Canvas.DrawColor = TextColor;
Canvas.DrawText(ButtonText,,TS,TS,TextFontInfo);
}
}
defaultproperties
{
}