private static bool Prefix(Panel_BodyHarvest __instance) { float origBurnRate = GameManager.GetHungerComponent().m_CalorieBurnPerHourHarvestingCarcass; float calorieBurnRate = GameManager.GetPlayerManagerComponent().CalculateModifiedCalorieBurnRate(origBurnRate); UILabel targetLabel = null; float hours = 0; if (__instance.IsTabHarvestSelected()) { targetLabel = __instance.m_Label_HarvestEstimatedCalories; hours = __instance.GetHarvestDurationMinutes() / 60f; } else if (__instance.IsTabQuarterSelected()) { targetLabel = __instance.m_Label_QuarterEstimatedCalories; hours = __instance.GetQuarterDurationMinutes() / 60f; } HungerTuple simulation = HungerRevamped.Instance.SimulateHungerBar(calorieBurnRate, hours); int hungerPercent = Mathf.RoundToInt(simulation.hungerRatio * 100f); if (targetLabel != null) { targetLabel.text = hungerPercent + "% " + Localization.Get("GAMEPLAY_Hunger"); } __instance.m_Label_CurrentCalories.text = Localization.Get("GAMEPLAY_CalorieStore"); int storedCalories = Mathf.RoundToInt(simulation.storedCalories); __instance.m_Label_CurrentCaloriesAmount.text = storedCalories.ToString(); return(false); }
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; }
private static void UpdateSnowShelterInteractPanel(Panel_SnowShelterInteract panel) { float hours = panel.GetTaskDurationInHours(); float origBurnRate = panel.GetCalorieBurnRate(); float calorieBurnRate = GameManager.GetPlayerManagerComponent().CalculateModifiedCalorieBurnRate(origBurnRate); HungerTuple simulation = HungerRevamped.Instance.SimulateHungerBar(calorieBurnRate, hours); UILabel calorieStoreLabel = panel.m_CurrentCaloriesValLabel.GetComponent <UILabel>(); int storedCalories = Mathf.RoundToInt(simulation.storedCalories); calorieStoreLabel.text = storedCalories.ToString(); UILabel hungerLabel = panel.m_EstimatedCaloriesBurnedLabel.GetComponent <UILabel>(); int hungerPercent = Mathf.RoundToInt(simulation.hungerRatio * 100f); hungerLabel.text = hungerPercent.ToString() + "%"; }
// Panel_IceFishing private static void UpdateIceFishingPanel(Panel_IceFishing panel) { int hours = panel.m_HoursToFish; float origBurnRate = GameManager.GetHungerComponent().m_CalorieBurnPerHourStanding; float calorieBurnRate = GameManager.GetPlayerManagerComponent().CalculateModifiedCalorieBurnRate(origBurnRate); HungerTuple simulation = HungerRevamped.Instance.SimulateHungerBar(calorieBurnRate, hours); UILabel calorieStoreLabel = panel.m_CurrentCaloriesLabel.GetComponent <UILabel>(); int storedCalories = Mathf.RoundToInt(simulation.storedCalories); calorieStoreLabel.text = Localization.Get("GAMEPLAY_CalorieStore") + ": " + storedCalories.ToString(); UILabel hungerLabel = panel.m_EstimatedCaloriesBurnedLabel.GetComponent <UILabel>(); int hungerPercent = Mathf.RoundToInt(simulation.hungerRatio * 100f); hungerLabel.text = Localization.Get("GAMEPLAY_Hunger") + ": " + hungerPercent.ToString() + "%"; }
// Panel_BreakDown private static void UpdateBreakDownPanel(Panel_BreakDown panel) { float hours = panel.m_DurationHours; float origBurnRate = GameManager.GetHungerComponent().m_CalorieBurnPerHourBreakingDown; float calorieBurnRate = GameManager.GetPlayerManagerComponent().CalculateModifiedCalorieBurnRate(origBurnRate); HungerTuple simulation = HungerRevamped.Instance.SimulateHungerBar(calorieBurnRate, hours); panel.m_CurrentCaloriesLabel.text = Localization.Get("GAMEPLAY_CalorieStore"); UILabel calorieStoreLabel = panel.m_CurrentCaloriesValLabel; int storedCalories = Mathf.RoundToInt(simulation.storedCalories); calorieStoreLabel.text = storedCalories.ToString(); calorieStoreLabel.UpdateAnchors(); UILabel hungerLabel = panel.m_EstimatedCaloriesBurnedLabel; int hungerPercent = Mathf.RoundToInt(simulation.hungerRatio * 100f); hungerLabel.text = hungerPercent.ToString() + "% " + Localization.Get("GAMEPLAY_Hunger"); }