Skip to content

Commit

Permalink
Resize golden outline based on grid config size
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaPiggy committed Sep 23, 2024
1 parent 98c5bff commit f9ed833
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Winch/Patches/API/RecipePatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Linq;
using System.Reflection.Emit;
using HarmonyLib;
using UnityEngine;
using Winch.Components;
using Winch.Data.Recipe;
using Winch.Util;
Expand All @@ -13,6 +14,20 @@ namespace Winch.Patches.API;
[HarmonyPatch]
internal static class RecipePatcher
{
/// <summary>
/// Resize golden outline based on grid config size
/// </summary>
[HarmonyPostfix]
[HarmonyPatch(typeof(ItemProductPanel), nameof(ItemProductPanel.Show))]
public static void ItemProductPanel_Show_Postfix(ItemProductPanel __instance)
{
var gridConfig = __instance.questGridConfig.gridConfiguration;
var width = gridConfig.columns / 4f;
var height = gridConfig.rows / 4f;
var goldenSquareOutline = (RectTransform)(__instance.gridUI.transform.Find("BackgroundImage"));
goldenSquareOutline.localScale = new Vector3(width, height, 1);
}

[HarmonyTranspiler]
[HarmonyPatch(typeof(ConstructableDestinationUI), nameof(ConstructableDestinationUI.OnRecipeGridPanelExitEvent))]
public static IEnumerable<CodeInstruction> ConstructableDestinationUI_OnRecipeGridPanelExitEvent_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
Expand Down

0 comments on commit f9ed833

Please sign in to comment.