CreatRoomForms.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. using LitJson;
  2. using SUIFW;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. using UnityEngine.UI;
  7. public class CreatRoomForms : BaseUIForms
  8. {
  9. public Text roomName;
  10. public Text roomType;
  11. public Text roomPeopleNum;
  12. public Text isRecode;
  13. public Text isDownload;
  14. public Toggle toggle;
  15. public Button returnBtn;
  16. public Button confirmBtn;
  17. private int index;
  18. private bool isClick = false;
  19. #region 窗体生命周期
  20. public override void Display()
  21. {
  22. base.Display();
  23. Init();
  24. }
  25. public override void Redisplay()
  26. {
  27. base.Redisplay();
  28. }
  29. public override void Freeze()
  30. {
  31. base.Freeze();
  32. }
  33. public override void Hiding()
  34. {
  35. base.Hiding();
  36. }
  37. #endregion
  38. private void Awake()
  39. {
  40. returnBtn.onClick.AddListener(Return);
  41. confirmBtn.onClick.AddListener(Create);
  42. }
  43. public void Init()
  44. {
  45. isClick = false;
  46. roomName.text = "房间名: " + RoomMainInfo.roomName;
  47. if (UserInfo.isSN)
  48. {
  49. roomType.text = "设备SN账号";
  50. roomPeopleNum.text = "2人";
  51. isRecode.text = "不支持";
  52. isDownload.text = "不支持";
  53. }
  54. else if (UserInfo.activateType == 1)
  55. {
  56. roomType.text = "未激活账号";
  57. roomPeopleNum.text = "2人";
  58. isRecode.text = "不支持";
  59. isDownload.text = "不支持";
  60. }
  61. else
  62. {
  63. roomType.text = "激活账号";
  64. roomPeopleNum.text = "10人";
  65. isRecode.text = "支持";
  66. isDownload.text = "支持";
  67. }
  68. toggle.onValueChanged.AddListener(remindTip);
  69. }
  70. public void remindTip(bool isRemind)
  71. {
  72. index = isRemind == true ? 1 : -1;
  73. }
  74. public void Create()
  75. {
  76. if (!isClick)
  77. {
  78. isClick = true;
  79. PlayerPrefs.SetInt("isRemindTip", index);
  80. OnCreateRoom();
  81. }
  82. }
  83. private void OnCreateRoom()
  84. {
  85. WSHandler.Office.OnGetRoomIdReveived -= getRoomId;
  86. WSHandler.Office.OnGetRoomIdReveived += getRoomId;
  87. WSHandler.Office.GetRoomID();
  88. }
  89. private void getRoomId(JsonData data)
  90. {
  91. WSHandler.Office.ChangeUserType(UserInfo.BusyType);
  92. RoomMainInfo.roomNum = data["data"]["roomId"].ToString();
  93. WSHandler.roomRtcinit(RoomMainInfo.roomNum);
  94. WSHandler.Office.OnGetRoomIdReveived -= getRoomId;
  95. }
  96. public void Return()
  97. {
  98. index = -1;
  99. toggle.isOn = false;
  100. CloseOrReturnUIForms();
  101. ShowUIForms(SysConst.MainPanelForms);
  102. }
  103. }