You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
107 lines
2.6 KiB
107 lines
2.6 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Net;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.Networking;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class LoginManager : MonoBehaviour
|
|
{
|
|
[Header("References")]
|
|
[SerializeField] private GameObject formMain;
|
|
[SerializeField] private GameObject formLogin;
|
|
[SerializeField] private GameObject formReg;
|
|
//[SerializeField] private GameObject formLogin;
|
|
|
|
|
|
[Header("Login Data")]
|
|
[SerializeField] private RS_InputField _loginName;
|
|
[SerializeField] private RS_InputField _loginPassword;
|
|
[SerializeField] private RS_LabeledComponent _loginError;
|
|
|
|
[Header("Reg Data")]
|
|
[SerializeField] private RS_InputField _regLogin;
|
|
[SerializeField] private RS_InputField _regEmail;
|
|
[SerializeField] private RS_InputField _regPassword;
|
|
[SerializeField] private RS_InputField _regPassword2;
|
|
[SerializeField] private RS_LabeledComponent _regError;
|
|
|
|
|
|
[System.Serializable]
|
|
class TempID
|
|
{
|
|
public int id;
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
//WebRequest.Get(this, "Test", (UnityWebRequest.Result status, string data) =>
|
|
//{
|
|
// Debug.Log(status.ToString());
|
|
// Debug.Log(data);
|
|
//});
|
|
|
|
//string fields = $@"{{ ""username"": ""432"",
|
|
// ""email"": ""432"",
|
|
// ""password"": ""432""}}";
|
|
|
|
|
|
//WebRequest.Post(this, "RegUser", fields, (UnityWebRequest.Result status, string data) =>
|
|
//{
|
|
// Debug.Log(status.ToString());
|
|
// Debug.Log(data);
|
|
//});
|
|
}
|
|
|
|
private void ClearFormLogin()
|
|
{
|
|
_loginName.Clear();
|
|
_loginPassword.Clear();
|
|
}
|
|
|
|
private void ClearFormRegister()
|
|
{
|
|
_regLogin.Clear();
|
|
_regEmail.Clear();
|
|
_regPassword.Clear();
|
|
_regPassword2.Clear();
|
|
}
|
|
|
|
public void FormLogin()
|
|
{
|
|
formReg.SetActive(false);
|
|
formMain.SetActive(false);
|
|
formLogin.SetActive(true);
|
|
}
|
|
|
|
public void FormRegister()
|
|
{
|
|
formLogin.SetActive(false);
|
|
formMain.SetActive(false);
|
|
formReg.SetActive(true);
|
|
}
|
|
|
|
public void FormMain()
|
|
{
|
|
ClearFormLogin();
|
|
ClearFormRegister();
|
|
formLogin.SetActive(false);
|
|
formReg.SetActive(false);
|
|
formMain.SetActive(true);
|
|
}
|
|
|
|
public void SkipTest()
|
|
{
|
|
bool isFirst = true;
|
|
|
|
if(isFirst)
|
|
{
|
|
SceneManager.LoadScene("AccountInit");
|
|
}
|
|
else
|
|
{
|
|
SceneManager.LoadScene("Game");
|
|
}
|
|
}
|
|
}
|
|
|