2022-09-03 17:26:40 +00:00
|
|
|
class YAS_ScoreBoard extends KFGUI_Page
|
|
|
|
dependson(YAS_Types);
|
2020-01-10 13:14:11 +00:00
|
|
|
|
2022-09-08 19:17:55 +00:00
|
|
|
const HeaderWidthRatio = 0.30f;
|
|
|
|
const PlayerListWidthRatio = 0.6f;
|
|
|
|
const PlayerEntryHeightMod = 1.05f;
|
|
|
|
const ListItems = 12;
|
|
|
|
const PlayerEntryFontScalarMod = 1.25f;
|
2022-09-03 15:46:23 +00:00
|
|
|
|
2022-09-08 13:32:28 +00:00
|
|
|
/*
|
|
|
|
const IconRanked = Texture2D'YAS.IconRanked';
|
|
|
|
const IconCustom = Texture2D'UI_Menus.ServerBrowserMenu_SWF_I26';
|
|
|
|
const IconUnranked = Texture2D'UI_Menus.ServerBrowserMenu_SWF_I28';
|
|
|
|
const IconPassword = Texture2D'UI_Menus.ServerBrowserMenu_SWF_I20';
|
|
|
|
const IconDosh = Texture2D'UI_HUD.InGameHUD_SWF_I13A';
|
|
|
|
const IconPlayer = Texture2D'UI_HUD.InGameHUD_ZED_SWF_I1F5';
|
|
|
|
const IconClock = Texture2D'UI_HUD.InGameHUD_SWF_I17D';
|
|
|
|
const IconSkull = Texture2D'UI_Shared.AssetLib_I32';
|
|
|
|
const IconHealth = Texture2D'UI_VoiceComms_TEX.UI_VoiceCommand_Icon_Heal';
|
|
|
|
*/
|
|
|
|
|
2022-09-07 12:57:47 +00:00
|
|
|
var public E_LogLevel LogLevel;
|
|
|
|
|
2022-09-03 10:05:39 +00:00
|
|
|
var transient float HealthXPos, RankXPos, PlayerXPos, LevelXPos, PerkXPos, DoshXPos, KillsXPos, AssistXPos, PingXPos, ScrollXPos;
|
|
|
|
var transient float HealthWBox, RankWBox, PlayerWBox, LevelWBox, PerkWBox, DoshWBox, KillsWBox, AssistWBox, PingWBox, ScrollWBox;
|
2020-01-10 13:14:11 +00:00
|
|
|
var transient float NextScoreboardRefresh;
|
2021-07-05 03:02:30 +00:00
|
|
|
var transient int NumPlayer;
|
2020-01-10 13:14:11 +00:00
|
|
|
|
|
|
|
var int PlayerIndex;
|
|
|
|
var KFGUI_List PlayersList;
|
|
|
|
var Texture2D DefaultAvatar;
|
|
|
|
|
|
|
|
var KFGameReplicationInfo KFGRI;
|
2021-06-13 03:17:40 +00:00
|
|
|
var array<KFPlayerReplicationInfo> KFPRIArray;
|
2020-01-10 13:14:11 +00:00
|
|
|
|
|
|
|
var KFPlayerController OwnerPC;
|
|
|
|
|
|
|
|
var Color PingColor;
|
2021-06-13 02:29:47 +00:00
|
|
|
var float PingBars;
|
2020-01-10 13:14:11 +00:00
|
|
|
|
2022-09-08 13:32:28 +00:00
|
|
|
var localized String Players, Spectators;
|
2022-09-07 12:57:47 +00:00
|
|
|
|
2021-06-14 13:45:40 +00:00
|
|
|
// Cache
|
2022-09-07 16:13:13 +00:00
|
|
|
var public Array<YAS_RankRepInfo> RepInfos;
|
|
|
|
|
2022-09-07 12:57:47 +00:00
|
|
|
var public YAS_Settings Settings;
|
2022-09-08 18:20:04 +00:00
|
|
|
var public String DynamicServerName, MessageOfTheDay;
|
2022-09-07 12:57:47 +00:00
|
|
|
var public bool UsesStats, Custom, PasswordRequired;
|
|
|
|
|
|
|
|
var public SystemRank RankPlayer;
|
|
|
|
var public SystemRank RankAdmin;
|
|
|
|
|
|
|
|
function Rank PlayerRank(KFPlayerReplicationInfo KFPRI)
|
|
|
|
{
|
2022-09-07 16:13:13 +00:00
|
|
|
local YAS_RankRepInfo RepInfo;
|
2022-09-07 12:57:47 +00:00
|
|
|
local Rank Rank;
|
2022-09-07 16:13:13 +00:00
|
|
|
local bool NeedClean, FoundRepInfo;
|
2022-09-07 12:57:47 +00:00
|
|
|
|
|
|
|
`Log_Trace();
|
|
|
|
|
2022-09-07 16:13:13 +00:00
|
|
|
Rank = class'YAS_Types'.static.FromSystemRank(RankPlayer);
|
|
|
|
|
|
|
|
NeedClean = false;
|
|
|
|
FoundRepInfo = false;
|
|
|
|
|
|
|
|
foreach RepInfos(RepInfo)
|
2022-09-07 12:57:47 +00:00
|
|
|
{
|
2022-09-07 16:13:13 +00:00
|
|
|
if (RepInfo == None)
|
|
|
|
{
|
|
|
|
NeedClean = true;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RepInfo.UID.Uid == KFPRI.UniqueId.Uid)
|
2022-09-07 12:57:47 +00:00
|
|
|
{
|
2022-09-07 16:13:13 +00:00
|
|
|
Rank = RepInfo.Rank;
|
|
|
|
FoundRepInfo = true;
|
2022-09-07 12:57:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-07 16:13:13 +00:00
|
|
|
if (!FoundRepInfo)
|
2022-09-07 12:57:47 +00:00
|
|
|
{
|
2022-09-07 16:13:13 +00:00
|
|
|
foreach KFPRI.DynamicActors(class'YAS_RankRepInfo', RepInfo)
|
|
|
|
{
|
|
|
|
if (RepInfo.UID.Uid == KFPRI.UniqueId.Uid)
|
|
|
|
{
|
|
|
|
Rank = RepInfo.Rank;
|
|
|
|
FoundRepInfo = true;
|
|
|
|
RepInfos.AddItem(RepInfo);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2022-09-07 12:57:47 +00:00
|
|
|
}
|
|
|
|
|
2022-09-07 16:13:13 +00:00
|
|
|
if (NeedClean)
|
|
|
|
{
|
|
|
|
RepInfos.RemoveItem(None);
|
|
|
|
}
|
2022-09-07 12:57:47 +00:00
|
|
|
|
2022-09-07 16:13:13 +00:00
|
|
|
if (KFPRI.bAdmin && !Rank.OverrideAdmin)
|
|
|
|
{
|
|
|
|
Rank = class'YAS_Types'.static.FromSystemRank(RankAdmin);
|
|
|
|
}
|
2022-09-07 12:57:47 +00:00
|
|
|
|
|
|
|
return Rank;
|
|
|
|
}
|
|
|
|
|
|
|
|
function float MinPerkBoxWidth(float FontScalar)
|
|
|
|
{
|
|
|
|
local Array<String> PerkNames;
|
|
|
|
local String PerkName;
|
|
|
|
local float XL, YL, MaxWidth;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
foreach PerkNames(PerkName)
|
|
|
|
{
|
2022-09-08 19:17:55 +00:00
|
|
|
Canvas.TextSize(PerkName $ "A", XL, YL, FontScalar * PlayerEntryFontScalarMod, FontScalar * PlayerEntryFontScalarMod);
|
2022-09-07 12:57:47 +00:00
|
|
|
if (XL > MaxWidth) MaxWidth = XL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return MaxWidth;
|
|
|
|
}
|
2021-06-13 04:47:54 +00:00
|
|
|
|
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;
|
|
|
|
|
2021-06-13 02:53:33 +00:00
|
|
|
if (KFPRI.Avatar == None || KFPRI.Avatar == default.DefaultAvatar)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
|
|
|
Avatar = FindAvatar(PC, KFPRI.UniqueId);
|
2021-06-13 02:53:33 +00:00
|
|
|
if (Avatar == None)
|
2021-05-16 09:40:02 +00:00
|
|
|
Avatar = default.DefaultAvatar;
|
|
|
|
|
|
|
|
KFPRI.Avatar = Avatar;
|
|
|
|
}
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
2021-06-13 03:00:19 +00:00
|
|
|
delegate bool InOrder(KFPlayerReplicationInfo P1, KFPlayerReplicationInfo P2)
|
2020-01-10 13:14:11 +00:00
|
|
|
{
|
2021-06-13 02:53:33 +00:00
|
|
|
if (P1 == None || P2 == None)
|
2021-05-16 09:40:02 +00:00
|
|
|
return true;
|
|
|
|
|
2021-06-13 02:53:33 +00:00
|
|
|
if (P1.GetTeamNum() < P2.GetTeamNum())
|
2021-05-16 09:40:02 +00:00
|
|
|
return false;
|
|
|
|
|
2021-06-13 02:53:33 +00:00
|
|
|
if (P1.Kills == P2.Kills)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
2021-06-13 02:53:33 +00:00
|
|
|
if (P1.Assists == P2.Assists)
|
2021-05-16 09:40:02 +00:00
|
|
|
return true;
|
|
|
|
|
|
|
|
return P1.Assists < P2.Assists;
|
|
|
|
}
|
|
|
|
|
|
|
|
return P1.Kills < P2.Kills;
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
2021-06-07 01:30:04 +00:00
|
|
|
function string WaveText()
|
|
|
|
{
|
|
|
|
local int CurrentWaveNum;
|
|
|
|
|
|
|
|
CurrentWaveNum = KFGRI.WaveNum;
|
2021-06-13 02:53:33 +00:00
|
|
|
if (KFGRI.IsBossWave())
|
2021-06-07 01:30:04 +00:00
|
|
|
{
|
|
|
|
return class'KFGFxHUD_WaveInfo'.default.BossWaveString;
|
|
|
|
}
|
|
|
|
else if (KFGRI.IsFinalWave())
|
|
|
|
{
|
|
|
|
return class'KFGFxHUD_ScoreboardMapInfoContainer'.default.FinalString;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (KFGRI.default.bEndlessMode)
|
|
|
|
{
|
|
|
|
return "" $ CurrentWaveNum;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return CurrentWaveNum $ " / " $ KFGRI.GetFinalWaveNum();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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-07-05 03:02:30 +00:00
|
|
|
local float XPos, YPos, YL, XL, FontScalar, XPosCenter, BoxW, BoxX, BoxH, MinBoxW, DoshSize, ScrollBarWidth;
|
|
|
|
local int i, j, NumSpec, NumAlivePlayer, Width;
|
2022-09-08 18:20:04 +00:00
|
|
|
local float BorderSize, PlayerListSizeY;
|
2022-09-03 17:26:40 +00:00
|
|
|
local Color ColorTMP;
|
2022-09-08 18:20:04 +00:00
|
|
|
local Array<String> MessageOfTheDayLines;
|
2022-09-03 17:26:40 +00:00
|
|
|
|
2021-05-16 09:40:02 +00:00
|
|
|
PC = GetPlayer();
|
2021-06-13 02:53:33 +00:00
|
|
|
if (KFGRI == None)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
|
|
|
KFGRI = KFGameReplicationInfo(PC.WorldInfo.GRI);
|
2021-06-13 02:53:33 +00:00
|
|
|
if (KFGRI == None)
|
2021-05-16 09:40:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Sort player list.
|
2021-06-13 02:53:33 +00:00
|
|
|
if (NextScoreboardRefresh < PC.WorldInfo.TimeSeconds)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
|
|
|
NextScoreboardRefresh = PC.WorldInfo.TimeSeconds + 0.1;
|
|
|
|
|
2021-06-13 02:53:33 +00:00
|
|
|
for (i=(KFGRI.PRIArray.Length-1); i > 0; --i)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
2021-06-13 02:53:33 +00:00
|
|
|
for (j=i-1; j >= 0; --j)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
2021-06-13 02:54:35 +00:00
|
|
|
if (!InOrder(KFPlayerReplicationInfo(KFGRI.PRIArray[i]), KFPlayerReplicationInfo(KFGRI.PRIArray[j])))
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
|
|
|
PRI = KFGRI.PRIArray[i];
|
|
|
|
KFGRI.PRIArray[i] = KFGRI.PRIArray[j];
|
|
|
|
KFGRI.PRIArray[j] = PRI;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check players.
|
|
|
|
PlayerIndex = -1;
|
|
|
|
NumPlayer = 0;
|
2021-06-13 02:53:33 +00:00
|
|
|
for (i=(KFGRI.PRIArray.Length-1); i >= 0; --i)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
|
|
|
KFPRI = KFPlayerReplicationInfo(KFGRI.PRIArray[i]);
|
2021-06-13 02:53:33 +00:00
|
|
|
if (KFPRI == None)
|
2021-05-16 09:40:02 +00:00
|
|
|
continue;
|
2021-06-13 02:53:33 +00:00
|
|
|
if (KFPRI.bOnlySpectator)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
|
|
|
++NumSpec;
|
|
|
|
continue;
|
|
|
|
}
|
2021-06-13 02:53:33 +00:00
|
|
|
if (KFPRI.PlayerHealth > 0 && KFPRI.PlayerHealthPercent > 0 && KFPRI.GetTeamNum() == 0)
|
2021-05-16 09:40:02 +00:00
|
|
|
++NumAlivePlayer;
|
|
|
|
++NumPlayer;
|
|
|
|
}
|
|
|
|
|
|
|
|
KFPRIArray.Length = NumPlayer;
|
|
|
|
j = KFPRIArray.Length;
|
2021-06-13 02:53:33 +00:00
|
|
|
for (i=(KFGRI.PRIArray.Length-1); i >= 0; --i)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
|
|
|
KFPRI = KFPlayerReplicationInfo(KFGRI.PRIArray[i]);
|
2021-06-13 02:53:33 +00:00
|
|
|
if (KFPRI != None && !KFPRI.bOnlySpectator)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
|
|
|
KFPRIArray[--j] = KFPRI;
|
2021-06-13 02:53:33 +00:00
|
|
|
if (KFPRI == PC.PlayerReplicationInfo)
|
2021-05-16 09:40:02 +00:00
|
|
|
PlayerIndex = j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Canvas.Font = Owner.CurrentStyle.PickFont(FontScalar);
|
2021-06-07 01:30:04 +00:00
|
|
|
Canvas.TextSize("ABC", XL, YL, FontScalar, FontScalar);
|
|
|
|
BorderSize = Owner.HUDOwner.ScaledBorderSize;
|
|
|
|
|
|
|
|
// Server Info
|
2021-06-23 17:45:32 +00:00
|
|
|
XPosCenter = Canvas.ClipX * 0.5;
|
2022-09-03 15:46:23 +00:00
|
|
|
Width = Canvas.ClipX * HeaderWidthRatio; // Full Box Width
|
2021-06-23 17:45:32 +00:00
|
|
|
XPos = XPosCenter - Width * 0.5;
|
2021-06-07 01:30:04 +00:00
|
|
|
YPos = YL;
|
|
|
|
|
|
|
|
BoxW = Width;
|
|
|
|
BoxX = XPos;
|
|
|
|
BoxH = YL + BorderSize;
|
|
|
|
|
|
|
|
// Top Rect (Server name)
|
2022-09-03 17:26:40 +00:00
|
|
|
Canvas.SetDrawColorStruct(Settings.Style.ServerNameBoxColor);
|
2021-06-13 08:36:10 +00:00
|
|
|
Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, BoxH, Settings.Style.EdgeSize, Settings.Style.ShapeServerNameBox);
|
2021-06-07 01:30:04 +00:00
|
|
|
|
2022-09-03 17:26:40 +00:00
|
|
|
Canvas.SetDrawColorStruct(Settings.Style.ServerNameTextColor);
|
2022-09-07 12:57:47 +00:00
|
|
|
S = (DynamicServerName == "" ? KFGRI.ServerName : DynamicServerName);
|
2022-09-08 13:32:28 +00:00
|
|
|
DrawTextShadowHVCenter(S, BoxX, YPos, BoxW, BoxH, FontScalar);
|
|
|
|
|
|
|
|
// icons
|
|
|
|
/*
|
|
|
|
IconIndent = BoxH * 0.1;
|
|
|
|
if (PasswordRequired)
|
|
|
|
{
|
|
|
|
Owner.CurrentStyle.DrawTexture(IconPassword,
|
|
|
|
BoxX + IconIndent,
|
|
|
|
YPos + IconIndent,
|
|
|
|
BoxH - IconIndent*2,
|
|
|
|
BoxH - IconIndent*2,
|
|
|
|
MakeColor(250,250,250,250));
|
|
|
|
}
|
|
|
|
*/
|
2021-05-26 23:56:29 +00:00
|
|
|
|
2021-06-07 01:30:04 +00:00
|
|
|
YPos += BoxH;
|
|
|
|
|
|
|
|
// Mid Left Rect (Info)
|
2022-09-08 13:32:28 +00:00
|
|
|
BoxW = Width * 0.7;
|
2021-06-07 01:30:04 +00:00
|
|
|
BoxH = YL * 2 + BorderSize * 2;
|
2022-09-03 17:26:40 +00:00
|
|
|
Canvas.SetDrawColorStruct(Settings.Style.GameInfoBoxColor);
|
2021-06-13 08:36:10 +00:00
|
|
|
Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, BoxH, Settings.Style.EdgeSize, Settings.Style.ShapeGameInfoBox);
|
2021-06-07 01:30:04 +00:00
|
|
|
|
2022-09-03 17:26:40 +00:00
|
|
|
Canvas.SetDrawColorStruct(Settings.Style.GameInfoTextColor);
|
2021-06-07 01:30:04 +00:00
|
|
|
S = class'KFCommon_LocalizedStrings'.static.GetFriendlyMapName(PC.WorldInfo.GetMapName(true));
|
2022-09-08 13:32:28 +00:00
|
|
|
DrawTextShadowHLeftVCenter(S, BoxX + Settings.Style.EdgeSize, YPos, BoxH/2, FontScalar);
|
2021-06-07 01:30:04 +00:00
|
|
|
|
2021-06-09 02:47:15 +00:00
|
|
|
S = KFGRI.GameClass.default.GameName $ " - " $ class'KFCommon_LocalizedStrings'.Static.GetDifficultyString(KFGRI.GameDifficulty);
|
2022-09-08 13:32:28 +00:00
|
|
|
DrawTextShadowHLeftVCenter(S, BoxX + Settings.Style.EdgeSize, YPos + BoxH/2, BoxH/2, FontScalar);
|
2021-06-07 01:30:04 +00:00
|
|
|
|
|
|
|
// Mid Right Rect (Wave)
|
|
|
|
BoxX = BoxX + BoxW;
|
|
|
|
BoxW = Width - BoxW;
|
2022-09-03 17:26:40 +00:00
|
|
|
Canvas.SetDrawColorStruct(Settings.Style.WaveBoxColor);
|
2021-06-13 08:36:10 +00:00
|
|
|
Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, BoxH, Settings.Style.EdgeSize, Settings.Style.ShapeWaveInfoBox);
|
2021-06-07 01:30:04 +00:00
|
|
|
|
2022-09-03 17:26:40 +00:00
|
|
|
Canvas.SetDrawColorStruct(Settings.Style.WaveTextColor);
|
2021-06-07 01:30:04 +00:00
|
|
|
S = class'KFGFxHUD_ScoreboardMapInfoContainer'.default.WaveString;
|
2022-09-08 13:32:28 +00:00
|
|
|
DrawTextShadowHVCenter(S, BoxX, YPos, BoxW, BoxH / 2, FontScalar);
|
|
|
|
DrawTextShadowHVCenter(WaveText(), BoxX, YPos + BoxH / 2, BoxW, BoxH / 2, FontScalar);
|
2021-06-07 01:30:04 +00:00
|
|
|
|
|
|
|
YPos += BoxH;
|
|
|
|
|
|
|
|
// Bottom Rect (Players count)
|
|
|
|
BoxX = XPos;
|
|
|
|
BoxW = Width;
|
|
|
|
BoxH = YL + BorderSize;
|
2022-09-03 17:26:40 +00:00
|
|
|
Canvas.SetDrawColorStruct(Settings.Style.PlayerCountBoxColor);
|
2021-06-13 08:36:10 +00:00
|
|
|
Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, BoxH, Settings.Style.EdgeSize, Settings.Style.ShapePlayersCountBox);
|
2021-06-07 01:30:04 +00:00
|
|
|
|
2022-09-08 13:32:28 +00:00
|
|
|
/*
|
|
|
|
Owner.CurrentStyle.DrawTexture(IconPlayer,
|
|
|
|
BoxX + Settings.Style.EdgeSize + IconIndent,
|
|
|
|
YPos + IconIndent,
|
|
|
|
BoxH - IconIndent*2,
|
|
|
|
BoxH - IconIndent*2,
|
|
|
|
MakeColor(250,250,250,250));
|
|
|
|
*/
|
|
|
|
|
2022-09-03 17:26:40 +00:00
|
|
|
Canvas.SetDrawColorStruct(Settings.Style.PlayerCountTextColor);
|
2022-09-08 13:32:28 +00:00
|
|
|
S = Players $ ":" @ NumPlayer @ "/" @ KFGRI.MaxHumanCount $ " " $ Spectators $ ": " $ NumSpec; ;
|
2021-05-16 09:40:02 +00:00
|
|
|
Canvas.TextSize(S, XL, YL, FontScalar, FontScalar);
|
2022-09-08 13:32:28 +00:00
|
|
|
DrawTextShadowHLeftVCenter(S, BoxX + Settings.Style.EdgeSize, YPos, BoxH, FontScalar);
|
2021-06-07 01:30:04 +00:00
|
|
|
|
|
|
|
S = Owner.CurrentStyle.GetTimeString(KFGRI.ElapsedTime);
|
2022-09-08 13:32:28 +00:00
|
|
|
DrawTextShadowHVCenter(S, XPos + Width * 0.7, YPos, Width * 0.3, BoxH, FontScalar); // TODO: ?
|
2021-06-07 01:30:04 +00:00
|
|
|
|
|
|
|
YPos += BoxH;
|
2021-05-16 09:40:02 +00:00
|
|
|
|
2021-06-07 01:30:04 +00:00
|
|
|
// Header
|
2022-09-03 15:46:23 +00:00
|
|
|
Width = Canvas.ClipX * PlayerListWidthRatio;
|
2021-05-16 09:40:02 +00:00
|
|
|
XPos = (Canvas.ClipX - Width) * 0.5;
|
2021-06-07 01:30:04 +00:00
|
|
|
YPos += YL;
|
|
|
|
BoxH = YL + BorderSize;
|
2022-09-03 17:26:40 +00:00
|
|
|
Canvas.SetDrawColorStruct(Settings.Style.ListHeaderBoxColor);
|
2022-09-08 18:20:04 +00:00
|
|
|
Owner.CurrentStyle.DrawRectBox(
|
|
|
|
XPos - BorderSize * 2,
|
2021-06-06 21:22:24 +00:00
|
|
|
YPos,
|
2021-06-07 01:30:04 +00:00
|
|
|
Width + BorderSize * 4,
|
2021-06-06 21:22:24 +00:00
|
|
|
BoxH,
|
2021-06-13 08:36:10 +00:00
|
|
|
Settings.Style.EdgeSize,
|
2021-06-13 07:00:31 +00:00
|
|
|
Settings.Style.ShapeHeaderBox);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
// Calc X offsets
|
2022-09-03 15:46:23 +00:00
|
|
|
MinBoxW = Width * 0.07; // minimum width for column
|
2021-06-13 05:38:44 +00:00
|
|
|
|
2021-07-05 03:02:30 +00:00
|
|
|
// Health
|
|
|
|
HealthXPos = 0;
|
|
|
|
BoxW = 0;
|
2022-09-03 15:46:23 +00:00
|
|
|
Canvas.TextSize("0000", BoxW, YL, FontScalar, FontScalar);
|
|
|
|
HealthWBox = BoxW + BorderSize * 2;
|
2022-09-08 19:17:55 +00:00
|
|
|
if (HealthWBox < PlayersList.GetItemHeight())
|
|
|
|
{
|
|
|
|
HealthWBox = PlayersList.GetItemHeight();
|
|
|
|
}
|
2021-06-13 05:38:44 +00:00
|
|
|
|
2022-09-03 15:46:23 +00:00
|
|
|
PlayerXPos = HealthXPos + HealthWBox + PlayersList.GetItemHeight() + Settings.Style.EdgeSize;
|
2021-07-05 03:02:30 +00:00
|
|
|
|
|
|
|
Canvas.TextSize(class'KFGFxHUD_ScoreboardWidget'.default.PingString$" ", XL, YL, FontScalar, FontScalar);
|
|
|
|
PingWBox = XL < MinBoxW ? MinBoxW : XL;
|
2022-09-08 18:20:04 +00:00
|
|
|
if (NumPlayer <= PlayersList.ListItemsPerPage)
|
2021-07-05 03:02:30 +00:00
|
|
|
ScrollBarWidth = 0;
|
|
|
|
else
|
|
|
|
ScrollBarWidth = BorderSize * 8;
|
|
|
|
PingXPos = Width - PingWBox - ScrollBarWidth;
|
2021-06-13 05:38:44 +00:00
|
|
|
|
|
|
|
Canvas.TextSize(class'KFGFxHUD_ScoreboardWidget'.default.AssistsString$" ", XL, YL, FontScalar, FontScalar);
|
2021-07-05 03:02:30 +00:00
|
|
|
AssistWBox = XL < MinBoxW ? MinBoxW : XL;
|
|
|
|
AssistXPos = PingXPos - AssistWBox;
|
2021-06-13 05:38:44 +00:00
|
|
|
|
|
|
|
Canvas.TextSize(class'KFGFxHUD_ScoreboardWidget'.default.KillsString$" ", XL, YL, FontScalar, FontScalar);
|
2021-07-05 03:02:30 +00:00
|
|
|
KillsWBox = XL < MinBoxW ? MinBoxW : XL;
|
|
|
|
KillsXPos = AssistXPos - KillsWBox;
|
2021-06-13 05:38:44 +00:00
|
|
|
|
|
|
|
Canvas.TextSize(class'KFGFxHUD_ScoreboardWidget'.default.DoshString$" ", XL, YL, FontScalar, FontScalar);
|
2021-06-14 21:02:32 +00:00
|
|
|
Canvas.TextSize("999999", DoshSize, YL, FontScalar, FontScalar);
|
2021-07-05 03:02:30 +00:00
|
|
|
DoshWBox = XL < DoshSize ? DoshSize : XL;
|
|
|
|
DoshXPos = KillsXPos - DoshWBox;
|
2021-06-14 13:45:40 +00:00
|
|
|
|
2022-09-07 12:57:47 +00:00
|
|
|
BoxW = MinPerkBoxWidth(FontScalar);
|
2021-07-05 03:02:30 +00:00
|
|
|
PerkWBox = BoxW < MinBoxW ? MinBoxW : BoxW;
|
|
|
|
PerkXPos = DoshXPos - PerkWBox;
|
2021-06-13 05:38:44 +00:00
|
|
|
|
2021-06-14 21:02:32 +00:00
|
|
|
Canvas.TextSize("000", XL, YL, FontScalar, FontScalar);
|
2021-07-05 03:02:30 +00:00
|
|
|
LevelWBox = XL;
|
|
|
|
LevelXPos = PerkXPos - LevelWBox;
|
|
|
|
|
2021-05-16 09:40:02 +00:00
|
|
|
// Header texts
|
2022-09-03 17:26:40 +00:00
|
|
|
Canvas.SetDrawColorStruct(Settings.Style.ListHeaderTextColor);
|
2022-09-08 13:32:28 +00:00
|
|
|
DrawTextShadowHLeftVCenter(class'KFGFxHUD_ScoreboardWidget'.default.PlayerString, XPos + PlayerXPos, YPos, BoxH, FontScalar);
|
|
|
|
DrawTextShadowHLeftVCenter(class'KFGFxMenu_Inventory'.default.PerkFilterString, XPos + PerkXPos, YPos, BoxH, FontScalar);
|
|
|
|
DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.KillsString, XPos + KillsXPos, YPos, KillsWBox, BoxH, FontScalar);
|
|
|
|
DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.AssistsString, XPos + AssistXPos, YPos, AssistWBox, BoxH, FontScalar);
|
|
|
|
DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.DoshString, XPos + DoshXPos, YPos, DoshWBox, BoxH, FontScalar);
|
|
|
|
DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.PingString, XPos + PingXPos, YPos, PingWBox, BoxH, FontScalar);
|
2021-07-05 03:02:30 +00:00
|
|
|
|
2022-09-03 17:26:40 +00:00
|
|
|
ColorTMP = Settings.Style.ListHeaderTextColor;
|
|
|
|
ColorTMP.A = 150;
|
|
|
|
Canvas.SetDrawColorStruct(ColorTmp);
|
2021-07-05 03:02:30 +00:00
|
|
|
|
|
|
|
DrawHealthIcon(XPos + HealthXPos, YPos, HealthWBox, BoxH);
|
2022-09-03 10:05:39 +00:00
|
|
|
|
2021-05-16 09:40:02 +00:00
|
|
|
PlayersList.XPosition = ((Canvas.ClipX - Width) * 0.5) / InputPos[2];
|
2021-06-07 01:30:04 +00:00
|
|
|
PlayersList.YPosition = (YPos + YL + BorderSize * 4) / InputPos[3];
|
2021-05-16 09:40:02 +00:00
|
|
|
PlayersList.YSize = (1.f - PlayersList.YPosition) - 0.15;
|
|
|
|
|
|
|
|
PlayersList.ChangeListSize(KFPRIArray.Length);
|
2022-09-08 18:20:04 +00:00
|
|
|
|
|
|
|
PlayerListSizeY = PlayersList.GetItemHeight() * PlayerEntryHeightMod * (NumPlayer <= PlayersList.ListItemsPerPage ? NumPlayer : PlayersList.ListItemsPerPage);
|
|
|
|
|
|
|
|
PlayerListSizeY -= PlayersList.GetItemHeight() * PlayerEntryHeightMod - PlayersList.GetItemHeight();
|
|
|
|
|
|
|
|
// Scroll bar (fake)
|
|
|
|
// This is an imitation of a scroll bar
|
|
|
|
// just to let people know that they can scroll the mouse wheel.
|
|
|
|
// This interface already has a scroll bar,
|
|
|
|
// but I haven't figured out how to use it yet.
|
|
|
|
// I hope this can be replaced later
|
|
|
|
if (NumPlayer > PlayersList.ListItemsPerPage)
|
|
|
|
{
|
|
|
|
Canvas.SetDrawColorStruct(Settings.Style.ListHeaderBoxColor);
|
|
|
|
Owner.CurrentStyle.DrawRectBox(
|
|
|
|
XPos + PlayersList.GetWidth() - ScrollBarWidth,
|
|
|
|
YPos + YL + BorderSize * 4,
|
|
|
|
ScrollBarWidth,
|
|
|
|
PlayerListSizeY,
|
|
|
|
Settings.Style.EdgeSize,
|
|
|
|
0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// MessageOfTheDay
|
|
|
|
MessageOfTheDayLines = SplitString(MessageOfTheDay, "\n");
|
|
|
|
|
|
|
|
YPos += BoxH + BorderSize * 6 + PlayerListSizeY;
|
|
|
|
Width = Canvas.ClipX * PlayerListWidthRatio;
|
|
|
|
BoxH = YL + BorderSize;
|
|
|
|
Canvas.SetDrawColorStruct(Settings.Style.ListHeaderBoxColor);
|
|
|
|
Owner.CurrentStyle.DrawRectBox(
|
|
|
|
XPos - BorderSize * 2,
|
|
|
|
YPos,
|
|
|
|
Width + BorderSize * 4,
|
|
|
|
BoxH * (MessageOfTheDayLines.Length > 0 ? MessageOfTheDayLines.Length : 1),
|
|
|
|
Settings.Style.EdgeSize,
|
|
|
|
152);
|
|
|
|
|
|
|
|
if (MessageOfTheDay != "")
|
|
|
|
{
|
|
|
|
Canvas.SetDrawColorStruct(Settings.Style.ListHeaderTextColor);
|
|
|
|
foreach MessageOfTheDayLines(S)
|
|
|
|
{
|
|
|
|
DrawTextShadowHVCenter(S, XPos - BorderSize * 2, YPos, Width + BorderSize * 4, BoxH, FontScalar);
|
|
|
|
YPos += BoxH;
|
|
|
|
}
|
|
|
|
}
|
2021-05-16 09:40:02 +00:00
|
|
|
}
|
|
|
|
|
2021-07-05 03:02:30 +00:00
|
|
|
function DrawHealthIcon(float X, float Y, float W, float H)
|
|
|
|
{
|
|
|
|
local float XPos, YPos, Size, Part;
|
|
|
|
|
|
|
|
Size = H * 0.65;
|
|
|
|
Part = Size / 3;
|
|
|
|
|
|
|
|
XPos = X + (W * 0.5 - Part * 0.5);
|
|
|
|
YPos = Y + (H * 0.5 - Size * 0.5);
|
|
|
|
Owner.CurrentStyle.DrawRectBox(XPos, YPos, Part, Part, 4, 100);
|
|
|
|
|
|
|
|
XPos = X + (W * 0.5 - Size * 0.5);
|
|
|
|
YPos = Y + (H * 0.5 - Part * 0.5);
|
|
|
|
Owner.CurrentStyle.DrawRectBox(XPos, YPos, Size, Part, 4, 100);
|
|
|
|
|
|
|
|
XPos = X + (W * 0.5 - Part * 0.5);
|
|
|
|
YPos = Y + (H * 0.5 + Part * 0.5);
|
|
|
|
Owner.CurrentStyle.DrawRectBox(XPos, YPos, Part, Part, 4, 100);
|
|
|
|
}
|
|
|
|
|
2021-06-13 03:00:19 +00:00
|
|
|
function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float Width, bool bFocus)
|
2020-01-10 13:14:11 +00:00
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
local string S, StrValue;
|
2022-09-08 13:32:28 +00:00
|
|
|
local float FontScalar, XL, YL, PerkIconPosX, PerkIconPosY, PerkIconSize, PrestigeIconScale;
|
2021-06-14 21:02:32 +00:00
|
|
|
local float XPos, BoxWidth, RealPlayerWBox;
|
2021-05-16 09:40:02 +00:00
|
|
|
local KFPlayerReplicationInfo KFPRI;
|
|
|
|
local byte Level, PrestigeLevel;
|
|
|
|
local bool bIsZED;
|
|
|
|
local int Ping;
|
2022-09-07 12:57:47 +00:00
|
|
|
local Rank Rank;
|
2021-05-31 01:46:53 +00:00
|
|
|
|
2021-07-05 03:02:30 +00:00
|
|
|
local float BorderSize;
|
2021-07-11 19:36:55 +00:00
|
|
|
|
2022-09-03 10:05:39 +00:00
|
|
|
local int Shape, ShapeHealth;
|
2021-07-05 03:02:30 +00:00
|
|
|
|
2022-09-08 13:32:28 +00:00
|
|
|
local Color HealthBoxColor;
|
2021-07-05 04:20:53 +00:00
|
|
|
|
2021-07-05 03:02:30 +00:00
|
|
|
BorderSize = Owner.HUDOwner.ScaledBorderSize;
|
2022-09-08 18:20:04 +00:00
|
|
|
|
|
|
|
YOffset *= PlayerEntryHeightMod;
|
|
|
|
|
2021-05-16 09:40:02 +00:00
|
|
|
KFPRI = KFPRIArray[Index];
|
2022-09-07 12:57:47 +00:00
|
|
|
|
|
|
|
Rank = PlayerRank(KFPRI);
|
|
|
|
|
2021-06-13 02:53:33 +00:00
|
|
|
if (KFGRI.bVersusGame)
|
2022-09-03 17:26:40 +00:00
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
bIsZED = KFTeamInfo_Zeds(KFPRI.Team) != None;
|
2022-09-03 17:26:40 +00:00
|
|
|
}
|
2021-05-16 09:40:02 +00:00
|
|
|
|
2021-06-06 21:22:24 +00:00
|
|
|
XPos = 0.f;
|
|
|
|
|
2021-05-16 09:40:02 +00:00
|
|
|
C.Font = Owner.CurrentStyle.PickFont(FontScalar);
|
|
|
|
|
2022-09-08 19:17:55 +00:00
|
|
|
FontScalar *= PlayerEntryFontScalarMod;
|
2021-05-26 23:56:29 +00:00
|
|
|
Canvas.TextSize("ABC", XL, YL, FontScalar, FontScalar);
|
|
|
|
|
2022-09-08 18:20:04 +00:00
|
|
|
ShapeHealth = Settings.Style.ShapeStateHealthBoxMidPlayer;
|
2021-06-13 07:00:31 +00:00
|
|
|
|
2022-09-08 18:20:04 +00:00
|
|
|
if (!KFGRI.bMatchHasBegun)
|
2021-07-05 03:02:30 +00:00
|
|
|
{
|
2022-09-08 13:32:28 +00:00
|
|
|
HealthBoxColor = Settings.Style.StateBoxColorLobby;
|
2021-07-05 03:02:30 +00:00
|
|
|
}
|
|
|
|
else if (KFPRI.PlayerHealth <= 0 || KFPRI.PlayerHealthPercent <= 0)
|
|
|
|
{
|
2022-09-08 13:32:28 +00:00
|
|
|
HealthBoxColor = Settings.Style.StateBoxColorDead;
|
2021-07-05 03:02:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-08 13:32:28 +00:00
|
|
|
HealthBoxColor = HealthColorByPercent(ByteToFloat(KFPRI.PlayerHealthPercent));
|
2021-07-05 03:02:30 +00:00
|
|
|
}
|
|
|
|
|
2021-07-11 19:36:55 +00:00
|
|
|
// Health box
|
2022-09-03 17:26:40 +00:00
|
|
|
C.SetDrawColorStruct(HealthBoxColor);
|
2021-07-05 03:02:30 +00:00
|
|
|
Owner.CurrentStyle.DrawRectBox(XPos,
|
2021-07-11 19:36:55 +00:00
|
|
|
YOffset,
|
|
|
|
HealthWBox,
|
|
|
|
Height,
|
|
|
|
Settings.Style.EdgeSize,
|
|
|
|
ShapeHealth);
|
|
|
|
|
2022-09-08 13:32:28 +00:00
|
|
|
C.SetDrawColorStruct(Settings.Style.StateTextColorHealthHigh);
|
2022-09-03 17:26:40 +00:00
|
|
|
|
2022-09-03 15:46:23 +00:00
|
|
|
if (KFPRI.PlayerHealth > 0)
|
2022-09-03 17:26:40 +00:00
|
|
|
{
|
2022-09-08 13:32:28 +00:00
|
|
|
DrawTextShadowHVCenter(String(KFPRI.PlayerHealth), HealthXPos, YOffset, HealthWBox, Height, FontScalar);
|
2022-09-03 17:26:40 +00:00
|
|
|
}
|
|
|
|
|
2022-09-03 15:46:23 +00:00
|
|
|
XPos += HealthWBox;
|
2021-06-06 21:22:24 +00:00
|
|
|
|
2021-07-05 03:02:30 +00:00
|
|
|
// PlayerBox
|
2021-05-16 09:40:02 +00:00
|
|
|
if (PlayerIndex == Index)
|
2022-09-03 17:26:40 +00:00
|
|
|
C.SetDrawColorStruct(Settings.Style.PlayerOwnerBoxColor);
|
2021-06-06 21:22:24 +00:00
|
|
|
else
|
2022-09-03 17:26:40 +00:00
|
|
|
C.SetDrawColorStruct(Settings.Style.PlayerBoxColor);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
2022-09-08 18:20:04 +00:00
|
|
|
Shape = Settings.Style.ShapePlayerBoxMidPlayer;
|
2021-06-13 07:00:31 +00:00
|
|
|
|
2022-09-03 10:05:39 +00:00
|
|
|
BoxWidth = DoshXPos - HealthWBox - BorderSize * 2;
|
2021-06-13 08:36:10 +00:00
|
|
|
Owner.CurrentStyle.DrawRectBox(XPos, YOffset, BoxWidth, Height, Settings.Style.EdgeSize, Shape);
|
2021-06-06 21:22:24 +00:00
|
|
|
|
|
|
|
XPos += BoxWidth;
|
|
|
|
|
|
|
|
// Right stats box
|
2022-09-08 18:20:04 +00:00
|
|
|
Shape = Settings.Style.ShapeStatsBoxMidPlayer;
|
2021-06-13 07:00:31 +00:00
|
|
|
|
2021-06-06 21:22:24 +00:00
|
|
|
BoxWidth = Width - XPos;
|
2022-09-03 17:26:40 +00:00
|
|
|
C.SetDrawColorStruct(Settings.Style.StatsBoxColor);
|
2022-09-08 18:20:04 +00:00
|
|
|
Owner.CurrentStyle.DrawRectBox(
|
|
|
|
XPos,
|
2021-06-06 21:22:24 +00:00
|
|
|
YOffset,
|
|
|
|
BoxWidth,
|
|
|
|
Height,
|
2021-06-13 08:36:10 +00:00
|
|
|
Settings.Style.EdgeSize,
|
|
|
|
Shape);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
// Perk
|
2021-06-14 21:02:32 +00:00
|
|
|
RealPlayerWBox = PlayerWBox;
|
2021-06-13 02:53:33 +00:00
|
|
|
if (bIsZED)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
2022-09-03 17:26:40 +00:00
|
|
|
C.SetDrawColorStruct(Settings.Style.ZedTextColor);
|
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');
|
|
|
|
|
2021-06-13 04:47:54 +00:00
|
|
|
S = class'KFCommon_LocalizedStrings'.default.ZedString;
|
2022-09-08 13:32:28 +00:00
|
|
|
DrawTextShadowHLeftVCenter(S, PerkXPos + Height, YOffset, Height, FontScalar);
|
2021-06-14 21:02:32 +00:00
|
|
|
RealPlayerWBox = PerkXPos + Height - PlayerXPos;
|
2021-05-16 09:40:02 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-03 17:26:40 +00:00
|
|
|
if (KFPRI.CurrentPerkclass != None)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
2020-01-10 13:14:11 +00:00
|
|
|
PrestigeLevel = KFPRI.GetActivePerkPrestigeLevel();
|
|
|
|
Level = KFPRI.GetActivePerkLevel();
|
2021-05-16 09:40:02 +00:00
|
|
|
|
2021-07-05 03:02:30 +00:00
|
|
|
PerkIconPosY = YOffset + (BorderSize * 2);
|
|
|
|
PerkIconSize = Height-(BorderSize * 4);
|
|
|
|
PerkIconPosX = LevelXPos - PerkIconSize - (BorderSize*2);
|
2020-01-10 13:14:11 +00:00
|
|
|
PrestigeIconScale = 0.6625f;
|
2021-05-16 09:40:02 +00:00
|
|
|
|
2021-06-14 21:02:32 +00:00
|
|
|
RealPlayerWBox = PerkIconPosX - PlayerXPos;
|
|
|
|
|
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-06-07 01:30:04 +00:00
|
|
|
}
|
2021-06-09 02:47:15 +00:00
|
|
|
|
2022-09-03 17:26:40 +00:00
|
|
|
|
|
|
|
if (Level < Settings.Level.Low[KFGRI.GameDifficulty])
|
|
|
|
C.SetDrawColorStruct(Settings.Style.LevelTextColorLow);
|
|
|
|
else if (Level < Settings.Level.High[KFGRI.GameDifficulty])
|
|
|
|
C.SetDrawColorStruct(Settings.Style.LevelTextColorMid);
|
2021-06-09 02:47:15 +00:00
|
|
|
else
|
2022-09-03 17:26:40 +00:00
|
|
|
C.SetDrawColorStruct(Settings.Style.LevelTextColorHigh);
|
|
|
|
|
2021-06-09 02:47:15 +00:00
|
|
|
S = String(Level);
|
2022-09-08 13:32:28 +00:00
|
|
|
DrawTextShadowHLeftVCenter(S, LevelXPos, YOffset, Height, FontScalar);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
2022-09-03 17:26:40 +00:00
|
|
|
C.SetDrawColorStruct(Settings.Style.PerkNoneTextColor);
|
2021-06-09 02:47:15 +00:00
|
|
|
S = KFPRI.CurrentPerkClass.default.PerkName;
|
2022-09-08 13:32:28 +00:00
|
|
|
DrawTextShadowHLeftVCenter(S, PerkXPos, YOffset, Height, FontScalar);
|
2021-05-16 09:40:02 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-03 17:26:40 +00:00
|
|
|
C.SetDrawColorStruct(Settings.Style.PerkNoneTextColor);
|
|
|
|
S = "";
|
2022-09-08 13:32:28 +00:00
|
|
|
DrawTextShadowHLeftVCenter(S, PerkXPos, YOffset, Height, FontScalar);
|
2021-06-14 21:02:32 +00:00
|
|
|
RealPlayerWBox = PerkXPos - PlayerXPos;
|
2021-05-16 09:40:02 +00:00
|
|
|
}
|
|
|
|
}
|
2022-09-03 15:46:23 +00:00
|
|
|
|
|
|
|
// Rank
|
2022-09-07 12:57:47 +00:00
|
|
|
if (Rank.RankName != "")
|
|
|
|
{
|
|
|
|
C.SetDrawColorStruct(Rank.RankColor);
|
2022-09-08 13:32:28 +00:00
|
|
|
DrawTextShadowHRightVCenter(Rank.RankName, PlayerXPos, YOffset, PerkIconPosX - PlayerXPos - (BorderSize * 4), Height, FontScalar);
|
2022-09-07 12:57:47 +00:00
|
|
|
}
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
// Avatar
|
2022-09-07 12:57:47 +00:00
|
|
|
if (KFPRI.Avatar == None || (!KFPRI.bBot && KFPRI.Avatar == default.DefaultAvatar))
|
|
|
|
{
|
|
|
|
CheckAvatar(KFPRI, OwnerPC);
|
|
|
|
}
|
|
|
|
|
2021-06-13 02:53:33 +00:00
|
|
|
if (KFPRI.Avatar != None)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
2021-06-13 02:54:35 +00:00
|
|
|
C.SetDrawColor(255, 255, 255, 255);
|
2021-05-16 09:40:02 +00:00
|
|
|
C.SetPos(PlayerXPos - (Height * 1.075), YOffset + (Height * 0.5f) - ((Height - 6) * 0.5f));
|
2021-06-13 02:54:35 +00:00
|
|
|
C.DrawTile(KFPRI.Avatar, Height - 6, Height - 6, 0,0, KFPRI.Avatar.SizeX, KFPRI.Avatar.SizeY);
|
2021-05-16 09:40:02 +00:00
|
|
|
Owner.CurrentStyle.DrawBoxHollow(PlayerXPos - (Height * 1.075), YOffset + (Height * 0.5f) - ((Height - 6) * 0.5f), Height - 6, Height - 6, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Player
|
2022-09-07 12:57:47 +00:00
|
|
|
C.SetDrawColorStruct(Rank.PlayerColor);
|
2021-06-09 02:47:15 +00:00
|
|
|
S = KFPRI.PlayerName;
|
2021-06-14 13:45:40 +00:00
|
|
|
Canvas.TextSize(S, XL, YL, FontScalar, FontScalar);
|
2021-06-14 21:02:32 +00:00
|
|
|
while (XL > RealPlayerWBox)
|
2021-06-14 13:45:40 +00:00
|
|
|
{
|
|
|
|
S = Left(S, Len(S)-1);
|
|
|
|
Canvas.TextSize(S, XL, YL, FontScalar, FontScalar);
|
|
|
|
}
|
2022-09-08 13:32:28 +00:00
|
|
|
DrawTextShadowHLeftVCenter(S, PlayerXPos, YOffset, Height, FontScalar);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
// Kill
|
2022-09-08 13:32:28 +00:00
|
|
|
C.SetDrawColorStruct(Settings.Style.KillsTextColorMid);
|
|
|
|
DrawTextShadowHVCenter(string (KFPRI.Kills), KillsXPos, YOffset, KillsWBox, Height, FontScalar);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
// Assist
|
2022-09-08 13:32:28 +00:00
|
|
|
C.SetDrawColorStruct(Settings.Style.AssistsTextColorMid);
|
|
|
|
DrawTextShadowHVCenter(string (KFPRI.Assists), AssistXPos, YOffset, AssistWBox, Height, FontScalar);
|
2021-06-08 23:22:35 +00:00
|
|
|
|
2021-07-05 03:02:30 +00:00
|
|
|
// Dosh
|
2021-06-13 02:53:33 +00:00
|
|
|
if (bIsZED)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
2022-09-03 17:26:40 +00:00
|
|
|
C.SetDrawColorStruct(Settings.Style.ZedTextColor);
|
2021-06-13 04:47:54 +00:00
|
|
|
StrValue = "-";
|
2021-05-16 09:40:02 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-08 13:32:28 +00:00
|
|
|
C.SetDrawColorStruct(Settings.Style.DoshTextColorMid);
|
2022-09-03 15:46:23 +00:00
|
|
|
StrValue = GetNiceSize(int(KFPRI.Score));
|
2021-05-16 09:40:02 +00:00
|
|
|
}
|
2022-09-08 13:32:28 +00:00
|
|
|
DrawTextShadowHVCenter(StrValue, DoshXPos, YOffset, DoshWBox, Height, FontScalar);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
// Ping
|
|
|
|
if (KFPRI.bBot)
|
2021-06-08 23:22:35 +00:00
|
|
|
{
|
2022-09-03 17:26:40 +00:00
|
|
|
C.SetDrawColorStruct(Settings.Style.PingTextColorNone);
|
2021-05-16 09:40:02 +00:00
|
|
|
S = "-";
|
2021-06-08 23:22:35 +00:00
|
|
|
}
|
2021-05-16 09:40:02 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
Ping = int(KFPRI.Ping * `PING_SCALE);
|
|
|
|
|
2022-09-03 17:26:40 +00:00
|
|
|
if (Ping <= Settings.Ping.Low)
|
|
|
|
C.SetDrawColorStruct(Settings.Style.PingTextColorLow);
|
2021-06-09 00:58:31 +00:00
|
|
|
else if (Ping <= Settings.Ping.High)
|
2022-09-03 17:26:40 +00:00
|
|
|
C.SetDrawColorStruct(Settings.Style.PingTextColorMid);
|
2021-06-08 23:22:35 +00:00
|
|
|
else
|
2022-09-03 17:26:40 +00:00
|
|
|
C.SetDrawColorStruct(Settings.Style.PingTextColorHigh);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
S = string(Ping);
|
|
|
|
}
|
|
|
|
|
2021-06-13 02:29:47 +00:00
|
|
|
C.TextSize(S, XL, YL, FontScalar, FontScalar);
|
2022-09-08 13:32:28 +00:00
|
|
|
DrawTextShadowHVCenter(S, PingXPos, YOffset, Settings.Style.ShowPingBars ? PingWBox/2 : PingWBox, Height, FontScalar);
|
2021-06-13 02:54:35 +00:00
|
|
|
C.SetDrawColor(250, 250, 250, 255);
|
2021-07-05 03:53:26 +00:00
|
|
|
if (Settings.Style.ShowPingBars)
|
2021-07-05 03:02:30 +00:00
|
|
|
DrawPingBars(C, YOffset + (Height/2) - ((Height*0.5)/2), Width - (Height*0.5) - (BorderSize*2), Height*0.5, Height*0.5, float(Ping));
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
2021-06-13 03:00:19 +00:00
|
|
|
final function DrawPingBars(Canvas C, float YOffset, float XOffset, float W, float H, float Ping)
|
2020-01-10 13:14:11 +00:00
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
local float PingMul, BarW, BarH, BaseH, XPos, YPos;
|
|
|
|
local byte i;
|
|
|
|
|
2021-06-09 00:58:31 +00:00
|
|
|
PingMul = 1.f - FClamp(FMax(Ping - Settings.Ping.Low, 1.f) / Settings.Ping.High, 0.f, 1.f);
|
2021-05-16 09:40:02 +00:00
|
|
|
BarW = W / PingBars;
|
|
|
|
BaseH = H / PingBars;
|
|
|
|
|
|
|
|
PingColor.R = (1.f - PingMul) * 255;
|
|
|
|
PingColor.G = PingMul * 255;
|
|
|
|
|
2021-06-13 02:53:33 +00:00
|
|
|
for (i=1; i < PingBars; i++)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
|
|
|
BarH = BaseH * i;
|
|
|
|
XPos = XOffset + ((i - 1) * BarW);
|
|
|
|
YPos = YOffset + (H - BarH);
|
|
|
|
|
2021-06-13 02:54:35 +00:00
|
|
|
C.SetPos(XPos, YPos);
|
2021-05-16 09:40:02 +00:00
|
|
|
C.SetDrawColor(20, 20, 20, 255);
|
2021-06-13 02:54:35 +00:00
|
|
|
Owner.CurrentStyle.DrawWhiteBox(BarW, BarH);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
2021-06-13 02:53:33 +00:00
|
|
|
if (PingMul >= (i / PingBars))
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
2021-06-13 02:54:35 +00:00
|
|
|
C.SetPos(XPos, YPos);
|
2021-05-16 09:40:02 +00:00
|
|
|
C.DrawColor = PingColor;
|
2021-06-13 02:54:35 +00:00
|
|
|
Owner.CurrentStyle.DrawWhiteBox(BarW, BarH);
|
2021-05-16 09:40:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
C.SetDrawColor(80, 80, 80, 255);
|
2021-06-13 02:54:35 +00:00
|
|
|
Owner.CurrentStyle.DrawBoxHollow(XPos, YPos, BarW, BarH, 1);
|
2021-05-16 09:40:02 +00:00
|
|
|
}
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
2021-06-13 03:00:19 +00:00
|
|
|
static final function Texture2D FindAvatar(KFPlayerController PC, UniqueNetId ClientID)
|
2020-01-10 13:14:11 +00:00
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
local string S;
|
|
|
|
|
|
|
|
S = PC.GetSteamAvatar(ClientID);
|
2021-06-13 02:53:33 +00:00
|
|
|
if (S == "")
|
2021-05-16 09:40:02 +00:00
|
|
|
return None;
|
2021-06-13 02:54:35 +00:00
|
|
|
return Texture2D(PC.FindObject(S, class'Texture2D'));
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
final static function string GetNiceSize(int Num)
|
|
|
|
{
|
2022-09-03 15:46:23 +00:00
|
|
|
if (Num < 10000 ) return string(Num);
|
2021-06-13 02:53:33 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-06-13 03:00:19 +00:00
|
|
|
function ScrollMouseWheel(bool bUp)
|
2020-01-10 13:14:11 +00:00
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
PlayersList.ScrollMouseWheel(bUp);
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
2022-09-08 13:32:28 +00:00
|
|
|
function Color HealthColorByPercent(float FloatPercent)
|
|
|
|
{
|
|
|
|
local Color CRED, CYLW, CGRN, RV;
|
|
|
|
|
|
|
|
CRED = MakeColor(200, 0, 0, 150);
|
|
|
|
CYLW = MakeColor(200, 200, 0, 150);
|
|
|
|
CGRN = MakeColor(0, 200, 0, 150);
|
|
|
|
|
|
|
|
if (FloatPercent >= 0.9f)
|
|
|
|
{
|
|
|
|
RV = CGRN;
|
|
|
|
}
|
|
|
|
else if (FloatPercent >= 0.5f)
|
|
|
|
{
|
|
|
|
RV = PickDynamicColor(CYLW, CGRN, (FloatPercent - 0.5f) / (0.9f - 0.5f));
|
|
|
|
}
|
|
|
|
else if (FloatPercent >= 0.1f)
|
|
|
|
{
|
|
|
|
RV = PickDynamicColor(CRED, CYLW, (FloatPercent - 0.1f) / (0.5f - 0.1f));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RV = CRED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return RV;
|
|
|
|
}
|
|
|
|
|
|
|
|
function Color PickDynamicColor(Color LowerColor, Color UpperColor, float FloatPercent)
|
|
|
|
{
|
|
|
|
return MakeColor((
|
|
|
|
LowerColor.R < UpperColor.R ?
|
|
|
|
LowerColor.R + ((UpperColor.R - LowerColor.R) * FloatPercent) :
|
|
|
|
LowerColor.R - ((LowerColor.R - UpperColor.R) * FloatPercent)),
|
|
|
|
(
|
|
|
|
LowerColor.G < UpperColor.G ?
|
|
|
|
LowerColor.G + ((UpperColor.G - LowerColor.G) * FloatPercent) :
|
|
|
|
LowerColor.G - ((LowerColor.G - UpperColor.G) * FloatPercent)),
|
|
|
|
(
|
|
|
|
LowerColor.B < UpperColor.B ?
|
|
|
|
LowerColor.B + ((UpperColor.B - LowerColor.B) * FloatPercent) :
|
|
|
|
LowerColor.B - ((LowerColor.B - UpperColor.B) * FloatPercent)),
|
|
|
|
(
|
|
|
|
LowerColor.A < UpperColor.A ?
|
|
|
|
LowerColor.A + ((UpperColor.A - LowerColor.A) * FloatPercent) :
|
|
|
|
LowerColor.A - ((LowerColor.A - UpperColor.A) * FloatPercent)));
|
|
|
|
}
|
|
|
|
|
|
|
|
function DrawTextShadowHVCenter(string Str, float XPos, float YPos, float BoxWidth, float BoxHeight, float FontScalar)
|
|
|
|
{
|
|
|
|
local float TextWidth;
|
|
|
|
local float TextHeight;
|
|
|
|
|
|
|
|
Canvas.TextSize(Str, TextWidth, TextHeight, FontScalar, FontScalar);
|
|
|
|
|
|
|
|
Owner.CurrentStyle.DrawTextShadow(Str, XPos + (BoxWidth - TextWidth)/2 , YPos + (BoxHeight - TextHeight)/2, 1, FontScalar);
|
|
|
|
}
|
|
|
|
|
|
|
|
function DrawTextShadowHLeftVCenter(string Str, float XPos, float YPos, float BoxHeight, float FontScalar)
|
|
|
|
{
|
|
|
|
local float TextWidth;
|
|
|
|
local float TextHeight;
|
|
|
|
|
|
|
|
Canvas.TextSize(Str, TextWidth, TextHeight, FontScalar, FontScalar);
|
|
|
|
|
|
|
|
Owner.CurrentStyle.DrawTextShadow(Str, XPos, YPos + (BoxHeight - TextHeight)/2, 1, FontScalar);
|
|
|
|
}
|
|
|
|
|
|
|
|
function DrawTextShadowHRightVCenter(string Str, float XPos, float YPos, float BoxWidth, float BoxHeight, float FontScalar)
|
|
|
|
{
|
|
|
|
local float TextWidth;
|
|
|
|
local float TextHeight;
|
|
|
|
|
|
|
|
Canvas.TextSize(Str, TextWidth, TextHeight, FontScalar, FontScalar);
|
|
|
|
|
|
|
|
Owner.CurrentStyle.DrawTextShadow(Str, XPos + BoxWidth - TextWidth, YPos + (BoxHeight - TextHeight)/2, 1, FontScalar);
|
|
|
|
}
|
|
|
|
|
2020-01-10 13:14:11 +00:00
|
|
|
defaultproperties
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
bEnableInputs=true
|
|
|
|
|
2021-06-13 02:54:35 +00:00
|
|
|
PingColor=(R=255, G=255, B=60, A=255)
|
2021-05-16 09:40:02 +00:00
|
|
|
PingBars=5.0
|
|
|
|
|
|
|
|
Begin Object Class=KFGUI_List Name=PlayerList
|
2022-09-03 15:46:23 +00:00
|
|
|
XSize=PlayerListWidthRatio
|
2021-05-16 09:40:02 +00:00
|
|
|
OnDrawItem=DrawPlayerEntry
|
|
|
|
ID="PlayerList"
|
|
|
|
bClickable=false
|
2022-09-08 18:20:04 +00:00
|
|
|
ListItemsPerPage=ListItems
|
2021-05-16 09:40:02 +00:00
|
|
|
End Object
|
|
|
|
Components.Add(PlayerList)
|
|
|
|
|
|
|
|
DefaultAvatar=Texture2D'UI_HUD.ScoreBoard_Standard_SWF_I26'
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|