using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; public class searchPanel : MonoBehaviour, IPointerEnterHandler, IPointerDownHandler, IPointerExitHandler, IPointerUpHandler { [HideInInspector] public Manager manager; [HideInInspector] public static bool IsSearch = false; private Image[] img; void Start() { manager = GameObject.Find("Manager").GetComponent(); img = this.GetComponentsInChildren(); img[0].gameObject.SetActive(true); img[1].gameObject.SetActive(false); gameObject.GetComponentInChildren().color = (IsSearch) ? Color.green : Color.white; } public void OnPointerUp(PointerEventData eventData) { IsSearch = !IsSearch; gameObject.GetComponentInChildren().color = (IsSearch) ? Color.green : Color.white; //здесь нужен метод } public void OnPointerEnter(PointerEventData eventData) { img[0].gameObject.SetActive(false); img[1].gameObject.SetActive(true); gameObject.GetComponentInChildren().color = (IsSearch) ? Color.green : Color.white; /* if (manager.viewmode == 1) manager.ChangeLayerIgnore(); else if (manager.viewmode == 2) manager.ChangeLayerPassCabineIgnore();*/ manager.mouseEnterUI(); } public void OnPointerDown(PointerEventData eventData) { gameObject.GetComponentInChildren().color = Color.green; } public void OnPointerExit(PointerEventData eventData) { img[0].gameObject.SetActive(true); img[1].gameObject.SetActive(false); gameObject.GetComponentInChildren().color = (IsSearch) ? Color.green : Color.white; /* if (manager.viewmode == 1) manager.ChangeLayerDefault(); else if (manager.viewmode == 2) manager.ChangeLayerPassCabineIgnore();*/ manager.mouseExitUI(); } }