Guest User

Untitled

a guest
May 31st, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class GuiManager : MonoBehaviour {
  6.  
  7.  
  8. //Manager
  9. public MysqlManager _MysqlManager;
  10.  
  11. public bool _GuiIsOn;
  12. public string _NameOfMenu;
  13.  
  14. public string _IpFUsernameLogin;
  15. public string _IpFPasswordLogin;
  16.  
  17. public string _IpFUsernameRegister;
  18. public string _IpFPasswordRegister;
  19. public string _IpFCPasswordRegister;
  20. public string _IpFMailRegister;
  21.  
  22. private int buttonWidth;
  23. private int buttonHeight;
  24. private int ipFWidth;
  25. private int ipFHeight;
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32. void Awake(){
  33. buttonWidth = 150;
  34. buttonHeight = 80;
  35. ipFWidth = 200;
  36. ipFHeight = 40;
  37. _GuiIsOn = true;
  38. _NameOfMenu = "Main Menu";
  39.  
  40. }
  41.  
  42. void OnGUI(){
  43. if (_GuiIsOn == true) {
  44. GUI.Box (new Rect (Screen.width / 2 - 300, Screen.height / 2 -300, 600, 600), _NameOfMenu);
  45. if (_NameOfMenu == "Main Menu") {
  46. if (GUI.Button (new Rect (Screen.width / 2 - 150, Screen.height / 2, buttonWidth, buttonHeight), "Login")) {
  47. _NameOfMenu = "Login Menu";
  48. }
  49. if (GUI.Button (new Rect (Screen.width / 2 + 50, Screen.height / 2, buttonWidth, buttonHeight), "Register")) {
  50. _NameOfMenu = "Register Menu";
  51. }
  52. }
  53. if (_NameOfMenu == "Login Menu") {
  54. GUI.Label (new Rect (Screen.width /2 -100, Screen.height / 2 - 200, 100, 20), "Username : ");
  55. _IpFUsernameLogin = GUI.TextArea (new Rect (Screen.width/ 2 , Screen.height/2 - 200, 200, 20), _IpFUsernameLogin, 25);
  56. GUI.Label (new Rect (Screen.width /2 -100, Screen.height / 2 - 170, 100, 20), "Password : ");
  57. _IpFPasswordLogin = GUI.TextArea (new Rect (Screen.width/ 2 , Screen.height/2 - 170, 200, 20), _IpFPasswordLogin, 25);
  58. if (GUI.Button (new Rect (Screen.width / 2 - 150, Screen.height / 2, buttonWidth, buttonHeight), "Login")) {
  59.  
  60. }
  61. if (GUI.Button (new Rect (Screen.width / 2 + 50, Screen.height / 2, buttonWidth, buttonHeight), "Back Main Menu")) {
  62. _NameOfMenu = "Main Menu";
  63. }
  64.  
  65. }
  66. if (_NameOfMenu == "Register Menu") {
  67. GUI.Label (new Rect (Screen.width /2 -100, Screen.height / 2 - 200, 100, 20), "Username : ");
  68. _IpFUsernameRegister = GUI.TextArea (new Rect (Screen.width/ 2 , Screen.height/2 - 200, 200, 20), _IpFUsernameRegister, 25);
  69. GUI.Label (new Rect (Screen.width /2 -100, Screen.height / 2 - 170, 100, 20), "Password : ");
  70. _IpFPasswordRegister = GUI.TextArea (new Rect (Screen.width/ 2 , Screen.height/2 - 170, 200, 20), _IpFPasswordRegister, 25);
  71. GUI.Label (new Rect (Screen.width /2 -100, Screen.height / 2 - 140, 100, 20), "Confirme Password : ");
  72. _IpFCPasswordRegister = GUI.TextArea (new Rect (Screen.width/ 2 , Screen.height/2 - 140, 200, 20), _IpFCPasswordRegister, 25);
  73. GUI.Label (new Rect (Screen.width /2 -100, Screen.height / 2 - 110, 100, 20), "E-Mail : ");
  74. _IpFMailRegister = GUI.TextArea (new Rect (Screen.width/ 2 , Screen.height/2 - 110, 200, 20), _IpFMailRegister, 25);
  75. if (GUI.Button (new Rect (Screen.width / 2 - 150, Screen.height / 2, buttonWidth, buttonHeight), "Creat account")) {
  76. _MysqlManager._AccountCreat (_IpFUsernameRegister, _IpFPasswordRegister, _IpFMailRegister);
  77. }
  78. if (GUI.Button (new Rect (Screen.width / 2 + 50, Screen.height / 2, buttonWidth, buttonHeight), "Back Main Menu")) {
  79. _NameOfMenu = "Main Menu";
  80. }
  81.  
  82. }
  83. }
  84. }
  85. }
Add Comment
Please, Sign In to add comment