网上演练贵港万达广场(人员密集)
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.
 
 
 

47 lines
1.5 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class OnlyTextPromptWin : 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, -155);
transform.Find("Text").GetComponent<Text>().text = promptContent;
StartCoroutine(DestoryWindow(stayTime));
transform.SetSiblingIndex(transform.parent.childCount - 2);
}
public void SetNoButtonWindow(string promptContent, float stayTime)
{
transform.SetParent(GameObject.Find("Canvas").transform, false);
GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -400);
transform.Find("TipContent").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);
}
}