fix columns pos

This commit is contained in:
GenZmeY 2021-06-15 00:02:32 +03:00
parent bbe93f13d4
commit 48ea52e9f9

View File

@ -4,8 +4,8 @@ class KFScoreBoard extends KFGUI_Page
`include(Build.uci) `include(Build.uci)
`include(Logger.uci) `include(Logger.uci)
var transient float RankXPos, PerkXPos, PlayerXPos, HealthXPos, TimeXPos, KillsXPos, AssistXPos, CashXPos, DeathXPos, PingXPos; var transient float RankXPos, LevelXPos, PerkXPos, PlayerXPos, HealthXPos, TimeXPos, KillsXPos, AssistXPos, CashXPos, DeathXPos, PingXPos;
var transient float StatusWBox, PlayerWBox, PerkWBox, CashWBox, KillsWBox, AssistWBox, HealthWBox, PingWBox; var transient float StatusWBox, PlayerWBox, LevelWBox, PerkWBox, CashWBox, KillsWBox, AssistWBox, HealthWBox, PingWBox;
var transient float NextScoreboardRefresh; var transient float NextScoreboardRefresh;
var int PlayerIndex; var int PlayerIndex;
@ -297,20 +297,23 @@ function DrawMenu()
KillsXPos = AssistXPos - (XL < MinBoxW ? MinBoxW : XL); KillsXPos = AssistXPos - (XL < MinBoxW ? MinBoxW : XL);
Canvas.TextSize(class'KFGFxHUD_ScoreboardWidget'.default.DoshString$" ", XL, YL, FontScalar, FontScalar); Canvas.TextSize(class'KFGFxHUD_ScoreboardWidget'.default.DoshString$" ", XL, YL, FontScalar, FontScalar);
Canvas.TextSize("99999", DoshSize, YL, FontScalar, FontScalar); Canvas.TextSize("999999", DoshSize, YL, FontScalar, FontScalar);
CashXPos = KillsXPos - (XL < DoshSize ? DoshSize : XL); CashXPos = KillsXPos - (XL < DoshSize ? DoshSize : XL);
BoxW = 0; BoxW = 0;
foreach PerkNames(S) foreach PerkNames(S)
{ {
// PerkName + 2 Space + 2 Symbols for level Canvas.TextSize(S$"A", XL, YL, FontScalar, FontScalar);
Canvas.TextSize(S$" 99", XL, YL, FontScalar, FontScalar);
if (XL > BoxW) BoxW = XL; if (XL > BoxW) BoxW = XL;
} }
PerkXPos = CashXPos - (BoxW < MinBoxW ? MinBoxW : BoxW); PerkXPos = CashXPos - (BoxW < MinBoxW ? MinBoxW : BoxW);
Canvas.TextSize("000", XL, YL, FontScalar, FontScalar);
LevelXPos = PerkXPos - XL;
StatusWBox = PlayerXPos - RankXPos; StatusWBox = PlayerXPos - RankXPos;
PlayerWBox = PerkXPos - PlayerXPos; PlayerWBox = LevelXPos - PlayerXPos;
LevelWBox = PerkXPos - LevelXPos;
PerkWBox = CashXPos - PerkXPos; PerkWBox = CashXPos - PerkXPos;
CashWBox = KillsXPos - CashXPos; CashWBox = KillsXPos - CashXPos;
KillsWBox = AssistXPos - KillsXPos; KillsWBox = AssistXPos - KillsXPos;
@ -370,7 +373,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
{ {
local string S, StrValue; local string S, StrValue;
local float FontScalar, TextYOffset, XL, YL, PerkIconPosX, PerkIconPosY, PerkIconSize, PrestigeIconScale; local float FontScalar, TextYOffset, XL, YL, PerkIconPosX, PerkIconPosY, PerkIconSize, PrestigeIconScale;
local float XPos, BoxWidth; local float XPos, BoxWidth, RealPlayerWBox;
local KFPlayerReplicationInfo KFPRI; local KFPlayerReplicationInfo KFPRI;
local byte Level, PrestigeLevel; local byte Level, PrestigeLevel;
local bool bIsZED; local bool bIsZED;
@ -519,6 +522,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
DrawTextShadowHLeftVCenter(S, RankXPos, TextYOffset, FontScalar); DrawTextShadowHLeftVCenter(S, RankXPos, TextYOffset, FontScalar);
// Perk // Perk
RealPlayerWBox = PlayerWBox;
if (bIsZED) if (bIsZED)
{ {
if (CurrentRank.ApplyColorToFields.Perk) if (CurrentRank.ApplyColorToFields.Perk)
@ -530,6 +534,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
S = class'KFCommon_LocalizedStrings'.default.ZedString; S = class'KFCommon_LocalizedStrings'.default.ZedString;
DrawTextShadowHLeftVCenter(S, PerkXPos + Height, TextYOffset, FontScalar); DrawTextShadowHLeftVCenter(S, PerkXPos + Height, TextYOffset, FontScalar);
RealPlayerWBox = PerkXPos + Height - PlayerXPos;
} }
else else
{ {
@ -540,9 +545,11 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
PerkIconPosY = YOffset + (Owner.HUDOwner.ScaledBorderSize * 2); PerkIconPosY = YOffset + (Owner.HUDOwner.ScaledBorderSize * 2);
PerkIconSize = Height-(Owner.HUDOwner.ScaledBorderSize * 4); PerkIconSize = Height-(Owner.HUDOwner.ScaledBorderSize * 4);
PerkIconPosX = PerkXPos - PerkIconSize - (Owner.HUDOwner.ScaledBorderSize*2); PerkIconPosX = LevelXPos - PerkIconSize - (Owner.HUDOwner.ScaledBorderSize*2);
PrestigeIconScale = 0.6625f; PrestigeIconScale = 0.6625f;
RealPlayerWBox = PerkIconPosX - PlayerXPos;
C.DrawColor = HUDOwner.WhiteColor; C.DrawColor = HUDOwner.WhiteColor;
if (PrestigeLevel > 0) if (PrestigeLevel > 0)
{ {
@ -572,18 +579,14 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
SetDrawColor(C, Settings.Style.LevelTextColorHigh); SetDrawColor(C, Settings.Style.LevelTextColorHigh);
} }
S = String(Level); S = String(Level);
DrawTextShadowHLeftVCenter(S, PerkXPos, TextYOffset, FontScalar); DrawTextShadowHLeftVCenter(S, LevelXPos, TextYOffset, FontScalar);
if (Len(S) == 1)
Canvas.TextSize(S@" ", XL, YL, FontScalar, FontScalar);
else
Canvas.TextSize(S$" ", XL, YL, FontScalar, FontScalar);
if (CurrentRank.ApplyColorToFields.Perk) if (CurrentRank.ApplyColorToFields.Perk)
SetDrawColor(C, CurrentRank.TextColor); SetDrawColor(C, CurrentRank.TextColor);
else else
SetDrawColor(C, Settings.Style.PerkTextColor); SetDrawColor(C, Settings.Style.PerkTextColor);
S = KFPRI.CurrentPerkClass.default.PerkName; S = KFPRI.CurrentPerkClass.default.PerkName;
DrawTextShadowHLeftVCenter(S, PerkXPos+XL, TextYOffset, FontScalar); DrawTextShadowHLeftVCenter(S, PerkXPos, TextYOffset, FontScalar);
} }
else else
{ {
@ -593,6 +596,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
SetDrawColor(C, Settings.Style.PerkTextColor); SetDrawColor(C, Settings.Style.PerkTextColor);
S = NoPerk; S = NoPerk;
DrawTextShadowHLeftVCenter(S, PerkXPos, TextYOffset, FontScalar); DrawTextShadowHLeftVCenter(S, PerkXPos, TextYOffset, FontScalar);
RealPlayerWBox = PerkXPos - PlayerXPos;
} }
} }
@ -617,7 +621,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
SetDrawColor(C, Settings.Style.PlayerNameTextColor); SetDrawColor(C, Settings.Style.PlayerNameTextColor);
S = KFPRI.PlayerName; S = KFPRI.PlayerName;
Canvas.TextSize(S, XL, YL, FontScalar, FontScalar); Canvas.TextSize(S, XL, YL, FontScalar, FontScalar);
while (XL > PlayerWBox) while (XL > RealPlayerWBox)
{ {
S = Left(S, Len(S)-1); S = Left(S, Len(S)-1);
Canvas.TextSize(S, XL, YL, FontScalar, FontScalar); Canvas.TextSize(S, XL, YL, FontScalar, FontScalar);