using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; // 温湿度切换房间 public class HT_CutFloot : MonoBehaviour,IPointerClickHandler { public Sprite init; // 初始状态 public Sprite click; // 点击状态 public Image current; // 当前图片 public List Images; // 所有的图片 public GameObject target; // 目标对象 public string deviceId; // 设备ID public string tagId1; public string tagId2; public void OnPointerClick(PointerEventData eventData) { foreach (Image image in Images) { image.sprite = init; image.rectTransform.sizeDelta = new Vector2(init.rect.width,init.rect.height); } current.sprite = click; current.rectTransform.sizeDelta = new Vector2(click.rect.width,click.rect.height); HumitureTrend_Controller controller = target.GetComponent(); target.SetActive(false); controller.deviceId = deviceId; controller.tagId1 = tagId1; controller.tagId2 = tagId2; target.SetActive(true); } }