using System; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; using XRTool.Util; public class ErrorManager : WindowSingleton { public Image iconBg; public RawImage icon; public TextMeshProUGUI TitleText; public TextMeshProUGUI MessageText; public TextMeshProUGUI actionText; public GameObject actionTextGO; public GameObject actionButtonGO; public GameObject BtGoAll; public TextMeshProUGUI bt0Text; public TextMeshProUGUI bt1Text; public TextMeshProUGUI bt2Text; public TextMeshProUGUI xunJianText; public GameObject xunJianExit; int timeDjs = 0; Action callback; List backList; public void show(string title,string Msg,Color iconBg,Texture icon, List backList, Action callback, bool isText = true, string djsMsg="", int time=5,string bt0Name="",string bt1Name="",string bt2Name="") { this.gameObject.SetActive(true); TitleText.text = title; MessageText.text = Msg; xunJianExit.gameObject.SetActive(false); if (title == "巡检项目已完成") { BtGoAll.SetActive(false); xunJianText.text = "(" + time + ")" + djsMsg; this.iconBg.color = iconBg; this.icon.texture = icon; this.backList = backList; this.callback = callback; if (isText) { xunJianText.gameObject.SetActive(true); actionButtonGO.gameObject.SetActive(false); timeDjs = time; TimerMgr.Instance.CreateTimer(() => { timeDjs--; if (timeDjs <= 0) { gotoBt(0); } xunJianText.text = "(" + timeDjs + ")" + djsMsg; }, 1, time); } else { actionTextGO.gameObject.SetActive(false); actionButtonGO.gameObject.SetActive(true); if (bt0Name != "") { bt0Text.text = bt0Name; bt0Text.transform.parent.gameObject.SetActive(true); bt1Text.transform.parent.gameObject.SetActive(false); bt2Text.transform.parent.gameObject.SetActive(false); } else { bt1Text.text = bt1Name; bt2Text.text = bt2Name; bt0Text.transform.parent.gameObject.SetActive(false); bt1Text.transform.parent.gameObject.SetActive(true); bt2Text.transform.parent.gameObject.SetActive(true); } } if (bt0Name == "" && bt1Name == "" && bt2Name == "") { xunJianExit.SetActive(false); } else { xunJianExit.SetActive(true); } } else { actionText.text = "(" + time + ")" + djsMsg; this.iconBg.color = iconBg; this.icon.texture = icon; this.backList = backList; this.callback = callback; if (isText) { actionTextGO.gameObject.SetActive(true); actionButtonGO.gameObject.SetActive(false); timeDjs = time; TimerMgr.Instance.CreateTimer(() => { timeDjs--; if (timeDjs <= 0) { gotoBt(0); } actionText.text = "(" + timeDjs + ")" + djsMsg; }, 1, time); } else { actionTextGO.gameObject.SetActive(false); actionButtonGO.gameObject.SetActive(true); if (bt0Name != "") { bt0Text.text = bt0Name; bt0Text.transform.parent.gameObject.SetActive(true); bt1Text.transform.parent.gameObject.SetActive(false); bt2Text.transform.parent.gameObject.SetActive(false); } else { bt1Text.text = bt1Name; bt2Text.text = bt2Name; bt0Text.transform.parent.gameObject.SetActive(false); bt1Text.transform.parent.gameObject.SetActive(true); bt2Text.transform.parent.gameObject.SetActive(true); } } if (bt0Name == "" && bt1Name == "" && bt2Name == "") { BtGoAll.SetActive(false); } else { BtGoAll.SetActive(true); } } } public void gotoBt(int i) { callback.Invoke(backList[i]); this.gameObject.SetActive(false); WindowsManager.Instance.isShowTip = false; } }