Quantcast
Channel: Latest Questions by IWannaTaco
Viewing all articles
Browse latest Browse all 7

Need help converting javascript to c# script

$
0
0
I got this javascript code i need to convert it to c# and i'm having some troubles. I've tried many things and it just won't convert and work. Here is the code JavaScript Code: #pragma strict private var formNick = ""; private var formPassword = ""; var formText = ""; var URL = "http://gameserver.com/login.php"; //Not actual site var hash = "hashcode"; private var textrect = Rect (10, 150, 500, 100); function OnGUI() { GUI.Label( Rect (10, 10, 80, 20), "Your Nick:" ); GUI.Label( Rect (10, 30, 80, 20), "Your Pass:" ); formNick = GUI.TextField ( Rect (90, 10, 100, 20), formNick ); formPassword = GUI.TextField ( Rect (90, 30, 100, 20), formPassword ); if ( GUI.Button ( Rect (110, 60, 100, 20) , "Register" ) ) { Register(); } if ( GUI.Button ( Rect (10, 60, 100, 20) , "Login" ) ){ Login(); } GUI.TextArea( textrect, formText ); } function Register() { Application.LoadLevel("Menu_Register"); } function Login() { var form = new WWWForm(); form.AddField( "myform_hash", hash ); form.AddField( "myform_nick", formNick ); form.AddField( "myform_pass", formPassword ); var w = WWW(URL, form); yield w; if (w.error != null) { print(w.error); } else { print("Test ok"); formText = w.data; if (formText.Contains("Logged In Successful, Redirecting now...")) { Application.LoadLevel("Menu_Lobby"); // PhotonNetwork.playerName = formNick; } w.Dispose(); } }

Viewing all articles
Browse latest Browse all 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>