예제 #1
0
    public IEnumerator Register(IAccountField accountField)
    {
        WWWForm form = new WWWForm();

        form.AddField("name", nameField.text);
        form.AddField("password", passwordField.text);

        WWW www = new WWW("http://localhost/sqlconnect/register.php", form);

        yield return(www);

        if (www.text == "0")
        {
            Debug.Log("User created successfully!");
            accountField.ShowAccountPanel(AccountPanel.LoginOrRegister);
        }
        else
        {
            Debug.Log("User creation failed. Error #" + www.text);
        }
    }
예제 #2
0
    IEnumerator LoginPlayer(IAccountField accountField)
    {
        WWWForm form = new WWWForm();

        form.AddField("name", nameField.text);
        form.AddField("password", passwordField.text);

        WWW www = new WWW("http://localhost/sqlconnect/login.php", form);

        yield return(www);

        if (www.text[0] == '0')
        {
            DBManager.username = nameField.text;
            DBManager.score    = int.Parse(www.text.Split('\t')[1]);
            accountField.ShowAccountPanel(AccountPanel.LoginOrRegister);
        }
        else
        {
            Debug.Log("User login failed. Error #" + www.text);
        }
    }