// Update is called once per frame void Update() { if (soundEffects == null) { soundEffects = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <SoundEffectsManager>(); } if (!WindowsCTRL.activeSelf) { if (Input.GetKeyDown(KeyCode.UpArrow) && lookAt > 0) { if (soundEffects != null) { soundEffects.playPositiveSound(); } --lookAt; GetComponent <RectTransform>().anchoredPosition = stuff[lookAt].GetComponent <RectTransform>().anchoredPosition; } else if (Input.GetKeyDown(KeyCode.DownArrow) && lookAt < (stuff.Length - 1)) { if (soundEffects != null) { soundEffects.playPositiveSound(); } ++lookAt; GetComponent <RectTransform>().anchoredPosition = stuff[lookAt].GetComponent <RectTransform>().anchoredPosition; } if (Input.GetKeyDown(KeyCode.Return)) { if (soundEffects != null) { soundEffects.playPositiveSound(); } switch (lookAt) { case 0: { WindowsCTRL.SetActive(!WindowsCTRL.activeSelf); break; } case 1: { //some other things SoundCTRL.SetActive(!SoundCTRL.activeSelf); break; } } } } }
public void turnOnInGamePauseMenu() { if (SceneManager.GetActiveScene().buildIndex > 1) { //activate the child canvas //OptionsCanvas.gameObject.SetActive(!OptionsCanvas.gameObject.activeSelf); //InGamePauseCanvas.SetActive(!InGamePauseCanvas.activeSelf); switch (isOpeningInPause) { case true: // If the player happens to be openning in game pause menu, turn it off! if (soundEffects != null) { soundEffects.playNegativeSound(); } InGamePauseCanvas.SetActive(false); isOpeningInPause = false; talking = false; break; default: // If the player is not talking, then player can access the in game pause menu if (!talking) { if (soundEffects != null) { soundEffects.playPositiveSound(); } InGamePauseCanvas.SetActive(true); isOpeningInPause = true; } break; } } }
// Update is called once per frame void Update() { if (soundEffects == null) { soundEffects = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <SoundEffectsManager>(); } // navigation if (Input.GetKeyDown(KeyCode.UpArrow) && lookAt > 0) { if (soundEffects != null) { soundEffects.playPositiveSound(); } --lookAt; GetComponent <RectTransform>().anchoredPosition = stuff[lookAt].GetComponent <RectTransform>().anchoredPosition; } else if (Input.GetKeyDown(KeyCode.DownArrow) && lookAt < (stuff.Length - 1)) { if (soundEffects != null) { soundEffects.playPositiveSound(); } ++lookAt; GetComponent <RectTransform>().anchoredPosition = stuff[lookAt].GetComponent <RectTransform>().anchoredPosition; } //press enter if (Input.GetKeyDown(KeyCode.Return)) { if (soundEffects != null) { soundEffects.playPositiveSound(); } for (int i = 0; i < stuff.Length; i++) { if (i == lookAt) { stuff[i].GetComponent <LoadGameScript>().BroadcastMessage("beginLoadingData"); break; } } } }
// Update is called once per frame void Update() { if (soundEffects == null) { soundEffects = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <SoundEffectsManager>(); } //we'll just hardcode the fixed text, everytime. children[0].transform.GetChild(0).GetComponent <Text>().text = KeyBindScript.upKey.ToString(); children[1].transform.GetChild(0).GetComponent <Text>().text = KeyBindScript.downKey.ToString(); children[2].transform.GetChild(0).GetComponent <Text>().text = KeyBindScript.leftKey.ToString(); children[3].transform.GetChild(0).GetComponent <Text>().text = KeyBindScript.rightKey.ToString(); children[4].transform.GetChild(0).GetComponent <Text>().text = KeyBindScript.attackKey.ToString(); children[5].transform.GetChild(0).GetComponent <Text>().text = KeyBindScript.rangeKey.ToString(); children[6].transform.GetChild(0).GetComponent <Text>().text = KeyBindScript.inventoryKey.ToString(); //we handle the input from here. if (Input.GetKeyDown(KeyCode.Return)) { //we need to create a interface to activate some helper text helperText.SetActive(!helperText.activeSelf); // invert the activetext state; if (soundEffects != null) { soundEffects.playPositiveSound(); } //allow for modification if the helpertext is active } else if (Input.GetKeyDown(KeyCode.Escape) && !helperText.activeSelf) { //SAVE HERE. Hardcoding unfortunately but the fastest way to save keybinds int zeUpKeyValue = (int)KeyBindScript.upKey; int zeDownKeyValue = (int)KeyBindScript.downKey; int zeRightKeyValue = (int)KeyBindScript.rightKey; int zeLeftKeyValue = (int)KeyBindScript.leftKey; int zeAttackKeyValue = (int)KeyBindScript.attackKey; int zeRangeKeyValue = (int)KeyBindScript.rangeKey; int zeInventoryKeyValue = (int)KeyBindScript.inventoryKey; MySQLiteHandler.instance.saveSpecificResult(KeyBindScript.theSQLiteTable, KeyBindScript.upKeyField, zeUpKeyValue.ToString()); MySQLiteHandler.instance.saveSpecificResult(KeyBindScript.theSQLiteTable, KeyBindScript.downKeyField, zeDownKeyValue.ToString()); MySQLiteHandler.instance.saveSpecificResult(KeyBindScript.theSQLiteTable, KeyBindScript.rightKeyField, zeRightKeyValue.ToString()); MySQLiteHandler.instance.saveSpecificResult(KeyBindScript.theSQLiteTable, KeyBindScript.leftKeyField, zeLeftKeyValue.ToString()); MySQLiteHandler.instance.saveSpecificResult(KeyBindScript.theSQLiteTable, KeyBindScript.attackKeyField, zeAttackKeyValue.ToString()); MySQLiteHandler.instance.saveSpecificResult(KeyBindScript.theSQLiteTable, KeyBindScript.rangeKeyField, zeRangeKeyValue.ToString()); MySQLiteHandler.instance.saveSpecificResult(KeyBindScript.theSQLiteTable, KeyBindScript.inventoryKeyField, zeInventoryKeyValue.ToString()); if (soundEffects != null) { soundEffects.playNegativeSound(); } //only allow the thing to be closed if not editing a keybind transform.parent.gameObject.SetActive(false); } if (helperText.activeSelf) { helperText.GetComponent <RectTransform>().anchoredPosition = new Vector2(startingX, children[pointingAt].GetComponent <RectTransform>().anchoredPosition.y); children[pointingAt].transform.GetChild(0).GetComponent <Text>().text = ""; //handle the input here if (temp == KeyCode.None) { temp = FetchKey(); } } if (temp != KeyCode.None && helperText.activeSelf) { switch (pointingAt) { case 0: { KeyBindScript.upKey = temp; for (int i = 0; i < allKeys.Length; i++) { if (i != pointingAt) { if (KeyBindScript.downKey == temp) { KeyBindScript.downKey = KeyCode.None; break; } else if (KeyBindScript.leftKey == temp) { KeyBindScript.leftKey = KeyCode.None; break; } else if (KeyBindScript.rightKey == temp) { KeyBindScript.rightKey = KeyCode.None; break; } else if (KeyBindScript.attackKey == temp) { KeyBindScript.attackKey = KeyCode.None; break; } else if (KeyBindScript.rangeKey == temp) { KeyBindScript.rangeKey = KeyCode.None; break; } else if (KeyBindScript.inventoryKey == temp) { KeyBindScript.inventoryKey = KeyCode.None; break; } } } temp = KeyCode.None; helperText.SetActive(!helperText.activeSelf); break; } case 1: { KeyBindScript.downKey = temp; for (int i = 0; i < allKeys.Length; i++) { if (i != pointingAt) { if (KeyBindScript.upKey == temp) { KeyBindScript.upKey = KeyCode.None; break; } else if (KeyBindScript.leftKey == temp) { KeyBindScript.leftKey = KeyCode.None; break; } else if (KeyBindScript.rightKey == temp) { KeyBindScript.rightKey = KeyCode.None; break; } else if (KeyBindScript.attackKey == temp) { KeyBindScript.attackKey = KeyCode.None; break; } else if (KeyBindScript.rangeKey == temp) { KeyBindScript.rangeKey = KeyCode.None; break; } else if (KeyBindScript.inventoryKey == temp) { KeyBindScript.inventoryKey = KeyCode.None; break; } } } temp = KeyCode.None; helperText.SetActive(!helperText.activeSelf); break; } case 2: { KeyBindScript.leftKey = temp; for (int i = 0; i < allKeys.Length; i++) { if (i != pointingAt) { if (KeyBindScript.upKey == temp) { KeyBindScript.upKey = KeyCode.None; break; } else if (KeyBindScript.downKey == temp) { KeyBindScript.downKey = KeyCode.None; break; } else if (KeyBindScript.rightKey == temp) { KeyBindScript.rightKey = KeyCode.None; break; } else if (KeyBindScript.attackKey == temp) { KeyBindScript.attackKey = KeyCode.None; break; } else if (KeyBindScript.rangeKey == temp) { KeyBindScript.rangeKey = KeyCode.None; break; } else if (KeyBindScript.inventoryKey == temp) { KeyBindScript.inventoryKey = KeyCode.None; break; } } } temp = KeyCode.None; helperText.SetActive(!helperText.activeSelf); break; } case 3: { KeyBindScript.rightKey = temp; for (int i = 0; i < allKeys.Length; i++) { if (i != pointingAt) { if (KeyBindScript.upKey == temp) { KeyBindScript.upKey = KeyCode.None; break; } else if (KeyBindScript.downKey == temp) { KeyBindScript.downKey = KeyCode.None; break; } else if (KeyBindScript.leftKey == temp) { KeyBindScript.leftKey = KeyCode.None; break; } else if (KeyBindScript.attackKey == temp) { KeyBindScript.attackKey = KeyCode.None; break; } else if (KeyBindScript.rangeKey == temp) { KeyBindScript.rangeKey = KeyCode.None; break; } else if (KeyBindScript.inventoryKey == temp) { KeyBindScript.inventoryKey = KeyCode.None; break; } } } temp = KeyCode.None; helperText.SetActive(!helperText.activeSelf); break; } case 4: { KeyBindScript.attackKey = temp; for (int i = 0; i < allKeys.Length; i++) { if (i != pointingAt) { if (KeyBindScript.upKey == temp) { KeyBindScript.upKey = KeyCode.None; break; } else if (KeyBindScript.downKey == temp) { KeyBindScript.downKey = KeyCode.None; break; } else if (KeyBindScript.leftKey == temp) { KeyBindScript.leftKey = KeyCode.None; break; } else if (KeyBindScript.rightKey == temp) { KeyBindScript.rightKey = KeyCode.None; break; } else if (KeyBindScript.rangeKey == temp) { KeyBindScript.rangeKey = KeyCode.None; break; } else if (KeyBindScript.inventoryKey == temp) { KeyBindScript.inventoryKey = KeyCode.None; break; } } } temp = KeyCode.None; helperText.SetActive(!helperText.activeSelf); break; } case 5: { KeyBindScript.rangeKey = temp; for (int i = 0; i < allKeys.Length; i++) { if (i != pointingAt) { if (KeyBindScript.upKey == temp) { KeyBindScript.upKey = KeyCode.None; break; } else if (KeyBindScript.downKey == temp) { KeyBindScript.downKey = KeyCode.None; break; } else if (KeyBindScript.leftKey == temp) { KeyBindScript.leftKey = KeyCode.None; break; } else if (KeyBindScript.rightKey == temp) { KeyBindScript.rightKey = KeyCode.None; break; } else if (KeyBindScript.attackKey == temp) { KeyBindScript.attackKey = KeyCode.None; break; } else if (KeyBindScript.inventoryKey == temp) { KeyBindScript.inventoryKey = KeyCode.None; break; } } } temp = KeyCode.None; helperText.SetActive(!helperText.activeSelf); break; } case 6: { KeyBindScript.inventoryKey = temp; for (int i = 0; i < allKeys.Length; i++) { if (i != pointingAt) { if (KeyBindScript.upKey == temp) { KeyBindScript.upKey = KeyCode.None; break; } else if (KeyBindScript.downKey == temp) { KeyBindScript.downKey = KeyCode.None; break; } else if (KeyBindScript.leftKey == temp) { KeyBindScript.leftKey = KeyCode.None; break; } else if (KeyBindScript.rightKey == temp) { KeyBindScript.rightKey = KeyCode.None; break; } else if (KeyBindScript.attackKey == temp) { KeyBindScript.attackKey = KeyCode.None; break; } else if (KeyBindScript.rangeKey == temp) { KeyBindScript.rangeKey = KeyCode.None; break; } } } temp = KeyCode.None; helperText.SetActive(!helperText.activeSelf); break; } } } else //allow navigation if not waiting { if (Input.GetKeyDown(KeyCode.UpArrow) && pointingAt > 0) { if (soundEffects != null) { soundEffects.playPositiveSound(); } --pointingAt; GetComponent <RectTransform>().anchoredPosition = new Vector2(0, children[pointingAt].GetComponent <RectTransform>().anchoredPosition.y); } else if (Input.GetKeyDown(KeyCode.DownArrow) && pointingAt < (children.Length - 1)) { if (soundEffects != null) { soundEffects.playPositiveSound(); } ++pointingAt; GetComponent <RectTransform>().anchoredPosition = new Vector2(0, children[pointingAt].GetComponent <RectTransform>().anchoredPosition.y); } } }
// Update is called once per frame void Update() { if (soundEffects == null) { soundEffects = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <SoundEffectsManager>(); } if (OptionCanvas == null) { OptionCanvas = LocalDataSingleton.instance.transform.GetChild(0).gameObject; } if (!PlayCanvas.activeSelf && !OptionCanvas.activeSelf) { if (Input.GetKeyDown(KeyCode.UpArrow) && lookAt > 0) { if (soundEffects != null) { soundEffects.playPositiveSound(); } --lookAt; GetComponent <RectTransform>().anchoredPosition = stuff[lookAt].GetComponent <RectTransform>().anchoredPosition; } else if (Input.GetKeyDown(KeyCode.DownArrow) && lookAt < (stuff.Length - 1)) { if (soundEffects != null) { soundEffects.playPositiveSound(); } ++lookAt; GetComponent <RectTransform>().anchoredPosition = stuff[lookAt].GetComponent <RectTransform>().anchoredPosition; } if (Input.GetKeyDown(KeyCode.Return)) { if (soundEffects != null) { soundEffects.playPositiveSound(); } switch (lookAt) { case 0: { //play PlayCanvas.SetActive(!PlayCanvas.activeSelf); break; } case 1: { //some other things OptionCanvas.SetActive(!OptionCanvas.activeSelf); break; } case 2: { #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #else Application.Quit(); #endif break; } } } } }
// Update is called once per frame void Update() { if (soundEffects == null) { soundEffects = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <SoundEffectsManager>(); } if (m_disableUpdate) { return; } // In the mean time, we need to make sure the player can't even move for sure! switch (LocalDataSingleton.instance.talking) { case false: // If the player can still move, just force it to stop! LocalDataSingleton.instance.talking = true; break; default: break; } #if UNITY_ANDROID if (thePlayerJoystick.movingInYDirection == 1) { if (soundEffects != null) { soundEffects.playPositiveSound(); } UpdateUI((short)(whichButtonIsAt - 1)); } else if (thePlayerJoystick.movingInYDirection == -1) { if (soundEffects != null) { soundEffects.playPositiveSound(); } UpdateUI((short)(whichButtonIsAt + 1)); } #else if (Input.GetKeyDown(KeyBindScript.upKey)) { UpdateUI((short)(whichButtonIsAt - 1)); if (soundEffects != null) { soundEffects.playPositiveSound(); } } if (Input.GetKeyDown(KeyBindScript.downKey)) { UpdateUI((short)(whichButtonIsAt + 1)); if (soundEffects != null) { soundEffects.playPositiveSound(); } } if (Input.GetKeyDown(KeyBindScript.attackKey) || Input.GetKeyDown(KeyCode.Return)) { PauseButtonScript zePauseButton; // if can find the pause button, then execute that button if (allThePauseButtons.TryGetValue(whichButtonIsAt, out zePauseButton)) { zePauseButton.executeButton(); if (soundEffects != null) { soundEffects.playPositiveSound(); } } } if (Input.GetKeyDown(KeyCode.Escape)) { m_InGamePauseCanvas.SetActive(false); } #endif }