Люди помогите в чем проблема (я скорее всего не правильно сделал) когда я регистрируюсь всё хорошо а вот логин не логинит помогите плз
[code]using UnityEngine;
using System.Collections;
using gui = UnityEngine.GUILayout;
using System.Threading.Tasks;
using Parse;
public class Register_and_login : MonoBehaviour {
public string LoginPole = "Login";
public string PasswordPole = "Password";
public string EmailPole = "Email";
public string NamePole = "Your Name";
public int BestRecord = 0;
int RegisterButton = 1;
int MenuButton = 1;
void OnGUI() {
if (MenuButton == 1) {
gui.Label(" " + BestRecord);
gui.Label("Register");
gui.Label("Profile");
LoginPole = gui.TextField(LoginPole);
PasswordPole = gui.TextField(PasswordPole);
if (gui.Button("Login")) {
ParseUser.LogInAsync(LoginPole, PasswordPole).ContinueWith(t =>
{
if (t.IsFaulted || t.IsCanceled)
{
Debug.Log ("Error 404");
}
else
{
Debug.Log ("LoginComplite");
}
});
}
if (gui.Button("Register")) {
var user = new ParseUser()
{
Username = LoginPole,
Password = PasswordPole,
Email = "email@example.com"
};
Debug.Log ("RegisterComplite");
}
}
}
private void Register(){
var user = new ParseUser()
{
Username = "Name",
Password = "Password",
Email = "email@example.com"
};
// other fields can be set just like with ParseObject
user["phone"] = "415-392-0202";
Task signUpTask = user.SignUpAsync();
}
private void Login() {
ParseUser.LogInAsync(LoginPole, PasswordPole).ContinueWith(t =>
{
if (t.IsFaulted || t.IsCanceled)
{
Debug.Log ("Error 404");
}
else
{
Debug.Log ("LoginComplite");
}
});
}
private void CurrentUser (){
if (ParseUser.CurrentUser != null)
{
// do stuff with the user
}
else
{
// show the signup or login screen
}
}
}
[code]Добавлено (16 декабря 2014, 22:59)
---------------------------------------------
вот теперешний код я попытался переделать всё ровно
Код
using UnityEngine;
using System.Collections;
using gui = UnityEngine.GUILayout;
using System.Threading.Tasks;
using Parse;
public class Register_and_login : MonoBehaviour {
public string _password = "";
public string _username = "";
public string EmailPole = "Email";
public string NamePole = "Your Name";
int RegisterButton = 1;
int MenuButton = 1;
void OnGUI() {
if (MenuButton == 1) {
gui.Label("Register");
gui.Label("Profile");
_username = GUILayout.TextField(_username);
_password = GUILayout.PasswordField(_password, '*');
if (gui.Button("Login")) {
ParseUser.LogInAsync(_username, _password).ContinueWith(t =>
{
if (t.IsFaulted || t.IsCanceled)
{
Debug.Log ("Error 404");
}
else
{
Debug.Log ("LoginComplite");
}
});
}
if (gui.Button("Register")) {
var user = new ParseUser()
{
Username = _username,
Password = _password
};
Debug.Log ("RegisterComplite");
}
}
}
private void Register(){
var user = new ParseUser()
{
Username = "Name",
Password = "Password",
Email = "email@example.com"
};
// other fields can be set just like with ParseObject
user["phone"] = "415-392-0202";
Task signUpTask = user.SignUpAsync();
}
private void Login() {
ParseUser.LogInAsync(_username, _password).ContinueWith(t =>
{
if (t.IsFaulted || t.IsCanceled)
{
Debug.Log ("Error 404");
}
else
{
Debug.Log ("LoginComplite");
}
});
}
private void CurrentUser (){
if (ParseUser.CurrentUser != null)
{
// do stuff with the user
}
else
{
// show the signup or login screen
}
}
}
Добавлено (16 декабря 2014, 23:05)
---------------------------------------------
он вообще не работает...