using Blue; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; public class RoomOtherUserItem : MonoBehaviour, IController { public TMP_Text mName; private RTCUserInfo mRTCUserInfo; public List TestBtn; private bool IsEnter = false; private void Start() { } /// /// 初始化 /// /// /// 主动进入 public void Init(RTCUserInfo RTCUserInfo,bool active=false) { mName.text = "待加入"; mRTCUserInfo = RTCUserInfo; if(active) { foreach(GameObject go in TestBtn) { go.SetActive(false); } mName.text = mRTCUserInfo.UserName; mRTCUserInfo.State = "2"; IsEnter = true; } } private void OnEnable() { StartCoroutine(Close()); } private IEnumerator Close() { yield return new WaitForSeconds(10); if(!IsEnter) TestRefuse(); } public void TestEnter() { mName.text = mRTCUserInfo.UserName; mRTCUserInfo.State = "2"; this.SendCommand(new OtherUserJoinRoomCommand(mRTCUserInfo)); IsEnter = true; } public void TestRefuse() { Destroy(gameObject); this.SendCommand(new NoEnterRoomCommand(mRTCUserInfo.UserID)); } public void TestResponse() { Destroy(gameObject); this.SendCommand(new NoEnterRoomCommand(mRTCUserInfo.UserID)); } }