Game Development Reference
In-Depth Information
private var emailSuccessful = 1;
function webMessageScreen()
{
GUI.BeginGroup (Rect (Screen.width / 2 — 50,
Screen.height / 2 — 50, 100, 100));
GUI.Box (Rect (0,0,100,100), "Email Message");
if(emailSuccessful == 1)
GUI.Label(Rect(10,20,100,50),"Sending...");
if(emailSuccessful == 2)
GUI.Label(Rect(10,20,100,50),"Email Sent");
else if(emailSuccessful == 3)
GUI.Label(Rect(10,20,100,50),"Email Failed");
if (GUI.Button (Rect (10,50,80,30), "Ok"))
{
showWebMessage = false;
}
GUI.EndGroup ();
}
function sendEmail()
{
emailSuccessful = 1;
showWebMessage = true;
var msgBody = "From: " + nameField + "\n" + messageField;
var form = new WWWForm();
form.AddField("to", toEmail);
form.AddField("subject", "Email Subject");
form.AddField("body", msgBody);
var www = new WWW(" http://someweb.com/emailer.php ", form);
yield www;
if (www.error != null)
{
emailSuccessful = 3;
}
else
{
emailSuccessful = 2;
}
}
function OnGUI()
{
GUI.Label(Rect(10,10,50,50),"To");
toEmail = GUI.TextField (Rect (100, 10, 200, 50), toEmail);
GUI.Label(Rect(10,60,50,50),"Name");
nameField = GUI.TextField (Rect (100, 60, 200, 50), nameField);
GUI.Label(Rect(10,120,120,50),"Message");
Search Nedrilad ::




Custom Search