This commit is contained in:
GenZmeY 2022-09-03 13:05:39 +03:00
parent 0641ab8773
commit 9dd37033fc
12 changed files with 79 additions and 182 deletions

View File

@ -41,7 +41,7 @@ public static function InitConfig(int ConfigVersion)
}
}
DefaultProperties
defaultproperties
{
}

View File

@ -4,8 +4,8 @@ class KFScoreBoard extends KFGUI_Page
`include(Build.uci)
`include(Logger.uci)
var transient float HealthXPos, ArmorXPos, RankXPos, PlayerXPos, LevelXPos, PerkXPos, DoshXPos, KillsXPos, AssistXPos, PingXPos, ScrollXPos;
var transient float HealthWBox, ArmorWBox, RankWBox, PlayerWBox, LevelWBox, PerkWBox, DoshWBox, KillsWBox, AssistWBox, PingWBox, ScrollWBox;
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;
var transient float NextScoreboardRefresh;
var transient int NumPlayer;
@ -136,6 +136,22 @@ function string WaveText()
}
}
function String ServerName()
{
local KFOnlineGameSettings KFGS;
local KFGameInfo KFGI;
KFGI = KFGameInfo(KFGRI.WorldInfo.Game);
if (KFGI != None && KFGI.PlayfabInter != None && KFGI.PlayfabInter.GetGameSettings() != None)
{
KFGS = KFOnlineGameSettings(KFGI.PlayfabInter.GetGameSettings());
return KFGS.OwningPlayerName;
}
return KFGRI.ServerName;
}
function DrawMenu()
{
local string S;
@ -224,7 +240,7 @@ function DrawMenu()
Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, BoxH, Settings.Style.EdgeSize, Settings.Style.ShapeServerNameBox);
SetDrawColor(Canvas, Settings.Style.ServerNameTextColor);
S = KFGRI.ServerName;
S = ServerName();
DrawTextShadowHVCenter(S, BoxX, YPos, BoxW, FontScalar);
YPos += BoxH;
@ -305,11 +321,7 @@ function DrawMenu()
}
HealthWBox = (BoxW < MinBoxW ? MinBoxW : BoxW) * 0.5 + BorderSize * 2;
// Armor
ArmorXPos = HealthXPos + HealthWBox;
ArmorWBox = HealthWBox;
RankXPos = ArmorXPos + ArmorWBox + Settings.Style.EdgeSize;
RankXPos = HealthXPos + HealthWBox + Settings.Style.EdgeSize;
PlayerXPos = Width * 0.30; // TODO
@ -362,7 +374,6 @@ function DrawMenu()
SetDrawColor(Canvas, ColorTmp);
DrawHealthIcon(XPos + HealthXPos, YPos, HealthWBox, BoxH);
DrawArmorIcon(XPos + ArmorXPos, YPos, ArmorWBox, BoxH);
PlayersList.XPosition = ((Canvas.ClipX - Width) * 0.5) / InputPos[2];
PlayersList.YPosition = (YPos + YL + BorderSize * 4) / InputPos[3];
@ -391,19 +402,6 @@ function DrawHealthIcon(float X, float Y, float W, float H)
Owner.CurrentStyle.DrawRectBox(XPos, YPos, Part, Part, 4, 100);
}
function DrawArmorIcon(float X, float Y, float W, float H)
{
local float XPos, YPos, Size;
local int Edge;
Edge = 6;
Size = H * 0.65;
XPos = X + (W * 0.5 - Size * 0.5);
YPos = Y + (H * 0.5 - Size * 0.5);
Owner.CurrentStyle.DrawRectBox(XPos, YPos, Size, Size, Edge, 252);
}
function DrawTextShadowHVCenter(string Str, float XPos, float YPos, float BoxWidth, float FontScalar)
{
local float TextWidth;
@ -440,8 +438,6 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
local float FontScalar, TextYOffset, XL, YL, PerkIconPosX, PerkIconPosY, PerkIconSize, PrestigeIconScale;
local float XPos, BoxWidth, RealPlayerWBox;
local KFPlayerReplicationInfo KFPRI;
local KFPlayerController KFPC;
local KFPawn_Human KFPH;
local byte Level, PrestigeLevel;
local bool bIsZED;
local int Ping;
@ -451,12 +447,10 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
local int PlayerInfoIndex, PlayerRankIndex;
local float BorderSize;
local int Shape, ShapeHealth, ShapeArmor;
local int Health, MaxHealth;
local int Armor, MaxArmor;
local string TextHealth, TextArmor, TextState;
local int Shape, ShapeHealth;
local string TextHealth, TextState;
local ColorRGBA HealthBoxColor, ArmorBoxColor, HealthTextColor, ArmorTextColor;
local ColorRGBA HealthBoxColor, HealthTextColor;
BorderSize = Owner.HUDOwner.ScaledBorderSize;
@ -510,25 +504,20 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
if (KFPRIArray.Length > 1 && Index == 0)
{
ShapeHealth = Settings.Style.ShapeStateHealthBoxTopPlayer;
ShapeArmor = Settings.Style.ShapeStateArmorBoxTopPlayer;
}
else if (KFPRIArray.Length > 1 && Index == KFPRIArray.Length - 1)
{
ShapeHealth = Settings.Style.ShapeStateHealthBoxBottomPlayer;
ShapeArmor = Settings.Style.ShapeStateArmorBoxBottomPlayer;
}
else
{
ShapeHealth = Settings.Style.ShapeStateHealthBoxMidPlayer;
ShapeArmor = Settings.Style.ShapeStateArmorBoxMidPlayer;
}
if (!KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun)
{
HealthBoxColor = Settings.Style.StateBoxColorLobby;
ArmorBoxColor = Settings.Style.StateBoxColorLobby;
HealthTextColor = Settings.Style.StateTextColorLobby;
ArmorTextColor = Settings.Style.StateTextColorLobby;
TextState = class'KFGFxMenu_ServerBrowser'.default.InLobbyString;;
}
else if (!KFGRI.bMatchHasBegun)
@ -536,26 +525,20 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
if (KFPRI.bReadyToPlay)
{
HealthBoxColor = Settings.Style.StateBoxColorReady;
ArmorBoxColor = Settings.Style.StateBoxColorReady;
HealthTextColor = Settings.Style.StateBoxColorReady;
ArmorTextColor = Settings.Style.StateBoxColorReady;
TextState = Ready;
}
else
{
HealthBoxColor = Settings.Style.StateBoxColorNotReady;
ArmorBoxColor = Settings.Style.StateBoxColorNotReady;
HealthTextColor = Settings.Style.StateBoxColorNotReady;
ArmorTextColor = Settings.Style.StateBoxColorNotReady;
TextState = NotReady;
}
}
else if (bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None)
{
HealthBoxColor = Settings.Style.StateTextColorNone;
ArmorBoxColor = Settings.Style.StateTextColorNone;
HealthTextColor = Settings.Style.StateTextColorNone;
ArmorTextColor = Settings.Style.StateTextColorNone;
TextState = Unknown;
}
else if (KFPRI.PlayerHealth <= 0 || KFPRI.PlayerHealthPercent <= 0)
@ -563,17 +546,13 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
if (KFPRI.bOnlySpectator)
{
HealthBoxColor = Settings.Style.StateTextColorSpectator;
ArmorBoxColor = Settings.Style.StateTextColorSpectator;
HealthTextColor = Settings.Style.StateTextColorSpectator;
ArmorTextColor = Settings.Style.StateTextColorSpectator;
TextState = class'KFCommon_LocalizedStrings'.default.SpectatorString;
}
else
{
HealthBoxColor = Settings.Style.StateTextColorDead;
ArmorBoxColor = Settings.Style.StateTextColorDead;
HealthTextColor = Settings.Style.StateTextColorDead;
ArmorTextColor = Settings.Style.StateTextColorDead;
TextState = Dead;
}
}
@ -595,36 +574,6 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
HealthTextColor = Settings.Style.StateTextColorHealthLow;
}
TextHealth = String(KFPRI.PlayerHealth);
KFPC = KFPlayerController(KFPRI.Owner);
if (KFPC != None)
{
KFPH = KFPawn_Human(KFPC.Pawn);
if (KFPH != None)
{
TextArmor = String(KFPH.Armor);
if (ByteToFloat(KFPH.Armor / KFPH.MaxArmor) >= float(Settings.Armor.High) / 100.0)
{
ArmorBoxColor = Settings.Style.StateBoxColorArmorHigh;
ArmorTextColor = Settings.Style.StateTextColorArmorHigh;
}
else if (ByteToFloat(KFPH.Armor / KFPH.MaxArmor) >= float(Settings.Armor.Low) / 100.0)
{
ArmorBoxColor = Settings.Style.StateBoxColorArmorMid;
ArmorTextColor = Settings.Style.StateTextColorArmorMid;
}
else if (KFPH.Armor > 0)
{
ArmorBoxColor = Settings.Style.StateBoxColorArmorLow;
ArmorTextColor = Settings.Style.StateTextColorArmorLow;
}
else
{
ArmorBoxColor = Settings.Style.StateBoxColorArmorNone;
ArmorTextColor = Settings.Style.StateTextColorArmorNone;
}
}
}
}
// Health box
@ -636,24 +585,15 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
Settings.Style.EdgeSize,
ShapeHealth);
// Armor box
SetDrawColor(C, ArmorBoxColor);
Owner.CurrentStyle.DrawRectBox(XPos + ArmorWBox,
YOffset,
ArmorWBox,
Height,
Settings.Style.EdgeSize,
ShapeArmor);
if (TextState != "")
{
SetDrawColor(C, HealthTextColor);
if (CurrentRank.ApplyColorToFields.Health)
SetDrawColor(C, CurrentRank.TextColor);
DrawTextShadowHVCenter(TextState, HealthXPos, TextYOffset, HealthWBox + ArmorWBox, FontScalar);
DrawTextShadowHVCenter(TextState, HealthXPos, TextYOffset, HealthWBox, FontScalar);
XPos += (HealthWBox + ArmorWBox);
XPos += HealthWBox;
}
else
{
@ -663,13 +603,6 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
SetDrawColor(C, HealthTextColor);
DrawTextShadowHVCenter(TextHealth, HealthXPos, TextYOffset, HealthWBox, FontScalar);
XPos += HealthWBox;
if (CurrentRank.ApplyColorToFields.Armor)
SetDrawColor(C, CurrentRank.TextColor);
else
SetDrawColor(C, ArmorTextColor);
DrawTextShadowHVCenter(TextArmor, ArmorXPos, TextYOffset, HealthWBox, FontScalar);
XPos += ArmorWBox;
}
// PlayerBox
@ -685,7 +618,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
else
Shape = Settings.Style.ShapePlayerBoxMidPlayer;
BoxWidth = DoshXPos - (HealthWBox + ArmorWBox) - BorderSize * 2;
BoxWidth = DoshXPos - HealthWBox - BorderSize * 2;
Owner.CurrentStyle.DrawRectBox(XPos, YOffset, BoxWidth, Height, Settings.Style.EdgeSize, Shape);
XPos += BoxWidth;

View File

@ -26,7 +26,7 @@ public static function InitConfig(int ConfigVersion)
}
}
DefaultProperties
defaultproperties
{
}

View File

@ -52,7 +52,7 @@ public static function WriteSettings(YASSettingsArmor Settings)
default.High = Settings.High;
}
DefaultProperties
defaultproperties
{
}

View File

@ -52,7 +52,7 @@ public static function WriteSettings(YASSettingsHealth Settings)
default.High = Settings.High;
}
DefaultProperties
defaultproperties
{
}

View File

@ -70,7 +70,7 @@ public static function WriteSettings(YASSettingsLevel Settings)
default.HellOnEarth_High = Settings.High[3];
}
DefaultProperties
defaultproperties
{
}

View File

@ -52,7 +52,7 @@ public static function WriteSettings(YASSettingsPing Settings)
default.High = Settings.High;
}
DefaultProperties
defaultproperties
{
}

View File

@ -26,7 +26,7 @@ public static function InitConfig(int ConfigVersion)
}
}
DefaultProperties
defaultproperties
{
}

View File

@ -56,7 +56,7 @@ public static function WriteSettings(YASSettingsAdmin Settings)
default.ApplyColorToFields = Settings.ApplyColorToFields;
}
DefaultProperties
defaultproperties
{
}

View File

@ -56,7 +56,7 @@ public static function WriteSettings(YASSettingsPlayer Settings)
default.ApplyColorToFields = Settings.ApplyColorToFields;
}
DefaultProperties
defaultproperties
{
}

View File

@ -7,7 +7,7 @@ struct ColorRGBA
{
var byte R, G, B, A;
StructDefaultProperties
Structdefaultproperties
{
R = 250
G = 250
@ -29,7 +29,7 @@ struct Fields
var bool Armor;
var bool Ping;
StructDefaultProperties
Structdefaultproperties
{
Rank = true;
Player = true;
@ -58,7 +58,7 @@ struct RankRelation
var string ObjectID;
var int RankID;
StructDefaultProperties
Structdefaultproperties
{
RankID = -999
}
@ -69,7 +69,7 @@ struct UIDRankRelation
var UniqueNetId UID;
var int RankID;
StructDefaultProperties
Structdefaultproperties
{
RankID = -999
}
@ -81,7 +81,7 @@ struct YASSettingsAdmin
var ColorRGBA TextColor;
var Fields ApplyColorToFields;
StructDefaultProperties
Structdefaultproperties
{
Rank = "Admin"
TextColor = (R=250, G=0, B=0, A=255)
@ -95,7 +95,7 @@ struct YASSettingsPlayer
var ColorRGBA TextColor;
var Fields ApplyColorToFields;
StructDefaultProperties
Structdefaultproperties
{
Rank = "Player"
TextColor = (R=250, G=250, B=250, A=255)
@ -108,7 +108,7 @@ struct YASSettingsHealth
var int Low;
var int High;
StructDefaultProperties
Structdefaultproperties
{
Low = 40
High = 80
@ -120,7 +120,7 @@ struct YASSettingsArmor
var int Low;
var int High;
StructDefaultProperties
Structdefaultproperties
{
Low = 40
High = 80
@ -132,7 +132,7 @@ struct YASSettingsPing
var int Low;
var int High;
StructDefaultProperties
Structdefaultproperties
{
Low = 60
High = 120
@ -144,7 +144,7 @@ struct YASSettingsLevel
var int Low [4];
var int High[4];
StructDefaultProperties
Structdefaultproperties
{
Low [0] = 0
High[0] = 0
@ -295,7 +295,7 @@ struct YASStyle
var bool AssistsTextSmoothColorChange;
var bool PingTextSmoothColorChange;
StructDefaultProperties
Structdefaultproperties
{
EdgeSize = 8

View File

@ -11,13 +11,7 @@ var config int ConfigVersion;
var private OnlineSubsystem Steamworks;
struct SClient
{
var YASRepInfo RepInfo;
var KFPlayerController KFPC;
};
var private array<SClient> RepClients;
var private array<YASRepInfo> RepInfos;
var private array<UIDRankRelation> UIDRankRelationsPlayers;
var private array<UIDRankRelation> UIDRankRelationsSteamGroups;
var private array<UIDRankRelation> UIDRankRelationsActive;
@ -49,7 +43,8 @@ function NotifyLogin(Controller C)
{
`callstack();
AddPlayer(C);
CreateRepInfo(C);
Super.NotifyLogin(C);
}
@ -57,7 +52,8 @@ function NotifyLogout(Controller C)
{
`callstack();
RemovePlayer(C);
DestroyRepInfo(C);
Super.NotifyLogout(C);
}
@ -151,75 +147,43 @@ private function LoadRelations()
}
}
private function AddPlayer(Controller C)
private function CreateRepInfo(Controller C)
{
local KFPlayerController KFPC;
local UIDRankRelation Relation;
local SClient RepClient, RepClientNew;
local YASRepInfo RepInfo;
`callstack();
KFPC = KFPlayerController(C);
if (KFPC == None)
return;
if (C == None) return;
RepClientNew.KFPC = KFPC;
RepClientNew.RepInfo = Spawn(class'YASRepInfo', KFPC);
RepInfo = Spawn(class'YASRepInfo', C);
RepClientNew.RepInfo.Mut = Self;
RepClientNew.RepInfo.CustomRanks = class'CustomRanks'.default.Rank;
RepClientNew.RepInfo.SteamGroupRelations = UIDRankRelationsSteamGroups;
RepClientNew.RepInfo.Settings = Settings;
RepClientNew.RepInfo.RankRelation.UID = KFPC.PlayerReplicationInfo.UniqueId;
RepClientNew.RepInfo.RankRelation.RankID = UIDRankRelationsPlayers.Find('UID', RepClientNew.RepInfo.RankRelation.UID);
RepInfo.Mut = Self;
RepInfo.Settings = Settings;
RepClients.AddItem(RepClientNew);
foreach UIDRankRelationsActive(Relation)
RepClientNew.RepInfo.AddRankRelation(Relation);
RepClientNew.RepInfo.StartFirstTimeReplication();
if (RepClientNew.RepInfo.RankRelation.RankID != INDEX_NONE)
{
UIDRankRelationsActive.AddItem(RepClientNew.RepInfo.RankRelation);
foreach RepClients(RepClient)
RepClient.RepInfo.AddRankRelation(RepClientNew.RepInfo.RankRelation);
}
RepInfos.AddItem(RepInfo);
}
private function RemovePlayer(Controller C)
private function DestroyRepInfo(Controller C)
{
local KFPlayerController KFPC;
local int Index, i;
local UniqueNetId UID;
local YASRepInfo RepInfo;
`callstack();
KFPC = KFPlayerController(C);
if (KFPC == None)
return;
if (C == None) return;
UID = KFPC.PlayerReplicationInfo.UniqueId;
Index = UIDRankRelationsActive.Find('UID', UID);
if (Index != INDEX_NONE)
for (i = 0; i < UIDRankRelationsActive.Length; ++i)
if (Index != i)
RepClients[i].RepInfo.RemoveRankRelation(UIDRankRelationsActive[Index]);
Index = RepClients.Find('KFPC', KFPC);
if (Index == INDEX_NONE)
return;
if (RepClients[Index].RepInfo != None)
RepClients[Index].RepInfo.Destroy();
RepClients.Remove(Index, 1);
foreach RepInfos(RepInfo)
{
if (RepInfo.Owner == C)
{
RepInfos.RemoveItem(RepInfo);
RepInfo.Destroy();
}
}
}
public function UpdatePlayerRank(UIDRankRelation Rel)
{
local SClient RepClient;
local YASRepInfo RepInfo;
local int Index;
`callstack();
@ -230,21 +194,21 @@ public function UpdatePlayerRank(UIDRankRelation Rel)
else
UIDRankRelationsActive.AddItem(Rel);
foreach RepClients(RepClient)
RepClient.RepInfo.UpdateRankRelation(Rel);
foreach RepInfos(RepInfo)
RepInfo.UpdateRankRelation(Rel);
}
public function AddPlayerRank(UIDRankRelation Rel)
{
local SClient RepClient;
local YASRepInfo RepInfo;
`callstack();
foreach RepClients(RepClient)
RepClient.RepInfo.AddRankRelation(Rel);
foreach RepInfos(RepInfo)
RepInfo.AddRankRelation(Rel);
}
DefaultProperties
defaultproperties
{
}