diff --git a/BuildExpansion/BuildExpansionMod.cs b/BuildExpansion/BuildExpansionMod.cs index 18aed8b..ed27548 100644 --- a/BuildExpansion/BuildExpansionMod.cs +++ b/BuildExpansion/BuildExpansionMod.cs @@ -20,6 +20,7 @@ public class BuildExpansionMod : BaseUnityPlugin public static ConfigEntry newGridWidth; public static ConfigEntry disableScrollCategories; public static ConfigEntry isEnabled; + public static ConfigEntry debugLogging; public Harmony harmony; @@ -31,6 +32,7 @@ public void Awake() newGridWidth = Config.Bind("General", "GridWidth", 10, "Width in number of columns of the build grid, maximum value of 10."); disableScrollCategories = Config.Bind("General.Toggles", "DisableScrollCategories", true, "Should the mousewheel stop scrolling categories, RECOMMEND TRUE."); isEnabled = Config.Bind("General.Toggles", "EnableExpansion", true, "Whether or not to expand the build grid."); + debugLogging = Config.Bind("General.Toggles", "DebugLogging", false, "Whether or not to print the debug logging."); if (newGridWidth.Value > 10) newGridWidth.Value = 10; harmony = new Harmony(ID); @@ -147,8 +149,11 @@ public static bool Prefix(ref Hud __instance, ref Player player, ref Vector2Int category = (Piece.PieceCategory)5; if (needRefresh || __instance.m_pieceIcons.Count(x => x.m_go.activeSelf) != buildPieces.Count) { - BuildExpansionMod.buildFilterLogger.LogDebug($"\npieceIcons: {__instance.m_pieceIcons.Count(x => x.m_go.activeSelf)}\nBuild pieces: {buildPieces.Count}"); - BuildExpansionMod.buildFilterLogger.LogDebug($"\nRows: {calculatedRows}\nColumns: {columns}"); + if (BuildExpansionMod.debugLogging.Value) + { + BuildExpansionMod.buildFilterLogger.LogDebug($"\npieceIcons: {__instance.m_pieceIcons.Count(x => x.m_go.activeSelf)}\nBuild pieces: {buildPieces.Count}"); + BuildExpansionMod.buildFilterLogger.LogDebug($"\nRows: {calculatedRows}\nColumns: {columns}"); + } __instance.m_pieceListRoot.sizeDelta = new Vector2((int)(__instance.m_pieceIconSpacing * BuildExpansionMod.newGridWidth.Value), (int)(__instance.m_pieceIconSpacing * calculatedRows) + 16); foreach (Hud.PieceIconData pieceIconData in __instance.m_pieceIcons) { @@ -199,11 +204,14 @@ public static bool Prefix(ref Hud __instance, ref Player player, ref Vector2Int templatePieceData.m_upgrade.SetActive(false); templatePieceData.m_go.SetActive(false); } - BuildExpansionMod.buildFilterLogger.LogDebug($"\nPiece name: {templatePieceData.m_tooltip.m_text}" + + if (BuildExpansionMod.debugLogging.Value) + { + BuildExpansionMod.buildFilterLogger.LogDebug($"\nPiece name: {templatePieceData.m_tooltip.m_text}" + $"\nPiece icon: {templatePieceData.m_icon.enabled}" + $"\nPiece index: {index}" + $"\nPiece x: {xaxis}" + $"\nPiece y: {yaxis}"); + } __instance.m_pieceIcons.Add(templatePieceData); } }