您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

27 行
996 B

using System.Runtime.InteropServices;
namespace Unity.Networking.Transport.Relay
{
[StructLayout(LayoutKind.Sequential)]
public struct RelayMessageRelay
{
public const int Length = RelayMessageHeader.Length + RelayAllocationId.k_Length * 2 + 2; // Header + FromAllocationId + ToAllocationId + DataLength
public RelayMessageHeader Header;
public RelayAllocationId FromAllocationId;
public RelayAllocationId ToAllocationId;
public ushort DataLength;
public static RelayMessageRelay Create(RelayAllocationId fromAllocationId, RelayAllocationId toAllocationId, ushort dataLength)
{
return new RelayMessageRelay
{
Header = RelayMessageHeader.Create(RelayMessageType.Relay),
FromAllocationId = fromAllocationId,
ToAllocationId = toAllocationId,
DataLength = RelayNetworkProtocol.SwitchEndianness(dataLength),
};
}
}
}