public static bool Prefix(ItemDescriptionPage __instance, GearItem gi) { var uiLocalize = __instance.m_FavoriteLabel.GetComponent <UILocalize>(); if (Implementation.IsStruggleWeapon(gi)) { bool isPreferredStruggleWeapon = Implementation.IsPreferredStruggleWeapon(gi); Utils.SetActive(__instance.m_FavoriteObject, true); Utils.SetActive(__instance.m_FavoriteCheckmark, isPreferredStruggleWeapon); __instance.m_FavoriteLabel.color = isPreferredStruggleWeapon ? __instance.m_FavoriteLabelColorChecked : __instance.m_FavoriteLabelColorUnchecked; __instance.m_FavoriteLabel.text = Localization.Get("GAMEPLAY_PreferredStruggleWeapon"); if (uiLocalize) { uiLocalize.enabled = false; } return(false); } if (uiLocalize && !uiLocalize.enabled) { uiLocalize.enabled = true; __instance.m_FavoriteLabel.text = Localization.Get(uiLocalize.key); } return(true); }
public static bool Prefix(ItemDescriptionPage __instance) { var panelInventory = InterfaceManager.m_Panel_Inventory; var gearItem = (GearItem)AccessTools.Method(panelInventory.GetType(), "GetCurrentlySelectedGearItem").Invoke(panelInventory, null); if (!Implementation.IsStruggleWeapon(gearItem)) { return(true); } Implementation.TogglePreferredStruggleWeapon(gearItem); InterfaceManager.m_Panel_Inventory.RefreshTable(); return(false); }