您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
26 行
905 B
26 行
905 B
using System;
|
|
using Unity.Collections.LowLevel.Unsafe;
|
|
|
|
namespace Unity.Networking.Transport.Relay
|
|
{
|
|
/// <summary>
|
|
/// This is the encrypted data that the Relay server uses for describing a connection.
|
|
/// Used mainly in the connection stablishing process (Binding)
|
|
/// </summary>
|
|
public unsafe struct RelayConnectionData
|
|
{
|
|
public const int k_Length = 255;
|
|
public fixed byte Value[k_Length];
|
|
|
|
// Used by Relay SDK
|
|
public static RelayConnectionData FromBytePointer(byte* dataPtr, int length)
|
|
{
|
|
if (length != k_Length)
|
|
throw new ArgumentException($"Provided byte array length is invalid, must be {k_Length} but got {length}.");
|
|
|
|
var connectionData = new RelayConnectionData();
|
|
UnsafeUtility.MemCpy(connectionData.Value, dataPtr, length);
|
|
return connectionData;
|
|
}
|
|
}
|
|
}
|