91 lines
2.1 KiB
C#
91 lines
2.1 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_全景监控_温度)
|
|
{
|
|
sp_ui.expand_image.gameObject.SetActive(false);
|
|
sp_ui.isNormal = true;
|
|
gameObject.SetActive(true);
|
|
ChangeState("温度");
|
|
}
|
|
else if (menu == Menu.M_全景监控_湿度)
|
|
{
|
|
sp_ui.expand_image.gameObject.SetActive(false);
|
|
sp_ui.isNormal = true;
|
|
gameObject.SetActive(true);
|
|
ChangeState("湿度");
|
|
}
|
|
else if (menu == Menu.M_全景监控_烟感)
|
|
{
|
|
sp_ui.expand_image.gameObject.SetActive(false);
|
|
sp_ui.isNormal = true;
|
|
gameObject.SetActive(true);
|
|
ChangeState("烟感");
|
|
}
|
|
else if (menu == Menu.M_全景监控_水浸)
|
|
{
|
|
sp_ui.expand_image.gameObject.SetActive(false);
|
|
sp_ui.isNormal = true;
|
|
gameObject.SetActive(true);
|
|
ChangeState("水浸");
|
|
}
|
|
else
|
|
{
|
|
gameObject.SetActive(false);
|
|
sp_ui.expand_image.gameObject.SetActive(false);
|
|
sp_ui.isNormal = true;
|
|
}
|
|
}
|
|
|
|
|
|
}
|