Beispiel #1
0
            public void Send(byte[] buffer)
            {
                var pinnedBuffer = GCHandle.Alloc(buffer, GCHandleType.Pinned);

                UnityPeerJS.Send(_peer._peerIndex, _connIndex, pinnedBuffer.AddrOfPinnedObject(), buffer.Length);
                pinnedBuffer.Free();
            }
Beispiel #2
0
        /// <summary>
        /// Connect to another client
        /// </summary>
        /// <param name="remoteId">Peer ID of target client</param>
        public void Connect(string remoteId)
        {
            var remoteIdStr = Marshal.StringToHGlobalUni(remoteId);

            UnityPeerJS.Connect(_peerIndex, remoteIdStr);

            Marshal.FreeHGlobal(remoteIdStr);
        }
Beispiel #3
0
 public void Send(string str)
 {
     UnityPeerJS.Send(Peer._peerIndex, _connIndex, str, str.Length);
 }
Beispiel #4
0
 public void Connect(string remoteId)
 {
     UnityPeerJS.Connect(_peerIndex, remoteId);
 }