[JavaScript] 纯文本查看 复制代码#pragma strict
var rect:Rect;
var myguiskin:GUISkin;
var text1:String="";
var answer:String="流";
var jieguo:boolean=false;
var panduan:String;
function Start () {
rect=Rect(100,50,800,500);
}
function OnGUI ()
{
GUI.skin=myguiskin;
rect=GUI.Window(10,rect,Tt,"填空自动判断对错测试");
}
function Tt()
{
GUILayout.BeginHorizontal();
GUILayout.Label("白日依山尽,黄河入海");
text1=GUILayout.TextField(text1,50);
GUILayout.EndHorizontal();
GUILayout.Label("答案:"+answer);
GUILayout.Label(panduan);
if(text1 != null && answer !=null)
{
if(text1.Equals(answer))
{
jieguo=true;
panduan="true";
GUILayout.Label("结果:对");
}else{
jieguo=false;
panduan="false";
GUILayout.Label("结果:错");
}
}else if(text1 == null && answer!=null)
{
jieguo=false;
panduan="false";
GUILayout.Label("结果:错");
}//else{
// jieguo=false;
// panduan="false";
// GUILayout.Label("结果:错");
// }
GUI.DragWindow( Rect(0,0,1000,1000));
}