Skip to content

Commit

Permalink
fix: a bug where slider settings broke
Browse files Browse the repository at this point in the history
  • Loading branch information
xhayper committed Aug 21, 2024
1 parent 5b0e07a commit 9991012
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 0 additions & 2 deletions COTL_API/CustomInventory/Patches/CustomItemSpawnPatches.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using HarmonyLib;
using MMBiomeGeneration;
using MMRoomGeneration;
using MMTools;
using UnityEngine;
using UnityEngine.AddressableAssets;
using Object = UnityEngine.Object;
Expand Down Expand Up @@ -60,7 +59,6 @@ private static bool Prefix(InventoryItem.ITEM_TYPE type, int quantity, Vector3 p

pickUp.type = type;
pickUp.Speed = StartSpeed;

});
}
else
Expand Down
7 changes: 4 additions & 3 deletions COTL_API/CustomSkins/CustomSkinPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ private static void SkeletonData_FindSkin(ref Skin? __result, SkeletonData __ins
}

if (CustomFollowerSkins.TryGetValue(skinName, out var skin)) __result = skin;
if (AlwaysUnlockedSkins.TryGetValue(skinName, out var alwaysUnlocked) && alwaysUnlocked) DataManager.SetFollowerSkinUnlocked(skinName);
if (AlwaysUnlockedSkins.TryGetValue(skinName, out var alwaysUnlocked) && alwaysUnlocked)
DataManager.SetFollowerSkinUnlocked(skinName);
}

[HarmonyPatch(typeof(Graphics), nameof(Graphics.CopyTexture), typeof(Texture), typeof(int), typeof(int),
Expand Down Expand Up @@ -57,8 +58,8 @@ private static bool Graphics_CopyTexture(ref Texture src, int srcElement, int sr
var fullPix = orig.GetPixels32();
var croppedPix = new Color32[srcWidth * srcHeight];
for (var i = 0; i < srcHeight; i++)
for (var j = 0; j < srcWidth; j++)
croppedPix[i * srcWidth + j] = fullPix[(i + srcY) * orig.width + j + srcX];
for (var j = 0; j < srcWidth; j++)
croppedPix[i * srcWidth + j] = fullPix[(i + srcY) * orig.width + j + srcX];

dst2d.SetPixels32(croppedPix);

Expand Down
8 changes: 4 additions & 4 deletions COTL_API/UI/UIManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public static class UIManager
[HarmonyPostfix]
private static void UISettingsMenuController_OnShowStarted(UISettingsMenuController __instance)
{
if (SettingsUtils.SliderTemplate == null)
SettingsUtils.SliderTemplate = __instance._audioSettings.GetComponentInChildren<ScrollRect>()
.content.GetChild(0).gameObject;

if (SettingsUtils.HeaderTemplate == null)
SettingsUtils.HeaderTemplate = __instance._graphicsSettings.GetComponentInChildren<ScrollRect>()
.content.GetChild(0).gameObject;

if (SettingsUtils.SliderTemplate == null)
SettingsUtils.SliderTemplate = __instance._gameSettings.GetComponentInChildren<ScrollRect>()
.content.GetChild(2).gameObject;

if (SettingsUtils.DropdownTemplate == null)
SettingsUtils.DropdownTemplate = __instance._graphicsSettings.GetComponentInChildren<ScrollRect>()
.content.GetChild(2).gameObject;
Expand Down

0 comments on commit 9991012

Please sign in to comment.