internal static void Initialize(ItemDescriptionPage itemDescriptionPage) { if (itemDescriptionPage == null) { return; } fillText = Localization.Get("GAMEPLAY_BWM_FillBottle"); transferText = Localization.Get("GAMEPLAY_BWM_TransferBottle"); dumpText = Localization.Get("GAMEPLAY_BWM_DumpBottle"); GameObject drinkButton = itemDescriptionPage.m_MouseButtonEquip; fillButton = Object.Instantiate <GameObject>(drinkButton, drinkButton.transform.parent, true); fillButton.transform.Translate(0, -0.09f, 0); Utils.GetComponentInChildren <UILabel>(fillButton).text = fillText; transferButton = Object.Instantiate <GameObject>(drinkButton, drinkButton.transform.parent, true); transferButton.transform.Translate(0, -0.18f, 0); Utils.GetComponentInChildren <UILabel>(transferButton).text = transferText; dumpButton = Object.Instantiate <GameObject>(drinkButton, drinkButton.transform.parent, true); dumpButton.transform.Translate(0, -0.27f, 0); Utils.GetComponentInChildren <UILabel>(dumpButton).text = dumpText; AddAction(fillButton, new System.Action(OnFill)); AddAction(transferButton, new System.Action(OnTransfer)); AddAction(dumpButton, new System.Action(OnDump)); SetActive(true); }
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); }
private static void Postfix(ItemDescriptionPage __instance, GearItem gi) { if (__instance != InterfaceManager.m_Panel_Inventory?.m_ItemDescriptionPage) { return; } WaterButtons.currentLiquidItemShowing = gi?.GetComponent <LiquidItem>(); if (WaterButtons.currentLiquidItemShowing == null || WaterButtons.currentLiquidItemShowing.m_LiquidType != GearLiquidTypeEnum.Water) { WaterButtons.SetActive(false); } else { WaterButtons.SetActive(true); } }