39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
// 电压趋势房间切换
|
|
public class VT_CutFloot : MonoBehaviour,IPointerClickHandler
|
|
{
|
|
public Sprite init; // 初始状态
|
|
public Sprite click; // 点击状态
|
|
|
|
public Image current; // 当前图片
|
|
public List<Image> Images; // 所有的图片
|
|
|
|
public GameObject target; // 目标对象
|
|
public string deviceId; // 设备ID
|
|
public string tagId1;
|
|
|
|
|
|
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);
|
|
|
|
VoltageTrend_Controller controller = target.GetComponent<VoltageTrend_Controller>();
|
|
target.SetActive(false);
|
|
controller.deviceId = deviceId;
|
|
controller.tagId1 = tagId1;
|
|
target.SetActive(true);
|
|
|
|
}
|
|
}
|