Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Spatison committed Sep 15, 2024
1 parent a1dab8d commit 199e486
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions Content.Client/Popups/PopupSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,17 @@ public sealed class PopupSystem : SharedPopupSystem
public const float MaximumPopupLifetime = 5f;
public const float PopupLifetimePerCharacter = 0.04f;

private bool _isLogging; // WD EDIT
// WD EDIT START
private static readonly Dictionary<PopupType, string> FontSizeDict = new()
{
{ PopupType.Medium, "12" },
{ PopupType.MediumCaution, "12" },
{ PopupType.Large, "15" },
{ PopupType.LargeCaution, "15" }
};

private bool _shouldLogInChat;
// WD EDIT END

public override void Initialize()
{
Expand All @@ -64,8 +74,8 @@ public override void Initialize()
this));

// WD EDIT START
_isLogging = _configManager.GetCVar(WhiteCVars.LogInChat);
_configManager.OnValueChanged(WhiteCVars.LogInChat, log => { _isLogging = log; });
_shouldLogInChat = _configManager.GetCVar(WhiteCVars.LogInChat);
_configManager.OnValueChanged(WhiteCVars.LogInChat, log => { _shouldLogInChat = log; });
// WD EDIT END
}

Expand Down Expand Up @@ -98,7 +108,7 @@ private void PopupMessage(string? message, PopupType type, EntityCoordinates coo
_aliveWorldLabels.Add(label);

// WD EDIT START
if (!_isLogging)
if (!_shouldLogInChat)
return;

if (_playerManager.LocalEntity == null)
Expand All @@ -107,15 +117,7 @@ private void PopupMessage(string? message, PopupType type, EntityCoordinates coo
if (!_examine.InRangeUnOccluded(_playerManager.LocalEntity.Value, coordinates, 10))
return;

var fontSizeDict = new Dictionary<PopupType, string>
{
{ PopupType.Medium, "12" },
{ PopupType.MediumCaution, "12" },
{ PopupType.Large, "15" },
{ PopupType.LargeCaution, "15" }
};

var fontsize = fontSizeDict.GetValueOrDefault(type, "10");
var fontsize = FontSizeDict.GetValueOrDefault(type, "10");
var fontcolor = type is PopupType.LargeCaution or PopupType.MediumCaution or PopupType.SmallCaution
? "#C62828"
: "#AEABC4";
Expand Down

0 comments on commit 199e486

Please sign in to comment.