using LitJson; using SUIFW; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class CreatRoomForms : BaseUIForms { public Text roomName; public Text roomType; public Text roomPeopleNum; public Text isRecode; public Text isDownload; public Toggle toggle; public Button returnBtn; public Button confirmBtn; private int index; private bool isClick = false; #region 窗体生命周期 public override void Display() { base.Display(); Init(); } public override void Redisplay() { base.Redisplay(); } public override void Freeze() { base.Freeze(); } public override void Hiding() { base.Hiding(); } #endregion private void Awake() { returnBtn.onClick.AddListener(Return); confirmBtn.onClick.AddListener(Create); } public void Init() { isClick = false; roomName.text = "房间名: " + RoomMainInfo.roomName; if (UserInfo.isSN) { roomType.text = "设备SN账号"; roomPeopleNum.text = "2人"; isRecode.text = "不支持"; isDownload.text = "不支持"; } else if (UserInfo.activateType == 1) { roomType.text = "未激活账号"; roomPeopleNum.text = "2人"; isRecode.text = "不支持"; isDownload.text = "不支持"; } else { roomType.text = "激活账号"; roomPeopleNum.text = "10人"; isRecode.text = "支持"; isDownload.text = "支持"; } toggle.onValueChanged.AddListener(remindTip); } public void remindTip(bool isRemind) { index = isRemind == true ? 1 : -1; } public void Create() { if (!isClick) { isClick = true; PlayerPrefs.SetInt("isRemindTip", index); OnCreateRoom(); } } private void OnCreateRoom() { WSHandler.Office.OnGetRoomIdReveived -= getRoomId; WSHandler.Office.OnGetRoomIdReveived += getRoomId; WSHandler.Office.GetRoomID(); } private void getRoomId(JsonData data) { WSHandler.Office.ChangeUserType(UserInfo.BusyType); RoomMainInfo.roomNum = data["data"]["roomId"].ToString(); WSHandler.roomRtcinit(RoomMainInfo.roomNum); WSHandler.Office.OnGetRoomIdReveived -= getRoomId; } public void Return() { index = -1; toggle.isOn = false; CloseOrReturnUIForms(); ShowUIForms(SysConst.MainPanelForms); } }