12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- 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<GameObject> TestBtn;
- private bool IsEnter = false;
- private void Start()
- {
- }
- /// <summary>
- /// 初始化
- /// </summary>
- /// <param name="RTCUserInfo"></param>
- /// <param name="active">主动进入</param>
- 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));
- }
- }
|