JoinRoom.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. 
  2. using System;
  3. using System.Text.RegularExpressions;
  4. using SC.XR.Unity;
  5. using UnityEngine;
  6. using UnityEngine.UI;
  7. using static ScenesManager;
  8. public class JoinRoom : RemoteSingleton<JoinRoom>
  9. {
  10. public SCInputField fieldName;
  11. public Text remind;
  12. public override void initShow()
  13. {
  14. base.initShow();
  15. fieldName.text = "";
  16. remind.gameObject.SetActive(false);
  17. fieldName.onValueChanged.RemoveAllListeners();
  18. fieldName.onValueChanged.AddListener(UserValueChanged);
  19. }
  20. private void UserValueChanged(string arg0)
  21. {
  22. remind.gameObject.SetActive(false);
  23. }
  24. public void showOffice()
  25. {
  26. ScenesManager.Instance.showOffice(SceneType.OfficeWindow);
  27. }
  28. public bool isClick = false;
  29. private void OnEnable()
  30. {
  31. isClick = false;
  32. }
  33. private void OnDisable()
  34. {
  35. isClick = false;
  36. }
  37. public void Join()
  38. {
  39. if (fieldName.text != "" && !isClick)
  40. {
  41. isClick = true;
  42. OfficeWindow.Instance.OnJoinRoom(fieldName.text);
  43. }
  44. else
  45. {
  46. remind.text = "请输入房间号";
  47. remind.gameObject.SetActive(true);
  48. }
  49. // ScenesManager.Instance.showWindow(SceneType.ShowRoom);
  50. }
  51. }