using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; public class UpdateTipWindowManager : MonoBehaviour { public UnityAction OKFunction { get; set; } public UnityAction NOFunction { get; set; } /// /// 不参与记录 /// /// /// /// public void SetWindow(string tips, UnityAction OKFunctions, UnityAction NOFunctions, UnityAction CloseFunctions) { OKFunction = OKFunctions; NOFunction = NOFunctions == null ? () => { DestroyWindow(); } : NOFunctions; CloseFunctions = DestroyWindow; transform.name = "UpdateTipWindow"; transform.SetParent(GameObject.Find("Canvas").transform); if (transform.parent.GetComponent().referenceResolution.x != 1920) { transform.localScale = new Vector3(0.6f, 0.6f, 1); } else { transform.localScale = new Vector3(1, 1, 1); } GetComponent().anchoredPosition = new Vector2(0, 40); transform.Find("Text").GetComponent().text = tips; } public void SetWindow(string tips, UnityAction OKFunctions, UnityAction NOFunctions) { OKFunction = OKFunctions; NOFunction = NOFunctions == null ? () => { DestroyWindow(); } : NOFunctions; transform.name = "UpdateTipWindow"; //transform.SetParent(GameObject.Find("Canvas").transform); //if (transform.parent.GetComponent().referenceResolution.x != 1920) //{ // transform.localScale = new Vector3(0.6f, 0.6f, 1); //} //else //{ // transform.localScale = new Vector3(1, 1, 1); //} //GetComponent().anchoredPosition = new Vector2(0, 40); transform.Find("Text").GetComponent().text = tips; } public void DestroyWindow() { Destroy(gameObject); } }