You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-16 07:06:30 +09:00
Unity Support. Just compile with __CONSTRAINED__ and UNITY keyworkds and add a reference to UnityEngine.dll
This commit is contained in:
@@ -7,18 +7,30 @@ namespace Lidgren.Network
|
||||
public class NetAESEncryption : NetCryptoProviderBase
|
||||
{
|
||||
public NetAESEncryption(NetPeer peer)
|
||||
#if UNITY
|
||||
: base(peer, new RijndaelManaged())
|
||||
#else
|
||||
: base(peer, new AesCryptoServiceProvider())
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
public NetAESEncryption(NetPeer peer, string key)
|
||||
#if UNITY
|
||||
: base(peer, new RijndaelManaged())
|
||||
#else
|
||||
: base(peer, new AesCryptoServiceProvider())
|
||||
#endif
|
||||
{
|
||||
SetKey(key);
|
||||
}
|
||||
|
||||
public NetAESEncryption(NetPeer peer, byte[] data, int offset, int count)
|
||||
#if UNITY
|
||||
: base(peer, new RijndaelManaged())
|
||||
#else
|
||||
: base(peer, new AesCryptoServiceProvider())
|
||||
#endif
|
||||
{
|
||||
SetKey(data, offset, count);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if __CONSTRAINED__ || UNITY_STANDALONE_LINUX
|
||||
#if __CONSTRAINED__ || UNITY_STANDALONE_LINUX || UNITY
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
@@ -29,9 +29,9 @@ namespace Lidgren.Network
|
||||
public static IPAddress GetMyAddress(out IPAddress mask)
|
||||
{
|
||||
mask = null;
|
||||
#if UNITY_ANDROID || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX || UNITY_IOS
|
||||
try
|
||||
{
|
||||
#if UNITY_ANDROID || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX || UNITY_IOS || UNITY
|
||||
if (!(UnityEngine.Application.internetReachability == UnityEngine.NetworkReachability.NotReachable))
|
||||
{
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user