public NetworkingPeer(string playername, ConnectionProtocol connectionProtocol) : base(connectionProtocol)
{
this.Listener = this;
#if !UNITY_EDITOR && (UNITY_WINRT)
// this automatically uses a separate assembly-file with Win8-style Socket usage (not possible in Editor)
Debug.LogWarning("Using PingWindowsStore");
PhotonHandler.PingImplementation = typeof(PingWindowsStore); // but for ping, we have to set the implementation explicitly to Win 8 Store/Phone
#endif
#pragma warning disable 0162 // the library variant defines if we should use PUN's SocketUdp variant (at all)
if (PhotonPeer.NoSocket)
{
#if !UNITY_EDITOR && (UNITY_PS3 || UNITY_ANDROID)
Debug.Log("Using class SocketUdpNativeDynamic");
this.SocketImplementation = typeof(SocketUdpNativeDynamic);
PhotonHandler.PingImplementation = typeof(PingNativeDynamic);
#elif !UNITY_EDITOR && UNITY_IPHONE
Debug.Log("Using class SocketUdpNativeStatic");
this.SocketImplementation = typeof(SocketUdpNativeStatic);
PhotonHandler.PingImplementation = typeof(PingNativeStatic);
#elif !UNITY_EDITOR && (UNITY_WINRT)
// this automatically uses a separate assembly-file with Win8-style Socket usage (not possible in Editor)
#else
this.SocketImplementation = typeof(SocketUdp);
PhotonHandler.PingImplementation = typeof(PingMonoEditor);
#endif
if (this.SocketImplementation == null)
{
Debug.Log("No socket implementation set for 'NoSocket' assembly. Please contact Exit Games.");
}
}
#pragma warning restore 0162
#if UNITY_WEBGL
if (connectionProtocol == ConnectionProtocol.WebSocket || connectionProtocol == ConnectionProtocol.WebSocketSecure)
{
Debug.Log("Using SocketWebTcp");
this.SocketImplementation = typeof(SocketWebTcp);
}
#endif
if (PhotonHandler.PingImplementation == null)
{
PhotonHandler.PingImplementation = typeof(PingMono);
}
this.LimitOfUnreliableCommands = 40;
this.lobby = TypedLobby.Default;
this.PlayerName = playername;
this.mLocalActor = new PhotonPlayer(true, -1, this.playername);
this.AddNewPlayer(this.mLocalActor.ID, this.mLocalActor);
// RPC shortcut lookup creation (from list of RPCs, which is updated by Editor scripts)
rpcShortcuts = new Dictionary<string, int>(PhotonNetwork.PhotonServerSettings.RpcList.Count);
for (int index = 0; index < PhotonNetwork.PhotonServerSettings.RpcList.Count; index++)
{
var name = PhotonNetwork.PhotonServerSettings.RpcList[index];
rpcShortcuts[name] = index;
}
this.State = global::PeerState.PeerCreated;
}