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.3 KiB
58 lines
2.3 KiB
using UnityEngine; |
|
using System.Collections; |
|
using UnityEngine.UI; |
|
|
|
public class MessageControl : MonoBehaviour |
|
{ |
|
|
|
private ShowMessageType type; |
|
public Text title; |
|
public Text details; |
|
public Image icon; |
|
public Sprite prompt; |
|
public Sprite error; |
|
public Sprite warning; |
|
// Use this for initialization |
|
void Start() |
|
{ |
|
|
|
} |
|
|
|
// Update is called once per frame |
|
void Update() |
|
{ |
|
|
|
} |
|
public ShowMessageType Type |
|
{ |
|
get |
|
{ |
|
return type; |
|
} |
|
set |
|
{ |
|
type = value; |
|
setIcon(type); |
|
} |
|
} |
|
private void setIcon(ShowMessageType Type) |
|
{ |
|
|
|
switch (type) |
|
{ |
|
case ShowMessageType.prompt: |
|
icon.sprite = prompt; |
|
break; |
|
case ShowMessageType.error: |
|
icon.sprite= error; |
|
break; |
|
case ShowMessageType.warning: |
|
icon.sprite = warning; |
|
break; |
|
} |
|
} |
|
public void destroyMessage() |
|
{ |
|
Destroy(this.gameObject); |
|
} |
|
}
|
|
|