|
1 | 1 | using AmongUs.Data; |
2 | 2 | using HarmonyLib; |
| 3 | +using LaunchpadReloaded.Components; |
3 | 4 | using LaunchpadReloaded.Features; |
4 | 5 | using LaunchpadReloaded.Features.Managers; |
5 | 6 | using LaunchpadReloaded.Networking.Color; |
@@ -28,6 +29,20 @@ private static void SwitchSelector(PlayerTab instance) |
28 | 29 | instance.currentColor = SelectGradient ? GradientManager.LocalGradientId : DataManager.Player.Customization.Color; |
29 | 30 | } |
30 | 31 |
|
| 32 | + [HarmonyPatch(typeof(InventoryTab), nameof(InventoryTab.GetDisplayColor))] |
| 33 | + public static class InventoryTabPatch |
| 34 | + { |
| 35 | + public static bool Prefix(InventoryTab __instance, ref int __result) |
| 36 | + { |
| 37 | + if (SelectGradient) |
| 38 | + { |
| 39 | + __result = GradientManager.LocalGradientId; |
| 40 | + return false; |
| 41 | + } |
| 42 | + |
| 43 | + return true; |
| 44 | + } |
| 45 | + } |
31 | 46 |
|
32 | 47 | [HarmonyPostfix] |
33 | 48 | [HarmonyPatch(nameof(PlayerTab.OnEnable))] |
@@ -102,19 +117,12 @@ public static bool SelectPrefix(PlayerTab __instance, [HarmonyArgument(0)] int c |
102 | 117 | var colorName = Palette.GetColorName(colorId); |
103 | 118 | PlayerCustomizationMenu.Instance.SetItemName(colorName); |
104 | 119 | __instance.PlayerPreview.UpdateFromDataManager(PlayerMaterial.MaskType.None); |
105 | | - return false; |
106 | | - } |
107 | 120 |
|
108 | | - return true; |
109 | | - } |
110 | | - |
111 | | - [HarmonyPrefix] |
112 | | - [HarmonyPatch(nameof(PlayerTab.GetCurrentColorId))] |
113 | | - public static bool GetCurrentColorPrefix(PlayerTab __instance, ref int __result) |
114 | | - { |
115 | | - if (SelectGradient) |
116 | | - { |
117 | | - __result = GradientManager.LocalGradientId; |
| 121 | + var playerGradientData = __instance.PlayerPreview.GetComponent<PlayerGradientData>(); |
| 122 | + if (playerGradientData) |
| 123 | + { |
| 124 | + playerGradientData.Destroy(); |
| 125 | + } |
118 | 126 | return false; |
119 | 127 | } |
120 | 128 |
|
|
0 commit comments