// private EventTrigger asd; // private void OnEnable() { // eventSystem = EventSystem.current; //// originalOption = eventSystem.firstSelectedGameObject; //// origTextPos = originalOption.GetComponentInChildren<TextMeshProUGUI>().transform.position; ////// OnCurrentEventObjectChange. //// Debug.LogFormat("\t\torig SET {0}", originalOption); // } // // private void Update() { //// Debug.LogFormat("orig:\t\t\t{0}", originalOption.name); // Debug.LogFormat("currentSelectedGameObject:\t{0}", eventSystem.currentSelectedGameObject); //// Debug.LogFormat("equal?:\t{0}", eventSystem.currentSelectedGameObject == originalOption); //// if (eventSystem.currentSelectedGameObject != originalOption && OnCurrentEventObjectChange != null) { //// GameObject newObj = eventSystem.currentSelectedGameObject; //// originalOption = newObj; //// OnCurrentEventObjectChange(newObj); //// Debug.LogFormat("\t\tChanging option to {0}", newObj.name); //// } // } // // public void CurrentObjectChange() { // Debug.LogFormat("\t\tChanging option to {0}", eventSystem.currentSelectedGameObject); //// if (eventSystem.currentSelectedGameObject != originalOption) { //// GameObject newObj = eventSystem.currentSelectedGameObject; //// originalOption = newObj; //// Debug.LogFormat("\t\tChanging option to {0}", newObj.name); //// } // } // public override void OnUpdateSelected(BaseEventData eventData) { // Debug.Log("Updating selected..."); // } // public override void OnMove(AxisEventData data) { // Debug.Log("OnMove called."); // } // // public override void OnSelect(BaseEventData data) // { // Debug.Log("OnSelect called."); // } // // public override void OnSubmit(BaseEventData data) // { // Debug.Log("OnSubmit called."); // } private void Awake() { button = GetComponent <TmpButton>(); // text = GetComponentInChildren<TextMeshProUGUI>(); // origTextPos = text.transform.position; // Debug.LogFormat("Text pos : {0}", origTextPos); }
/*************************** * * * Main Action Menu Options * * ***************************/ /// <summary> /// /// </summary> public void ChooseBasicAttack() { if (_attackMenu == null) { _attackMenu = Instantiate(attackMenuPrefab, BattleManager.battleCanvas.transform, false); } // Debug.LogFormat("Chose basic attack"); previousOptions.Push(eventSystem.currentSelectedGameObject); // Add attack action to previous options SpriteButton button = eventSystem.currentSelectedGameObject.GetComponent <SpriteButton>(); // Debug.LogFormat("enqueing {0}", previousOptions.Peek()); SetButtonsInteractable(_mainActionMenu, false); SetMenuActive(_attackMenu, true); SetButtonsInteractable(_attackMenu, true); eventSystem.SetSelectedGameObject(_attackMenu.transform.GetChild(0).gameObject); button.SpriteRenderer.sprite = button.spriteState.highlightedSprite; // Show the highlighted sprite of the button TmpButton tmpButton = eventSystem.currentSelectedGameObject.GetComponent <TmpButton>(); tmpButton.SpriteRenderer.sprite = tmpButton.spriteState.highlightedSprite; // Debug.Log("current attack " + tmpButton.name); }