1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- using UnityEngine.UI;
- public class AuthorizationController : MonoBehaviour
- {
- public static string login;
- public static string password;
- public InputField Login;
- public InputField Password;
- public GameObject Error;
- public GameObject loading;
- public static bool send = false;
- public static bool success = false;
- public static bool error = false;
- static string textError = "Неправильный логин или пароль";
- Client client;
- // Start is called before the first frame update
- void Start()
- {
- client = Client.instance;
- var waslogin = PlayerPrefs.GetString("lastlogin");
- var waspass = PlayerPrefs.GetString("lastpass");
- if (waslogin != null)
- Login.text = waslogin;
- if (waspass != null)
- Password.text = waspass;
- DebugHelper.ActivateConsole();
- }
- // Update is called once per frame
- void Update()
- {
- if (success)
- {//SceneManager.LoadScene("Location");
- transform.gameObject.SetActive(false);
- client.SendGetUsers((uint)PlayerController.active_company + 1);
-
- if (ModeController.editor == true && PlayerController.active_location != PlayerController.locations.Count) client.BeaconsRequest((uint)PlayerController.locations[PlayerController.active_location].id);
- if (ModeController.editor == false) client.BeaconsRequest((uint)PlayerController.locations[PlayerController.active_location].id);
- }
- if(error) Error.SetActive(true);
- }
- public void Authorization()
- {
- login = Login.text;
- password = Password.text;
- PlayerPrefs.SetString("lastlogin", login);
- PlayerPrefs.SetString("lastpass", password);
- if (!string.IsNullOrEmpty(login) && !string.IsNullOrEmpty(password))
- {
- send = true;
- error = false;
- Error.SetActive(false);
- }
- }
- void OnGUI()
- {
- DebugHelper.DrawConsole();
- }
- }
-
|