GQ_Communicate/GQ_TongXin/Assets/Scripts/WJ/TemperatureAndHumidity.cs

76 lines
1.5 KiB
C#

using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
public class TemperatureAndHumidity : CabinetUIBase
{
public static Transform Camera;
/// <summary>
/// 当前状态为温度还是湿度
/// </summary>
public static string current_state = "温度";
public SpUI sp_ui;
public Color hightC;
public Color hightM;
// Start is called before the first frame update
void Start()
{
Camera = UnityEngine.Camera.main.transform;
}
// Update is called once per frame
void Update()
{
transform.eulerAngles = Camera.eulerAngles;
}
[ContextMenu("温度")]
public void tw()
{
ChangeState("温度");
}
[ContextMenu("湿度")]
public void sw()
{
ChangeState("湿度");
}
public void ChangeState(string state)
{
current_state = state;
sp_ui.ChangeWSD(current_state);
}
public override void OnMenuChanged(Menu menu)
{
base.OnMenuChanged(menu);
if (menu == Menu.M_全景监控_温度)
{
gameObject.SetActive(true);
ChangeState("温度");
}
else if (menu == Menu.M_全景监控_湿度)
{
gameObject.SetActive(true);
ChangeState("湿度");
}
else if (menu == Menu.M_全景监控_烟感)
{
gameObject.SetActive(true);
ChangeState("烟感");
}
else
{
gameObject.SetActive(false);
}
}
}