using UnityEngine; using System.Collections; public class UISendGreetings : MonoBehaviour { public UIButton mail; public UIButton cancel; public UIButton open; public UIInput input; public UILabel label; public static bool Visible { get; private set; } // Use this for initialization void Start () { mail.onClick.Add(new EventDelegate(OnMail)); cancel.onClick.Add(new EventDelegate(OnCancel)); open.onClick.Add(new EventDelegate(OnOpen)); OnCancel(); } private void Update() { if (Visible) { input.transform.localScale = new Vector3(0.25f,0.25f,1); label.maxLineCount = 10; } } private void OnMail() { var subject = WWW.EscapeURL("Jólakveðja fyrir pakkaleikinn").Replace("+", "%20"); var email = "kringlan@kringlan.is"; var body = WWW.EscapeURL(input.value).Replace("+", "%20"); var url = "mailto:" + email + "?subject=" + subject + "&body=" + body; Debug.Log(url); Application.OpenURL(url); gameObject.SetActive(false); Visible = false; } private void OnCancel() { gameObject.SetActive(false); Visible = false; } private void OnOpen() { if (Visible) { OnCancel(); } else { gameObject.SetActive(true); Visible = true; } } }