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.
37 lines
793 B
37 lines
793 B
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public enum ShowMessageType
|
||
|
{
|
||
|
prompt,
|
||
|
error,
|
||
|
warning
|
||
|
}
|
||
|
public class MessageTool : MonoBehaviour
|
||
|
{
|
||
|
|
||
|
// Use this for initialization
|
||
|
public GameObject messagePrefab;
|
||
|
void Start()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
void Update()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
public GameObject showMessage(ShowMessageType type, string title, string details)
|
||
|
{
|
||
|
GameObject item = Instantiate(messagePrefab) as GameObject;
|
||
|
item.transform.parent = transform;
|
||
|
item.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, 0);
|
||
|
var message = item.GetComponent<MessageControl>();
|
||
|
message.title.text = title;
|
||
|
message.details.text = details;
|
||
|
message.Type = type;
|
||
|
return item;
|
||
|
}
|
||
|
}
|