using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Exceptionhandling : MonoBehaviour { /// /// 重启按钮 /// public Button Restarbt; /// /// 异常按钮 /// public GameObject ErrorBt; void Start() { Restarbt.onClick.AddListener(() => { ErrorBt.SetActive(false); StartCoroutine(RestarLight()); }); } /// /// 异常处理 /// public void Exception() { ControlLight.Instance.redlight1.GetComponent().material.DisableKeyword("_EMISSION"); ControlLight.Instance.yellowlight1.GetComponent().material.EnableKeyword("_EMISSION"); ControlLight.Instance.LightNumber1.text = "0F"; ControlLight.Instance.redlight2.GetComponent().material.DisableKeyword("_EMISSION"); ControlLight.Instance.yellowlight2.GetComponent().material.EnableKeyword("_EMISSION"); ControlLight.Instance.LightNumber2.text = "0F"; } IEnumerator RestarLight() { ImageTips.instance.TipPanel.SetActive(true); ImageTips.instance.Tips.color = Color.red; ImageTips.instance.Tips.text = "设备正在重启."; yield return new WaitForSeconds(0.2f); ImageTips.instance.Tips.text = "设备正在重启.."; yield return new WaitForSeconds(0.2f); ImageTips.instance.Tips.text = "设备正在重启..."; yield return new WaitForSeconds(3f); ImageTips.instance.Tips.color = Color.green; ImageTips.instance.Tips.text = "设备重启完成"; yield return new WaitForSeconds(2); ImageTips.instance.TipPanel.SetActive(false); ControlLight.Instance.greenlight1.GetComponent().material.EnableKeyword("_EMISSION"); ControlLight.Instance.yellowlight1.GetComponent().material.DisableKeyword("_EMISSION"); ControlLight.Instance.LightNumber1.text = "99"; ControlLight.Instance.LightNumber1.color=Color.green; ControlLight.Instance.LightBox1.SetActive(false); ControlLight.Instance.greenlight2.GetComponent().material.EnableKeyword("_EMISSION"); ControlLight.Instance.yellowlight2.GetComponent().material.DisableKeyword("_EMISSION"); ControlLight.Instance.LightNumber2.text = "99"; ControlLight.Instance.LightNumber2.color = Color.green; ControlLight.Instance.LightBox2.SetActive(false); } }