Ejemplo n.º 1
0
 public static void Postfix(Panel_Inventory_Examine __instance)
 {
     if (Implementation.IsFuelItem(__instance.m_GearItem) && BetterFuelManagementUtils.IsSelected(__instance.m_Button_Unload))
     {
         __instance.m_ButtonLegendContainer.UpdateButton("Continue", "GAMEPLAY_Drain", true, 1, true);
     }
 }
Ejemplo n.º 2
0
        public static void Postfix(PlayerManager __instance, float litersToAdd, GearLiquidTypeEnum liquidType, ref float __result)
        {
            if (liquidType == GearLiquidTypeEnum.Kerosene && __result != litersToAdd)
            {
                __instance.StartCoroutine(BetterFuelManagementUtils.SendDelayedLostMessage(litersToAdd - __result));

                // just pretend we added everything, so the original method will not generate new containers
                __result = litersToAdd;
            }
        }
Ejemplo n.º 3
0
        public static void Prefix(Panel_Inventory_Examine __instance, bool selected)
        {
            if (!Implementation.IsFuelItem(__instance.m_GearItem))
            {
                return;
            }

            if (selected)
            {
                BetterFuelManagementUtils.SetButtonLocalizationKey(__instance.m_RefuelPanel.GetComponentInChildren <UIButton>(), "GAMEPLAY_Refuel");
            }
        }
Ejemplo n.º 4
0
        public static bool Prefix(Panel_Inventory_Examine __instance, bool selected)
        {
            if (!Implementation.IsFuelItem(__instance.m_GearItem))
            {
                return(true);
            }

            if (selected)
            {
                BetterFuelManagementUtils.SetButtonLocalizationKey(__instance.m_RefuelPanel.GetComponentInChildren <UIButton>(), "GAMEPLAY_Drain");
            }

            __instance.m_RefuelPanel.SetActive(selected || BetterFuelManagementUtils.IsSelected(__instance.m_Button_Refuel));

            return(false);
        }
Ejemplo n.º 5
0
        public static bool Prefix(Panel_Inventory_Examine __instance)
        {
            if (!Implementation.IsFuelItem(__instance.m_GearItem))
            {
                return(true);
            }

            if (BetterFuelManagementUtils.IsSelected(__instance.m_Button_Unload))
            {
                Implementation.Drain(__instance.m_GearItem);
            }
            else
            {
                Implementation.Refuel(__instance.m_GearItem);
            }

            return(false);
        }
Ejemplo n.º 6
0
        public static void Postfix(Panel_Inventory_Examine __instance)
        {
            if (!Implementation.IsFuelItem(__instance.m_GearItem))
            {
                return;
            }

            Vector3 position = BetterFuelManagementUtils.GetBottomPosition(
                __instance.m_Button_Harvest,
                __instance.m_Button_Refuel,
                __instance.m_Button_Repair);

            position.y += __instance.m_ButtonSpacing;
            __instance.m_Button_Unload.transform.localPosition = position;

            __instance.m_Button_Unload.gameObject.SetActive(true);

            float litersToDrain = Implementation.GetLitersToDrain(__instance.m_GearItem);

            __instance.m_Button_Unload.GetComponent <Panel_Inventory_Examine_MenuItem>().SetDisabled(litersToDrain < Implementation.MIN_LITERS);
        }
Ejemplo n.º 7
0
        public static void Prefix(Panel_Inventory_Examine __instance, bool enable)
        {
            if (!enable)
            {
                return;
            }

            if (Implementation.IsFuelItem(__instance.m_GearItem))
            {
                // repurpose the "Unload" button to "Drain"
                BetterFuelManagementUtils.SetButtonLocalizationKey(__instance.m_Button_Unload, "GAMEPLAY_Drain");
                BetterFuelManagementUtils.SetButtonSprite(__instance.m_Button_Unload, "ico_lightSource_lantern");

                Transform lanternTexture = __instance.m_RefuelPanel.transform.Find("FuelDisplay/Lantern_Texture");
                BetterFuelManagementUtils.SetTexture(lanternTexture, Utils.GetInventoryIconTexture(__instance.m_GearItem));
            }
            else
            {
                BetterFuelManagementUtils.SetButtonLocalizationKey(__instance.m_Button_Unload, "GAMEPLAY_Unload");
                BetterFuelManagementUtils.SetButtonSprite(__instance.m_Button_Unload, "ico_ammo_rifle");
            }
        }
Ejemplo n.º 8
0
        internal static void Drain(GearItem gearItem)
        {
            Panel_Inventory_Examine panel = InterfaceManager.m_Panel_Inventory_Examine;

            float currentLiters = GetCurrentLiters(panel.m_GearItem);

            if (currentLiters < MIN_LITERS)
            {
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_AlreadyEmpty"));
                GameAudioManager.PlayGUIError();
                return;
            }

            float totalCapacity = GetTotalCapacityLiters(panel.m_GearItem);
            float totalCurrent  = GetTotalCurrentLiters(panel.m_GearItem);

            if (Mathf.Approximately(totalCapacity, totalCurrent))
            {
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_NoFuelCapacityAvailable"));
                GameAudioManager.PlayGUIError();
                return;
            }

            GameAudioManager.PlayGuiConfirm();
            InterfaceManager.m_Panel_GenericProgressBar.Launch(
                Localization.Get("GAMEPLAY_DrainingProgress"),
                REFUEL_TIME,
                0,
                0,
                REFUEL_AUDIO,
                null,
                false,
                true,
                new OnExitDelegate(OnDrainFinished));

            // HACK: somehow this is needed to revert the button text to "Refuel", which will be active when draining finishes
            BetterFuelManagementUtils.SetButtonLocalizationKey(panel.m_RefuelPanel.GetComponentInChildren <UIButton>(), "GAMEPLAY_Refuel");
        }