Inheritance: ClientPeer, IPhotonWirePeer
コード例 #1
0
        protected sealed override PeerBase CreatePeer(InitRequest initRequest)
        {
            Logger.PeerReceived(ApplicationName, initRequest.ApplicationId, initRequest.ClientVersion?.ToString() ?? "", initRequest.ConnectionId, initRequest.RemoteIP, initRequest.RemotePort);

            if (IsServerToServerPeer(initRequest))
            {
                // Server-Server Connection
                var s2sPeer = new PhotonWireInboundS2SPeer(initRequest);
                PeerManager.InboundServerConnections.Add(s2sPeer);
                OnPeerCreated(s2sPeer, initRequest, true);
                return(s2sPeer);
            }
            else
            {
                // Client-Server Connection
                var peer = new PhotonWireClientPeer(initRequest);

                // PhotonWire.HubInvoker use only Json, flag is embeded.
                if (initRequest.InitObject != null && initRequest.InitObject.ToString() == "UseJsonSerializer")
                {
                    peer.Items["PhotonWireApplicationBase.ModifySerializer"] = PhotonSerializers.Json;
                }

                PeerManager.ClientConnections.Add(peer);
                OnPeerCreated(peer, initRequest, false);
                return(peer);
            }
        }
コード例 #2
0
 public Subscription(PhotonWireClientPeer peer, Action<int, string> action)
 {
     this.peer = peer;
     this.action = action;
 }
コード例 #3
0
 public Subscription(PhotonWireClientPeer peer, Action <int, string> action)
 {
     this.peer   = peer;
     this.action = action;
 }
コード例 #4
0
        protected sealed override PeerBase CreatePeer(InitRequest initRequest)
        {
            Logger.PeerReceived(ApplicationName, initRequest.ApplicationId, initRequest.ClientVersion?.ToString() ?? "", initRequest.ConnectionId, initRequest.RemoteIP, initRequest.RemotePort);

            if (IsServerToServerPeer(initRequest))
            {
                // Server-Server Connection
                var s2sPeer = new PhotonWireInboundS2SPeer(initRequest);
                PeerManager.InboundServerConnections.Add(s2sPeer);
                OnPeerCreated(s2sPeer, initRequest, true);
                return s2sPeer;
            }
            else
            {
                // Client-Server Connection
                var peer = new PhotonWireClientPeer(initRequest);

                // PhotonWire.HubInvoker use only Json, flag is embeded.
                if (initRequest.InitObject != null && initRequest.InitObject.ToString() == "UseJsonSerializer")
                {
                    peer.Items["PhotonWireApplicationBase.ModifySerializer"] = PhotonSerializers.Json;
                }

                PeerManager.ClientConnections.Add(peer);
                OnPeerCreated(peer, initRequest, false);
                return peer;
            }
        }