using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using FancyScrollView.FocusOn; using UnityEngine.Events; public class MouseButton : MonoBehaviour { [SerializeField] RectTransform targetRTF; [SerializeField] Graphic targetGraphic; [SerializeField] Color selectedColor = new Color(1, 1, 1, 0.6f); Vector3 _scale; Color _color; [SerializeField] public Button targetButton; [SerializeField] public GameObject cellObj; [SerializeField] UnityEvent OnStartEvent; [SerializeField] UnityEvent OnEndEvent; public void OnSelect() { if (targetGraphic) { _color = targetGraphic.color; targetGraphic.color = selectedColor; } if (targetRTF) { _scale = targetRTF.localScale; targetRTF.localScale = _scale * 1.15f; } if (targetButton) { targetButton.image.sprite = targetButton.spriteState.highlightedSprite; } if (cellObj) { cellObj.GetComponent().onCellClickedEvent(); } } public void OnExit() { if (targetGraphic) targetGraphic.color = _color; if (targetRTF) targetRTF.localScale = _scale; if (targetButton) { targetButton.image.sprite = targetButton.spriteState.disabledSprite; } //if (cellObj) //{ // cellObj.SetActive(false); //} } public void OnSendStart() { OnStartEvent.Invoke(); } public void OnSendEnd() { OnEndEvent.Invoke(); } }