Hello where is the error?
Error:
- All compiler errors have to be fixed before you can enter playmode!
- UnityEditor.SceneView:ShowCompileErrorNotification ()
code:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class MenuGlowne : MonoBehaviour {
public string obecneOkno = "";
Vector2 srodekEkranu;
string login = "";
string haslo = "";
string email = "";
void Start () {
srodekEkranu = new Vector2(Screen.width/2-100, Screen.height/2-15);
}
void Update()
{
if(input.getKey (KeyCode.Escape)){
obecneOkno = "login";
}
}
void OnGUI(){
switch (obecneOkno){
case "login":
PokazOknoLogowania();
break;
case "rejestracja":
PokazOknoRejestracji();
break;
case "menuGlowne":
break;
case "lobby":
break;
}
}
void PokazOknoLogowania(){
login = GUI.TextField (new Rect(srodekEkranu.x, srodekEkranu.y, 200, 30), login, 20, "box");
haslo = GUI.PasswordField (new Rect(srodekEkranu.x, srodekEkranu.y+35, 200, 30),haslo, '*', 20, "box");
if (GUI.Button (new Rect(srodekEkranu.x, srodekEkranu.y+75, 200, 30),"Zaloguj")){
GenerujLinkLoginu();
}
if (GUI.Button (new Rect(srodekEkranu.x, srodekEkranu.y+140, 200, 30),"Rejestracja")){
obecneOkno = "rejestracja";
}
}
void PokazOknoRejestracji(){
login = GUI.TextField (new Rect(srodekEkranu.x, srodekEkranu.y-70, 200, 30), login, 20, "box");
GUI.Label (new Rect(srodekEkranu.x-205, srodekEkranu.y-70, 100, 30),"Podaj login:");
email = GUI.TextField (new Rect(srodekEkranu.x, srodekEkranu.y-35, 200, 30), email, 100, "box");
GUI.Label (new Rect(srodekEkranu.x-205, srodekEkranu.y-35, 100, 30),"Podaj E-mail:");
haslo = GUI.PasswordField (new Rect(srodekEkranu.x, srodekEkranu.y+35, 200, 30),haslo, '*', 20, "box");
GUI.Label (new Rect(srodekEkranu.x-205, srodekEkranu.y+35, 100, 30),"Podaj Hasło:");
if (GUI.Button (new Rect(srodekEkranu.x, srodekEkranu.y+75, 200, 30),"Zarejestruj")){
GenerujLinkRejestracji();
}
}
void GenerujLinkLoginu(){
WWWForm w = new WWWForm();
w.AddField ("login",login);
w.AddField ("haslo",haslo);
WWW link = new WWW("http://localhost/unity/login.php", w);
StartCoroutine (Zaloguj (link));
}
IEnumerator Zaloguj(WWW link) {
yield return link;
Debug.Log (link.text);
}
void GenerujLinkRejestracji(){
WWWForm w = new WWWForm();
w.AddField ("login",login);
w.AddField ("haslo",haslo);
w.AddField ("email",email);
WWW link = new WWW("http://localhost/unity/register.php", w);
StartCoroutine (Zarejestruj (link));
}
IEnumerator Zarejestruj(WWW link){
yield return link;
Debug.Log (link.text);
}
}