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.
58 lines
2.1 KiB
58 lines
2.1 KiB
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; } |
|
|
|
/// <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) |
|
{ |
|
OKFunction = OKFunctions; |
|
NOFunction = NOFunctions == null ? () => { DestroyWindow(); } : NOFunctions; |
|
CloseFunctions = DestroyWindow; |
|
|
|
transform.name = "UpdateTipWindow"; |
|
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; |
|
} |
|
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<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; |
|
} |
|
public void DestroyWindow() |
|
{ |
|
Destroy(gameObject); |
|
} |
|
}
|
|
|