Advertisement
Guest User

Untitled

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