compact mode

This commit is contained in:
GenZmeY 2022-09-08 23:11:46 +03:00
parent ee0f203f3a
commit 98a5d85019
2 changed files with 81 additions and 19 deletions

View File

@ -18,8 +18,12 @@ function RenderFramedWindow(KFGUI_FloatingWindow P)
Canvas.DrawTileStretched(TabTextures[`TAB_TOP], XS, TitleHeight, 0,0, 128, 16);
// Frame itself.
Canvas.SetPos(0, TitleHeight);
Canvas.DrawTileStretched(BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT], XS, YS-TitleHeight, 0,0, 128, 128);
if (`BOX_SMALL_SLIGHTTRANSPARENT >= 0 && `BOX_SMALL_SLIGHTTRANSPARENT < BorderTextures.Length)
{
Canvas.SetPos(0, TitleHeight);
Canvas.DrawTileStretched(BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT], XS, YS-TitleHeight, 0,0, 128, 128);
}
// Title.
if (P.WindowTitle != "")
@ -44,8 +48,11 @@ function RenderWindow(KFGUI_Page P)
Canvas.SetDrawColor(105, 105, 105, 255);
else Canvas.SetDrawColor(85, 85, 85, P.FrameOpacity);
Canvas.SetPos(0, 0);
Canvas.DrawTileStretched(BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT], XS, YS, 0,0, 128, 128);
if (`BOX_SMALL_SLIGHTTRANSPARENT >= 0 && `BOX_SMALL_SLIGHTTRANSPARENT < BorderTextures.Length)
{
Canvas.SetPos(0, 0);
Canvas.DrawTileStretched(BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT], XS, YS, 0,0, 128, 128);
}
}
function RenderToolTip(KFGUI_Tooltip TT)
@ -118,8 +125,11 @@ function RenderScrollBar(KFGUI_ScrollBarBase S)
Canvas.SetDrawColor(15, 15, 15, 160);
else Canvas.SetDrawColor(15, 15, 15, 160);
Canvas.SetPos(0.f, 0.f);
Canvas.DrawTileStretched(BorderTextures[`BOX_INNERBORDER], S.CompPos[2], S.CompPos[3], 0,0, 128, 128);
if (`BOX_INNERBORDER >= 0 && `BOX_INNERBORDER < BorderTextures.Length)
{
Canvas.SetPos(0.f, 0.f);
Canvas.DrawTileStretched(BorderTextures[`BOX_INNERBORDER], S.CompPos[2], S.CompPos[3], 0,0, 128, 128);
}
if (S.bDisabled)
return;
@ -191,8 +201,11 @@ function RenderComboBox(KFGUI_ComboBox C)
else if (C.bFocused)
Canvas.SetDrawColor(190, 190, 190, 255);
Canvas.SetPos(0.f, 0.f);
Canvas.DrawTileStretched(BorderTextures[`BOX_INNERBORDER], C.CompPos[2], C.CompPos[3], 0,0, 128, 128);
if (`BOX_INNERBORDER >= 0 && `BOX_INNERBORDER < BorderTextures.Length)
{
Canvas.SetPos(0.f, 0.f);
Canvas.DrawTileStretched(BorderTextures[`BOX_INNERBORDER], C.CompPos[2], C.CompPos[3], 0,0, 128, 128);
}
DrawArrowBox(3, C.CompPos[2]-32, 0.5f, 32, 32);
@ -216,8 +229,12 @@ function RenderComboList(KFGUI_ComboSelector C)
// Draw background.
Edge = C.Combo.BorderSize;
Canvas.SetPos(0.f, 0.f);
Canvas.DrawTileStretched(BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT], C.CompPos[2], C.CompPos[3], 0,0, 128, 128);
if (`BOX_SMALL_SLIGHTTRANSPARENT >= 0 && `BOX_SMALL_SLIGHTTRANSPARENT < BorderTextures.Length)
{
Canvas.SetPos(0.f, 0.f);
Canvas.DrawTileStretched(BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT], C.CompPos[2], C.CompPos[3], 0,0, 128, 128);
}
// While rendering, figure out mouse focus row.
X = C.Owner.MousePosition.X - Canvas.OrgX;

View File

@ -4,8 +4,14 @@ class YAS_ScoreBoard extends KFGUI_Page
const HeaderWidthRatio = 0.30f;
const PlayerListWidthRatio = 0.6f;
const PlayerEntryHeightMod = 1.05f;
const ListItems = 12;
const PlayerEntryFontScalarMod = 1.25f;
const CompactModePlayers = 12;
const ListItemsCompact = 16;
const ListItemsDefault = 12;
const FontScalarModCompact = 1.0f;
const FontScalarModDefault = 1.25f;
/*
const IconRanked = Texture2D'YAS.IconRanked';
@ -50,6 +56,9 @@ var public bool UsesStats, Custom, PasswordRequired;
var public SystemRank RankPlayer;
var public SystemRank RankAdmin;
var private int ListItems;
var private float FontScalarMod;
function Rank PlayerRank(KFPlayerReplicationInfo KFPRI)
{
local YAS_RankRepInfo RepInfo;
@ -126,7 +135,7 @@ function float MinPerkBoxWidth(float FontScalar)
foreach PerkNames(PerkName)
{
Canvas.TextSize(PerkName $ "A", XL, YL, FontScalar * PlayerEntryFontScalarMod, FontScalar * PlayerEntryFontScalarMod);
Canvas.TextSize(PerkName $ "A", XL, YL, FontScalar * FontScalarMod, FontScalar * FontScalarMod);
if (XL > MaxWidth) MaxWidth = XL;
}
@ -138,6 +147,20 @@ function InitMenu()
Super.InitMenu();
PlayersList = KFGUI_List(FindComponentID('PlayerList'));
OwnerPC = KFPlayerController(GetPlayer());
if (GetKFGRI() != None)
{
if (KFGRI.MaxHumanCount > CompactModePlayers)
{
ListItems = ListItemsCompact;
FontScalarMod = FontScalarModCompact;
}
else
{
ListItems = ListItemsDefault;
FontScalarMod = FontScalarModDefault;
}
PlayersList.ListItemsPerPage = ListItems;
}
}
static function CheckAvatar(KFPlayerReplicationInfo KFPRI, KFPlayerController PC)
@ -199,6 +222,16 @@ function string WaveText()
}
}
function KFGameReplicationInfo GetKFGRI()
{
if (KFGRI == None)
{
KFGRI = KFGameReplicationInfo(GetPlayer().WorldInfo.GRI);
}
return KFGRI;
}
function DrawMenu()
{
local string S;
@ -212,11 +245,23 @@ function DrawMenu()
local Array<String> MessageOfTheDayLines;
PC = GetPlayer();
if (KFGRI == None)
if (GetKFGRI() == None)
{
KFGRI = KFGameReplicationInfo(PC.WorldInfo.GRI);
if (KFGRI == None)
return;
return;
}
else if (PlayersList != None)
{
if (KFGRI.MaxHumanCount > CompactModePlayers)
{
ListItems = ListItemsCompact;
FontScalarMod = FontScalarModCompact;
}
else
{
ListItems = ListItemsDefault;
FontScalarMod = FontScalarModDefault;
}
PlayersList.ListItemsPerPage = ListItems;
}
// Sort player list.
@ -540,7 +585,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
C.Font = Owner.CurrentStyle.PickFont(FontScalar);
FontScalar *= PlayerEntryFontScalarMod;
FontScalar *= FontScalarMod;
Canvas.TextSize("ABC", XL, YL, FontScalar, FontScalar);
ShapeHealth = Settings.Style.ShapeStateHealthBoxMidPlayer;
@ -895,7 +940,7 @@ defaultproperties
OnDrawItem=DrawPlayerEntry
ID="PlayerList"
bClickable=false
ListItemsPerPage=ListItems
ListItemsPerPage=ListItemsDefault
End Object
Components.Add(PlayerList)