From f806c6f53a044cf8d33807f37e965ea9c84e51d9 Mon Sep 17 00:00:00 2001 From: legoandmars Date: Sat, 17 Feb 2024 22:52:46 -0800 Subject: [PATCH] Fix incompatible LobbyList icon color being white --- .../Behaviours/ButtonEventHandler.cs | 12 ++++++ .../Behaviours/ModdedLobbySlot.cs | 38 +++++++++++-------- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/LobbyCompatibility/Behaviours/ButtonEventHandler.cs b/LobbyCompatibility/Behaviours/ButtonEventHandler.cs index cf42f43..f447996 100644 --- a/LobbyCompatibility/Behaviours/ButtonEventHandler.cs +++ b/LobbyCompatibility/Behaviours/ButtonEventHandler.cs @@ -65,6 +65,18 @@ public void SetButtonImageData(Image image, Sprite normalSprite, Sprite highligh _image = image; _normalSprite = normalSprite; _highlightedSprite = highlightedSprite; + + SetColor(normalColor, highlightedColor); + SetHighlighted(false); + } + + /// + /// Sets the button's color data + /// + /// Color to use when the button is not highlighted + /// Color to use when the button is highlighted + public void SetColor(Color normalColor, Color highlightedColor) + { _normalColor = normalColor; _highlightedColor = highlightedColor; diff --git a/LobbyCompatibility/Behaviours/ModdedLobbySlot.cs b/LobbyCompatibility/Behaviours/ModdedLobbySlot.cs index 174e4e3..7b19bd5 100644 --- a/LobbyCompatibility/Behaviours/ModdedLobbySlot.cs +++ b/LobbyCompatibility/Behaviours/ModdedLobbySlot.cs @@ -7,6 +7,7 @@ using UnityEngine.UI; using Image = UnityEngine.UI.Image; using Color = UnityEngine.Color; +using System.Linq; namespace LobbyCompatibility.Behaviours; @@ -18,6 +19,7 @@ public class ModdedLobbySlot : MonoBehaviour { private List _buttonEventHandlers = new(); private RectTransform? _buttonTransform; + private Button? _joinButton; private LobbyDiff? _lobbyDiff; private LobbySlot? _lobbySlot; private Transform? _parentContainer; @@ -36,8 +38,8 @@ internal void Setup(LobbySlot lobbySlot) return; // Find "Join Lobby" button template - var joinButton = GetComponentInChildren