JoinRoom.cs 1.3 KB

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