Esempio n. 1
0
        private static void OnTransfer()
        {
            //MelonLoader.MelonLogger.Log("Transfer");
            var liquidItem = WaterButtons.currentLiquidItemShowing;

            if (liquidItem == null)
            {
                return;
            }
            if (Water.IsEmpty(liquidItem))             // If the selected liquid container is empty.
            {
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_BWM_Empty"));
                GameAudioManager.PlayGUIError();
                return;
            }
            float spaceAvailable = Water.GetRemainingCapacityEmpty() + Water.GetRemainingCapacity(liquidItem.m_LiquidQuality) - liquidItem.m_LiquidCapacityLiters + liquidItem.m_LiquidLiters;

            if (Water.IsNone(spaceAvailable))
            {
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_BWM_NoCapacityAvailable"));
                GameAudioManager.PlayGUIError();
                return;
            }
            float maximumWaterTransfer = Mathf.Min(spaceAvailable, liquidItem.m_LiquidLiters);

            GameAudioManager.PlayGuiConfirm();
            float refillDuration = Mathf.Max(maximumWaterTransfer * 4, 1);

            InterfaceManager.m_Panel_GenericProgressBar.Launch(Localization.Get("GAMEPLAY_BWM_TransferingProgress"), refillDuration, 0f, 0f,
                                                               "Play_SndActionRefuelLantern", null, false, true, new System.Action <bool, bool, float>(OnTransferFinished));
        }
 private static void UpdateWaterBottleSound(GearItem instance)
 {
     if (Water.IsEmpty(instance.m_LiquidItem))
     {
         instance.m_PickUpAudio  = AppendSuffix(instance.m_PickUpAudio, SOUND_SUFFIX_EMPTY);
         instance.m_PutBackAudio = AppendSuffix(instance.m_PutBackAudio, SOUND_SUFFIX_EMPTY);
     }
     else
     {
         instance.m_PickUpAudio  = StripSuffix(instance.m_PickUpAudio, SOUND_SUFFIX_EMPTY);
         instance.m_PutBackAudio = StripSuffix(instance.m_PutBackAudio, SOUND_SUFFIX_EMPTY);
     }
 }
Esempio n. 3
0
 private static void UpdateWaterBottleSound(GearItem instance)
 {
     if (Water.IsEmpty(instance.m_LiquidItem))
     {
         instance.m_PickUpAudio  = "Play_SndInvWaterBottle_empty";
         instance.m_PutBackAudio = "Play_SndInvWaterBottle_empty";
     }
     else
     {
         instance.m_PickUpAudio  = "Play_SndInvWaterBottle";
         instance.m_PutBackAudio = "Play_SndInvWaterBottle";
     }
 }
        internal static string GetWaterSuffix(LiquidItem liquidItem)
        {
            if (Water.IsEmpty(liquidItem))
            {
                return("_empty");
            }

            if (liquidItem.m_LiquidQuality == LiquidQuality.NonPotable)
            {
                return("_nonpotable");
            }

            return("_potable");
        }
Esempio n. 5
0
        private static void OnFill()
        {
            //MelonLoader.MelonLogger.Log("Fill");
            var liquidItem = WaterButtons.currentLiquidItemShowing;

            if (liquidItem == null)
            {
                return;
            }
            if (liquidItem.m_LiquidLiters >= liquidItem.m_LiquidCapacityLiters)            //if the container is already full
            {
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_BWM_AlreadyFull"));
                GameAudioManager.PlayGUIError();
                return;
            }

            //If an empty container held nonpotable water before, we want to fill it with potable water.
            if (Water.IsEmpty(liquidItem) && liquidItem.m_LiquidQuality == LiquidQuality.NonPotable)
            {
                liquidItem.m_LiquidQuality = LiquidQuality.Potable;
            }

            //If the current water supply is empty.
            if (Water.IsNone(Water.GetActual(liquidItem.m_LiquidQuality)))
            {
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_BWM_Empty"));
                GameAudioManager.PlayGUIError();
                return;
            }
            float maxWaterInBottle   = Mathf.Min(Water.GetActual(liquidItem.m_LiquidQuality), liquidItem.m_LiquidCapacityLiters);
            float maximumWaterRefill = Mathf.Max(maxWaterInBottle - liquidItem.m_LiquidLiters, 0);

            if (Water.IsNone(maximumWaterRefill))             // If nothing gets transferred.
            {
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_None"));
                GameAudioManager.PlayGUIError();
                return;
            }
            GameAudioManager.PlayGuiConfirm();
            float refuelDuration = Mathf.Max(maximumWaterRefill * 4, 1);

            InterfaceManager.m_Panel_GenericProgressBar.Launch(Localization.Get("GAMEPLAY_BWM_FillingProgress"), refuelDuration, 0f, 0f,
                                                               "Play_SndActionRefuelLantern", null, false, true, new System.Action <bool, bool, float>(OnFillFinished));
        }
        internal static void Postfix(GearItem gearItem, ref string __result)
        {
            LiquidItem liquidItem = gearItem.m_LiquidItem;

            if (!liquidItem || liquidItem.m_LiquidType != GearLiquidTypeEnum.Water)
            {
                return;
            }

            if (Water.IsEmpty(liquidItem))
            {
                __result += " - " + Localization.Get("GAMEPLAY_Empty");
            }
            else if (liquidItem.m_LiquidQuality == LiquidQuality.Potable)
            {
                __result += " - " + Localization.Get("GAMEPLAY_WaterPotable");
            }
            else
            {
                __result += " - " + Localization.Get("GAMEPLAY_WaterUnsafe");
            }
        }