123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using TMPro;
- using UnityEngine;
- using UnityEngine.UI;
- using XRTool.Util;
- public class ErrorManager : WindowSingleton<ErrorManager>
- {
- 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<string> callback;
- List<string> backList;
- public void show(string title,string Msg,Color iconBg,Texture icon, List<string> backList, Action<string> 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;
- }
- }
|