/// <summary> /// /// </summary> /// <param name="track"></param> public override void SetChannel(string connectionId, RTCDataChannel channel) { if (channel == null) { if (remoteInput != null) { onDeviceChange.Invoke(remoteInput.RemoteGamepad, InputDeviceChange.Removed); onDeviceChange.Invoke(remoteInput.RemoteKeyboard, InputDeviceChange.Removed); onDeviceChange.Invoke(remoteInput.RemoteMouse, InputDeviceChange.Removed); onDeviceChange.Invoke(remoteInput.RemoteTouchscreen, InputDeviceChange.Removed); remoteInput.Dispose(); remoteInput = null; } } else { remoteInput = RemoteInputReceiver.Create(); remoteInput.ActionButtonClick = OnButtonClick; channel.OnMessage += remoteInput.ProcessInput; onDeviceChange.Invoke(remoteInput.RemoteGamepad, InputDeviceChange.Added); onDeviceChange.Invoke(remoteInput.RemoteKeyboard, InputDeviceChange.Added); onDeviceChange.Invoke(remoteInput.RemoteMouse, InputDeviceChange.Added); onDeviceChange.Invoke(remoteInput.RemoteTouchscreen, InputDeviceChange.Added); } base.SetChannel(connectionId, channel); }
/// <summary> /// /// </summary> public virtual void OnDestroy() { remoteInput?.Dispose(); }