2021-05-31 01:46:53 +00:00
|
|
|
class KFScoreBoard extends KFGUI_Page
|
|
|
|
dependson(Types);
|
2020-01-10 13:14:11 +00:00
|
|
|
|
2021-05-16 09:40:02 +00:00
|
|
|
var transient float StatusXPos, PerkXPos, PlayerXPos, HealthXPos, TimeXPos, KillsXPos, AssistXPos, CashXPos, DeathXPos, PingXPos;
|
|
|
|
var transient float StatusWBox, PlayerWBox, PerkWBox, CashWBox, KillsWBox, AssistWBox, HealthWBox, PingWBox;
|
2020-01-10 13:14:11 +00:00
|
|
|
var transient float NextScoreboardRefresh;
|
|
|
|
|
|
|
|
var int PlayerIndex;
|
|
|
|
var KFGUI_List PlayersList;
|
|
|
|
var Texture2D DefaultAvatar;
|
|
|
|
|
|
|
|
var KFGameReplicationInfo KFGRI;
|
|
|
|
var array<KFPlayerReplicationInfo> KFPRIArray;
|
|
|
|
|
|
|
|
var KFPlayerController OwnerPC;
|
|
|
|
|
|
|
|
var Color PingColor;
|
|
|
|
var float PingBars,IdealPing,MaxPing;
|
|
|
|
|
2021-05-31 01:46:53 +00:00
|
|
|
// Groups
|
|
|
|
var array<PlayerGroupEntry> PlayerGroups;
|
|
|
|
var array<UIDInfoEntry> PlayerInfos;
|
|
|
|
|
|
|
|
var string SystemAdminRank;
|
|
|
|
var TextColor SystemAdminColor;
|
|
|
|
var Fields SystemAdminApplyColorToFields;
|
|
|
|
|
|
|
|
var string SystemPlayerRank;
|
|
|
|
var TextColor SystemPlayerColor;
|
|
|
|
var Fields SystemPlayerApplyColorToFields;
|
|
|
|
|
2020-01-10 13:14:11 +00:00
|
|
|
function InitMenu()
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
Super.InitMenu();
|
|
|
|
PlayersList = KFGUI_List(FindComponentID('PlayerList'));
|
|
|
|
OwnerPC = KFPlayerController(GetPlayer());
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static function CheckAvatar(KFPlayerReplicationInfo KFPRI, KFPlayerController PC)
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
local Texture2D Avatar;
|
|
|
|
|
|
|
|
if( KFPRI.Avatar == None || KFPRI.Avatar == default.DefaultAvatar )
|
|
|
|
{
|
|
|
|
Avatar = FindAvatar(PC, KFPRI.UniqueId);
|
|
|
|
if( Avatar == None )
|
|
|
|
Avatar = default.DefaultAvatar;
|
|
|
|
|
|
|
|
KFPRI.Avatar = Avatar;
|
|
|
|
}
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
delegate bool InOrder( KFPlayerReplicationInfo P1, KFPlayerReplicationInfo P2 )
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
if( P1 == None || P2 == None )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if( P1.GetTeamNum() < P2.GetTeamNum() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if( P1.Kills == P2.Kills )
|
|
|
|
{
|
|
|
|
if( P1.Assists == P2.Assists )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return P1.Assists < P2.Assists;
|
|
|
|
}
|
|
|
|
|
|
|
|
return P1.Kills < P2.Kills;
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function DrawMenu()
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
local string S;
|
|
|
|
local PlayerController PC;
|
|
|
|
local KFPlayerReplicationInfo KFPRI;
|
|
|
|
local PlayerReplicationInfo PRI;
|
2021-05-26 23:56:29 +00:00
|
|
|
local float XPos, YPos, YL, XL, FontScalar, XPosCenter, BoxW, BoxX, BoxH;
|
2021-05-16 09:40:02 +00:00
|
|
|
local int i, j, NumSpec, NumPlayer, NumAlivePlayer, Width;
|
|
|
|
|
|
|
|
PC = GetPlayer();
|
|
|
|
if( KFGRI==None )
|
|
|
|
{
|
|
|
|
KFGRI = KFGameReplicationInfo(PC.WorldInfo.GRI);
|
|
|
|
if( KFGRI==None )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Sort player list.
|
|
|
|
if( NextScoreboardRefresh < PC.WorldInfo.TimeSeconds )
|
|
|
|
{
|
|
|
|
NextScoreboardRefresh = PC.WorldInfo.TimeSeconds + 0.1;
|
|
|
|
|
|
|
|
for( i=(KFGRI.PRIArray.Length-1); i>0; --i )
|
|
|
|
{
|
|
|
|
for( j=i-1; j>=0; --j )
|
|
|
|
{
|
|
|
|
if( !InOrder(KFPlayerReplicationInfo(KFGRI.PRIArray[i]),KFPlayerReplicationInfo(KFGRI.PRIArray[j])) )
|
|
|
|
{
|
|
|
|
PRI = KFGRI.PRIArray[i];
|
|
|
|
KFGRI.PRIArray[i] = KFGRI.PRIArray[j];
|
|
|
|
KFGRI.PRIArray[j] = PRI;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check players.
|
|
|
|
PlayerIndex = -1;
|
|
|
|
NumPlayer = 0;
|
|
|
|
for( i=(KFGRI.PRIArray.Length-1); i>=0; --i )
|
|
|
|
{
|
|
|
|
KFPRI = KFPlayerReplicationInfo(KFGRI.PRIArray[i]);
|
|
|
|
if( KFPRI==None )
|
|
|
|
continue;
|
|
|
|
if( KFPRI.bOnlySpectator )
|
|
|
|
{
|
|
|
|
++NumSpec;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if( KFPRI.PlayerHealth>0 && KFPRI.PlayerHealthPercent>0 && KFPRI.GetTeamNum()==0 )
|
|
|
|
++NumAlivePlayer;
|
|
|
|
++NumPlayer;
|
|
|
|
}
|
|
|
|
|
|
|
|
KFPRIArray.Length = NumPlayer;
|
|
|
|
j = KFPRIArray.Length;
|
|
|
|
for( i=(KFGRI.PRIArray.Length-1); i>=0; --i )
|
|
|
|
{
|
|
|
|
KFPRI = KFPlayerReplicationInfo(KFGRI.PRIArray[i]);
|
|
|
|
if( KFPRI!=None && !KFPRI.bOnlySpectator )
|
|
|
|
{
|
|
|
|
KFPRIArray[--j] = KFPRI;
|
|
|
|
if( KFPRI==PC.PlayerReplicationInfo )
|
|
|
|
PlayerIndex = j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Header font info.
|
|
|
|
Canvas.Font = Owner.CurrentStyle.PickFont(FontScalar);
|
|
|
|
|
|
|
|
XPosCenter = (Canvas.ClipX * 0.5);
|
|
|
|
|
|
|
|
// Server Name
|
|
|
|
|
|
|
|
S = KFGRI.ServerName;
|
|
|
|
Canvas.TextSize(S, XL, YL, FontScalar, FontScalar);
|
2021-05-26 23:56:29 +00:00
|
|
|
|
|
|
|
XPos = XPosCenter;
|
|
|
|
YPos += YL;
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
BoxW = XL + (Owner.HUDOwner.ScaledBorderSize*4);
|
|
|
|
BoxX = XPos - (BoxW * 0.5);
|
2021-05-26 23:56:29 +00:00
|
|
|
BoxH = YL + (Owner.HUDOwner.ScaledBorderSize);
|
2021-05-16 09:40:02 +00:00
|
|
|
Canvas.SetDrawColor(10, 10, 10, 200);
|
2021-05-26 23:56:29 +00:00
|
|
|
Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, BoxH, 4);
|
2021-05-16 09:40:02 +00:00
|
|
|
Canvas.SetDrawColor(250, 0, 0, 255);
|
|
|
|
|
2021-05-26 23:56:29 +00:00
|
|
|
Owner.CurrentStyle.DrawTextShadow(S, BoxX + ((BoxW-XL) * 0.5f), YPos, 1, FontScalar);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
// Deficulty | Wave | MapName
|
|
|
|
|
|
|
|
XPos = XPosCenter;
|
2021-05-26 23:56:29 +00:00
|
|
|
YPos += YL+Owner.HUDOwner.ScaledBorderSize*2;
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
S = Class'KFCommon_LocalizedStrings'.Static.GetDifficultyString (KFGRI.GameDifficulty) $" | "$class'KFGFxHUD_ScoreboardMapInfoContainer'.default.WaveString@KFGRI.WaveNum $" | " $class'KFCommon_LocalizedStrings'.static.GetFriendlyMapName(PC.WorldInfo.GetMapName(true));
|
|
|
|
Canvas.TextSize(S, XL, YL, FontScalar, FontScalar);
|
|
|
|
|
|
|
|
BoxW = XL + (Owner.HUDOwner.ScaledBorderSize*4);
|
|
|
|
BoxX = XPos - (BoxW * 0.5);
|
|
|
|
Canvas.SetDrawColor(10, 10, 10, 200);
|
2021-05-26 23:56:29 +00:00
|
|
|
Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, BoxH, 4);
|
2021-05-16 09:40:02 +00:00
|
|
|
Canvas.SetDrawColor(0, 250, 0, 255);
|
|
|
|
|
2021-05-26 23:56:29 +00:00
|
|
|
Owner.CurrentStyle.DrawTextShadow(S, BoxX + ((BoxW-XL) * 0.5f), YPos, 1, FontScalar);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
// Players | Spectators | Alive | Time
|
|
|
|
|
|
|
|
XPos = XPosCenter;
|
2021-05-26 23:56:29 +00:00
|
|
|
YPos += YL+Owner.HUDOwner.ScaledBorderSize*2;
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
S = " Players : " $ NumPlayer $ " | Spectators : " $ NumSpec $ " | Alive : " $ NumAlivePlayer $ " | Elapsed Time : " $ Owner.CurrentStyle.GetTimeString(KFGRI.ElapsedTime) $ " ";
|
|
|
|
Canvas.TextSize(S, XL, YL, FontScalar, FontScalar);
|
|
|
|
|
|
|
|
BoxW = XL + (Owner.HUDOwner.ScaledBorderSize*4);
|
|
|
|
BoxX = XPos - (BoxW * 0.5);
|
|
|
|
Canvas.SetDrawColor(10, 10, 10, 200);
|
2021-05-26 23:56:29 +00:00
|
|
|
Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, BoxH, 4);
|
2021-05-16 09:40:02 +00:00
|
|
|
Canvas.SetDrawColor(250, 250, 0, 255);
|
|
|
|
|
2021-05-26 23:56:29 +00:00
|
|
|
Owner.CurrentStyle.DrawTextShadow(S, BoxX + ((BoxW-XL) * 0.5f), YPos, 1, FontScalar);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
Width = Canvas.ClipX * 0.625;
|
|
|
|
|
|
|
|
XPos = (Canvas.ClipX - Width) * 0.5;
|
2021-05-26 23:56:29 +00:00
|
|
|
YPos += YL * 2.0;
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
Canvas.SetDrawColor (10, 10, 10, 200);
|
2021-05-26 23:56:29 +00:00
|
|
|
Owner.CurrentStyle.DrawRectBox(XPos, YPos, Width, BoxH, 4);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
Canvas.SetDrawColor(250, 250, 250, 255);
|
|
|
|
|
|
|
|
// Calc X offsets
|
|
|
|
StatusXPos = Width * 0.01;
|
|
|
|
PlayerXPos = Width * 0.20;
|
|
|
|
PerkXPos = Width * 0.40;
|
|
|
|
CashXPos = Width * 0.57;
|
|
|
|
KillsXPos = Width * 0.66;
|
|
|
|
AssistXPos = Width * 0.75;
|
|
|
|
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
|
2021-05-25 00:45:49 +00:00
|
|
|
DrawTextShadowHLeftVCenter("STATUS", XPos + StatusXPos, YPos, FontScalar);
|
|
|
|
DrawTextShadowHLeftVCenter(class'KFGFxHUD_ScoreboardWidget'.default.PlayerString, XPos + PlayerXPos, YPos, FontScalar);
|
|
|
|
DrawTextShadowHLeftVCenter(class'KFGFxMenu_Inventory'.default.PerkFilterString, XPos + PerkXPos, YPos, FontScalar);
|
|
|
|
DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.KillsString, XPos + KillsXPos, YPos, KillsWBox, FontScalar);
|
|
|
|
DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.AssistsString, XPos + AssistXPos, YPos, AssistWBox, FontScalar);
|
|
|
|
DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.DoshString, XPos + CashXPos, YPos, CashWBox, FontScalar);
|
|
|
|
DrawTextShadowHVCenter("HEALTH", XPos + HealthXPos, YPos, HealthWBox, FontScalar);
|
|
|
|
DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.PingString, XPos + PingXPos, YPos, PingWBox, FontScalar);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
PlayersList.XPosition = ((Canvas.ClipX - Width) * 0.5) / InputPos[2];
|
2021-05-28 21:46:45 +00:00
|
|
|
PlayersList.YPosition = (YPos + (YL + Owner.HUDOwner.ScaledBorderSize*2)) / InputPos[3];
|
2021-05-16 09:40:02 +00:00
|
|
|
PlayersList.YSize = (1.f - PlayersList.YPosition) - 0.15;
|
|
|
|
|
|
|
|
PlayersList.ChangeListSize(KFPRIArray.Length);
|
|
|
|
}
|
|
|
|
|
2021-05-25 00:45:49 +00:00
|
|
|
function DrawTextShadowHVCenter(string Str, float XPos, float YPos, float BoxWidth, float FontScalar)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
|
|
|
local float TextWidth;
|
|
|
|
local float TextHeight;
|
|
|
|
|
|
|
|
Canvas.TextSize(Str, TextWidth, TextHeight, FontScalar, FontScalar);
|
|
|
|
|
2021-05-16 20:29:34 +00:00
|
|
|
Owner.CurrentStyle.DrawTextShadow(Str, XPos + (BoxWidth - TextWidth)/2 , YPos, 1, FontScalar);
|
2021-05-16 09:40:02 +00:00
|
|
|
}
|
|
|
|
|
2021-05-25 00:45:49 +00:00
|
|
|
function DrawTextShadowHLeftVCenter(string Str, float XPos, float YPos, float FontScalar)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
2021-05-16 20:28:37 +00:00
|
|
|
Owner.CurrentStyle.DrawTextShadow(Str, XPos, YPos, 1, FontScalar);
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, float Width, bool bFocus )
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
local string S, StrValue;
|
|
|
|
local float FontScalar, TextYOffset, XL, YL, PerkIconPosX, PerkIconPosY, PerkIconSize, PrestigeIconScale;
|
|
|
|
local KFPlayerReplicationInfo KFPRI;
|
|
|
|
local byte Level, PrestigeLevel;
|
|
|
|
local bool bIsZED;
|
|
|
|
local int Ping;
|
2021-05-31 01:46:53 +00:00
|
|
|
|
|
|
|
local PlayerGroupEntry Group;
|
|
|
|
local bool HasGroup;
|
|
|
|
local int PlayerInfoIndex, PlayerGroupIndex;
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
YOffset *= 1.05;
|
|
|
|
KFPRI = KFPRIArray[Index];
|
2021-05-31 01:46:53 +00:00
|
|
|
|
|
|
|
HasGroup = false;
|
|
|
|
PlayerInfoIndex = PlayerInfos.Find('UID', KFPRI.UniqueId);
|
|
|
|
if (PlayerInfoIndex != INDEX_NONE )
|
|
|
|
{
|
|
|
|
PlayerGroupIndex = PlayerGroups.Find('ID', PlayerInfos[PlayerInfoIndex].GroupID);
|
|
|
|
if (PlayerGroupIndex != INDEX_NONE)
|
|
|
|
{
|
|
|
|
HasGroup = true;
|
|
|
|
Group = PlayerGroups[PlayerGroupIndex];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (KFPRI.bAdmin)
|
|
|
|
{
|
|
|
|
if (!HasGroup || (HasGroup && !Group.OverrideAdminRank))
|
|
|
|
{
|
|
|
|
Group.Rank = SystemAdminRank;
|
|
|
|
Group.Color = SystemAdminColor;
|
|
|
|
Group.ApplyColorToFields = SystemAdminApplyColorToFields;
|
|
|
|
HasGroup = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else // Player
|
|
|
|
{
|
|
|
|
if (!HasGroup)
|
|
|
|
{
|
|
|
|
Group.Rank = SystemPlayerRank;
|
|
|
|
Group.Color = SystemPlayerColor;
|
|
|
|
Group.ApplyColorToFields = SystemPlayerApplyColorToFields;
|
|
|
|
HasGroup = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Now all players belongs to 'Group'
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
if( KFGRI.bVersusGame )
|
|
|
|
bIsZED = KFTeamInfo_Zeds(KFPRI.Team) != None;
|
|
|
|
|
|
|
|
C.Font = Owner.CurrentStyle.PickFont(FontScalar);
|
|
|
|
|
2021-05-26 23:56:29 +00:00
|
|
|
Canvas.TextSize("ABC", XL, YL, FontScalar, FontScalar);
|
|
|
|
|
|
|
|
TextYOffset = YOffset + (Height * 0.5f) - (YL * 0.5f);
|
2021-05-16 09:40:02 +00:00
|
|
|
if (PlayerIndex == Index)
|
|
|
|
C.SetDrawColor (51, 30, 101, 150);
|
|
|
|
else C.SetDrawColor (30, 30, 30, 150);
|
|
|
|
|
|
|
|
Owner.CurrentStyle.DrawRectBox(0.f, YOffset, Width, Height, 4);
|
|
|
|
|
|
|
|
C.SetDrawColor(250,250,250,255);
|
|
|
|
|
2021-05-31 01:46:53 +00:00
|
|
|
// Rank
|
|
|
|
if (Group.ApplyColorToFields.Rank)
|
|
|
|
C.SetDrawColor(Group.Color.R,Group.Color.G,Group.Color.B,255);
|
|
|
|
S = Group.Rank;
|
2021-05-25 00:45:49 +00:00
|
|
|
DrawTextShadowHLeftVCenter(S, StatusXPos, TextYOffset, FontScalar);
|
2021-05-31 01:46:53 +00:00
|
|
|
C.SetDrawColor(250,250,250,255);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
// Perk
|
|
|
|
if( bIsZED )
|
|
|
|
{
|
|
|
|
C.SetDrawColor(255,0,0,255);
|
2021-05-31 01:46:53 +00:00
|
|
|
if (Group.ApplyColorToFields.Perk)
|
|
|
|
C.SetDrawColor(Group.Color.R,Group.Color.G,Group.Color.B,255);
|
2021-05-16 09:40:02 +00:00
|
|
|
C.SetPos (PerkXPos, YOffset - ((Height-5) * 0.5f));
|
|
|
|
C.DrawRect (Height-5, Height-5, Texture2D'UI_Widgets.MenuBarWidget_SWF_IF');
|
|
|
|
|
|
|
|
S = "ZED";
|
2021-05-25 00:45:49 +00:00
|
|
|
DrawTextShadowHLeftVCenter(S, PerkXPos + Height, TextYOffset, FontScalar);
|
2021-05-16 09:40:02 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( KFPRI.CurrentPerkClass!=None )
|
|
|
|
{
|
2020-01-10 13:14:11 +00:00
|
|
|
PrestigeLevel = KFPRI.GetActivePerkPrestigeLevel();
|
|
|
|
Level = KFPRI.GetActivePerkLevel();
|
2021-05-16 09:40:02 +00:00
|
|
|
|
2020-01-10 13:14:11 +00:00
|
|
|
PerkIconPosY = YOffset + (Owner.HUDOwner.ScaledBorderSize * 2);
|
|
|
|
PerkIconSize = Height-(Owner.HUDOwner.ScaledBorderSize * 4);
|
2021-05-27 00:37:53 +00:00
|
|
|
PerkIconPosX = PerkXPos - PerkIconSize - (Owner.HUDOwner.ScaledBorderSize*2);
|
2020-01-10 13:14:11 +00:00
|
|
|
PrestigeIconScale = 0.6625f;
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
C.DrawColor = HUDOwner.WhiteColor;
|
2020-01-10 13:14:11 +00:00
|
|
|
if (PrestigeLevel > 0)
|
|
|
|
{
|
|
|
|
C.SetPos(PerkIconPosX, PerkIconPosY);
|
|
|
|
C.DrawTile(KFPRI.CurrentPerkClass.default.PrestigeIcons[PrestigeLevel - 1], PerkIconSize, PerkIconSize, 0, 0, 256, 256);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
2020-01-10 13:14:11 +00:00
|
|
|
C.SetPos(PerkIconPosX + ((PerkIconSize/2) - ((PerkIconSize*PrestigeIconScale)/2)), PerkIconPosY + ((PerkIconSize/2) - ((PerkIconSize*PrestigeIconScale)/1.75)));
|
|
|
|
C.DrawTile(KFPRI.CurrentPerkClass.default.PerkIcon, PerkIconSize * PrestigeIconScale, PerkIconSize * PrestigeIconScale, 0, 0, 256, 256);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
C.SetPos(PerkIconPosX, PerkIconPosY);
|
|
|
|
C.DrawTile(KFPRI.CurrentPerkClass.default.PerkIcon, PerkIconSize, PerkIconSize, 0, 0, 256, 256);
|
|
|
|
}
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
C.SetDrawColor(250,250,250,255);
|
2021-05-31 01:46:53 +00:00
|
|
|
if (Group.ApplyColorToFields.Perk)
|
|
|
|
C.SetDrawColor(Group.Color.R,Group.Color.G,Group.Color.B,255);
|
2021-05-16 09:40:02 +00:00
|
|
|
S = Level@KFPRI.CurrentPerkClass.default.PerkName;
|
2021-05-27 00:37:53 +00:00
|
|
|
DrawTextShadowHLeftVCenter(S, PerkXPos, TextYOffset, FontScalar);
|
2021-05-16 09:40:02 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-01-10 13:14:11 +00:00
|
|
|
C.SetDrawColor(250,250,250,255);
|
2021-05-31 01:46:53 +00:00
|
|
|
if (Group.ApplyColorToFields.Perk)
|
|
|
|
C.SetDrawColor(Group.Color.R,Group.Color.G,Group.Color.B,255);
|
2021-05-16 09:40:02 +00:00
|
|
|
S = "No Perk";
|
2021-05-27 00:37:53 +00:00
|
|
|
DrawTextShadowHLeftVCenter(S, PerkXPos, TextYOffset, FontScalar);
|
2021-05-16 09:40:02 +00:00
|
|
|
}
|
|
|
|
}
|
2021-05-31 01:46:53 +00:00
|
|
|
C.SetDrawColor(250,250,250,255);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
// Avatar
|
|
|
|
if( KFPRI.Avatar != None )
|
|
|
|
{
|
|
|
|
if( KFPRI.Avatar == default.DefaultAvatar )
|
|
|
|
CheckAvatar(KFPRI, OwnerPC);
|
|
|
|
|
|
|
|
C.SetDrawColor(255,255,255,255);
|
|
|
|
C.SetPos(PlayerXPos - (Height * 1.075), YOffset + (Height * 0.5f) - ((Height - 6) * 0.5f));
|
|
|
|
C.DrawTile(KFPRI.Avatar,Height - 6,Height - 6,0,0,KFPRI.Avatar.SizeX,KFPRI.Avatar.SizeY);
|
|
|
|
Owner.CurrentStyle.DrawBoxHollow(PlayerXPos - (Height * 1.075), YOffset + (Height * 0.5f) - ((Height - 6) * 0.5f), Height - 6, Height - 6, 1);
|
|
|
|
}
|
|
|
|
else if( !KFPRI.bBot )
|
|
|
|
CheckAvatar(KFPRI, OwnerPC);
|
2021-05-31 01:46:53 +00:00
|
|
|
C.SetDrawColor(250,250,250,255);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
// Player
|
2021-05-31 01:46:53 +00:00
|
|
|
if (Group.ApplyColorToFields.Player)
|
|
|
|
C.SetDrawColor(Group.Color.R,Group.Color.G,Group.Color.B,255);
|
2021-05-16 09:40:02 +00:00
|
|
|
if( Len(KFPRI.PlayerName) > 25 )
|
|
|
|
S = Left(KFPRI.PlayerName, 25);
|
|
|
|
else S = KFPRI.PlayerName;
|
2021-05-25 00:45:49 +00:00
|
|
|
DrawTextShadowHLeftVCenter(S, PlayerXPos, TextYOffset, FontScalar);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
2021-05-31 01:46:53 +00:00
|
|
|
C.SetDrawColor(250,250,250,255);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
// Kill
|
2021-05-31 01:46:53 +00:00
|
|
|
if (Group.ApplyColorToFields.Kills)
|
|
|
|
C.SetDrawColor(Group.Color.R,Group.Color.G,Group.Color.B,255);
|
2021-05-25 00:45:49 +00:00
|
|
|
DrawTextShadowHVCenter(string (KFPRI.Kills), KillsXPos, TextYOffset, KillsWBox, FontScalar);
|
2021-05-31 01:46:53 +00:00
|
|
|
C.SetDrawColor(250,250,250,255);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
// Assist
|
2021-05-31 01:46:53 +00:00
|
|
|
if (Group.ApplyColorToFields.Assists)
|
|
|
|
C.SetDrawColor(Group.Color.R,Group.Color.G,Group.Color.B,255);
|
2021-05-25 00:45:49 +00:00
|
|
|
DrawTextShadowHVCenter(string (KFPRI.Assists), AssistXPos, TextYOffset, AssistWBox, FontScalar);
|
2021-05-31 01:46:53 +00:00
|
|
|
C.SetDrawColor(250,250,250,255);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
// Cash
|
|
|
|
if( bIsZED )
|
|
|
|
{
|
|
|
|
C.SetDrawColor(250, 0, 0, 255);
|
|
|
|
StrValue = "Brains!";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
C.SetDrawColor(250, 250, 100, 255);
|
|
|
|
StrValue = GetNiceSize(int(KFPRI.Score));
|
|
|
|
}
|
2021-05-31 01:46:53 +00:00
|
|
|
if (Group.ApplyColorToFields.Dosh)
|
|
|
|
C.SetDrawColor(Group.Color.R,Group.Color.G,Group.Color.B,255);
|
2021-05-25 00:45:49 +00:00
|
|
|
DrawTextShadowHVCenter(StrValue, CashXPos, TextYOffset, CashWBox, FontScalar);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
2021-05-31 01:46:53 +00:00
|
|
|
C.SetDrawColor(250,250,250,255);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
// Health
|
|
|
|
if( !KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun )
|
|
|
|
{
|
|
|
|
C.SetDrawColor(250,0,0,255);
|
|
|
|
S = "LOBBY";
|
|
|
|
}
|
|
|
|
else if( !KFGRI.bMatchHasBegun )
|
|
|
|
{
|
|
|
|
C.SetDrawColor(250,0,0,255);
|
|
|
|
S = KFPRI.bReadyToPlay ? "Ready" : "Not Ready";
|
|
|
|
}
|
|
|
|
else if( bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None )
|
|
|
|
{
|
|
|
|
C.SetDrawColor(250,0,0,255);
|
|
|
|
S = "Unknown";
|
|
|
|
}
|
|
|
|
else if (KFPRI.PlayerHealth <= 0 || KFPRI.PlayerHealthPercent <= 0)
|
|
|
|
{
|
|
|
|
C.SetDrawColor(250,0,0,255);
|
|
|
|
S = (KFPRI.bOnlySpectator) ? "Spectator" : "DEAD";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ByteToFloat(KFPRI.PlayerHealthPercent) >= 0.8)
|
|
|
|
C.SetDrawColor(0,250,0,255);
|
|
|
|
else if (ByteToFloat(KFPRI.PlayerHealthPercent) >= 0.4)
|
|
|
|
C.SetDrawColor(250,250,0,255);
|
|
|
|
else C.SetDrawColor(250,100,100,255);
|
|
|
|
|
|
|
|
S = string (KFPRI.PlayerHealth) @"HP";
|
|
|
|
}
|
2021-05-31 01:46:53 +00:00
|
|
|
if (Group.ApplyColorToFields.Health)
|
|
|
|
C.SetDrawColor(Group.Color.R,Group.Color.G,Group.Color.B,255);
|
2021-05-25 00:45:49 +00:00
|
|
|
DrawTextShadowHVCenter(S, HealthXPos, TextYOffset, HealthWBox, FontScalar);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
C.SetDrawColor(250,250,250,255);
|
|
|
|
|
|
|
|
// Ping
|
|
|
|
if (KFPRI.bBot)
|
|
|
|
S = "-";
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Ping = int(KFPRI.Ping * `PING_SCALE);
|
|
|
|
|
|
|
|
if (Ping <= 100)
|
|
|
|
C.SetDrawColor(0,250,0,255);
|
|
|
|
else if (Ping <= 200)
|
|
|
|
C.SetDrawColor(250,250,0,255);
|
|
|
|
else C.SetDrawColor(250,100,100,255);
|
|
|
|
|
|
|
|
S = string(Ping);
|
|
|
|
}
|
|
|
|
|
|
|
|
C.TextSize(MaxPing, XL, YL, FontScalar, FontScalar);
|
2021-05-31 01:46:53 +00:00
|
|
|
if (Group.ApplyColorToFields.Ping)
|
|
|
|
C.SetDrawColor(Group.Color.R,Group.Color.G,Group.Color.B,255);
|
2021-05-25 00:45:49 +00:00
|
|
|
DrawTextShadowHVCenter(S, PingXPos, TextYOffset, PingWBox/2, FontScalar);
|
2021-05-31 01:46:53 +00:00
|
|
|
C.SetDrawColor(250,250,250,255);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
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));
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
final function DrawPingBars( Canvas C, float YOffset, float XOffset, float W, float H, float Ping )
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
local float PingMul, BarW, BarH, BaseH, XPos, YPos;
|
|
|
|
local byte i;
|
|
|
|
|
|
|
|
PingMul = 1.f - FClamp(FMax(Ping - IdealPing, 1.f) / MaxPing, 0.f, 1.f);
|
|
|
|
BarW = W / PingBars;
|
|
|
|
BaseH = H / PingBars;
|
|
|
|
|
|
|
|
PingColor.R = (1.f - PingMul) * 255;
|
|
|
|
PingColor.G = PingMul * 255;
|
|
|
|
|
|
|
|
for(i=1; i<PingBars; i++)
|
|
|
|
{
|
|
|
|
BarH = BaseH * i;
|
|
|
|
XPos = XOffset + ((i - 1) * BarW);
|
|
|
|
YPos = YOffset + (H - BarH);
|
|
|
|
|
|
|
|
C.SetPos(XPos,YPos);
|
|
|
|
C.SetDrawColor(20, 20, 20, 255);
|
|
|
|
Owner.CurrentStyle.DrawWhiteBox(BarW,BarH);
|
|
|
|
|
|
|
|
if( PingMul >= (i / PingBars) )
|
|
|
|
{
|
|
|
|
C.SetPos(XPos,YPos);
|
|
|
|
C.DrawColor = PingColor;
|
|
|
|
Owner.CurrentStyle.DrawWhiteBox(BarW,BarH);
|
|
|
|
}
|
|
|
|
|
|
|
|
C.SetDrawColor(80, 80, 80, 255);
|
|
|
|
Owner.CurrentStyle.DrawBoxHollow(XPos,YPos,BarW,BarH,1);
|
|
|
|
}
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static final function Texture2D FindAvatar( KFPlayerController PC, UniqueNetId ClientID )
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
local string S;
|
|
|
|
|
|
|
|
S = PC.GetSteamAvatar(ClientID);
|
|
|
|
if( S=="" )
|
|
|
|
return None;
|
|
|
|
return Texture2D(PC.FindObject(S,class'Texture2D'));
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
final static function string GetNiceSize(int Num)
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
if( Num < 1000 ) return string(Num);
|
|
|
|
else if( Num < 1000000 ) return (Num / 1000) $ "K";
|
|
|
|
else if( Num < 1000000000 ) return (Num / 1000000) $ "M";
|
2020-01-10 13:14:11 +00:00
|
|
|
|
2021-05-16 09:40:02 +00:00
|
|
|
return (Num / 1000000000) $ "B";
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function ScrollMouseWheel( bool bUp )
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
PlayersList.ScrollMouseWheel(bUp);
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
defaultproperties
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
bEnableInputs=true
|
|
|
|
|
|
|
|
PingColor=(R=255,G=255,B=60,A=255)
|
|
|
|
IdealPing=50.0
|
|
|
|
MaxPing=200.0
|
|
|
|
PingBars=5.0
|
|
|
|
|
|
|
|
Begin Object Class=KFGUI_List Name=PlayerList
|
|
|
|
XSize=0.625
|
|
|
|
OnDrawItem=DrawPlayerEntry
|
|
|
|
ID="PlayerList"
|
|
|
|
bClickable=false
|
|
|
|
ListItemsPerPage=16
|
|
|
|
End Object
|
|
|
|
Components.Add(PlayerList)
|
|
|
|
|
|
|
|
DefaultAvatar=Texture2D'UI_HUD.ScoreBoard_Standard_SWF_I26'
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|