AuthorizationController.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3. using UnityEngine.SceneManagement;
  4. using UnityEngine.UI;
  5. public class AuthorizationController : MonoBehaviour
  6. {
  7. public static string login;
  8. public static string password;
  9. public InputField Login;
  10. public InputField Password;
  11. public GameObject Error;
  12. public GameObject loading;
  13. public static bool send = false;
  14. public static bool success = false;
  15. public static bool error = false;
  16. static string textError = "Неправильный логин или пароль";
  17. Client client = new Client();
  18. // Start is called before the first frame update
  19. void Start()
  20. {
  21. DebugHelper.ActivateConsole();
  22. }
  23. // Update is called once per frame
  24. void Update()
  25. {
  26. if (success)
  27. {//SceneManager.LoadScene("Location");
  28. transform.gameObject.SetActive(false);
  29. client.SendGetUsers((uint)WorkerController.active_company + 1);
  30. client.BeaconsRequest((uint)WorkerController.locations[WorkerController.active_location].id);
  31. }
  32. if(error) Error.SetActive(true);
  33. }
  34. public void Authorization()
  35. {
  36. login = Login.text;
  37. password = Password.text;
  38. if (!string.IsNullOrEmpty(login) && !string.IsNullOrEmpty(password))
  39. {
  40. send = true;
  41. error = false;
  42. Error.SetActive(false);
  43. }
  44. }
  45. void OnGUI()
  46. {
  47. DebugHelper.DrawConsole();
  48. }
  49. }