2017-10-20 02:00:49 +00:00
|
|
|
Class UI_Scoreboard extends KFGUI_Page;
|
|
|
|
|
|
|
|
var editinline export KFGUI_RightClickMenu PlayerContext;
|
|
|
|
var KFGUI_List PlayersList;
|
|
|
|
var() float ScoreboardSpacing;
|
|
|
|
var color SBTextColor;
|
|
|
|
var Texture2D HealthIcon;
|
|
|
|
var KFGameReplicationInfo KFGRI;
|
|
|
|
var array<ExtPlayerReplicationInfo> PRIList;
|
|
|
|
var ExtPlayerReplicationInfo RightClickPlayer;
|
|
|
|
var int PlayerIndex;
|
|
|
|
var Font SBFont;
|
|
|
|
var transient float SBFontSize,CashXPos,KillsXPos,AssistXPos,PingXPos,SBFontHeight;
|
|
|
|
var transient int InitAdminSize;
|
|
|
|
|
|
|
|
var KFGUI_Tooltip ToolTipItem;
|
|
|
|
|
|
|
|
var transient bool bHasSelectedPlayer,bMeAdmin,bShowSpectatorsOnly;
|
|
|
|
|
2020-09-01 06:56:14 +00:00
|
|
|
var KFGUI_Button SpecButton;
|
|
|
|
|
|
|
|
var localized string TimeText;
|
|
|
|
var localized string PlayersText;
|
|
|
|
var localized string PlayerText;
|
|
|
|
var localized string AliveText;
|
|
|
|
var localized string SpectatorsText;
|
|
|
|
var localized string HeaderWaveText;
|
|
|
|
var localized string HeaderPlayerText;
|
|
|
|
var localized string HeaderDoshText;
|
|
|
|
var localized string HeaderKillsText;
|
|
|
|
var localized string HeaderAssistText;
|
|
|
|
var localized string HeaderPingText;
|
|
|
|
var localized string NoPerkText;
|
|
|
|
var localized string RespawnText;
|
|
|
|
var localized string BotText;
|
|
|
|
var localized string DeadText;
|
|
|
|
var localized string UnmutePlayerText;
|
|
|
|
var localized string MutePlayerText;
|
|
|
|
var localized string YouveMutedText;
|
|
|
|
var localized string YouveUnmutedText;
|
|
|
|
var localized string HealthText;
|
|
|
|
var localized string RClickForOptsText;
|
|
|
|
var localized string SpecButtonText;
|
|
|
|
var localized string SpecButtonTooltip;
|
|
|
|
var localized string SpectateThisPlayerText;
|
|
|
|
var localized string ViewPlayerProfileText;
|
|
|
|
var localized string MuteText;
|
|
|
|
|
|
|
|
function FRowItem NewFRowItem(string Text, bool isSplitter)
|
|
|
|
{
|
|
|
|
local FRowItem newItem;
|
|
|
|
newItem.Text=Text;
|
|
|
|
newItem.bSplitter=isSplitter;
|
|
|
|
return newItem;
|
|
|
|
}
|
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function InitMenu()
|
|
|
|
{
|
|
|
|
Super.InitMenu();
|
|
|
|
HealthIcon = Texture2D(DynamicLoadObject("UI_Objective_Tex.UI_Obj_Healing_Loc",class'Texture2D'));
|
|
|
|
PlayersList = KFGUI_List(FindComponentID('PlayerList'));
|
2020-09-01 06:56:14 +00:00
|
|
|
SpecButton = KFGUI_Button(FindComponentID('Spec'));
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2020-09-01 06:56:14 +00:00
|
|
|
SpecButton.ButtonText=SpecButtonText;
|
|
|
|
SpecButton.Tooltip=SpecButtonTooltip;
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2020-09-01 06:56:14 +00:00
|
|
|
PlayerContext.ItemRows.AddItem(NewFRowItem(SpectateThisPlayerText, false));
|
|
|
|
PlayerContext.ItemRows.AddItem(NewFRowItem(ViewPlayerProfileText, false));
|
|
|
|
PlayerContext.ItemRows.AddItem(NewFRowItem(MuteText, false));
|
|
|
|
PlayerContext.ItemRows.AddItem(NewFRowItem("", true));
|
2017-10-20 02:00:49 +00:00
|
|
|
}
|
2020-09-01 07:19:52 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function ShowMenu()
|
|
|
|
{
|
|
|
|
local ExtPlayerController PC;
|
|
|
|
local int i;
|
|
|
|
local bool bAdmin;
|
|
|
|
|
|
|
|
Owner.bAbsorbInput = false;
|
|
|
|
PC = ExtPlayerController(GetPlayer());
|
|
|
|
bAdmin = PC!=None && (PC.WorldInfo.NetMode!=NM_Client || (PC.PlayerReplicationInfo!=None && PC.PlayerReplicationInfo.bAdmin));
|
2020-11-28 20:12:58 +00:00
|
|
|
if (PC!=None && (InitAdminSize!=PC.AdminCommands.Length || !bAdmin))
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
InitAdminSize = (bAdmin ? PC.AdminCommands.Length : 0);
|
|
|
|
PlayerContext.ItemRows.Length = 4+InitAdminSize;
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=0; i<InitAdminSize; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
PlayerContext.ItemRows[4+i].Text = PC.AdminCommands[i].Info;
|
|
|
|
}
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function CloseMenu()
|
|
|
|
{
|
|
|
|
Owner.bAbsorbInput = true;
|
|
|
|
KFGRI = None;
|
|
|
|
PRIList.Length = 0;
|
|
|
|
RightClickPlayer = None;
|
|
|
|
bHasSelectedPlayer = false;
|
|
|
|
bShowSpectatorsOnly = false;
|
|
|
|
}
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function bool InOrder(PlayerReplicationInfo A, PlayerReplicationInfo B)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (A.bOnlySpectator!=B.bOnlySpectator)
|
2017-10-20 02:00:49 +00:00
|
|
|
return B.bOnlySpectator;
|
2020-11-28 20:12:58 +00:00
|
|
|
if (A.Kills!=B.Kills)
|
2017-10-20 02:00:49 +00:00
|
|
|
return (A.Kills<B.Kills);
|
2020-11-28 20:12:58 +00:00
|
|
|
if (A.Score!=B.Score)
|
2017-10-20 02:00:49 +00:00
|
|
|
return (A.Score<B.Score);
|
|
|
|
return (A.PlayerName<B.PlayerName);
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function DrawMenu()
|
|
|
|
{
|
|
|
|
local PlayerController PC;
|
|
|
|
local float XPos,YPos,XScale,YHeight,Y,FontScalar,BoxHeight,XL,YL;
|
|
|
|
local int i,j,NumSpec,NumPlayer,NumAlivePlayer;
|
|
|
|
local PlayerReplicationInfo PRI;
|
|
|
|
local ExtPlayerReplicationInfo KPRI;
|
|
|
|
local byte DefFont;
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
PC = GetPlayer();
|
2020-11-28 20:12:58 +00:00
|
|
|
if (KFGRI==None)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
KFGRI = KFGameReplicationInfo(PC.WorldInfo.GRI);
|
2020-11-28 20:12:58 +00:00
|
|
|
if (KFGRI==None)
|
2017-10-20 02:00:49 +00:00
|
|
|
return;
|
|
|
|
}
|
2022-08-30 04:42:20 +00:00
|
|
|
bMeAdmin = (PC.WorldInfo.NetMode!=NM_Client || (ExtPlayerReplicationInfo(PC.PlayerReplicationInfo) != None && ExtPlayerReplicationInfo(PC.PlayerReplicationInfo).AdminType <= AT_Admin));
|
2017-10-20 02:00:49 +00:00
|
|
|
|
|
|
|
// Sort player list.
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=(KFGRI.PRIArray.Length-1); i>0; --i)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
for (j=i-1; j>=0; --j)
|
|
|
|
if (!InOrder(KFGRI.PRIArray[i],KFGRI.PRIArray[j]))
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
PRI = KFGRI.PRIArray[i];
|
|
|
|
KFGRI.PRIArray[i] = KFGRI.PRIArray[j];
|
|
|
|
KFGRI.PRIArray[j] = PRI;
|
|
|
|
}
|
|
|
|
}
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Check players.
|
|
|
|
PlayerIndex = -1;
|
|
|
|
NumPlayer = 0;
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=(KFGRI.PRIArray.Length-1); i>=0; --i)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
KPRI = ExtPlayerReplicationInfo(KFGRI.PRIArray[i]);
|
2020-11-28 20:12:58 +00:00
|
|
|
if (KPRI==None || KPRI.bHiddenUser)
|
2017-10-20 02:00:49 +00:00
|
|
|
continue;
|
2020-11-28 20:12:58 +00:00
|
|
|
if (KPRI.bOnlySpectator)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
++NumSpec;
|
|
|
|
continue;
|
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
if (KPRI.PlayerHealth>0 && KPRI.PlayerHealthPercent>0 && KPRI.GetTeamNum()==0)
|
2017-10-20 02:00:49 +00:00
|
|
|
++NumAlivePlayer;
|
|
|
|
++NumPlayer;
|
|
|
|
}
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
PRIList.Length = (bShowSpectatorsOnly ? NumSpec : NumPlayer);
|
|
|
|
j = PRIList.Length;
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=(KFGRI.PRIArray.Length-1); i>=0; --i)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
KPRI = ExtPlayerReplicationInfo(KFGRI.PRIArray[i]);
|
2020-11-28 20:12:58 +00:00
|
|
|
if (KPRI!=None && bShowSpectatorsOnly==KPRI.bOnlySpectator)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
PRIList[--j] = KPRI;
|
2020-11-28 20:12:58 +00:00
|
|
|
if (KPRI==PC.PlayerReplicationInfo)
|
2017-10-20 02:00:49 +00:00
|
|
|
PlayerIndex = j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Header font info.
|
|
|
|
DefFont = Owner.CurrentStyle.DefaultFontSize;
|
|
|
|
Canvas.Font = Owner.CurrentStyle.PickFont(DefFont,FontScalar);
|
|
|
|
YL = Owner.CurrentStyle.DefaultHeight;
|
|
|
|
YHeight = YL*5.f;
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Draw header.
|
2020-11-28 20:12:58 +00:00
|
|
|
if (Canvas.ClipX<1000)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
XPos = Canvas.ClipX*0.2;
|
|
|
|
XScale = Canvas.ClipX*0.6;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
XPos = Canvas.ClipX*0.3;
|
|
|
|
XScale = Canvas.ClipX*0.4;
|
|
|
|
}
|
|
|
|
YPos = Canvas.ClipY*0.05;
|
|
|
|
Canvas.SetDrawColor(128,32,32,FrameOpacity);
|
|
|
|
Owner.CurrentStyle.DrawRectBox(XPos,YPos,XScale*0.75,YHeight,26,1);
|
|
|
|
|
|
|
|
Canvas.DrawColor = SBTextColor;
|
|
|
|
|
|
|
|
Y = YPos+10;
|
|
|
|
Canvas.SetPos(XPos+26,Y);
|
|
|
|
Canvas.DrawText(PC.WorldInfo.Title,,FontScalar,FontScalar);
|
|
|
|
|
|
|
|
Y+=YL;
|
|
|
|
Canvas.SetPos(XPos+26,Y);
|
|
|
|
Canvas.DrawText(KFGRI.ServerName,,FontScalar,FontScalar);
|
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
if (KFGRI.GameClass!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
Y+=YL;
|
|
|
|
Canvas.SetPos(XPos+26,Y);
|
|
|
|
Canvas.DrawText(KFGRI.GameClass.Default.GameName$" - "$Class'KFCommon_LocalizedStrings'.Static.GetDifficultyString(KFGRI.GameDifficulty),,FontScalar,FontScalar);
|
|
|
|
}
|
|
|
|
|
|
|
|
Y+=YL;
|
|
|
|
Canvas.SetPos(XPos+26,Y);
|
2020-09-01 07:19:52 +00:00
|
|
|
Canvas.DrawText(TimeText$": "$FormatTimeSM(KFGRI.ElapsedTime)$" | "$PlayersText$": "$NumPlayer$" | "$AliveText$": "$NumAlivePlayer$" | "$SpectatorsText$": "$NumSpec,,FontScalar,FontScalar);
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
XPos += XScale*0.75-1;
|
|
|
|
XScale *= 0.25;
|
|
|
|
Canvas.SetDrawColor(18,8,8,FrameOpacity);
|
|
|
|
Owner.CurrentStyle.DrawRectBox(XPos,YPos,XScale,YHeight,26);
|
|
|
|
Canvas.DrawColor = SBTextColor;
|
|
|
|
Canvas.Font = Owner.CurrentStyle.PickFont(DefFont+3,FontScalar);
|
|
|
|
Canvas.TextSize("A",XL,YL,FontScalar,FontScalar);
|
|
|
|
Y = YPos+4;
|
2020-09-01 06:56:14 +00:00
|
|
|
DrawCenteredText(HeaderWaveText,XPos+XScale*0.5,Y,FontScalar);
|
2017-10-20 02:00:49 +00:00
|
|
|
Y += YL;
|
|
|
|
DrawCenteredText(KFGRI.WaveNum$"/"$(KFGRI.WaveMax-1),XPos+XScale*0.5,Y,FontScalar*1.1);
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Scoreboard title line.
|
|
|
|
Canvas.Font = Owner.CurrentStyle.PickFont(DefFont,FontScalar);
|
|
|
|
YL = Owner.CurrentStyle.DefaultHeight;
|
2020-11-28 20:12:58 +00:00
|
|
|
if (Canvas.ClipX<1000)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
XPos = Canvas.ClipX*0.175;
|
|
|
|
XScale = Canvas.ClipX*0.65;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
XPos = Canvas.ClipX*0.25;
|
|
|
|
XScale = Canvas.ClipX*0.5;
|
|
|
|
}
|
|
|
|
YPos += YHeight*1.05;
|
|
|
|
YHeight = YL;
|
2020-11-28 20:12:58 +00:00
|
|
|
if (bShowSpectatorsOnly)
|
2017-10-20 02:00:49 +00:00
|
|
|
Canvas.SetDrawColor(32,32,128,FrameOpacity);
|
|
|
|
else Canvas.SetDrawColor(128,32,32,FrameOpacity);
|
|
|
|
Owner.CurrentStyle.DrawRectBox(XPos,YPos,XScale,YHeight,16,2);
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Calc X offsets
|
|
|
|
CashXPos = XScale*0.5;
|
|
|
|
KillsXPos = XScale*0.7;
|
|
|
|
AssistXPos = XScale*0.8;
|
|
|
|
PingXPos = XScale*0.9;
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Header texts
|
|
|
|
Canvas.DrawColor = SBTextColor;
|
|
|
|
Y = YPos+4;
|
|
|
|
Canvas.SetPos(XPos+18,Y);
|
2020-09-01 06:56:14 +00:00
|
|
|
Canvas.DrawText(HeaderPlayerText,,FontScalar,FontScalar);
|
2020-11-28 20:12:58 +00:00
|
|
|
if (!bShowSpectatorsOnly)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
Canvas.SetPos(XPos+CashXPos,Y);
|
2020-09-01 06:56:14 +00:00
|
|
|
Canvas.DrawText(HeaderDoshText,,FontScalar,FontScalar);
|
|
|
|
DrawCenteredText(HeaderKillsText,XPos+KillsXPos,Y,FontScalar);
|
|
|
|
DrawCenteredText(HeaderAssistText,XPos+AssistXPos,Y,FontScalar);
|
2017-10-20 02:00:49 +00:00
|
|
|
}
|
2020-09-01 06:56:14 +00:00
|
|
|
DrawCenteredText(HeaderPingText,XPos+PingXPos,Y,FontScalar);
|
2017-10-20 02:00:49 +00:00
|
|
|
|
|
|
|
// Check how many players to draw.
|
|
|
|
YPos+=(YHeight-1);
|
|
|
|
YHeight = (Canvas.ClipY*0.95) - YPos;
|
|
|
|
i = DefFont+2;
|
2020-11-28 20:12:58 +00:00
|
|
|
while (i>0)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
Canvas.Font = Owner.CurrentStyle.PickFont(i,SBFontSize);
|
|
|
|
Canvas.TextSize("A",XL,SBFontHeight,SBFontSize,SBFontSize);
|
|
|
|
BoxHeight = SBFontHeight*2.f+ScoreboardSpacing;
|
2020-11-28 20:12:58 +00:00
|
|
|
if ((BoxHeight*PRIList.Length)<=YHeight)
|
2017-10-20 02:00:49 +00:00
|
|
|
break;
|
|
|
|
--i;
|
|
|
|
}
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Scoreboard background.
|
|
|
|
Canvas.SetDrawColor(18,8,8,FrameOpacity);
|
|
|
|
Owner.CurrentStyle.DrawRectBox(XPos,YPos,XScale,YHeight,16);
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Setup listing.
|
|
|
|
PlayersList.XPosition = (XPos+8.f) / InputPos[2];
|
|
|
|
PlayersList.YPosition = (YPos+8.f) / InputPos[3];
|
|
|
|
PlayersList.XSize = (XScale-16.f) / InputPos[2];
|
|
|
|
PlayersList.YSize = (YHeight-16.f) / InputPos[3];
|
|
|
|
PlayersList.ListItemsPerPage = YHeight/BoxHeight;
|
|
|
|
PlayersList.ChangeListSize(PRIList.Length);
|
|
|
|
SBFont = Canvas.Font;
|
|
|
|
}
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
final function Texture2D FindAvatar(UniqueNetId ClientID)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local string S;
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
S = KFPlayerController(GetPlayer()).GetSteamAvatar(ClientID);
|
2020-11-28 20:12:58 +00:00
|
|
|
if (S=="")
|
2017-10-20 02:00:49 +00:00
|
|
|
return None;
|
2017-10-20 07:02:53 +00:00
|
|
|
return Texture2D(FindObject(S,class'Texture2D'));
|
2017-10-20 02:00:49 +00:00
|
|
|
}
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
final function DrawCenteredText(string S, float X, float Y, optional float Scale=1.f)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local float XL,YL;
|
|
|
|
|
|
|
|
Canvas.TextSize(S,XL,YL);
|
|
|
|
Canvas.SetPos(X-(XL*Scale*0.5),Y);
|
|
|
|
Canvas.DrawText(S,,Scale,Scale);
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
static final function string FormatTimeSM(float Sec)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local int Seconds,Minutes;
|
|
|
|
|
|
|
|
Sec = Abs(Sec);
|
|
|
|
Seconds = int(Sec);
|
|
|
|
Minutes = Seconds/60;
|
|
|
|
Seconds-=Minutes*60;
|
|
|
|
|
|
|
|
return Minutes$":"$(Seconds<10 ? "0"$Seconds : string(Seconds));
|
|
|
|
}
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float Width, bool bFocus)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local ExtPlayerReplicationInfo PRI;
|
|
|
|
local float XPos,YPos,XL,YL;
|
|
|
|
local string S;
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
if (Index==0)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
// Setup font info.
|
|
|
|
C.Font = SBFont;
|
|
|
|
}
|
|
|
|
PRI = PRIList[Index];
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
bFocus = bFocus || (bHasSelectedPlayer && RightClickPlayer==PRI);
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Draw name entry background.
|
2020-11-28 20:12:58 +00:00
|
|
|
if (PRI.bOnlySpectator) // Spectator - blue.
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (bFocus)
|
2017-10-20 02:00:49 +00:00
|
|
|
C.SetDrawColor(86,86,212,FrameOpacity);
|
|
|
|
else C.SetDrawColor(48,48,164,FrameOpacity);
|
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
else if (PRI.Team==None) // Unteamed - Grey.
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (bFocus)
|
2017-10-20 02:00:49 +00:00
|
|
|
C.SetDrawColor(86,86,86,FrameOpacity);
|
|
|
|
else C.SetDrawColor(48,48,48,FrameOpacity);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
switch (PRI.Team.TeamIndex)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
case 0: // Humans - Red.
|
2020-11-28 20:12:58 +00:00
|
|
|
if (bFocus)
|
2017-10-20 02:00:49 +00:00
|
|
|
C.SetDrawColor(160,48,48,FrameOpacity);
|
|
|
|
else C.SetDrawColor(128,32,32,FrameOpacity);
|
|
|
|
break;
|
|
|
|
default: // Rest - Green.
|
2020-11-28 20:12:58 +00:00
|
|
|
if (bFocus)
|
2017-10-20 02:00:49 +00:00
|
|
|
C.SetDrawColor(48,160,48,FrameOpacity);
|
|
|
|
else C.SetDrawColor(32,128,32,FrameOpacity);
|
|
|
|
}
|
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
if (PRI.PlayerHealth<=0 || PRI.PlayerHealthPercent<=0)
|
2017-10-20 02:00:49 +00:00
|
|
|
C.DrawColor = C.DrawColor*0.6;
|
|
|
|
Owner.CurrentStyle.DrawRectBox(0.f,YOffset,Width,Height-ScoreboardSpacing,10);
|
|
|
|
Height-=ScoreboardSpacing;
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Draw health bg.
|
2020-11-28 20:12:58 +00:00
|
|
|
if (!bShowSpectatorsOnly)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (PRI.PlayerHealth<30 || PRI.PlayerHealthPercent<=0) // Chose color based on health.
|
2017-10-20 02:00:49 +00:00
|
|
|
C.SetDrawColor(220,32,32,255);
|
2020-11-28 20:12:58 +00:00
|
|
|
else if (PRI.PlayerHealth<70)
|
2017-10-20 02:00:49 +00:00
|
|
|
C.SetDrawColor(220,220,32,255);
|
|
|
|
else C.SetDrawColor(32,225,32,255);
|
|
|
|
Owner.CurrentStyle.DrawRectBox(6.f,YOffset+6,Height-12,Height-12,5);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Avatar
|
2020-11-28 20:12:58 +00:00
|
|
|
if (PRI.Avatar!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
C.SetDrawColor(255,255,255,255);
|
|
|
|
C.SetPos(Height+4,YOffset+4);
|
|
|
|
C.DrawTile(PRI.Avatar,Height-8,Height-8,0,0,PRI.Avatar.SizeX,PRI.Avatar.SizeY);
|
|
|
|
XPos = Height*2+8;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
XPos = Height+4;
|
|
|
|
|
|
|
|
// Try to obtain avatar.
|
2020-11-28 20:12:58 +00:00
|
|
|
if (!PRI.bBot)
|
2017-10-20 02:00:49 +00:00
|
|
|
PRI.Avatar = FindAvatar(PRI.UniqueId);
|
|
|
|
}
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Name
|
|
|
|
C.SetPos(XPos,YOffset+2);
|
2020-11-28 20:12:58 +00:00
|
|
|
if (PlayerIndex==Index)
|
2017-10-20 02:00:49 +00:00
|
|
|
C.SetDrawColor(128,255,128,255);
|
|
|
|
else C.DrawColor = SBTextColor;
|
|
|
|
YPos = SBFontSize;
|
|
|
|
S = PRI.TaggedPlayerName;
|
2020-11-28 20:12:58 +00:00
|
|
|
if (PRI.ShowAdminName())
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
S = S$" ("$PRI.GetAdminNameAbr()$")";
|
|
|
|
C.DrawColor = PRI.GetAdminColorC();
|
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
else if (PRI.bIsDev)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
S = S$" (D)";
|
|
|
|
C.DrawColor = MakeColor(130,255,235,255);
|
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
if (bMeAdmin && PRI.FixedData>0)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
C.DrawColor = MakeColor(255,0,0,255);
|
|
|
|
S = S$" -"$PRI.GetDesc();
|
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
while (true) // Make sure too long name doesn't overleap.
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
C.TextSize(S,XL,YL,YPos,YPos);
|
2020-11-28 20:12:58 +00:00
|
|
|
if ((C.CurX+XL)<CashXPos)
|
2017-10-20 02:00:49 +00:00
|
|
|
break;
|
|
|
|
YPos*=0.9;
|
|
|
|
}
|
|
|
|
C.DrawText(S,,YPos,YPos);
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Other info background.
|
|
|
|
C.SetDrawColor(4,4,4,255);
|
|
|
|
Owner.CurrentStyle.DrawRectBox(CashXPos-4,YOffset+4,Width-CashXPos-8,Height-8,6);
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Perk
|
2020-11-28 20:12:58 +00:00
|
|
|
if (!bShowSpectatorsOnly)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (PRI.ECurrentPerk!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
// Icon.
|
|
|
|
C.DrawColor = PRI.HUDPerkColor;
|
|
|
|
C.SetPos(XPos,YOffset+Height*0.5);
|
|
|
|
C.DrawRect(Height*0.475,Height*0.475,PRI.ECurrentPerk.Default.PerkIcon);
|
|
|
|
|
|
|
|
// Name.
|
|
|
|
S = PRI.GetPerkLevelStr()@PRI.ECurrentPerk.Default.PerkName;
|
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
else if (PRI.bBot && PRI.CurrentPerkClass!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
// Icon.
|
|
|
|
C.DrawColor = SBTextColor;
|
|
|
|
C.SetPos(XPos,YOffset+Height*0.5);
|
|
|
|
C.DrawRect(Height*0.475,Height*0.475,PRI.CurrentPerkClass.Default.PerkIcon);
|
|
|
|
|
|
|
|
// Name.
|
|
|
|
S = PRI.CurrentPerkClass.Default.PerkName;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
C.DrawColor = SBTextColor;
|
2020-09-01 06:56:14 +00:00
|
|
|
S = NoPerkText;
|
2017-10-20 02:00:49 +00:00
|
|
|
}
|
|
|
|
YPos = SBFontSize*0.9;
|
|
|
|
C.SetPos(XPos+Height*0.5,YOffset+Height*0.495);
|
2020-11-28 20:12:58 +00:00
|
|
|
if (PRI.RespawnCounter>=0)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
C.DrawColor = SBTextColor;
|
2020-09-01 07:19:52 +00:00
|
|
|
S = RespawnText$": "$FormatTimeSM(PRI.RespawnCounter);
|
2017-10-20 02:00:49 +00:00
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
while (true) // Make sure too long name doesn't overleap.
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
C.TextSize(S,XL,YL,YPos,YPos);
|
2020-11-28 20:12:58 +00:00
|
|
|
if ((C.CurX+XL)<CashXPos)
|
2017-10-20 02:00:49 +00:00
|
|
|
break;
|
|
|
|
YPos*=0.8;
|
|
|
|
}
|
|
|
|
C.DrawText(S,,YPos,YPos);
|
|
|
|
}
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Cash
|
|
|
|
C.DrawColor = SBTextColor;
|
|
|
|
YPos = YOffset+(Height-SBFontHeight)*0.5;
|
2020-11-28 20:12:58 +00:00
|
|
|
if (!bShowSpectatorsOnly)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
C.SetPos(CashXPos,YPos);
|
|
|
|
C.DrawText(string(int(PRI.Score)),,SBFontSize,SBFontSize);
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Kills
|
|
|
|
DrawCenteredText(string(PRI.Kills),KillsXPos,YPos,SBFontSize);
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Assists
|
|
|
|
DrawCenteredText(string(PRI.Assists),AssistXPos,YPos,SBFontSize);
|
|
|
|
}
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Ping
|
2020-09-01 06:56:14 +00:00
|
|
|
DrawCenteredText(PRI.bBot ? BotText : string(PRI.Ping*4),PingXPos,YPos,SBFontSize);
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Draw health.
|
2020-11-28 20:12:58 +00:00
|
|
|
if (!bShowSpectatorsOnly)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (HealthIcon!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
C.SetPos(6+(Height-12)*0.25,YOffset+8);
|
|
|
|
C.DrawTile(HealthIcon,(Height-12)*0.5,(Height-12)*0.5,0,0,256,256);
|
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
if (PRI.PlayerHealth<=0 || PRI.PlayerHealthPercent<=0)
|
2020-09-01 06:56:14 +00:00
|
|
|
DrawCenteredText(DeadText,6+(Height-12)*0.5,YOffset+Height*0.45,SBFontSize*0.95);
|
2017-10-20 02:00:49 +00:00
|
|
|
else DrawCenteredText(string(PRI.PlayerHealth),6+(Height-12)*0.5,YOffset+Height*0.45,SBFontSize*0.95);
|
|
|
|
}
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function ClickedPlayer(int Index, bool bRight, int MouseX, int MouseY)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local PlayerController PC;
|
|
|
|
local int i;
|
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
if (!bRight || Index<0)
|
2017-10-20 02:00:49 +00:00
|
|
|
return;
|
|
|
|
bHasSelectedPlayer = true;
|
|
|
|
RightClickPlayer = PRIList[Index];
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
// Check what items to disable.
|
|
|
|
PC = GetPlayer();
|
|
|
|
PlayerContext.ItemRows[0].bDisabled = (PlayerIndex==Index || !PC.IsSpectating());
|
|
|
|
PlayerContext.ItemRows[1].bDisabled = RightClickPlayer.bBot;
|
|
|
|
PlayerContext.ItemRows[2].bDisabled = (PlayerIndex==Index || RightClickPlayer.bBot);
|
2020-09-01 06:56:14 +00:00
|
|
|
PlayerContext.ItemRows[2].Text = (PlayerContext.ItemRows[2].bDisabled || PC.IsPlayerMuted(RightClickPlayer.UniqueId)) ? UnmutePlayerText : MutePlayerText;
|
2017-10-20 02:00:49 +00:00
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
if (PlayerIndex==Index) // Selected self.
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=4; i<PlayerContext.ItemRows.Length; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
PlayerContext.ItemRows[i].bDisabled = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=4; i<PlayerContext.ItemRows.Length; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
PlayerContext.ItemRows[i].bDisabled = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
PlayerContext.OpenMenu(Self);
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function HidRightClickMenu(KFGUI_RightClickMenu M)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
bHasSelectedPlayer = false;
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function SelectedRCItem(int Index)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local PlayerController PC;
|
|
|
|
|
|
|
|
PC = GetPlayer();
|
2020-11-28 20:12:58 +00:00
|
|
|
switch (Index)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
case 0: // Spectate this player.
|
|
|
|
PC.ConsoleCommand("ViewPlayerID "$RightClickPlayer.PlayerID);
|
|
|
|
break;
|
|
|
|
case 1: // Steam profile.
|
|
|
|
OnlineSubsystemSteamworks(class'GameEngine'.static.GetOnlineSubsystem()).ShowProfileUI(0,,RightClickPlayer.UniqueId);
|
|
|
|
break;
|
|
|
|
case 2: // Mute voice.
|
2020-11-28 20:12:58 +00:00
|
|
|
if (!PC.IsPlayerMuted(RightClickPlayer.UniqueId))
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-09-01 06:56:14 +00:00
|
|
|
PC.ClientMessage(YouveMutedText$" "$RightClickPlayer.TaggedPlayerName);
|
2017-10-20 02:00:49 +00:00
|
|
|
PC.ClientMutePlayer(RightClickPlayer.UniqueId);
|
|
|
|
RightClickPlayer.bIsMuted = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-09-01 06:56:14 +00:00
|
|
|
PC.ClientMessage(YouveUnmutedText$" "$RightClickPlayer.TaggedPlayerName);
|
2017-10-20 02:00:49 +00:00
|
|
|
PC.ClientUnmutePlayer(RightClickPlayer.UniqueId);
|
|
|
|
RightClickPlayer.bIsMuted = false;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2020-11-28 20:12:58 +00:00
|
|
|
if (Index>=4)
|
2017-10-20 02:00:49 +00:00
|
|
|
PC.ConsoleCommand("Admin "$ExtPlayerController(PC).AdminCommands[Index-4].Cmd@RightClickPlayer.PlayerID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function ShowPlayerTooltip(int Index)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local ExtPlayerReplicationInfo PRI;
|
|
|
|
local string S;
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
PRI = PRIList[Index];
|
2020-11-28 20:12:58 +00:00
|
|
|
if (PRI!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (ToolTipItem==None)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
ToolTipItem = New(None)Class'KFGUI_Tooltip';
|
|
|
|
ToolTipItem.Owner = Owner;
|
|
|
|
ToolTipItem.ParentComponent = Self;
|
|
|
|
ToolTipItem.InitMenu();
|
|
|
|
}
|
2020-09-01 07:19:52 +00:00
|
|
|
S = PlayerText$": "$PRI.TaggedPlayerName$"|"$HealthText$": "$(PRI.PlayerHealthPercent<=0 ? "0" : string(PRI.PlayerHealth));
|
2020-11-28 20:12:58 +00:00
|
|
|
if (PRI.ShowAdminName())
|
2017-10-20 02:00:49 +00:00
|
|
|
S = S$"|"$PRI.GetAdminName();
|
2020-09-01 06:56:14 +00:00
|
|
|
S = S$"|"$RClickForOptsText;
|
2017-10-20 02:00:49 +00:00
|
|
|
ToolTipItem.SetText(S);
|
|
|
|
ToolTipItem.ShowMenu();
|
|
|
|
ToolTipItem.CompPos[0] = Owner.MousePosition.X;
|
|
|
|
ToolTipItem.CompPos[1] = Owner.MousePosition.Y;
|
|
|
|
ToolTipItem.GetInputFocus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function ButtonClicked(KFGUI_Button Sender)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
switch (Sender.ID)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
case 'Spec':
|
|
|
|
bShowSpectatorsOnly = !bShowSpectatorsOnly;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
defaultproperties
|
|
|
|
{
|
|
|
|
bAlwaysTop=true
|
|
|
|
SBTextColor=(R=250,G=250,B=250,A=255)
|
|
|
|
ScoreboardSpacing=4
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
Begin Object Class=KFGUI_List Name=PlayerList
|
|
|
|
bDrawBackground=false
|
|
|
|
OnDrawItem=DrawPlayerEntry
|
|
|
|
OnClickedItem=ClickedPlayer
|
|
|
|
ID="PlayerList"
|
|
|
|
bClickable=true
|
|
|
|
OnMouseRest=ShowPlayerTooltip
|
|
|
|
End Object
|
|
|
|
Begin Object Class=KFGUI_Button Name=B_ShowSpecs
|
|
|
|
ID="Spec"
|
|
|
|
XPosition=0.67
|
|
|
|
YPosition=0.95
|
|
|
|
XSize=0.09
|
|
|
|
YSize=0.03
|
|
|
|
OnClickLeft=ButtonClicked
|
|
|
|
OnClickRight=ButtonClicked
|
|
|
|
End Object
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
Components.Add(PlayerList)
|
|
|
|
Components.Add(B_ShowSpecs)
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
Begin Object Class=KFGUI_RightClickMenu Name=PlayerContextMenu
|
|
|
|
OnSelectedItem=SelectedRCItem
|
|
|
|
OnBecameHidden=HidRightClickMenu
|
|
|
|
End Object
|
|
|
|
PlayerContext=PlayerContextMenu
|
|
|
|
}
|