Skip to content

Commit

Permalink
Open mod settings from mod list
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-bures committed Jan 10, 2024
1 parent d33c1d7 commit e421ad5
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/SpaceWarp.UI/UI/ModList/ModListController.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Diagnostics;
using BepInEx;
using I2.Loc;
using KSP.Game;
using SpaceWarp.API.Assets;
using SpaceWarp.API.Mods;
using SpaceWarp.API.UI;
Expand All @@ -10,7 +11,11 @@
using UnityEngine;
using UnityEngine.UIElements;
using SpaceWarp.Backend.Extensions;
using SpaceWarp.UI.Settings;
using UnityEngine.UI;
using Button = UnityEngine.UIElements.Button;
using Enumerable = System.Linq.Enumerable;
using Toggle = UnityEngine.UIElements.Toggle;

namespace SpaceWarp.UI.ModList;

Expand Down Expand Up @@ -396,7 +401,15 @@ private void SetupButtons()

_openModSettingsButton.RegisterCallback<ClickEvent>(_ =>
{
// TODO: Open Settings -> Mods
var isMainMenu = GameManager.Instance.Game.GlobalGameState.GetState() == GameState.MainMenu;
GameManager.Instance.Game.SettingsMenuManager.SetVisible(isVisible: true, isMainMenu);
var modsButton = GameObject.Find(
"GameManager/Default Game Instance(Clone)/UI Manager(Clone)/Popup Canvas/SettingsMenu(Clone)/Frame/" +
"Body/Categories/Graphics(Clone)"
);
modsButton.GetComponent<UIAction_Void_Toggle>().OnToggleClicked();
modsButton.GetComponent<ToggleExtended>().isOn = true;
HideWindow();
});
}

Expand Down Expand Up @@ -502,7 +515,7 @@ private void SetSelectedModInfo(ModListItemController data, SpaceWarpPluginDescr
data.UnsupportedDependencies,
data.UnspecifiedDependencies,
data.DisabledDependencies,
data.Conflicts,// data.Conflicts,
data.Conflicts,
data.StoredDetails,
data.GetDetails,
x => data.StoredDetails = x
Expand Down

0 comments on commit e421ad5

Please sign in to comment.