Esempio n. 1
0
    public NetworkingPeer(IPhotonPeerListener listener, string playername, ConnectionProtocol connectionProtocol)
        : base(listener, connectionProtocol)
    {
        #if UNITY_EDITOR || (!UNITY_IPHONE && !UNITY_ANDROID && !UNITY_PS3)
        Debug.Log("Using C# Socket");
        this.SocketImplementation = typeof(SocketUdp);
        #elif !UNITY_EDITOR && UNITY_PS3
        Debug.Log("Using class SocketUdpNativeDllImport");
        this.SocketImplementation = typeof(SocketUdpNativeDllImport);
        #elif !UNITY_EDITOR && UNITY_ANDROID
        Debug.Log("Using class SocketUdpNativeDynamic");
        this.SocketImplementation = typeof(SocketUdpNativeDynamic);
        #elif !UNITY_EDITOR && UNITY_IPHONE
        Debug.Log("Using class SocketUdpNativeStatic");
        this.SocketImplementation = typeof(SocketUdpNativeStatic);
        #endif

        this.Listener = this;

        // don't set the field directly! the listener is passed on to other classes, which get updated by the property set method
        this.externalListener = listener;
        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;
    }
Esempio n. 2
0
        public ChatPeer(IPhotonPeerListener listener, ConnectionProtocol protocol) : base(listener, protocol)
        {
#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)
                UnityEngine.Debug.Log("Using class SocketUdpNativeDynamic");
                this.SocketImplementation = typeof(SocketUdpNativeDynamic);
#elif !UNITY_EDITOR && UNITY_IPHONE
                UnityEngine.Debug.Log("Using class SocketUdpNativeStatic");
                this.SocketImplementation = typeof(SocketUdpNativeStatic);
#elif !UNITY_EDITOR && (UNITY_WINRT)
                // this automatically uses a separate assembly-file with Win8-style Socket usage (not possible in Editor)
#else
                Type udpSocket = Type.GetType("ExitGames.Client.Photon.SocketUdp, Assembly-CSharp");
                this.SocketImplementation = udpSocket;
                if (udpSocket == null)
                {
                    UnityEngine.Debug.Log("ChatClient could not find a suitable C# socket class. The Photon3Unity3D.dll only supports native socket plugins.");
                }
#endif
                if (this.SocketImplementation == null)
                {
                    UnityEngine.Debug.Log("No socket implementation set for 'NoSocket' assembly. Please contact Exit Games.");
                }
            }
#pragma warning restore 0162

            if (protocol == ConnectionProtocol.WebSocket || protocol == ConnectionProtocol.WebSocketSecure)
            {
                UnityEngine.Debug.Log("Using SocketWebTcp");
                this.SocketImplementation = Type.GetType("ExitGames.Client.Photon.SocketWebTcp, Assembly-CSharp");//typeof(SocketWebTcp);
            }
        }
Esempio n. 3
0
        public ChatPeer(IPhotonPeerListener listener, ConnectionProtocol protocol) : base(listener, protocol)
        {
#if UNITY
#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)
                UnityEngine.Debug.Log("Using class SocketUdpNativeDynamic");
                this.SocketImplementation = typeof(SocketUdpNativeDynamic);
#elif !UNITY_EDITOR && UNITY_IPHONE
                UnityEngine.Debug.Log("Using class SocketUdpNativeStatic");
                this.SocketImplementation = typeof(SocketUdpNativeStatic);
#elif !UNITY_EDITOR && (UNITY_WINRT)
                // this automatically uses a separate assembly-file with Win8-style Socket usage (not possible in Editor)
#else
                Type udpSocket = Type.GetType("ExitGames.Client.Photon.SocketUdp, Assembly-CSharp");
                this.SocketImplementation = udpSocket;
                if (udpSocket == null)
                {
                    UnityEngine.Debug.Log("ChatClient could not find a suitable C# socket class. The Photon3Unity3D.dll only supports native socket plugins.");
                }
#endif
                if (this.SocketImplementation == null)
                {
                    UnityEngine.Debug.Log("No socket implementation set for 'NoSocket' assembly. Please contact Exit Games.");
                }
            }
#pragma warning restore 0162
			if (protocol == ConnectionProtocol.WebSocket || protocol == ConnectionProtocol.WebSocketSecure) {
            	UnityEngine.Debug.Log("Using SocketWebTcp");
            	this.SocketImplementation = Type.GetType("ExitGames.Client.Photon.SocketWebTcp, Assembly-CSharp");//typeof(SocketWebTcp);
			}
#endif
        }
Esempio n. 4
0
        public TestClient(IPhotonPeerListener listener)
        {
            Listener = listener;

            PhotonClient = new PhotonPeer(this, ConnectionProtocol.Tcp);
            ServiceFiber = new PoolFiber();
            ExecuteFiber = new PoolFiber();
        }
Esempio n. 5
0
 public PhotonPeer(IPhotonPeerListener listener, ConnectionProtocol protocolType)
     : this(protocolType)
 {
     if (listener == null)
     {
         throw new Exception("listener cannot be null");
     }
     this.Listener = listener;
 }
 public void onDisConnected(IPhotonPeerListener peer)
 {
     this.Invoke((MethodInvoker) delegate()
     {
         lock (this)
         {
             lblStatus.Text   = "Disconnected";
             btnJoin.Enabled  = true;
             txtName.ReadOnly = false;
             txtChat.ReadOnly = true;
             btnChat.Enabled  = false;
         }
     });
 }
 public void onConnected(IPhotonPeerListener peer)
 {
     this.Invoke((MethodInvoker) delegate()
     {
         lock (this)
         {
             lblStatus.Text   = "Connected";
             btnJoin.Enabled  = false;
             txtName.ReadOnly = true;
             txtChat.ReadOnly = false;
             btnChat.Enabled  = true;
             client.OpCustom((byte)OperationCode.JOIN_CHAT, new Dictionary <byte, object> {
                 { (byte)Data.DATA1, txtName.Text }
             }, true, null);
         }
     });
 }
Esempio n. 8
0
    public NetworkingPeer(IPhotonPeerListener listener, string playername, ConnectionProtocol connectionProtocol)
        : base(listener, connectionProtocol)
    {
        this.Listener = this;

        // don't set the field directly! the listener is passed on to other classes, which get updated by the property set method
        this.externalListener = listener;
        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;
    }
Esempio n. 9
0
 internal HttpBase3(IPhotonPeerListener listener)
     : this()
 {
     this.Listener = listener;
 }
Esempio n. 10
0
 public ChatPeer(IPhotonPeerListener listener, ConnectionProtocol protocol) : base(listener, protocol)
 {
 }
Esempio n. 11
0
 public LiteLobbyPeer(IPhotonPeerListener listener, bool useTcp)
     : base(listener, useTcp)
 {
 }
 // Token: 0x0600C332 RID: 49970 RVA: 0x0046F6BC File Offset: 0x0046D8BC
 public ChatPeer(IPhotonPeerListener listener, ConnectionProtocol protocol) : base(listener, protocol)
 {
 }
Esempio n. 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PhotonPeer"/> class.
 /// </summary>
 /// <param name="listener">
 /// The listener.
 /// </param>
 /// <param name="useTcp">
 /// The use tcp.
 /// </param>
 public PhotonPeer(IPhotonPeerListener listener, bool useTcp)
     : base(listener, useTcp ? ConnectionProtocol.Tcp : ConnectionProtocol.Udp)
 {
     this.ChannelCount = Settings.ChannelCount;
 }
Esempio n. 14
0
 /// <summary>
 /// Creates a LitePeer instance to communicate with Photon with your selection of protocol.
 /// We recommend UDP.
 /// </summary>
 /// <param name="listener">Your IPhotonPeerListener implementation.</param>
 /// <param name="protocolType">Protocol to use to connect to Photon.</param>
 public LitePeer(IPhotonPeerListener listener, ConnectionProtocol protocolType) : base(listener, protocolType)
 {
 }
Esempio n. 15
0
 public LiteLobbyPeer(IPhotonPeerListener listener, bool useTcp)
     : base(listener, useTcp)
 {
 }
Esempio n. 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PhotonPeer"/> class.
 /// </summary>
 /// <param name="listener">
 /// The listener.
 /// </param>
 public PhotonPeer(IPhotonPeerListener listener)
     : base(listener)
 {
     this.ChannelCount = Settings.ChannelCount;
 }
Esempio n. 17
0
 internal TPeer(IPhotonPeerListener listener)
     : this()
 {
     this.Listener = listener;
 }
Esempio n. 18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PhotonPeer"/> class.
 /// </summary>
 /// <param name="listener">
 /// The listener.
 /// </param>
 /// <param name="useTcp">
 /// The use tcp.
 /// </param>
 public PhotonPeer(IPhotonPeerListener listener, bool useTcp)
     : base(listener, useTcp)
 {
     this.ChannelCount = Settings.ChannelCount;
 }
Esempio n. 19
0
 // Token: 0x06003BB4 RID: 15284 RVA: 0x0012C3CE File Offset: 0x0012A7CE
 public LoadBalancingPeer(IPhotonPeerListener listener, ConnectionProtocol protocolType) : this(protocolType)
 {
     base.Listener = listener;
 }
Esempio n. 20
0
 public LiteLobbyPeer(IPhotonPeerListener listener) : base(listener)
 {
 }
Esempio n. 21
0
 public LitePeer(IPhotonPeerListener listener, ConnectionProtocol protocolType)
     : base(listener, protocolType)
 {
 }
Esempio n. 22
0
        }                            // Dummy constructor

        public ChatPeer(IPhotonPeerListener listener, ConnectionProtocol protocol)
        {
        }                                                                                     // 0x0000000182055070-0x0000000182055120
Esempio n. 23
0
 public LitePeer(IPhotonPeerListener listener)
     : base(listener, ConnectionProtocol.Udp)
 {
 }
Esempio n. 24
0
 public PhotonPeer(IPhotonPeerListener listener, bool useTcp)
     : this(listener, useTcp ? ConnectionProtocol.Tcp : ConnectionProtocol.Udp)
 {
 }
Esempio n. 25
0
 /// <summary>
 /// Creates a LitePeer instance to connect and communicate with a Photon server.<para></para>
 /// Uses UDP as protocol (except in the Silverlight library).
 /// </summary>
 /// <param name="listener">Your IPhotonPeerListener implementation.</param>
 public LitePeer(IPhotonPeerListener listener) : base(listener, ConnectionProtocol.Udp)
 {
 }
Esempio n. 26
0
 public ChatPeer(IPhotonPeerListener listener, ConnectionProtocol protocol)
 {
     base.\u002Ector(listener, protocol);
     this.ConfigUnitySockets();
 }
Esempio n. 27
0
 public PhotonPeer(IPhotonPeerListener listener, ConnectionProtocol protocolType) : this(protocolType)
 {
     this.Listener = listener;
 }
Esempio n. 28
0
        internal void DnsAndConnect()
        {
            IPAddress     iPAddress = null;
            AddressFamily addressFamily;

            try
            {
                iPAddress = IPhotonSocket.GetIpAddress(base.ServerAddress);
                if (iPAddress == null)
                {
                    throw new ArgumentException("Invalid IPAddress. Address: " + base.ServerAddress);
                }
                object obj = this.syncer;
                lock (obj)
                {
                    if (base.State != PhotonSocketState.Disconnecting && base.State != 0)
                    {
                        this.sock = new Socket(iPAddress.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
                        this.sock.Connect(iPAddress, base.ServerPort);
                        base.AddressResolvedAsIpv6 = base.IsIpv6SimpleCheck(iPAddress);
                        base.State = PhotonSocketState.Connected;
                        base.peerBase.OnConnect();
                        goto end_IL_003d;
                    }
                    return;

                    end_IL_003d :;
                }
            }
            catch (SecurityException ex)
            {
                if (base.ReportDebugOfLevel(DebugLevel.ERROR))
                {
                    IPhotonPeerListener listener = base.Listener;
                    string[]            obj2     = new string[6]
                    {
                        "Connect() to '",
                        base.ServerAddress,
                        "' (",
                        null,
                        null,
                        null
                    };
                    object obj3;
                    if (iPAddress != null)
                    {
                        addressFamily = iPAddress.AddressFamily;
                        obj3          = addressFamily.ToString();
                    }
                    else
                    {
                        obj3 = "";
                    }
                    obj2[3] = (string)obj3;
                    obj2[4] = ") failed: ";
                    obj2[5] = ex.ToString();
                    listener.DebugReturn(DebugLevel.ERROR, string.Concat(obj2));
                }
                base.HandleException(StatusCode.SecurityExceptionOnConnect);
                return;
            }
            catch (Exception ex2)
            {
                if (base.ReportDebugOfLevel(DebugLevel.ERROR))
                {
                    IPhotonPeerListener listener2 = base.Listener;
                    string[]            obj4      = new string[6]
                    {
                        "Connect() to '",
                        base.ServerAddress,
                        "' (",
                        null,
                        null,
                        null
                    };
                    object obj5;
                    if (iPAddress != null)
                    {
                        addressFamily = iPAddress.AddressFamily;
                        obj5          = addressFamily.ToString();
                    }
                    else
                    {
                        obj5 = "";
                    }
                    obj4[3] = (string)obj5;
                    obj4[4] = ") failed: ";
                    obj4[5] = ex2.ToString();
                    listener2.DebugReturn(DebugLevel.ERROR, string.Concat(obj4));
                }
                base.HandleException(StatusCode.ExceptionOnConnect);
                return;
            }
            Thread thread = new Thread(this.ReceiveLoop);

            thread.IsBackground = true;
            thread.Start();
        }
 public ChatPeer(IPhotonPeerListener listener, ConnectionProtocol protocol) : base(listener, protocol)
 {
     this.ConfigUnitySockets();
 }
Esempio n. 30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PhotonPeer"/> class.
 /// </summary>
 /// <param name="listener">
 /// The listener.
 /// </param>
 /// <param name="useTcp">
 /// The use tcp.
 /// </param>
 public PhotonPeer(IPhotonPeerListener listener, bool useTcp)
     : base(listener, useTcp)
 {
     this.ChannelCount = Settings.ChannelCount;
 }
Esempio n. 31
0
 public PhotonPeer(IPhotonPeerListener listener)
     : this(listener, ConnectionProtocol.Udp)
 {
 }
Esempio n. 32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PhotonPeer"/> class.
 /// </summary>
 /// <param name="listener">
 /// The listener.
 /// </param>
 public PhotonPeer(IPhotonPeerListener listener)
     : base(listener)
 {
     this.ChannelCount = Settings.ChannelCount;
 }
Esempio n. 33
0
 public LoadBalancingPeer(IPhotonPeerListener listener, ConnectionProtocol protocolType)
 {
     base.\u002Ector(listener, protocolType);
 }
Esempio n. 34
0
 public ChatPeer(IPhotonPeerListener listener, ConnectionProtocol protocol) : base(listener, protocol)
 {
     this.ConfigUnitySockets();
 }
    public NetworkingPeer(IPhotonPeerListener listener, string playername, ConnectionProtocol connectionProtocol) : base(listener, connectionProtocol)
    {
        #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 (PhotonHandler.PingImplementation == null)
        {
            PhotonHandler.PingImplementation = typeof(PingMono);
        }

        this.Listener = this;
        this.lobby = TypedLobby.Default;
        this.LimitOfUnreliableCommands = 40;

        // don't set the field directly! the listener is passed on to other classes, which get updated by the property set method
        this.externalListener = listener;
        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;
    }
Esempio n. 36
0
 public LiteLobbyPeer(IPhotonPeerListener listener)
     : base(listener)
 {
 }
Esempio n. 37
0
 public LoadbalancingPeer(IPhotonPeerListener listener, ConnectionProtocol protocolType)
     : base(listener, protocolType)
 {
 }
Esempio n. 38
0
 /// <summary>
 /// Creates a Peer with default connection protocol (UDP).
 /// </summary>
 public LoadBalancingPeer(IPhotonPeerListener listener, ConnectionProtocol protocolType) : base(listener, protocolType)
 {
 }
    public NetworkingPeer(IPhotonPeerListener listener, string playername, ConnectionProtocol connectionProtocol)
        : base(listener, connectionProtocol)
    {
        this.Listener = this;

        // don't set the field directly! the listener is passed on to other classes, which get updated by the property set method
        this.externalListener = listener;
        this.PlayerName = playername;
        this.mLocalActor = new PhotonPlayer(true, -1, this.playername);
        this.AddNewPlayer(this.mLocalActor.ID, this.mLocalActor);

        this.State = global::PeerState.PeerCreated;
    }