From 3ef633e47d6cec8fe98f5096160ac24a2221fcef Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Wed, 9 Jun 2021 03:58:31 +0300 Subject: [PATCH] settings works! --- ScoreboardExt/Classes/KFScoreBoard.uc | 113 +++++++------- ScoreboardExt/Classes/ScoreboardExtMut.uc | 39 +++-- ScoreboardExt/Classes/ScoreboardExtRepInfo.uc | 8 +- ScoreboardExt/Classes/ScoreboardStyle.uc | 143 +++++++++++++++++- ScoreboardExt/Classes/SystemAdminRank.uc | 26 ++++ ScoreboardExt/Classes/SystemPlayerRank.uc | 26 ++++ ScoreboardExt/Classes/ThresholdsHP.uc | 28 +++- ScoreboardExt/Classes/ThresholdsLevel.uc | 39 ++++- ScoreboardExt/Classes/ThresholdsPing.uc | 28 +++- ScoreboardExt/Classes/Types.uc | 88 +++++++---- 10 files changed, 418 insertions(+), 120 deletions(-) diff --git a/ScoreboardExt/Classes/KFScoreBoard.uc b/ScoreboardExt/Classes/KFScoreBoard.uc index 365fb36..de5bbd0 100644 --- a/ScoreboardExt/Classes/KFScoreBoard.uc +++ b/ScoreboardExt/Classes/KFScoreBoard.uc @@ -22,7 +22,6 @@ var array CustomRanks; var array PlayerRankRelations; var SCESettings Settings; -var SCEStyle Style; function InitMenu() { @@ -174,10 +173,10 @@ function DrawMenu() BoxH = YL + BorderSize; // Top Rect (Server name) - SetDrawColor(Canvas, Style.ServerNameBoxColor); + SetDrawColor(Canvas, Settings.Style.ServerNameBoxColor); Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, BoxH, Edge, 2); - SetDrawColor(Canvas, Style.ServerNameTextColor); + SetDrawColor(Canvas, Settings.Style.ServerNameTextColor); S = KFGRI.ServerName; DrawTextShadowHVCenter(S, BoxX, YPos, BoxW, FontScalar); @@ -186,10 +185,10 @@ function DrawMenu() // Mid Left Rect (Info) BoxW = Width * 0.7; BoxH = YL * 2 + BorderSize * 2; - SetDrawColor(Canvas, Style.GameInfoBoxColor); + SetDrawColor(Canvas, Settings.Style.GameInfoBoxColor); Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, BoxH, Edge, 1); - SetDrawColor(Canvas, Style.GameInfoTextColor); + SetDrawColor(Canvas, Settings.Style.GameInfoTextColor); S = class'KFCommon_LocalizedStrings'.static.GetFriendlyMapName(PC.WorldInfo.GetMapName(true)); DrawTextShadowHLeftVCenter(S, BoxX + Edge, YPos, FontScalar); @@ -199,10 +198,10 @@ function DrawMenu() // Mid Right Rect (Wave) BoxX = BoxX + BoxW; BoxW = Width - BoxW; - SetDrawColor(Canvas, Style.WaveBoxColor); + SetDrawColor(Canvas, Settings.Style.WaveBoxColor); Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, BoxH, Edge, 0); - SetDrawColor(Canvas, Style.WaveTextColor); + SetDrawColor(Canvas, Settings.Style.WaveTextColor); S = class'KFGFxHUD_ScoreboardMapInfoContainer'.default.WaveString; DrawTextShadowHVCenter(S, BoxX, YPos, BoxW, FontScalar); DrawTextShadowHVCenter(WaveText(), BoxX, YPos + YL, BoxW, FontScalar); @@ -213,10 +212,10 @@ function DrawMenu() BoxX = XPos; BoxW = Width; BoxH = YL + BorderSize; - SetDrawColor(Canvas, Style.PlayerCountBoxColor); + SetDrawColor(Canvas, Settings.Style.PlayerCountBoxColor); Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, BoxH, Edge, 4); - SetDrawColor(Canvas, Style.PlayerCountTextColor); + SetDrawColor(Canvas, Settings.Style.PlayerCountTextColor); S = "Players: " $ NumPlayer $ " / " $ KFGRI.MaxHumanCount $ " " $ "Spectators: " $ NumSpec; Canvas.TextSize(S, XL, YL, FontScalar, FontScalar); DrawTextShadowHLeftVCenter(S, BoxX + Edge, YPos, FontScalar); @@ -238,7 +237,7 @@ function DrawMenu() XPos = (Canvas.ClipX - Width) * 0.5; YPos += YL; BoxH = YL + BorderSize; - SetDrawColor(Canvas, Style.ListHeaderBoxColor); + SetDrawColor(Canvas, Settings.Style.ListHeaderBoxColor); Owner.CurrentStyle.DrawRectBox( XPos - BorderSize * 2, YPos, @@ -267,7 +266,7 @@ function DrawMenu() PingWBox = Width - PingXPos; // Header texts - SetDrawColor(Canvas, Style.ListHeaderTextColor); + SetDrawColor(Canvas, Settings.Style.ListHeaderTextColor); DrawTextShadowHLeftVCenter("RANK", XPos + RankXPos, YPos, FontScalar); DrawTextShadowHLeftVCenter(class'KFGFxHUD_ScoreboardWidget'.default.PlayerString, XPos + PlayerXPos, YPos, FontScalar); DrawTextShadowHLeftVCenter(class'KFGFxMenu_Inventory'.default.PerkFilterString, XPos + PerkXPos, YPos, FontScalar); @@ -347,9 +346,9 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa { if (!HasRank || (HasRank && !CurrentRank.OverrideAdminRank)) { - CurrentRank.Rank = Settings.SystemAdminRank; - CurrentRank.TextColor = Settings.SystemAdminColor; - CurrentRank.ApplyColorToFields = Settings.SystemAdminApplyColorToFields; + CurrentRank.Rank = Settings.Admin.Rank; + CurrentRank.TextColor = Settings.Admin.TextColor; + CurrentRank.ApplyColorToFields = Settings.Admin.ApplyColorToFields; HasRank = true; } } @@ -357,9 +356,9 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa { if (!HasRank) { - CurrentRank.Rank = Settings.SystemPlayerRank; - CurrentRank.TextColor = Settings.SystemPlayerColor; - CurrentRank.ApplyColorToFields = Settings.SystemPlayerApplyColorToFields; + CurrentRank.Rank = Settings.Player.Rank; + CurrentRank.TextColor = Settings.Player.TextColor; + CurrentRank.ApplyColorToFields = Settings.Player.ApplyColorToFields; HasRank = true; } } @@ -377,28 +376,28 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa // change rect color by HP if( !KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun ) { - SetDrawColor(C, Style.LeftHPBoxColorNone); + SetDrawColor(C, Settings.Style.LeftHPBoxColorNone); } else if ( !KFGRI.bMatchHasBegun ) { - SetDrawColor(C, Style.LeftHPBoxColorNone); + SetDrawColor(C, Settings.Style.LeftHPBoxColorNone); } else if( bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None ) { - SetDrawColor(C, Style.LeftHPBoxColorNone); + SetDrawColor(C, Settings.Style.LeftHPBoxColorNone); } else if (KFPRI.PlayerHealth <= 0 || KFPRI.PlayerHealthPercent <= 0) { - SetDrawColor(C, Style.LeftHPBoxColorDead); + SetDrawColor(C, Settings.Style.LeftHPBoxColorDead); } else { - if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.HP_High) / 100.0) - SetDrawColor(C, Style.LeftHPBoxColorHigh); - else if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.HP_Low) / 100.0) - SetDrawColor(C, Style.LeftHPBoxColorMid); + if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.HP.High) / 100.0) + SetDrawColor(C, Settings.Style.LeftHPBoxColorHigh); + else if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.HP.Low) / 100.0) + SetDrawColor(C, Settings.Style.LeftHPBoxColorMid); else - SetDrawColor(C, Style.LeftHPBoxColorLow); + SetDrawColor(C, Settings.Style.LeftHPBoxColorLow); } BoxWidth = Owner.HUDOwner.ScaledBorderSize * 8; @@ -413,9 +412,9 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa TextYOffset = YOffset + (Height * 0.5f) - (YL * 0.5f); if (PlayerIndex == Index) - SetDrawColor(C, Style.PlayerOwnerBoxColor); + SetDrawColor(C, Settings.Style.PlayerOwnerBoxColor); else - SetDrawColor(C, Style.PlayerBoxColor); + SetDrawColor(C, Settings.Style.PlayerBoxColor); BoxWidth = CashXPos + Owner.HUDOwner.ScaledBorderSize - BoxWidth; Owner.CurrentStyle.DrawRectBox(XPos, YOffset, BoxWidth, Height, 8); @@ -424,7 +423,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa // Right stats box BoxWidth = Width - XPos; - SetDrawColor(C, Style.StatsBoxColor); + SetDrawColor(C, Settings.Style.StatsBoxColor); Owner.CurrentStyle.DrawRectBox( XPos, YOffset, @@ -436,7 +435,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa if (CurrentRank.ApplyColorToFields.Rank) SetDrawColor(C, CurrentRank.TextColor); else - SetDrawColor(C, Style.RankTextColor); + SetDrawColor(C, Settings.Style.RankTextColor); S = CurrentRank.Rank; DrawTextShadowHLeftVCenter(S, RankXPos, TextYOffset, FontScalar); @@ -446,7 +445,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa if (CurrentRank.ApplyColorToFields.Perk) SetDrawColor(C, CurrentRank.TextColor); else - SetDrawColor(C, Style.ZedTextColor); + SetDrawColor(C, Settings.Style.ZedTextColor); C.SetPos (PerkXPos, YOffset - ((Height-5) * 0.5f)); C.DrawRect (Height-5, Height-5, Texture2D'UI_Widgets.MenuBarWidget_SWF_IF'); @@ -483,7 +482,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa if (CurrentRank.ApplyColorToFields.Perk) SetDrawColor(C, CurrentRank.TextColor); else - SetDrawColor(C, Style.PerkTextColor); // TODO: LevelTextColor + SetDrawColor(C, Settings.Style.PerkTextColor); // TODO: LevelTextColor S = Level@KFPRI.CurrentPerkClass.default.PerkName; DrawTextShadowHLeftVCenter(S, PerkXPos, TextYOffset, FontScalar); } @@ -492,7 +491,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa if (CurrentRank.ApplyColorToFields.Perk) SetDrawColor(C, CurrentRank.TextColor); else - SetDrawColor(C, Style.PerkTextColor); + SetDrawColor(C, Settings.Style.PerkTextColor); S = "No Perk"; DrawTextShadowHLeftVCenter(S, PerkXPos, TextYOffset, FontScalar); } @@ -504,7 +503,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa if( KFPRI.Avatar == default.DefaultAvatar ) CheckAvatar(KFPRI, OwnerPC); - SetDrawColor(C, Style.AvatarBorderColor); // Check + SetDrawColor(C, Settings.Style.AvatarBorderColor); // Check C.SetPos(PlayerXPos - (Height * 1.075), YOffset + (Height * 0.5f) - ((Height - 6) * 0.5f)); C.DrawTile(KFPRI.Avatar,Height - 6,Height - 6,0,0,KFPRI.Avatar.SizeX,KFPRI.Avatar.SizeY); Owner.CurrentStyle.DrawBoxHollow(PlayerXPos - (Height * 1.075), YOffset + (Height * 0.5f) - ((Height - 6) * 0.5f), Height - 6, Height - 6, 1); @@ -516,7 +515,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa if (CurrentRank.ApplyColorToFields.Player) SetDrawColor(C, CurrentRank.TextColor); else - SetDrawColor(C, Style.PlayerNameTextColor); + SetDrawColor(C, Settings.Style.PlayerNameTextColor); if( Len(KFPRI.PlayerName) > 25 ) S = Left(KFPRI.PlayerName, 25); else S = KFPRI.PlayerName; @@ -526,20 +525,20 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa if (CurrentRank.ApplyColorToFields.Kills) SetDrawColor(C, CurrentRank.TextColor); else - SetDrawColor(C, Style.KillsTextColor); + SetDrawColor(C, Settings.Style.KillsTextColor); DrawTextShadowHVCenter(string (KFPRI.Kills), KillsXPos, TextYOffset, KillsWBox, FontScalar); // Assist if (CurrentRank.ApplyColorToFields.Assists) SetDrawColor(C, CurrentRank.TextColor); else - SetDrawColor(C, Style.AssistsTextColor); + SetDrawColor(C, Settings.Style.AssistsTextColor); DrawTextShadowHVCenter(string (KFPRI.Assists), AssistXPos, TextYOffset, AssistWBox, FontScalar); // Cash if( bIsZED ) { - SetDrawColor(C, Style.ZedTextColor); + SetDrawColor(C, Settings.Style.ZedTextColor); StrValue = "Brains!"; } else @@ -547,7 +546,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa if (CurrentRank.ApplyColorToFields.Dosh) SetDrawColor(C, CurrentRank.TextColor); else - SetDrawColor(C, Style.DoshTextColor); + SetDrawColor(C, Settings.Style.DoshTextColor); StrValue = GetNiceSize(int(KFPRI.Score)); } DrawTextShadowHVCenter(StrValue, CashXPos, TextYOffset, CashWBox, FontScalar); @@ -555,48 +554,48 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa // State if( !KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun ) { - SetDrawColor(C, Style.StateTextColorLobby); + SetDrawColor(C, Settings.Style.StateTextColorLobby); S = "LOBBY"; } else if( !KFGRI.bMatchHasBegun ) { if (KFPRI.bReadyToPlay) { - SetDrawColor(C, Style.StateTextColorReady); + SetDrawColor(C, Settings.Style.StateTextColorReady); S = "Ready"; } else { - SetDrawColor(C, Style.StateTextColorNotReady); + SetDrawColor(C, Settings.Style.StateTextColorNotReady); S = "Not Ready"; } } else if( bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None ) { - SetDrawColor(C, Style.StateTextColorNone); + SetDrawColor(C, Settings.Style.StateTextColorNone); S = "Unknown"; } else if (KFPRI.PlayerHealth <= 0 || KFPRI.PlayerHealthPercent <= 0) { if (KFPRI.bOnlySpectator) { - SetDrawColor(C, Style.StateTextColorSpectator); + SetDrawColor(C, Settings.Style.StateTextColorSpectator); S = "Spectator"; } else { - SetDrawColor(C, Style.StateTextColorDead); + SetDrawColor(C, Settings.Style.StateTextColorDead); S = "DEAD"; } } else { - if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.HP_High) / 100.0) - SetDrawColor(C, Style.StateTextColorHighHP); - else if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.HP_Low) / 100.0) - SetDrawColor(C, Style.StateTextColorMidHP); + if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.HP.High) / 100.0) + SetDrawColor(C, Settings.Style.StateTextColorHighHP); + else if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.HP.Low) / 100.0) + SetDrawColor(C, Settings.Style.StateTextColorMidHP); else - SetDrawColor(C, Style.StateTextColorLowHP); + SetDrawColor(C, Settings.Style.StateTextColorLowHP); S = string (KFPRI.PlayerHealth) @"HP"; } @@ -607,7 +606,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa // Ping if (KFPRI.bBot) { - SetDrawColor(C, Style.PingTextColorNone); + SetDrawColor(C, Settings.Style.PingTextColorNone); S = "-"; } else @@ -616,12 +615,12 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa if (CurrentRank.ApplyColorToFields.Ping) SetDrawColor(C, CurrentRank.TextColor); - else if (Ping <= Settings.Ping_Low) - SetDrawColor(C, Style.PingTextColorLow); - else if (Ping <= Settings.Ping_High) - SetDrawColor(C, Style.PingTextColorMid); + else if (Ping <= Settings.Ping.Low) + SetDrawColor(C, Settings.Style.PingTextColorLow); + else if (Ping <= Settings.Ping.High) + SetDrawColor(C, Settings.Style.PingTextColorMid); else - SetDrawColor(C, Style.PingTextColorHigh); + SetDrawColor(C, Settings.Style.PingTextColorHigh); S = string(Ping); } @@ -638,7 +637,7 @@ final function DrawPingBars( Canvas C, float YOffset, float XOffset, float W, fl local float PingMul, BarW, BarH, BaseH, XPos, YPos; local byte i; - PingMul = 1.f - FClamp(FMax(Ping - Settings.Ping_Low, 1.f) / Settings.Ping_High, 0.f, 1.f); + PingMul = 1.f - FClamp(FMax(Ping - Settings.Ping.Low, 1.f) / Settings.Ping.High, 0.f, 1.f); BarW = W / PingBars; BaseH = H / PingBars; diff --git a/ScoreboardExt/Classes/ScoreboardExtMut.uc b/ScoreboardExt/Classes/ScoreboardExtMut.uc index decc719..57b8921 100644 --- a/ScoreboardExt/Classes/ScoreboardExtMut.uc +++ b/ScoreboardExt/Classes/ScoreboardExtMut.uc @@ -17,13 +17,23 @@ struct SClient var private array RepClients; var private array UIDRelations; +var private SCESettings Settings; function PostBeginPlay() { Super.PostBeginPlay(); + WorldInfo.Game.HUDType = class'ScoreboardExtHUD'; + InitConfig(); LoadPlayerRelations(); + + Settings.Style = class'ScoreboardStyle'.static.Settings(); + Settings.Admin = class'SystemAdminRank'.static.Settings(); + Settings.Player = class'SystemPlayerRank'.static.Settings(); + Settings.HP = class'ThresholdsHP'.static.Settings(); + Settings.Ping = class'ThresholdsPing'.static.Settings(); + Settings.Level = class'ThresholdsLevel'.static.Settings(); } function NotifyLogin(Controller C) @@ -50,17 +60,12 @@ private function InitConfig() case 0: // which means there is no config right now SaveConfig(); // because I want the main settings to be at the beginning of the config :) - // Default admin rank - class'SystemAdminRank'.default.Rank = "Admin"; - class'SystemAdminRank'.default.TextColor.R = 250; - class'SystemAdminRank'.default.TextColor.G = 0; - class'SystemAdminRank'.default.TextColor.B = 0; - - // Default player rank - class'SystemPlayerRank'.default.Rank = "Player"; - class'SystemPlayerRank'.default.TextColor.R = 250; - class'SystemPlayerRank'.default.TextColor.G = 250; - class'SystemPlayerRank'.default.TextColor.B = 250; + class'SystemAdminRank'.static.WriteSettings(class'SystemAdminRank'.static.DefaultSettings()); + class'SystemPlayerRank'.static.WriteSettings(class'SystemPlayerRank'.static.DefaultSettings()); + class'ScoreboardStyle'.static.WriteSettings(class'ScoreboardStyle'.static.DefaultSettings()); + class'ThresholdsHP'.static.WriteSettings(class'ThresholdsHP'.static.DefaultSettings()); + class'ThresholdsPing'.static.WriteSettings(class'ThresholdsPing'.static.DefaultSettings()); + class'ThresholdsLevel'.static.WriteSettings(class'ThresholdsLevel'.static.DefaultSettings()); // Example rank for player(s) ExampleRank.ID = 0; @@ -90,12 +95,9 @@ private function InitConfig() ExampleSteamGroup.RankID = ExampleRank.ID; class'SteamGroupRankRelations'.default.Relation.AddItem(ExampleSteamGroup); - class'SystemAdminRank'.static.StaticSaveConfig(); - class'SystemPlayerRank'.static.StaticSaveConfig(); class'CustomRanks'.static.StaticSaveConfig(); class'PlayerRankRelations'.static.StaticSaveConfig(); class'SteamGroupRankRelations'.static.StaticSaveConfig(); - case 2147483647: `log("[ScoreboardExt] Config updated to version"@CurrentVersion); break; @@ -157,14 +159,7 @@ function AddPlayer(Controller C) RepClient.RepInfo.PlayerRankRelations = UIDRelations; RepClient.RepInfo.CustomRanks = class'CustomRanks'.default.Rank; - /* - RepClient.RepInfo.SystemAdminRank = class'SystemAdminRank'.default.Rank; - RepClient.RepInfo.SystemAdminColor = class'SystemAdminRank'.default.TextColor; - RepClient.RepInfo.SystemAdminApplyColorToFields = class'SystemAdminRank'.default.ApplyColorToFields; - RepClient.RepInfo.SystemPlayerRank = class'SystemPlayerRank'.default.Rank; - RepClient.RepInfo.SystemPlayerColor = class'SystemPlayerRank'.default.TextColor; - RepClient.RepInfo.SystemPlayerApplyColorToFields = class'SystemPlayerRank'.default.ApplyColorToFields; - */ + RepClient.RepInfo.Settings = Settings; RepClient.RepInfo.ClientStartReplication(); } diff --git a/ScoreboardExt/Classes/ScoreboardExtRepInfo.uc b/ScoreboardExt/Classes/ScoreboardExtRepInfo.uc index ae85f9a..8b483cc 100644 --- a/ScoreboardExt/Classes/ScoreboardExtRepInfo.uc +++ b/ScoreboardExt/Classes/ScoreboardExtRepInfo.uc @@ -4,7 +4,6 @@ var public array PlayerRankRelations; var public array CustomRanks; var public SCESettings Settings; -var public SCEStyle Style; var private bool InitFinished, RanksFinished, InfosFinished; var private int InfosReplicateProgress, RanksReplicateProgress; @@ -15,7 +14,7 @@ public function ClientStartReplication() { GetScoreboard(); - ClientInit(Settings, Style); + ClientInit(Settings); SetTimer(0.01f, true, nameof(ClientReplicateRanks)); SetTimer(0.01f, true, nameof(ClientReplicateInfos)); } @@ -82,11 +81,9 @@ private reliable client function InfosReplicationFinished() ClientInfosApply(); } -private reliable client function ClientInit(SCESettings _Settings, SCEStyle _Style) +private reliable client function ClientInit(SCESettings _Settings) { Settings = _Settings; - Style = _Style; - ClientSystemApply(); } @@ -99,7 +96,6 @@ private reliable client function ClientSystemApply() } SC.Settings = Settings; - SC.Style = Style; InitFinished = true; Finished(); diff --git a/ScoreboardExt/Classes/ScoreboardStyle.uc b/ScoreboardExt/Classes/ScoreboardStyle.uc index 7704408..c0113c2 100644 --- a/ScoreboardExt/Classes/ScoreboardStyle.uc +++ b/ScoreboardExt/Classes/ScoreboardStyle.uc @@ -2,7 +2,148 @@ class ScoreboardStyle extends Object dependson(Types) config(ScoreboardExt); -DefaultProperties +var config ColorRGBA ServerNameBoxColor; +var config ColorRGBA ServerNameTextColor; +var config ColorRGBA GameInfoBoxColor; +var config ColorRGBA GameInfoTextColor; +var config ColorRGBA WaveBoxColor; +var config ColorRGBA WaveTextColor; +var config ColorRGBA PlayerCountBoxColor; +var config ColorRGBA PlayerCountTextColor; +var config ColorRGBA ListHeaderBoxColor; +var config ColorRGBA ListHeaderTextColor; +var config ColorRGBA LeftHPBoxColorNone; +var config ColorRGBA LeftHPBoxColorDead; +var config ColorRGBA LeftHPBoxColorLow; +var config ColorRGBA LeftHPBoxColorMid; +var config ColorRGBA LeftHPBoxColorHigh; +var config ColorRGBA PlayerOwnerBoxColor; +var config ColorRGBA PlayerBoxColor; +var config ColorRGBA StatsBoxColor; +var config ColorRGBA RankTextColor; +var config ColorRGBA ZedTextColor; +var config ColorRGBA PerkTextColor; +var config ColorRGBA LevelTextColor; +var config ColorRGBA AvatarBorderColor; +var config ColorRGBA PlayerNameTextColor; +var config ColorRGBA KillsTextColor; +var config ColorRGBA AssistsTextColor; +var config ColorRGBA DoshTextColor; +var config ColorRGBA StateTextColorLobby; +var config ColorRGBA StateTextColorReady; +var config ColorRGBA StateTextColorNotReady; +var config ColorRGBA StateTextColorNone; +var config ColorRGBA StateTextColorSpectator; +var config ColorRGBA StateTextColorDead; +var config ColorRGBA StateTextColorLowHP; +var config ColorRGBA StateTextColorMidHP; +var config ColorRGBA StateTextColorHighHP; +var config ColorRGBA PingTextColorNone; +var config ColorRGBA PingTextColorLow; +var config ColorRGBA PingTextColorMid; +var config ColorRGBA PingTextColorHigh; + +public static function SCEStyle defaultSettings() +{ + local SCEStyle Settings; + return Settings; +} + +public static function SCEStyle Settings() +{ + local SCEStyle Settings; + + Settings.ServerNameBoxColor = default.ServerNameBoxColor; + Settings.ServerNameTextColor = default.ServerNameTextColor; + Settings.GameInfoBoxColor = default.GameInfoBoxColor; + Settings.GameInfoTextColor = default.GameInfoTextColor; + Settings.WaveBoxColor = default.WaveBoxColor; + Settings.WaveTextColor = default.WaveTextColor; + Settings.PlayerCountBoxColor = default.PlayerCountBoxColor; + Settings.PlayerCountTextColor = default.PlayerCountTextColor; + Settings.ListHeaderBoxColor = default.ListHeaderBoxColor; + Settings.ListHeaderTextColor = default.ListHeaderTextColor; + Settings.LeftHPBoxColorNone = default.LeftHPBoxColorNone; + Settings.LeftHPBoxColorDead = default.LeftHPBoxColorDead; + Settings.LeftHPBoxColorLow = default.LeftHPBoxColorLow; + Settings.LeftHPBoxColorMid = default.LeftHPBoxColorMid; + Settings.LeftHPBoxColorHigh = default.LeftHPBoxColorHigh; + Settings.PlayerOwnerBoxColor = default.PlayerOwnerBoxColor; + Settings.PlayerBoxColor = default.PlayerBoxColor; + Settings.StatsBoxColor = default.StatsBoxColor; + Settings.RankTextColor = default.RankTextColor; + Settings.ZedTextColor = default.ZedTextColor; + Settings.PerkTextColor = default.PerkTextColor; + Settings.LevelTextColor = default.LevelTextColor; + Settings.AvatarBorderColor = default.AvatarBorderColor; + Settings.PlayerNameTextColor = default.PlayerNameTextColor; + Settings.KillsTextColor = default.KillsTextColor; + Settings.AssistsTextColor = default.AssistsTextColor; + Settings.DoshTextColor = default.DoshTextColor; + Settings.StateTextColorLobby = default.StateTextColorLobby; + Settings.StateTextColorReady = default.StateTextColorReady; + Settings.StateTextColorNotReady = default.StateTextColorNotReady; + Settings.StateTextColorNone = default.StateTextColorNone; + Settings.StateTextColorSpectator = default.StateTextColorSpectator; + Settings.StateTextColorDead = default.StateTextColorDead; + Settings.StateTextColorLowHP = default.StateTextColorLowHP; + Settings.StateTextColorMidHP = default.StateTextColorMidHP; + Settings.StateTextColorHighHP = default.StateTextColorHighHP; + Settings.PingTextColorNone = default.PingTextColorNone; + Settings.PingTextColorLow = default.PingTextColorLow; + Settings.PingTextColorMid = default.PingTextColorMid; + Settings.PingTextColorHigh = default.PingTextColorHigh; + + return Settings; +} + +public static function WriteSettings(SCEStyle Settings) +{ + default.ServerNameBoxColor = Settings.ServerNameBoxColor; + default.ServerNameTextColor = Settings.ServerNameTextColor; + default.GameInfoBoxColor = Settings.GameInfoBoxColor; + default.GameInfoTextColor = Settings.GameInfoTextColor; + default.WaveBoxColor = Settings.WaveBoxColor; + default.WaveTextColor = Settings.WaveTextColor; + default.PlayerCountBoxColor = Settings.PlayerCountBoxColor; + default.PlayerCountTextColor = Settings.PlayerCountTextColor; + default.ListHeaderBoxColor = Settings.ListHeaderBoxColor; + default.ListHeaderTextColor = Settings.ListHeaderTextColor; + default.LeftHPBoxColorNone = Settings.LeftHPBoxColorNone; + default.LeftHPBoxColorDead = Settings.LeftHPBoxColorDead; + default.LeftHPBoxColorLow = Settings.LeftHPBoxColorLow; + default.LeftHPBoxColorMid = Settings.LeftHPBoxColorMid; + default.LeftHPBoxColorHigh = Settings.LeftHPBoxColorHigh; + default.PlayerOwnerBoxColor = Settings.PlayerOwnerBoxColor; + default.PlayerBoxColor = Settings.PlayerBoxColor; + default.StatsBoxColor = Settings.StatsBoxColor; + default.RankTextColor = Settings.RankTextColor; + default.ZedTextColor = Settings.ZedTextColor; + default.PerkTextColor = Settings.PerkTextColor; + default.LevelTextColor = Settings.LevelTextColor; + default.AvatarBorderColor = Settings.AvatarBorderColor; + default.PlayerNameTextColor = Settings.PlayerNameTextColor; + default.KillsTextColor = Settings.KillsTextColor; + default.AssistsTextColor = Settings.AssistsTextColor; + default.DoshTextColor = Settings.DoshTextColor; + default.StateTextColorLobby = Settings.StateTextColorLobby; + default.StateTextColorReady = Settings.StateTextColorReady; + default.StateTextColorNotReady = Settings.StateTextColorNotReady; + default.StateTextColorNone = Settings.StateTextColorNone; + default.StateTextColorSpectator = Settings.StateTextColorSpectator; + default.StateTextColorDead = Settings.StateTextColorDead; + default.StateTextColorLowHP = Settings.StateTextColorLowHP; + default.StateTextColorMidHP = Settings.StateTextColorMidHP; + default.StateTextColorHighHP = Settings.StateTextColorHighHP; + default.PingTextColorNone = Settings.PingTextColorNone; + default.PingTextColorLow = Settings.PingTextColorLow; + default.PingTextColorMid = Settings.PingTextColorMid; + default.PingTextColorHigh = Settings.PingTextColorHigh; + + StaticSaveConfig(); +} + +defaultProperties { } \ No newline at end of file diff --git a/ScoreboardExt/Classes/SystemAdminRank.uc b/ScoreboardExt/Classes/SystemAdminRank.uc index 70abfed..e200b94 100644 --- a/ScoreboardExt/Classes/SystemAdminRank.uc +++ b/ScoreboardExt/Classes/SystemAdminRank.uc @@ -6,6 +6,32 @@ var config string Rank; var config ColorRGBA TextColor; var config Fields ApplyColorToFields; +public static function SCESettingsAdmin DefaultSettings() +{ + local SCESettingsAdmin Settings; + return Settings; +} + +public static function SCESettingsAdmin Settings() +{ + local SCESettingsAdmin Settings; + + Settings.Rank = default.Rank; + Settings.TextColor = default.TextColor; + Settings.ApplyColorToFields = default.ApplyColorToFields; + + return Settings; +} + +public static function WriteSettings(SCESettingsAdmin Settings) +{ + default.Rank = Settings.Rank; + default.TextColor = Settings.TextColor; + default.ApplyColorToFields = Settings.ApplyColorToFields; + + StaticSaveConfig(); +} + DefaultProperties { diff --git a/ScoreboardExt/Classes/SystemPlayerRank.uc b/ScoreboardExt/Classes/SystemPlayerRank.uc index 431ae74..86e0a98 100644 --- a/ScoreboardExt/Classes/SystemPlayerRank.uc +++ b/ScoreboardExt/Classes/SystemPlayerRank.uc @@ -6,6 +6,32 @@ var config string Rank; var config ColorRGBA TextColor; var config Fields ApplyColorToFields; +public static function SCESettingsPlayer DefaultSettings() +{ + local SCESettingsPlayer Settings; + return Settings; +} + +public static function SCESettingsPlayer Settings() +{ + local SCESettingsPlayer Settings; + + Settings.Rank = default.Rank; + Settings.TextColor = default.TextColor; + Settings.ApplyColorToFields = default.ApplyColorToFields; + + return Settings; +} + +public static function WriteSettings(SCESettingsPlayer Settings) +{ + default.Rank = Settings.Rank; + default.TextColor = Settings.TextColor; + default.ApplyColorToFields = Settings.ApplyColorToFields; + + StaticSaveConfig(); +} + DefaultProperties { diff --git a/ScoreboardExt/Classes/ThresholdsHP.uc b/ScoreboardExt/Classes/ThresholdsHP.uc index 02f8a5f..359f5fd 100644 --- a/ScoreboardExt/Classes/ThresholdsHP.uc +++ b/ScoreboardExt/Classes/ThresholdsHP.uc @@ -2,8 +2,32 @@ class ThresholdsHP extends Object dependson(Types) config(ScoreboardExt); -var config int HP_Low; -var config int HP_High; +var config int Low; +var config int High; + +public static function SCESettingsHP DefaultSettings() +{ + local SCESettingsHP Settings; + return Settings; +} + +public static function SCESettingsHP Settings() +{ + local SCESettingsHP Settings; + + Settings.Low = default.Low; + Settings.High = default.High; + + return Settings; +} + +public static function WriteSettings(SCESettingsHP Settings) +{ + default.Low = Settings.Low; + default.High = Settings.High; + + StaticSaveConfig(); +} DefaultProperties { diff --git a/ScoreboardExt/Classes/ThresholdsLevel.uc b/ScoreboardExt/Classes/ThresholdsLevel.uc index ed85dfd..9db900f 100644 --- a/ScoreboardExt/Classes/ThresholdsLevel.uc +++ b/ScoreboardExt/Classes/ThresholdsLevel.uc @@ -4,16 +4,49 @@ class ThresholdsLevel extends Object var config int Normal_Low; var config int Normal_High; - var config int Hard_Low; var config int Hard_High; - var config int Suicide_Low; var config int Suicide_High; - var config int HellOnEarth_Low; var config int HellOnEarth_High; +public static function SCESettingsLevel DefaultSettings() +{ + local SCESettingsLevel Settings; + return Settings; +} + +public static function SCESettingsLevel Settings() +{ + local SCESettingsLevel Settings; + + Settings.Normal_Low = default.Normal_Low; + Settings.Normal_High = default.Normal_High; + Settings.Hard_Low = default.Hard_Low; + Settings.Hard_High = default.Hard_High; + Settings.Suicide_Low = default.Suicide_Low; + Settings.Suicide_High = default.Suicide_High; + Settings.HellOnEarth_Low = default.HellOnEarth_Low; + Settings.HellOnEarth_High = default.HellOnEarth_High; + + return Settings; +} + +public static function WriteSettings(SCESettingsLevel Settings) +{ + default.Normal_Low = Settings.Normal_Low; + default.Normal_High = Settings.Normal_High; + default.Hard_Low = Settings.Hard_Low; + default.Hard_High = Settings.Hard_High; + default.Suicide_Low = Settings.Suicide_Low; + default.Suicide_High = Settings.Suicide_High; + default.HellOnEarth_Low = Settings.HellOnEarth_Low; + default.HellOnEarth_High = Settings.HellOnEarth_High; + + StaticSaveConfig(); +} + DefaultProperties { diff --git a/ScoreboardExt/Classes/ThresholdsPing.uc b/ScoreboardExt/Classes/ThresholdsPing.uc index 9134c69..17203dd 100644 --- a/ScoreboardExt/Classes/ThresholdsPing.uc +++ b/ScoreboardExt/Classes/ThresholdsPing.uc @@ -2,8 +2,32 @@ class ThresholdsPing extends Object dependson(Types) config(ScoreboardExt); -var config int Ping_Low; -var config int Ping_High; +var config int Low; +var config int High; + +public static function SCESettingsPing DefaultSettings() +{ + local SCESettingsPing Settings; + return Settings; +} + +public static function SCESettingsPing Settings() +{ + local SCESettingsPing Settings; + + Settings.Low = default.Low; + Settings.High = default.High; + + return Settings; +} + +public static function WriteSettings(SCESettingsPing Settings) +{ + default.Low = Settings.Low; + default.High = Settings.High; + + StaticSaveConfig(); +} DefaultProperties { diff --git a/ScoreboardExt/Classes/Types.uc b/ScoreboardExt/Classes/Types.uc index 83b82d2..ac91393 100644 --- a/ScoreboardExt/Classes/Types.uc +++ b/ScoreboardExt/Classes/Types.uc @@ -64,22 +64,60 @@ struct UIDRankRelation var int RankID; }; -struct SCESettings +struct SCESettingsAdmin { - var string SystemAdminRank; - var ColorRGBA SystemAdminColor; - var Fields SystemAdminApplyColorToFields; - - var string SystemPlayerRank; - var ColorRGBA SystemPlayerColor; - var Fields SystemPlayerApplyColorToFields; + var string Rank; + var ColorRGBA TextColor; + var Fields ApplyColorToFields; - var int HP_Low; - var int HP_High; + StructDefaultProperties + { + Rank="Admin" + TextColor=(R=250,G=0,B=0,A=255) + ApplyColorToFields=(Rank=True,Player=True,Perk=False,Dosh=False,Kills=False,Assists=False,Health=False,Ping=False) + } +}; - var int Ping_Low; - var int Ping_High; +struct SCESettingsPlayer +{ + var string Rank; + var ColorRGBA TextColor; + var Fields ApplyColorToFields; + + StructDefaultProperties + { + Rank="Player" + TextColor=(R=250,G=250,B=250,A=255) + ApplyColorToFields=(Rank=True,Player=True,Perk=False,Dosh=False,Kills=False,Assists=False,Health=False,Ping=False) + } +}; +struct SCESettingsHP +{ + var int Low; + var int High; + + StructDefaultProperties + { + Low=40 + High=80 + } +}; + +struct SCESettingsPing +{ + var int Low; + var int High; + + StructDefaultProperties + { + Low=60 + High=120; + } +}; + +struct SCESettingsLevel +{ var int Normal_Low; var int Normal_High; var int Hard_Low; @@ -91,20 +129,6 @@ struct SCESettings StructDefaultProperties { - SystemAdminRank="Admin" - SystemAdminColor=(R=250,G=0,B=0,A=255) - SystemAdminApplyColorToFields=(Rank=True,Player=True,Perk=False,Dosh=False,Kills=False,Assists=False,Health=False,Ping=False) - - SystemPlayerRank="Player" - SystemPlayerColor=(R=250,G=250,B=250,A=255) - SystemPlayerApplyColorToFields=(Rank=True,Player=True,Perk=False,Dosh=False,Kills=False,Assists=False,Health=False,Ping=False) - - HP_Low=40 - HP_High=80 - - Ping_Low=60 - Ping_High=120; - Normal_Low=0; Normal_High=0; Hard_Low=5; @@ -200,7 +224,7 @@ struct SCEStyle PerkTextColor=(R=250,G=250,B=250,A=255) LevelTextColor=(R=250,G=250,B=250,A=255) AvatarBorderColor=(R=255,G=255,B=255,A=255) - PlayerNameColor=(R=250,G=250,B=250,A=255) + PlayerNameTextColor=(R=250,G=250,B=250,A=255) KillsTextColor=(R=250,G=250,B=250,A=255) AssistsTextColor=(R=250,G=250,B=250,A=255) DoshTextColor=(R=250,G=250,B=100,A=255) @@ -222,3 +246,13 @@ struct SCEStyle } }; +struct SCESettings +{ + var SCEStyle Style; + var SCESettingsAdmin Admin; + var SCESettingsPlayer Player; + var SCESettingsHP HP; + var SCESettingsPing Ping; + var SCESettingsLevel Level; +}; +