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.
36 lines
1.0 KiB
36 lines
1.0 KiB
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using UnityEngine.UI; |
|
|
|
public class VictoryPromptWin : MonoBehaviour { |
|
|
|
// Use this for initialization |
|
void Start () { |
|
|
|
} |
|
|
|
// Update is called once per frame |
|
void Update () { |
|
|
|
} |
|
/// <summary> |
|
/// 设置纯文本提示窗 |
|
/// </summary> |
|
/// <param name="promptContent">提示内容</param> |
|
/// <param name="stayTime">提示窗停留时间</param> |
|
public void SetWindow(string promptContent, float stayTime) |
|
{ |
|
transform.SetParent(GameObject.Find("Canvas").transform, false); |
|
|
|
GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -200); |
|
transform.Find("Text").GetComponent<Text>().text = promptContent; |
|
StartCoroutine(DestoryWindow(stayTime)); |
|
transform.SetSiblingIndex(transform.parent.childCount - 2); |
|
} |
|
private IEnumerator DestoryWindow(float stayTime) |
|
{ |
|
yield return new WaitForSeconds(stayTime); |
|
Destroy(gameObject); |
|
} |
|
}
|
|
|