예제 #1
0
            private static void Postfix(Panel_Rest __instance)
            {
                PlayerManager playerManager = GameManager.GetPlayerManagerComponent();
                Hunger        hunger        = GameManager.GetHungerComponent();

                float calorieBurnRate;

                if (__instance.m_ShowPassTime)
                {
                    calorieBurnRate = playerManager.CalculateModifiedCalorieBurnRate(hunger.m_CalorieBurnPerHourStanding);
                }
                else
                {
                    calorieBurnRate = playerManager.CalculateModifiedCalorieBurnRate(hunger.m_CalorieBurnPerHourSleeping);
                }

                if (!GameManager.GetPassTime().IsPassingTime())
                {
                    lastSimulation = HungerRevamped.Instance.SimulateHungerBar(calorieBurnRate, __instance.m_SleepHours);
                }

                UILabel storedCaloriesLabel = __instance.m_CalorieReservesLabel;
                int     storedCalories      = Mathf.RoundToInt(lastSimulation.storedCalories);

                storedCaloriesLabel.text = storedCalories.ToString();

                UILabel hungerPercentLabel = __instance.m_EstimatedCaloriesBurnedLabel.GetComponent <UILabel>();
                int     hungerPercent      = Mathf.FloorToInt(lastSimulation.hungerRatio * 100f);

                hungerPercentLabel.text  = hungerPercent.ToString() + "%";
                hungerPercentLabel.color = (lastSimulation.hungerRatio >= Tuning.hungerLevelStarving) ? Color.white : __instance.m_NegativeTemperatureColor;
            }
예제 #2
0
            private static void Postfix(Panel_Rest __instance)
            {
                Transform  parentTransform = __instance.m_EstimatedCaloriesBurnedLabel.transform.parent;
                GameObject gameObject      = parentTransform.Find("Label_CaloriesBurned").gameObject;
                UILocalize localize        = gameObject.GetComponent <UILocalize>();

                //localize.key = "GAMEPLAY_Hunger";
                SetKey(localize, "GAMEPLAY_Hunger");
            }
예제 #3
0
        static void PanelRest_UpdateButtonLegend_Postfix(Panel_Rest __instance)
        {
            if (__instance.m_ShowPassTime)
            {
                return;
            }

            string label = Localization.Get("GAMEPLAY_Sleep") + (controlPressed? " (unlimited)": "");

            __instance.m_SleepButton.GetComponentInChildren <UILabel>().text = label;
        }
예제 #4
0
        static void PanelRest_Enable_Postfix(Panel_Rest __instance, bool enable)
        {
            if (!enable)
            {
                return;
            }

            var descriptionLabel = __instance.gameObject.getChild("ControllerOffset/RestOnly/Label_Description");

            descriptionLabel.destroyComponent <UILocalize>();
            descriptionLabel.GetComponentInChildren <UILabel>().text = Localization.Get("GAMEPLAY_RestDescription") + "\n(press Control for unlimited sleep)";
        }