using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class QuickMenu : Singleton { [Serializable] public class ContentButtonsClass { public GameObject[] ContentButtons; } public bool isOn; public GameObject mainContainer; public Image[] Knob; public Text ContentNameText; public GameObject[] Content; public List ContentButtonsList = new List(); public Color knobOnColor; public Color knobOffColor; private int currentContentIndex; private int nextContentIndex; private void Start() { ShowContent(0); } private void Update() { if (((bool)FScriptsHandler.Instance.m_PlayerMain && (bool)FScriptsHandler.Instance.m_PlayerMain.underWaterCamera) || GameManager.Instance.ChechIfPlayerShouldBeStoppedFromDoingAnything()) { return; } if (GameManager.Instance.player.GetButtonDown("quickMenu") && !UnityEngine.Object.FindObjectOfType()) { if (isOn) { ShowHide(isHide: true); } else { ShowHide(); } } if ((InputManager.isBPressed || InputManager.isExit) && isOn) { ShowHide(isHide: true); } if (!isOn) { return; } if (GameManager.Instance.player.GetButtonDown("LB")) { int num = currentContentIndex - 1; if (num < 0) { num = Content.Length - 1; } ShowContent(num); PlayClickSound(); } else if (GameManager.Instance.player.GetButtonDown("RB")) { int num2 = currentContentIndex + 1; if (num2 == Content.Length) { num2 = 0; } ShowContent(num2); PlayClickSound(); } } public void ShowHide(bool isHide = false) { if (Time.timeScale != 0f || isHide) { if (!isHide) { isOn = true; } else { isOn = false; } mainContainer.SetActive(isOn); ShowContent(0); GameManager.Instance.PauseGame(); } } private void SwitchKnob() { for (int i = 0; i < Knob.Length; i++) { if (i == currentContentIndex) { Knob[i].color = knobOnColor; } else { Knob[i].color = knobOffColor; } } } private void ShowContent(int newIndex) { Content[currentContentIndex].SetActive(value: false); Content[newIndex].SetActive(value: true); currentContentIndex = newIndex; SwitchKnob(); if ((bool)TutorialManager.Instance) { switch (newIndex) { case 0: if (TutorialManager.Instance.acctualLessonIndex != 1) { ContentButtonsList[newIndex].ContentButtons[1].GetComponent