using TMPro; using UnityEngine; using UnityEngine.EventSystems; public class UICommands : MonoBehaviour { public ResolutionGridFiller gridFiller; public void ReverseUIState(GameObject targetObject) { targetObject.SetActive(!targetObject.activeSelf); } public void ReverseCanvasState(Canvas targetCanvas) { targetCanvas.enabled = !targetCanvas.enabled; } public void QuitGame() { Application.Quit(); } public void ResetRectTransformRotation(RectTransform targetRect) { Vector3 rectRotation; rectRotation.x = 0; rectRotation.y = 0; rectRotation.z = 0; targetRect.eulerAngles = rectRotation; } public void SetInputFieldDefaultText(TMP_InputField targetField) { //take the current text within the input field and set that as the text that appears by default string newDefault = targetField.textComponent.text; targetField.text = newDefault; } public void SetSelectedUIObject(GameObject targetObject) { EventSystem.current.SetSelectedGameObject(null); EventSystem.current.SetSelectedGameObject(targetObject); } public void SetSelectedUIObjectToResolutionsGridObject() { GameObject targetObject = gridFiller.GetGridObject(0); EventSystem.current.SetSelectedGameObject(null); EventSystem.current.SetSelectedGameObject(targetObject); } public void SetInteractionSurfaceState() { ObjectManager.SetInteractionSurfaceState(); } public void SetUsernameFieldInUse(bool state) { GUIManager.SetUsernameFieldUseState(state); } }