diff --git a/Heatmap/Heatmap.cs b/Heatmap/Heatmap.cs index 081e8aa..21d4745 100644 --- a/Heatmap/Heatmap.cs +++ b/Heatmap/Heatmap.cs @@ -35,7 +35,7 @@ public override CachedLocalizedString Description private GameObject _timerObject; private int _timerIteration = 0; // tracks how often the timer has elapsed - private InputAction _actionToggleHeatmap + private readonly InputAction _actionToggleHeatmap = new InputAction("Toggle Heatmap", type: InputActionType.Button, binding: "/h"); /// diff --git a/Heatmap/UI/SettingsPanel.cs b/Heatmap/UI/SettingsPanel.cs index 4cb44ac..d3bf62f 100644 --- a/Heatmap/UI/SettingsPanel.cs +++ b/Heatmap/UI/SettingsPanel.cs @@ -1,6 +1,7 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Game; +using Game.Context; using Heatmap.IO; using Heatmap.Unity; using UnityEngine; @@ -83,7 +84,7 @@ private void InitializeValues() public static void Show() { Log("Opening settings panel", LogLevel.Info); - Instance = new SettingsPanel(GameController.Current.UiCanvas.gameObject); + Instance = new SettingsPanel(Ctx.Deps.GameButtons.GetComponentInParent().gameObject); } public static void Destroy() diff --git a/Heatmap/UI/ToolbarButton.cs b/Heatmap/UI/ToolbarButton.cs index 316d07a..3525290 100644 --- a/Heatmap/UI/ToolbarButton.cs +++ b/Heatmap/UI/ToolbarButton.cs @@ -32,7 +32,7 @@ public class ToolbarButton public ToolbarButton() { // Find the button that will be copied, and the layoutgroup it is in - GameButton sourceButton = Ctx.Deps.GameButtons.ContractsButtonHolder; + GameButton sourceButton = Ctx.Deps.GameButtons.ContractsButton.GetComponentInParent(); VerticalLayoutGroup buttonGroup = sourceButton.GetComponentInParent(); // Copy the button and add it to the layoutgroup diff --git a/Heatmap/UI/Tooltip.cs b/Heatmap/UI/Tooltip.cs index e3188a6..1708f12 100644 --- a/Heatmap/UI/Tooltip.cs +++ b/Heatmap/UI/Tooltip.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using Game; +using Game.Context; using Heatmap.Unity; using TMPro; using UnityEngine; @@ -37,7 +38,7 @@ public static void Show() // Create a tooltip if it does not exist if (_tooltipInstance == null) { - Canvas uiCanvas = GameController.Current.UiCanvas; + Canvas uiCanvas = Ctx.Deps.GameButtons.GetComponentInParent(); _tooltipInstance = UnityEngine.Object.Instantiate(_prefab, uiCanvas.transform, worldPositionStays: false); _tooltipInstance.GetComponent().CanvasRect =