105 lines
3.2 KiB
C#
105 lines
3.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
public class SpUI : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
|
{
|
|
public Image my_image;
|
|
|
|
public Sprite wendu_normal;
|
|
public Sprite wendu_selected;
|
|
public Sprite shidu_normal;
|
|
public Sprite shidu_selected;
|
|
|
|
public Image expand_image;
|
|
|
|
public Sprite wendu_expand;
|
|
public Sprite shidu_expand;
|
|
|
|
public TextMeshProUGUI textMeshPro;
|
|
public Text text;
|
|
|
|
public Color hightC;
|
|
public Transform temperatureAndHumidity;
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
{
|
|
expand_image.gameObject.SetActive(true);
|
|
switch (TemperatureAndHumidity.current_state)
|
|
{
|
|
case "ζÈ":
|
|
my_image.sprite = wendu_selected;
|
|
expand_image.sprite = wendu_expand;
|
|
textMeshPro.text = transform.parent.parent.parent.GetComponent<ENVQuery>().eNVList_W.collectResult;
|
|
text.text = transform.parent.parent.parent.GetComponent<ENVQuery>().eNVList_W.collectResult;
|
|
break;
|
|
case "ʪ¶È":
|
|
my_image.sprite = shidu_selected;
|
|
expand_image.sprite = shidu_expand;
|
|
textMeshPro.text = transform.parent.parent.parent.GetComponent<ENVQuery>().eNVList_S.collectResult;
|
|
text.text = transform.parent.parent.parent.GetComponent<ENVQuery>().eNVList_S.collectResult;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
my_image.SetNativeSize();
|
|
}
|
|
|
|
public void OnPointerExit(PointerEventData eventData)
|
|
{
|
|
expand_image.gameObject.SetActive(false);
|
|
switch (TemperatureAndHumidity.current_state)
|
|
{
|
|
case "ζÈ":
|
|
my_image.sprite = wendu_normal;
|
|
break;
|
|
case "ʪ¶È":
|
|
my_image.sprite = shidu_normal;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
my_image.SetNativeSize();
|
|
}
|
|
|
|
public void ChangeWSD(string wsd)
|
|
{
|
|
if (gameObject.name == "Expand")
|
|
return;
|
|
string _a=null;
|
|
string _b=null;
|
|
switch (TemperatureAndHumidity.current_state)
|
|
{
|
|
case "ζÈ":
|
|
{
|
|
_a = temperatureAndHumidity.parent.GetComponent<ENVQuery>().eNVList_W.collectResult;
|
|
_b = GameManager.Inst.arguments.heatThresholdValue;
|
|
my_image.sprite = wendu_normal;
|
|
}
|
|
break;
|
|
case "ʪ¶È":
|
|
{
|
|
_a = temperatureAndHumidity.parent.GetComponent<ENVQuery>().eNVList_S.collectResult;
|
|
_b = GameManager.Inst.arguments.humidityThresholdValue;
|
|
my_image.sprite = shidu_normal;
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
var a = string.IsNullOrEmpty(_a) ? "0" : _a;
|
|
var b = string.IsNullOrEmpty(_b) ? "0" : _b;
|
|
if (float.Parse(a) > float.Parse(b))
|
|
my_image.color = hightC;
|
|
else
|
|
my_image.color = new Color(1, 1, 1, 1);
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|