大连中石油电子沙盘
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

66 lines
2.6 KiB

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using AX.MessageSystem;
public class TipWindowManager : MonoBehaviour {
public UnityAction OKFunction { get; set; }
public UnityAction NOFunction { get; set; }
/// <summary>
/// 不参与记录
/// </summary>
/// <param name="tips"></param>
/// <param name="OKFunction"></param>
/// <param name="NOFunction"></param>
public void SetWindow(string tips, UnityAction OKFunctions, UnityAction NOFunctions, UnityAction CloseFunctions)
{
//MessageDispatcher.SendMessage("SHOW_SCREEN_MASK", gameObject);
OKFunction = OKFunctions;
NOFunction = NOFunctions == null ? () => { DestroyWindow(); } : NOFunctions;
CloseFunctions = DestroyWindow;
transform.name = "TheTipWindow";
transform.SetParent(GameObject.Find("Canvas").transform);
if (transform.parent.GetComponent<CanvasScaler>().referenceResolution.x != 1920)
{
transform.localScale = new Vector3(0.6f, 0.6f, 1);
}
else
{
transform.localScale = new Vector3(1, 1, 1);
}
GetComponent<RectTransform>().anchoredPosition = new Vector2(0, 40);
transform.Find("Text").GetComponent<Text>().text = tips;
//transform.Find("sure").GetComponent<Button>().onClick.AddListener(DestroyWindow);
//transform.Find("close").GetComponent<Button>().onClick.AddListener(DestroyWindow);
}
public void SetWindow(string tips, UnityAction OKFunctions, UnityAction NOFunctions)
{
//MessageDispatcher.SendMessage("SHOW_SCREEN_MASK", gameObject);
OKFunction = OKFunctions;
NOFunction = NOFunctions == null ? () => { DestroyWindow(); } : NOFunctions;
transform.name = "TheTipWindow";
//transform.SetParent(GameObject.Find("Canvas").transform);
//if (transform.parent.GetComponent<CanvasScaler>().referenceResolution.x != 1920)
//{
// transform.localScale = new Vector3(0.6f, 0.6f, 1);
//}
//else
//{
// transform.localScale = new Vector3(1, 1, 1);
//}
//GetComponent<RectTransform>().anchoredPosition = new Vector2(0, 40);
transform.Find("Text").GetComponent<Text>().text = tips;
//transform.Find("sure").GetComponent<Button>().onClick.AddListener(DestroyWindow);
//transform.Find("close").GetComponent<Button>().onClick.AddListener(DestroyWindow);
}
public void DestroyWindow()
{
//MessageDispatcher.SendMessage("HIDE_SCREEN_MASK");
Destroy(gameObject);
}
}