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

View File

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