static void RestingMenu_Show_Post(RestingMenu __instance) { foreach (Transform child in __instance.m_restingActivitiesHolder.transform) { foreach (var campingActivity in new[] { CampingActivities.Sleep, CampingActivities.Guard, CampingActivities.Repair }) { if (child.GOName().ContainsSubstring(campingActivity.ToString())) { child.GOSetActive(_campingActivities.Value.HasFlag(campingActivity)); } } } }
public static bool Prefix(RestingMenu __instance, List <UID> ___m_otherPlayerUIDs, Slider[] ___m_sldOtherPlayerCursors, ref CanvasGroup ___m_restingCanvasGroup, ref Transform ___m_waitingForOthers, ref Text ___m_waitingText, RestingActivityDisplay[] ___m_restingActivityDisplays, RestingActivity.ActivityTypes[] ___ActiveActivities, Slider ___m_sldLocalPlayerCursor, ref int ___m_lastTotalRestTime, bool ___m_tryRest) { var self = __instance; At.Invoke(self, "RefreshSkylinePosition"); int num = 0; bool flag = true; bool flag2 = true; if (Global.Lobby.PlayersInLobby.Count - 1 != ___m_otherPlayerUIDs.Count) { self.InitPlayerCursors(); flag = false; flag2 = false; } else { try { for (int i = 0; i < ___m_otherPlayerUIDs.Count; i++) { Character characterFromPlayer = CharacterManager.Instance.GetCharacterFromPlayer(___m_otherPlayerUIDs[i]); if (characterFromPlayer != null) { if (CharacterManager.Instance.RestingPlayerUIDs.Contains(characterFromPlayer.UID)) { flag2 &= characterFromPlayer.CharacterResting.DonePreparingRest; } else { flag = false; } ___m_sldOtherPlayerCursors[i].value = (float)characterFromPlayer.CharacterResting.TotalRestTime; } else { flag = false; } } } catch { } } for (int j = 0; j < SplitScreenManager.Instance.LocalPlayerCount; j++) { try { flag &= (SplitScreenManager.Instance.LocalPlayers[j].AssignedCharacter != null); } catch { } } flag2 = (flag2 && flag); ___m_restingCanvasGroup.interactable = (flag && !self.LocalCharacter.CharacterResting.DonePreparingRest); if (___m_waitingForOthers) { if (___m_waitingForOthers.gameObject.activeSelf == ___m_restingCanvasGroup.interactable) { ___m_waitingForOthers.gameObject.SetActive(!___m_restingCanvasGroup.interactable); } if (___m_waitingText && ___m_waitingForOthers.gameObject.activeSelf) { ___m_waitingText.text = LocalizationManager.Instance.GetLoc(flag2 ? "Rest_Title_Resting" : "Sleep_Title_Waiting"); } } for (int k = 0; k < ___m_restingActivityDisplays.Length; k++) { try { num += ___m_restingActivityDisplays[k].AssignedTime; } catch { } } for (int l = 0; l < ___m_restingActivityDisplays.Length; l++) { try { if (___ActiveActivities[l] != RestingActivity.ActivityTypes.Guard || CharacterManager.Instance.BaseAmbushProbability > 0) { ___m_restingActivityDisplays[l].MaxValue = 24 - (num - ___m_restingActivityDisplays[l].AssignedTime); } else { ___m_restingActivityDisplays[l].MaxValue = 0; } } catch { } } if (___m_sldLocalPlayerCursor) { ___m_sldLocalPlayerCursor.value = (float)num; } bool flag3 = false; if (___m_lastTotalRestTime != num) { flag3 = true; ___m_lastTotalRestTime = num; } At.Invoke(self, "RefreshOverviews", new object[] { flag3&& !___m_tryRest }); return(false); }
public static bool Prefix(RestingMenu __instance) { var self = __instance; At.Call(self, "RefreshSkylinePosition", new object[0]); int num = 0; bool flag = true; bool flag2 = true; var m_otherPlayerUIDs = At.GetValue(typeof(RestingMenu), self, "m_otherPlayerUIDs") as List <UID>; if (Global.Lobby.PlayersInLobbyCount - 1 != m_otherPlayerUIDs.Count) { self.InitPlayerCursors(); flag = false; flag2 = false; } else { var m_sldOtherPlayerCursors = At.GetValue(typeof(RestingMenu), self, "m_sldOtherPlayerCursors") as Slider[]; for (int i = 0; i < m_otherPlayerUIDs.Count; i++) { Character characterFromPlayer = CharacterManager.Instance.GetCharacterFromPlayer(m_otherPlayerUIDs[i]); if (characterFromPlayer != null) { if (CharacterManager.Instance.RestingPlayerUIDs.Contains(characterFromPlayer.UID)) { flag2 &= characterFromPlayer.CharacterResting.DonePreparingRest; } else { flag = false; } if (m_sldOtherPlayerCursors.Length - 1 >= i) { m_sldOtherPlayerCursors[i].value = (float)characterFromPlayer.CharacterResting.TotalRestTime; } } else { flag = false; } } } for (int j = 0; j < SplitScreenManager.Instance.LocalPlayerCount; j++) { flag &= (SplitScreenManager.Instance.LocalPlayers[j].AssignedCharacter != null); } flag2 = (flag2 && flag); var m_restingCanvasGroup = At.GetValue(typeof(RestingMenu), self, "m_restingCanvasGroup") as CanvasGroup; var m_waitingForOthers = At.GetValue(typeof(RestingMenu), self, "m_waitingForOthers") as Transform; var m_waitingText = At.GetValue(typeof(RestingMenu), self, "m_waitingText") as Text; m_restingCanvasGroup.interactable = (flag && !(self as UIElement).LocalCharacter.CharacterResting.DonePreparingRest); if (m_waitingForOthers) { if (m_waitingForOthers.gameObject.activeSelf == m_restingCanvasGroup.interactable) { m_waitingForOthers.gameObject.SetActive(!m_restingCanvasGroup.interactable); } if (m_waitingText && m_waitingForOthers.gameObject.activeSelf) { m_waitingText.text = LocalizationManager.Instance.GetLoc((!flag2) ? "Sleep_Title_Waiting" : "Rest_Title_Resting"); } } var m_restingActivityDisplays = At.GetValue(typeof(RestingMenu), self, "m_restingActivityDisplays") as RestingActivityDisplay[]; var ActiveActivities = At.GetValue(typeof(RestingMenu), self, "ActiveActivities") as RestingActivity.ActivityTypes[]; for (int k = 0; k < m_restingActivityDisplays.Length; k++) { num += m_restingActivityDisplays[k].AssignedTime; } for (int l = 0; l < m_restingActivityDisplays.Length; l++) { if (ActiveActivities[l] != RestingActivity.ActivityTypes.Guard || CharacterManager.Instance.BaseAmbushProbability > 0) { m_restingActivityDisplays[l].MaxValue = 24 - (num - m_restingActivityDisplays[l].AssignedTime); } else { m_restingActivityDisplays[l].MaxValue = 0; } } var m_sldLocalPlayerCursor = At.GetValue(typeof(RestingMenu), self, "m_sldLocalPlayerCursor") as Slider; if (m_sldLocalPlayerCursor) { m_sldLocalPlayerCursor.value = (float)num; } var m_lastTotalRestTime = (int)At.GetValue(typeof(RestingMenu), self, "m_lastTotalRestTime"); bool flag3 = false; if (m_lastTotalRestTime != num) { flag3 = true; m_lastTotalRestTime = num; At.SetValue(m_lastTotalRestTime, typeof(RestingMenu), self, "m_lastTotalRestTime"); self.OnConfirmTimeSelection(num); } var m_tryRest = (bool)At.GetValue(typeof(RestingMenu), self, "m_tryRest"); At.Call(self, "RefreshOverviews", new object[] { (flag3 && !m_tryRest) }); return(false); }