12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- 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;
- 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;
- 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;
- }
- }
|