using UnityEngine; using AX.DevelopEngine; using UnityEngine.Events; using UnityEngine.UI; public class ResourceLoadWindow : MonoSingleton { private ResourceLoadWindow() { } /// /// 加载文本提示框 /// /// 提示文本 /// 停留时间 public void LoadTextHintWindow(string hintText, float stayTime) { //如果前一个提示窗口还未关闭,提前销毁 if (GameObject.Find("HintTextWindow")) DestroyImmediate(GameObject.Find("HintTextWindow")); GameObject prefab = Instantiate(Resources.Load("UI/TextHintWindow"),GameObject.Find("Canvas").transform) as GameObject; prefab.GetComponent().SetWindow(hintText, stayTime); } /// /// 加载确认信息提示框 /// /// 提示文本 /// 确认调用的方法 /// 取消调用的方法 public void LoadTipWindow(string tips, UnityAction OKFunction, UnityAction NOFunction) { if (GameObject.Find("Canvas").transform.Find("TheTipWindow")) return; GameObject prefab = Instantiate(Resources.Load("UI/TipWindow"),GameObject.Find("Canvas").transform) as GameObject; prefab.GetComponent().SetWindow(tips, OKFunction, NOFunction); } /// /// 加载可以输入信息提示框 /// /// 提示文本 /// 确认调用的方法 /// 取消调用的方法 public void LoadInputWindow(string tips, UnityAction OKFunction, UnityAction NOFunction, string Intro) { if (GameObject.Find("Canvas").transform.Find("TheInputWindow")) return; GameObject prefab = Instantiate(Resources.Load("UI/TheInputWindow"), GameObject.Find("Canvas").transform) as GameObject; prefab.GetComponent().SetWindow(tips, OKFunction, NOFunction); prefab.name = "TheInputWindow"; prefab.transform.Find("InputField").GetComponent().text = Intro; } public GameObject LoadProgressWindow(string tips, float DurationTime, UnityAction CompleteFunction) { GameObject prefab = Instantiate(Resources.Load("UI/ProgressPanel")) as GameObject; prefab.GetComponent().SetWindow(tips, DurationTime, CompleteFunction); prefab.name = "ProgressPanel"; return prefab; } /// /// 加载确认信息提示框 /// /// 提示文本 /// 确认调用的方法 /// 取消调用的方法 public void LoadUpdateTipWindow(string tips, UnityAction OKFunction, UnityAction NOFunction) { if (GameObject.Find("Canvas").transform.Find("UpdateTipWindow")) return; GameObject prefab = Instantiate(Resources.Load("UI/UpdateTipWindow"), GameObject.Find("Canvas").transform) as GameObject; prefab.GetComponent().SetWindow(tips, OKFunction, NOFunction); } }