Ejemplo n.º 1
0
        private void Awake()
        {
            instance = this;

            Enabled = Main.Instance.Config.Bind(nameof(DebugInfo), "Enabled", true, "Globally enable or disable the debug info panel.");

            Enabled.SettingChanged += (sender, eventArgs) =>
            {
                DestroyPanel();

                if (Enabled.Value && Hud.instance)
                {
                    CreatePanel(Hud.instance);
                }
            };

            Position =
                Main.Instance.Config.Bind(
                    nameof(DebugInfo),
                    "PanelPosition",
                    new Vector2(40f, 600f),
                    "Position of the DebugInfo panel, starting at the lower left corner.");

            Position.SettingChanged += (sender, eventArgs) => Panel?.SetPosition(Position.Value);

            Main.Harmony.PatchAll(typeof(Patches));
        }
Ejemplo n.º 2
0
        private void Awake()
        {
            instance = this;

            _isModEnabled = Main.Instance.Config.Bind(nameof(HoverInfo), "Enabled", true, "Globally enable or disable the hover info.");

            _isModEnabled.SettingChanged += (sender, eventArgs) =>
            {
                DestroyPanels();

                if (_isModEnabled.Value && Hud.instance)
                {
                    CreatePanels(Hud.instance);
                }
            };

            _hoverPiecePanelPosition =
                Main.Instance.Config.Bind(
                    nameof(HoverInfo),
                    "hoverPiecePanelPosition",
                    new Vector2(-100, 200),
                    "Position of the HoverPiece properties panel.");

            _hoverPiecePanelPosition.SettingChanged +=
                (sender, eventArgs) => _hoverPiecePanel?.SetPosition(_hoverPiecePanelPosition.Value);

            _placementGhostPanelPosition =
                Main.Instance.Config.Bind(
                    nameof(HoverInfo),
                    "placementGhostPanelPosition",
                    new Vector2(100, 15),
                    "Position of the PlacementGhost properties panel.");

            _placementGhostPanelPosition.SettingChanged +=
                (sender, eventArgs) => _placementGhostPanel?.SetPosition(_placementGhostPanelPosition.Value);

            Main.Harmony.PatchAll(typeof(Patches));
        }