12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using Blue;
- using Newtonsoft.Json;
- using UnityEngine;
- using UnityEngine.UI;
- public class TestEnter : MonoBehaviour,IController
- {
- public Button mBtn_1;
- public Button mBtn_2;
- public Button mBtn_3;
- public Button mBtn_4;
- void Start()
- {
- mBtn_1.onClick.AddListener(Btn_1);
- mBtn_2.onClick.AddListener(Btn_2);
- mBtn_3.onClick.AddListener(Btn_3);
- mBtn_4.onClick.AddListener(Btn_4);
- }
- private RTCUserInfo mRTCUserInfo1= new RTCUserInfo()
- {
- UserID = 456,UserName="我是456",Head=321,Audio = false,Video = false
- };
- private RTCUserInfo mRTCUserInfo2= new RTCUserInfo()
- {
- UserID = 789,UserName="我是789",Head=321,Audio = false,Video = false
- };
- private void Btn_1()
- {
- this.SendCommand(new OtherUserJoinRoomCommand(mRTCUserInfo1));
- }
- private void Btn_2()
- {
- this.SendCommand(new OtherUserLeaveRoomCommand(mRTCUserInfo1));
- }
- private void Btn_3()
- {
- this.SendCommand(new OtherUserJoinRoomCommand(mRTCUserInfo2));
- }
- private void Btn_4()
- {
- this.SendCommand(new OtherUserLeaveRoomCommand(mRTCUserInfo2));
- }
- }
- public struct OtherUserJoinRoomCommand : ICommand
- {
- private string mJsonstring;
- public OtherUserJoinRoomCommand(RTCUserInfo RTCUserInfo)
- {
- mJsonstring = JsonConvert.SerializeObject(RTCUserInfo);
- }
- public void OnExcute()
- {
- this.SendEvent(new OtherUserJoinRoomEvent(){rtcUserInfoJsonString = mJsonstring});
- }
- }
- public struct OtherUserLeaveRoomCommand : ICommand
- {
- private string mJsonstring;
- public OtherUserLeaveRoomCommand(RTCUserInfo RTCUserInfo)
- {
- mJsonstring = JsonConvert.SerializeObject(RTCUserInfo);
- }
- public void OnExcute()
- {
- this.SendEvent(new OtherLeaveRoomEvent(){rtcUserInfoJsonString = mJsonstring});
- }
- }
|