public void Start() { currState = EMstate.outsideTab; //currentActiveLP = "lore"; //switchPanel (currentActiveLP); currentActiveLP = "lore"; listPanelLore.SetActive(true); listPanelBios.SetActive(false); listPanelJournal.SetActive(false); buttonsScrollView.content = listPanelLore.GetComponent <RectTransform>(); //Limpa o texto e o titulo contentPanelScript.switchTextAsset(null); EventSys.SetSelectedGameObject(buttonLore); StartCoroutine(ButtonHighlightDelay(buttonLore)); }
public void Update() { //OUTSIDE================================================= if (currState == EMstate.outsideTab) { //NEXT TAB if ((Input.GetKeyDown(KeyCode.Joystick1Button5) || Input.GetAxisRaw("Joystick1Triggers") < 0) && TriggerInUse == false) { TriggerInUse = true; nextTab(); } //PREVIOUS TAB if ((Input.GetKeyDown(KeyCode.Joystick1Button4) || Input.GetAxisRaw("Joystick1Triggers") > 0) && TriggerInUse == false) { TriggerInUse = true; prevTab(); } if (Input.GetAxisRaw("Joystick1Triggers") == 0) { TriggerInUse = false; } //GO TO EXIT BUTTON if (Input.GetButtonDown("Joystick1Fire1")) { currState = EMstate.exiting; StartCoroutine(ButtonHighlightDelay(buttonBack)); } //Enter the tab if (Input.GetButtonDown("Joystick1Fire0")) { //Puts the scrollbar on the top buttonsScrollbar.value = 1; EMListPanelManager ListPanelScr = null; if (currentActiveLP == "lore") { ListPanelScr = listPanelLore.GetComponent <EMListPanelManager> (); } else if (currentActiveLP == "journal") { ListPanelScr = listPanelJournal.GetComponent <EMListPanelManager> (); } else if (currentActiveLP == "bios") { ListPanelScr = listPanelBios.GetComponent <EMListPanelManager> (); } StartCoroutine(ButtonHighlightDelay(ListPanelScr.getFirstActiveButton())); currState = EMstate.insideTab; } } //INSIDE A TAB================================================= else if (currState == EMstate.insideTab) { //Read Text if (Input.GetButtonDown("Joystick1Fire0")) { lastButton = EventSys.currentSelectedGameObject; currState = EMstate.readingText; //textScrollbar.value = 1; EventSys.SetSelectedGameObject(textScrollbar.gameObject); } //Exit the tab if (Input.GetButtonDown("Joystick1Fire1")) { currState = EMstate.outsideTab; highlightCurrentTab(); } //Controlls scrollbar if (Input.GetAxis("Joystick1Vertical") < 0) { StartCoroutine(ScrollDelay(buttonsScrollbar, false)); } if (Input.GetAxis("Joystick1Vertical") > 0) { StartCoroutine(ScrollDelay(buttonsScrollbar, true)); } } //READING TEXT===================================================== else if (currState == EMstate.readingText) { //Controlls scrollbar if (Input.GetAxis("Joystick1Vertical") < 0) { StartCoroutine(ScrollDelay(textScrollbar, false)); } if (Input.GetAxis("Joystick1Vertical") > 0) { StartCoroutine(ScrollDelay(textScrollbar, true)); } if (Input.GetButtonDown("Joystick1Fire1")) { currState = EMstate.insideTab; EventSys.SetSelectedGameObject(lastButton); } } //EXITING THE MENU================================================= else { if (Input.GetButtonDown("Joystick1Fire1") || Input.GetAxis("Joystick1Vertical") > 0) { currState = EMstate.outsideTab; highlightCurrentTab(); } } }