using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; using UnityEngine.UI; public class TemperatureAndHumidity : CabinetUIBase { public static Transform Camera; /// /// 当前状态为温度还是湿度 /// public static string current_state = "温度"; public SpUI sp_ui; public Color hightC; // 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 { gameObject.SetActive(false); } } }