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.
68 lines
2.6 KiB
68 lines
2.6 KiB
4 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.Events;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class InputWindowManager : MonoBehaviour {
|
||
|
public UnityAction<string> 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<string> 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<string> 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);
|
||
|
}
|
||
|
}
|