This commit is contained in:
GenZmeY 2022-09-08 21:20:04 +03:00
parent 40d8ce4f71
commit f05e1dcca4
5 changed files with 86 additions and 49 deletions

View File

@ -59,7 +59,7 @@ function DrawMenu()
FocusMouseItem = n;
else MouseYHit -= ItemHeight;
}
OnDrawItem(Canvas, n,Y, ItemHeight, CompPos[2], (FocusMouseItem == n));
OnDrawItem(Canvas, n,Y, ItemHeight, GetWidth(), (FocusMouseItem == n));
Y+=ItemHeight;
++n;
}
@ -73,6 +73,11 @@ function DrawMenu()
}
}
function float GetWidth()
{
return CompPos[2];
}
function float GetItemHeight()
{
return CompPos[3] / ListItemsPerPage;

View File

@ -14,6 +14,7 @@ const MatchGroupSteamID64 = "10358279";
var private config int Version;
var private config E_LogLevel LogLevel;
var private config String MessageOfTheDay;
var private KFGameInfo KFGI;
var private KFGameInfo_Survival KFGIS;
@ -69,6 +70,7 @@ private function PreInit()
if (Version == `NO_CONFIG)
{
LogLevel = LL_Info;
MessageOfTheDay = "";
SaveConfig();
}
@ -318,6 +320,7 @@ public function YAS_RepInfo CreateRepInfo(Controller C)
OwnerRepInfo.LogLevel = LogLevel;
OwnerRepInfo.RankPlayer = CfgRanks.default.Player;
OwnerRepInfo.RankAdmin = CfgRanks.default.Admin;
OwnerRepInfo.MessageOfTheDay = MessageOfTheDay;
}
return OwnerRepInfo;

View File

@ -4,7 +4,7 @@ var public YAS YAS;
var public repnotify E_LogLevel LogLevel;
var public repnotify SystemRank RankPlayer, RankAdmin;
var public repnotify String DynamicServerName;
var public repnotify String DynamicServerName, MessageOfTheDay;
var public repnotify bool UsesStats, Custom, PasswordRequired;
var public YAS_RankRepInfo RankRepInfo;
@ -22,7 +22,7 @@ var private int Retries;
replication
{
if (bNetInitial)
LogLevel, RankPlayer, RankAdmin;
LogLevel, RankPlayer, RankAdmin, MessageOfTheDay;
if (bNetDirty)
DynamicServerName, UsesStats, Custom, PasswordRequired;
@ -59,6 +59,10 @@ public simulated event ReplicatedEvent(name VarName)
if (SC != None) SC.DynamicServerName = DynamicServerName;
break;
case 'MessageOfTheDay':
if (SC != None) SC.MessageOfTheDay = MessageOfTheDay;
break;
case 'UsesStats':
if (SC != None) SC.UsesStats = UsesStats;
break;
@ -233,6 +237,7 @@ private simulated function InitScoreboard()
SC.UsesStats = UsesStats;
SC.Custom = Custom;
SC.PasswordRequired = PasswordRequired;
SC.MessageOfTheDay = MessageOfTheDay;
}
defaultproperties

View File

@ -3,6 +3,8 @@ class YAS_ScoreBoard extends KFGUI_Page
const HeaderWidthRatio = 0.30f;
const PlayerListWidthRatio = 0.6f;
const PlayerEntryHeightMod = 1.05f;
const ListItems = 16;
/*
const IconRanked = Texture2D'YAS.IconRanked';
@ -41,7 +43,7 @@ var localized String Players, Spectators;
var public Array<YAS_RankRepInfo> RepInfos;
var public YAS_Settings Settings;
var public String DynamicServerName;
var public String DynamicServerName, MessageOfTheDay;
var public bool UsesStats, Custom, PasswordRequired;
var public SystemRank RankPlayer;
@ -204,8 +206,9 @@ function DrawMenu()
local PlayerReplicationInfo PRI;
local float XPos, YPos, YL, XL, FontScalar, XPosCenter, BoxW, BoxX, BoxH, MinBoxW, DoshSize, ScrollBarWidth;
local int i, j, NumSpec, NumAlivePlayer, Width;
local float BorderSize;
local float BorderSize, PlayerListSizeY;
local Color ColorTMP;
local Array<String> MessageOfTheDayLines;
PC = GetPlayer();
if (KFGRI == None)
@ -361,7 +364,8 @@ function DrawMenu()
YPos += YL;
BoxH = YL + BorderSize;
Canvas.SetDrawColorStruct(Settings.Style.ListHeaderBoxColor);
Owner.CurrentStyle.DrawRectBox( XPos - BorderSize * 2,
Owner.CurrentStyle.DrawRectBox(
XPos - BorderSize * 2,
YPos,
Width + BorderSize * 4,
BoxH,
@ -381,7 +385,7 @@ function DrawMenu()
Canvas.TextSize(class'KFGFxHUD_ScoreboardWidget'.default.PingString$" ", XL, YL, FontScalar, FontScalar);
PingWBox = XL < MinBoxW ? MinBoxW : XL;
if (true || NumPlayer <= PlayersList.ListItemsPerPage) // TODO: implement scrollbar later
if (NumPlayer <= PlayersList.ListItemsPerPage)
ScrollBarWidth = 0;
else
ScrollBarWidth = BorderSize * 8;
@ -428,6 +432,53 @@ function DrawMenu()
PlayersList.YSize = (1.f - PlayersList.YPosition) - 0.15;
PlayersList.ChangeListSize(KFPRIArray.Length);
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;
}
}
}
function DrawHealthIcon(float X, float Y, float W, float H)
@ -469,7 +520,8 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
BorderSize = Owner.HUDOwner.ScaledBorderSize;
YOffset *= 1.05;
YOffset *= PlayerEntryHeightMod;
KFPRI = KFPRIArray[Index];
Rank = PlayerRank(KFPRI);
@ -485,28 +537,9 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
Canvas.TextSize("ABC", XL, YL, FontScalar, FontScalar);
if (KFPRIArray.Length > 1 && Index == 0)
{
ShapeHealth = Settings.Style.ShapeStateHealthBoxTopPlayer;
}
else if (KFPRIArray.Length > 1 && Index == KFPRIArray.Length - 1)
{
ShapeHealth = Settings.Style.ShapeStateHealthBoxBottomPlayer;
}
else
{
ShapeHealth = Settings.Style.ShapeStateHealthBoxMidPlayer;
}
if (!KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun)
{
HealthBoxColor = Settings.Style.StateBoxColorLobby;
}
else if (!KFGRI.bMatchHasBegun)
{
HealthBoxColor = Settings.Style.StateBoxColorLobby;
}
else if (bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None)
if (!KFGRI.bMatchHasBegun)
{
HealthBoxColor = Settings.Style.StateBoxColorLobby;
}
@ -543,11 +576,6 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
else
C.SetDrawColorStruct(Settings.Style.PlayerBoxColor);
if (KFPRIArray.Length > 1 && Index == 0)
Shape = Settings.Style.ShapePlayerBoxTopPlayer;
else if (KFPRIArray.Length > 1 && Index == KFPRIArray.Length - 1)
Shape = Settings.Style.ShapePlayerBoxBottomPlayer;
else
Shape = Settings.Style.ShapePlayerBoxMidPlayer;
BoxWidth = DoshXPos - HealthWBox - BorderSize * 2;
@ -556,16 +584,12 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
XPos += BoxWidth;
// Right stats box
if (KFPRIArray.Length > 1 && Index == 0)
Shape = Settings.Style.ShapeStatsBoxTopPlayer;
else if (KFPRIArray.Length > 1 && Index == KFPRIArray.Length - 1)
Shape = Settings.Style.ShapeStatsBoxBottomPlayer;
else
Shape = Settings.Style.ShapeStatsBoxMidPlayer;
BoxWidth = Width - XPos;
C.SetDrawColorStruct(Settings.Style.StatsBoxColor);
Owner.CurrentStyle.DrawRectBox( XPos,
Owner.CurrentStyle.DrawRectBox(
XPos,
YOffset,
BoxWidth,
Height,
@ -865,7 +889,7 @@ defaultproperties
OnDrawItem=DrawPlayerEntry
ID="PlayerList"
bClickable=false
ListItemsPerPage=16
ListItemsPerPage=ListItems
End Object
Components.Add(PlayerList)

View File

@ -55,7 +55,7 @@ Difficulty="0"
GameLength="0"
# Mutators
Mutators="YAS.YASMut"
Mutators="YAS.YASMut,FriendlyHUD.FriendlyHUDMutator"
# Additional parameters
Args=""