dynamic column width, crop name if needed, dosh as is

This commit is contained in:
GenZmeY 2021-06-14 16:45:40 +03:00
parent c8dd2c0411
commit bbe93f13d4
6 changed files with 48 additions and 5 deletions

View File

@ -0,0 +1,6 @@
[h1]there should be a description, but there isn't one :( [/h1]
I will definitely write in more detail (but a little later)
[h1]Sources:[/h1]
[u]https://github.com/GenZmeY/KF2-ScoreboardExt[/u] [b](GNU GPLv3)[/b]

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB

View File

@ -0,0 +1 @@
Mutators

View File

@ -0,0 +1 @@
ScoreboardExt

View File

@ -20,6 +20,9 @@ var KFPlayerController OwnerPC;
var Color PingColor; var Color PingColor;
var float PingBars; var float PingBars;
// Cache
var array<String> PerkNames;
// Ranks // Ranks
var array<RankInfo> CustomRanks; var array<RankInfo> CustomRanks;
var array<UIDRankRelation> RankRelations; var array<UIDRankRelation> RankRelations;
@ -39,9 +42,26 @@ var localized string Dead;
function InitMenu() function InitMenu()
{ {
`callstack();
Super.InitMenu(); Super.InitMenu();
PlayersList = KFGUI_List(FindComponentID('PlayerList')); PlayersList = KFGUI_List(FindComponentID('PlayerList'));
OwnerPC = KFPlayerController(GetPlayer()); OwnerPC = KFPlayerController(GetPlayer());
if (PerkNames.Length == 0)
{
PerkNames.AddItem(class'KFGFxMenu_Inventory'.default.PerkFilterString);
PerkNames.AddItem(class'KFPerk_Berserker'.default.PerkName);
PerkNames.AddItem(class'KFPerk_Commando'.default.PerkName);
PerkNames.AddItem(class'KFPerk_Support'.default.PerkName);
PerkNames.AddItem(class'KFPerk_FieldMedic'.default.PerkName);
PerkNames.AddItem(class'KFPerk_Demolitionist'.default.PerkName);
PerkNames.AddItem(class'KFPerk_Firebug'.default.PerkName);
PerkNames.AddItem(class'KFPerk_Gunslinger'.default.PerkName);
PerkNames.AddItem(class'KFPerk_Sharpshooter'.default.PerkName);
PerkNames.AddItem(class'KFPerk_SWAT'.default.PerkName);
PerkNames.AddItem(class'KFPerk_Survivalist'.default.PerkName);
}
} }
static function CheckAvatar(KFPlayerReplicationInfo KFPRI, KFPlayerController PC) static function CheckAvatar(KFPlayerReplicationInfo KFPRI, KFPlayerController PC)
@ -109,7 +129,7 @@ function DrawMenu()
local PlayerController PC; local PlayerController PC;
local KFPlayerReplicationInfo KFPRI; local KFPlayerReplicationInfo KFPRI;
local PlayerReplicationInfo PRI; local PlayerReplicationInfo PRI;
local float XPos, YPos, YL, XL, FontScalar, XPosCenter, BoxW, BoxX, BoxH, MinBoxW; local float XPos, YPos, YL, XL, FontScalar, XPosCenter, BoxW, BoxX, BoxH, MinBoxW, DoshSize;
local int i, j, NumSpec, NumPlayer, NumAlivePlayer, Width; local int i, j, NumSpec, NumPlayer, NumAlivePlayer, Width;
local float BorderSize; local float BorderSize;
@ -263,7 +283,6 @@ function DrawMenu()
RankXPos = Owner.HUDOwner.ScaledBorderSize * 8 + Settings.Style.EdgeSize; RankXPos = Owner.HUDOwner.ScaledBorderSize * 8 + Settings.Style.EdgeSize;
PlayerXPos = Width * 0.20; PlayerXPos = Width * 0.20;
PerkXPos = Width * 0.40;
Canvas.TextSize(class'KFGFxHUD_ScoreboardWidget'.default.PingString$" ", XL, YL, FontScalar, FontScalar); Canvas.TextSize(class'KFGFxHUD_ScoreboardWidget'.default.PingString$" ", XL, YL, FontScalar, FontScalar);
PingXPos = Width - (XL < MinBoxW ? MinBoxW : XL); PingXPos = Width - (XL < MinBoxW ? MinBoxW : XL);
@ -278,7 +297,17 @@ 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);
CashXPos = KillsXPos - (XL < MinBoxW ? MinBoxW : XL); Canvas.TextSize("99999", DoshSize, YL, FontScalar, FontScalar);
CashXPos = KillsXPos - (XL < DoshSize ? DoshSize : XL);
BoxW = 0;
foreach PerkNames(S)
{
// PerkName + 2 Space + 2 Symbols for level
Canvas.TextSize(S$" 99", XL, YL, FontScalar, FontScalar);
if (XL > BoxW) BoxW = XL;
}
PerkXPos = CashXPos - (BoxW < MinBoxW ? MinBoxW : BoxW);
StatusWBox = PlayerXPos - RankXPos; StatusWBox = PlayerXPos - RankXPos;
PlayerWBox = PerkXPos - PlayerXPos; PlayerWBox = PerkXPos - PlayerXPos;
@ -587,6 +616,12 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
else else
SetDrawColor(C, Settings.Style.PlayerNameTextColor); SetDrawColor(C, Settings.Style.PlayerNameTextColor);
S = KFPRI.PlayerName; S = KFPRI.PlayerName;
Canvas.TextSize(S, XL, YL, FontScalar, FontScalar);
while (XL > PlayerWBox)
{
S = Left(S, Len(S)-1);
Canvas.TextSize(S, XL, YL, FontScalar, FontScalar);
}
DrawTextShadowHLeftVCenter(S, PlayerXPos, TextYOffset, FontScalar); DrawTextShadowHLeftVCenter(S, PlayerXPos, TextYOffset, FontScalar);
// Kill // Kill
@ -615,7 +650,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
SetDrawColor(C, CurrentRank.TextColor); SetDrawColor(C, CurrentRank.TextColor);
else else
SetDrawColor(C, Settings.Style.DoshTextColor); SetDrawColor(C, Settings.Style.DoshTextColor);
StrValue = GetNiceSize(int(KFPRI.Score)); StrValue = String(int(KFPRI.Score)); //StrValue = GetNiceSize(int(KFPRI.Score));
} }
DrawTextShadowHVCenter(StrValue, CashXPos, TextYOffset, CashWBox, FontScalar); DrawTextShadowHVCenter(StrValue, CashXPos, TextYOffset, CashWBox, FontScalar);

View File

@ -5,5 +5,5 @@
`define error(text) `scelog("[ERROR]"@`text, true) `define error(text) `scelog("[ERROR]"@`text, true)
`define debug(text) if (`bEnableDebug) { `scelog("[DEBUG]"@`text, `bEnableDebug); } `define debug(text) if (`bEnableDebug) { `scelog("[DEBUG]"@`text, `bEnableDebug); }
`define callstack() if (`bEnableCallstack) { `scelog("[CALLSTACK]"@`Location@"ROLE="$ROLE, `bEnableCallstack); } `define callstack() if (`bEnableCallstack) { `scelog("[CALLSTACK]"@`Location, `bEnableCallstack); }
`define callstack_static(text) if (`bEnableCallstack) { `scelog("[CALLSTACK]"@`text, `bEnableCallstack); } `define callstack_static(text) if (`bEnableCallstack) { `scelog("[CALLSTACK]"@`text, `bEnableCallstack); }