Hello ! I have a problem with GUILayout. No console errors but the window not work correctly.
public string inputUser;
public string inputPass;
private bool iWantToRegister = false;
private bool iWantToLogin = false;
// Variabili Supplementari
private string titleMessage = "My Game v.0.1";
private Rect connectionWindowRect;
private int connectionWindowWidth = 400;
private int connectionWindowHeight = 280;
private int btnHeightCntWindow = 60;
private int leftIndent;
private int topIndent;
void ConnectWindow(int windowID)
{
GUILayout.Space(15);
if (iWantToLogin == false
iWantToRegister == false)
{
if (GUILayout.Button("ACCESSO", GUILayout.Height(btnHeightCntWindow)))
{
iWantToLogin = true;
}
GUILayout.Space(10);
if (GUILayout.Button("REGISTRAZIONE", GUILayout.Height(btnHeightCntWindow)))
{
iWantToRegister = true;
}
GUILayout.Space(10);
if (Application.isWebPlayer == false Application.isEditor == false)
{
if (GUILayout.Button("Esci dal gioco", GUILayout.Height(btnHeightCntWindow)))
{
Application.Quit();
}
}
}
if (iWantToLogin == true)
{
GUILayout.Label("Nome Utente");
inputUser = GUILayout.TextField(inputUser);
GUILayout.Space(5);
GUILayout.Label("Password");
inputPass = GUILayout.TextField(inputPass);
GUILayout.Space(10);
if (GUILayout.Button("Accedi", GUILayout.Height(btnHeightCntWindow)))
{
Login();
iWantToLogin = false;
}
GUILayout.Space(10);
if (GUILayout.Button("Indietro", GUILayout.Height(btnHeightCntWindow)))
{
iWantToLogin = false;
}
}
if (iWantToRegister == true)
{
GUILayout.Label("Nome Utente");
inputUser = GUILayout.TextField(inputUser);
GUILayout.Space(5);
GUILayout.Label("Password");
inputPass = GUILayout.TextField(inputPass);
GUILayout.Space(10);
if (GUILayout.Button("Registrati", GUILayout.Height(btnHeightCntWindow / 2)))
{
Register();
iWantToRegister = false;
}
GUILayout.Space(10);
if (GUILayout.Button("Indietro", GUILayout.Height(30)))
{
iWantToRegister = false;
}
}
}
void OnGUI()
{
leftIndent = Screen.width / 2 - connectionWindowWidth / 2;
topIndent = Screen.height / 2 - connectionWindowHeight / 2;
connectionWindowRect = new Rect(leftIndent, topIndent, connectionWindowWidth,
connectionWindowHeight);
connectionWindowRect = GUILayout.Window(0, connectionWindowRect, ConnectWindow,
titleMessage);
}