improve scoreboard and replace spaces with tabs

This commit is contained in:
GenZmeY 2021-05-16 12:40:02 +03:00
parent 04262cb27b
commit 6af64d1f51
44 changed files with 6055 additions and 6037 deletions

View File

@ -859,6 +859,7 @@ static final function string Trim(coerce string S)
defaultproperties defaultproperties
{ {
// Font'UI_Canvas_Fonts.Font_Main'
MainFont=Font'KFScoreboardExt_Assets.Font.KFMainFont' MainFont=Font'KFScoreboardExt_Assets.Font.KFMainFont'
NumberFont=Font'UI_Canvas_Fonts.Font_General' NumberFont=Font'UI_Canvas_Fonts.Font_General'
InfiniteFont=Font'KFScoreboardExt_Assets.Font.KFInfiniteFont' InfiniteFont=Font'KFScoreboardExt_Assets.Font.KFInfiniteFont'

View File

@ -1,6 +1,7 @@
class KFScoreBoard extends KFGUI_Page; class KFScoreBoard extends KFGUI_Page;
var transient float PerkXPos, PlayerXPos, StateXPos, TimeXPos, HealXPos, KillsXPos, AssistXPos, CashXPos, DeathXPos, PingXPos; var transient float StatusXPos, PerkXPos, PlayerXPos, HealthXPos, TimeXPos, KillsXPos, AssistXPos, CashXPos, DeathXPos, PingXPos;
var transient float StatusWBox, PlayerWBox, PerkWBox, CashWBox, KillsWBox, AssistWBox, HealthWBox, PingWBox;
var transient float NextScoreboardRefresh; var transient float NextScoreboardRefresh;
var int PlayerIndex; var int PlayerIndex;
@ -188,35 +189,33 @@ function DrawMenu()
Canvas.SetDrawColor(250, 250, 250, 255); Canvas.SetDrawColor(250, 250, 250, 255);
// Calc X offsets // Calc X offsets
PerkXPos = Width * 0.01; StatusXPos = Width * 0.01;
PlayerXPos = Width * 0.2; PlayerXPos = Width * 0.20;
KillsXPos = Width * 0.5; PerkXPos = Width * 0.40;
AssistXPos = Width * 0.6; CashXPos = Width * 0.57;
CashXPos = Width * 0.7; KillsXPos = Width * 0.66;
StateXPos = Width * 0.8; AssistXPos = Width * 0.75;
PingXPos = Width * 0.92; HealthXPos = Width * 0.84;
PingXPos = Width * 0.93;
StatusWBox = PlayerXPos - StatusXPos;
PlayerWBox = PerkXPos - PlayerXPos;
PerkWBox = CashXPos - PerkXPos;
CashWBox = KillsXPos - CashXPos;
KillsWBox = AssistXPos - KillsXPos;
AssistWBox = HealthXPos - AssistXPos;
HealthWBox = PingXPos - HealthXPos;
PingWBox = Width - PingXPos;
// Header texts // Header texts
Canvas.SetPos (XPos + PerkXPos, YPos); DrawTextWLeft("STATUS", XPos + StatusXPos, YPos, FontScalar);
Canvas.DrawText (class'KFGFxMenu_Inventory'.default.PerkFilterString, , FontScalar, FontScalar); DrawTextWLeft(class'KFGFxHUD_ScoreboardWidget'.default.PlayerString, XPos + PlayerXPos, YPos, FontScalar);
DrawTextWLeft(class'KFGFxMenu_Inventory'.default.PerkFilterString, XPos + PerkXPos, YPos, FontScalar);
Canvas.SetPos (XPos + KillsXPos, YPos); DrawTextWCenter(class'KFGFxHUD_ScoreboardWidget'.default.KillsString, XPos + KillsXPos, YPos, KillsWBox, FontScalar);
Canvas.DrawText (class'KFGFxHUD_ScoreboardWidget'.default.KillsString, , FontScalar, FontScalar); DrawTextWCenter(class'KFGFxHUD_ScoreboardWidget'.default.AssistsString, XPos + AssistXPos, YPos, AssistWBox, FontScalar);
DrawTextWCenter(class'KFGFxHUD_ScoreboardWidget'.default.DoshString, XPos + CashXPos, YPos, CashWBox, FontScalar);
Canvas.SetPos (XPos + AssistXPos, YPos); DrawTextWCenter("HEALTH", XPos + HealthXPos, YPos, HealthWBox, FontScalar);
Canvas.DrawText (class'KFGFxHUD_ScoreboardWidget'.default.AssistsString, , FontScalar, FontScalar); DrawTextWCenter(class'KFGFxHUD_ScoreboardWidget'.default.PingString, XPos + PingXPos, YPos, PingWBox, FontScalar);
Canvas.SetPos (XPos + CashXPos, YPos);
Canvas.DrawText (class'KFGFxHUD_ScoreboardWidget'.default.DoshString, , FontScalar, FontScalar);
Canvas.SetPos (XPos + StateXPos, YPos);
Canvas.DrawText ("STATE", , FontScalar, FontScalar);
Canvas.SetPos (XPos + PlayerXPos, YPos);
Canvas.DrawText (class'KFGFxHUD_ScoreboardWidget'.default.PlayerString, , FontScalar, FontScalar);
Canvas.SetPos (XPos + PingXPos, YPos);
Canvas.DrawText (class'KFGFxHUD_ScoreboardWidget'.default.PingString, , FontScalar, FontScalar);
PlayersList.XPosition = ((Canvas.ClipX - Width) * 0.5) / InputPos[2]; PlayersList.XPosition = ((Canvas.ClipX - Width) * 0.5) / InputPos[2];
PlayersList.YPosition = (YPos + (YL + 4)) / InputPos[3]; PlayersList.YPosition = (YPos + (YL + 4)) / InputPos[3];
@ -225,6 +224,23 @@ function DrawMenu()
PlayersList.ChangeListSize(KFPRIArray.Length); PlayersList.ChangeListSize(KFPRIArray.Length);
} }
function DrawTextWCenter(string Str, float XPos, float YPos, float BoxWidth, float FontScalar)
{
local float TextWidth;
local float TextHeight;
Canvas.TextSize(Str, TextWidth, TextHeight, FontScalar, FontScalar);
Canvas.SetPos(XPos + (BoxWidth - TextWidth)/2 , YPos);
Canvas.DrawText(Str, , FontScalar, FontScalar);
}
function DrawTextWLeft(string Str, float XPos, float YPos, float FontScalar)
{
Canvas.SetPos(XPos, YPos);
Canvas.DrawText(Str, , FontScalar, FontScalar);
}
function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, float Width, bool bFocus ) function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, float Width, bool bFocus )
{ {
local string S, StrValue; local string S, StrValue;
@ -251,6 +267,17 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
C.SetDrawColor(250,250,250,255); C.SetDrawColor(250,250,250,255);
// Status
if (KFPRI.bAdmin)
{
S = "Admin";
}
else
{
S = "Player";
}
DrawTextWLeft(S, StatusXPos, TextYOffset, FontScalar);
// Perk // Perk
if( bIsZED ) if( bIsZED )
{ {
@ -259,8 +286,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
C.DrawRect (Height-5, Height-5, Texture2D'UI_Widgets.MenuBarWidget_SWF_IF'); C.DrawRect (Height-5, Height-5, Texture2D'UI_Widgets.MenuBarWidget_SWF_IF');
S = "ZED"; S = "ZED";
C.SetPos (PerkXPos + Height, TextYOffset); DrawTextWLeft(S, PerkXPos + Height, TextYOffset, FontScalar);
C.DrawText (S, , FontScalar, FontScalar);
} }
else else
{ {
@ -290,15 +316,14 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
} }
C.SetDrawColor(250,250,250,255); C.SetDrawColor(250,250,250,255);
C.SetPos(PerkIconPosX + PerkIconSize + (Owner.HUDOwner.ScaledBorderSize*2), TextYOffset); S = Level@KFPRI.CurrentPerkClass.default.PerkName;
C.DrawText(Level@KFPRI.CurrentPerkClass.default.PerkName, , FontScalar, FontScalar); DrawTextWLeft(S, PerkIconPosX + PerkIconSize + (Owner.HUDOwner.ScaledBorderSize*2), TextYOffset, FontScalar);
} }
else else
{ {
C.SetDrawColor(250,250,250,255); C.SetDrawColor(250,250,250,255);
S = "No Perk"; S = "No Perk";
C.SetPos (PerkXPos + Height, TextYOffset); DrawTextWLeft(S, PerkXPos + Height, TextYOffset, FontScalar);
C.DrawText (S, , FontScalar, FontScalar);
} }
} }
@ -317,25 +342,20 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
CheckAvatar(KFPRI, OwnerPC); CheckAvatar(KFPRI, OwnerPC);
// Player // Player
C.SetPos (PlayerXPos, TextYOffset);
if( Len(KFPRI.PlayerName) > 25 ) if( Len(KFPRI.PlayerName) > 25 )
S = Left(KFPRI.PlayerName, 25); S = Left(KFPRI.PlayerName, 25);
else S = KFPRI.PlayerName; else S = KFPRI.PlayerName;
C.DrawText (S, , FontScalar, FontScalar); DrawTextWLeft(S, PlayerXPos, TextYOffset, FontScalar);
C.SetDrawColor(255,255,255,255); C.SetDrawColor(255,255,255,255);
// Kill // Kill
C.SetPos (KillsXPos, TextYOffset); DrawTextWCenter(string (KFPRI.Kills), KillsXPos, TextYOffset, KillsWBox, FontScalar);
C.DrawText (string (KFPRI.Kills), , FontScalar, FontScalar);
// Assist // Assist
C.SetPos (AssistXPos, TextYOffset); DrawTextWCenter(string (KFPRI.Assists), AssistXPos, TextYOffset, AssistWBox, FontScalar);
C.DrawText (string (KFPRI.Assists), , FontScalar, FontScalar);
// Cash // Cash
C.SetPos (CashXPos, TextYOffset);
if( bIsZED ) if( bIsZED )
{ {
C.SetDrawColor(250, 0, 0, 255); C.SetDrawColor(250, 0, 0, 255);
@ -346,11 +366,11 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
C.SetDrawColor(250, 250, 100, 255); C.SetDrawColor(250, 250, 100, 255);
StrValue = GetNiceSize(int(KFPRI.Score)); StrValue = GetNiceSize(int(KFPRI.Score));
} }
C.DrawText (StrValue, , FontScalar, FontScalar); DrawTextWCenter(StrValue, CashXPos, TextYOffset, CashWBox, FontScalar);
C.SetDrawColor(255,255,255,255); C.SetDrawColor(255,255,255,255);
// State // Health
if( !KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun ) if( !KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun )
{ {
C.SetDrawColor(250,0,0,255); C.SetDrawColor(250,0,0,255);
@ -381,9 +401,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
S = string (KFPRI.PlayerHealth) @"HP"; S = string (KFPRI.PlayerHealth) @"HP";
} }
DrawTextWCenter(S, HealthXPos, TextYOffset, HealthWBox, FontScalar);
C.SetPos (StateXPos, TextYOffset);
C.DrawText (S, , FontScalar, FontScalar);
C.SetDrawColor(250,250,250,255); C.SetDrawColor(250,250,250,255);
@ -405,8 +423,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
C.TextSize(MaxPing, XL, YL, FontScalar, FontScalar); C.TextSize(MaxPing, XL, YL, FontScalar, FontScalar);
C.SetPos(PingXPos, TextYOffset); DrawTextWLeft(S, PingXPos, TextYOffset, FontScalar);
C.DrawText(S,, FontScalar, FontScalar);
DrawPingBars(C, YOffset + (Height/2) - ((Height*0.5)/2), Width - (Height*0.5) - (Owner.HUDOwner.ScaledBorderSize*2), Height*0.5, Height*0.5, float(Ping)); DrawPingBars(C, YOffset + (Height/2) - ((Height*0.5)/2), Width - (Height*0.5) - (Owner.HUDOwner.ScaledBorderSize*2), Height*0.5, Height*0.5, float(Ping));
} }