当前位置: 首页>>代码示例>>C#>>正文


C# IRpcProtocol类代码示例

本文整理汇总了C#中IRpcProtocol的典型用法代码示例。如果您正苦于以下问题:C# IRpcProtocol类的具体用法?C# IRpcProtocol怎么用?C# IRpcProtocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IRpcProtocol类属于命名空间,在下文中一共展示了IRpcProtocol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetPropertiesRequest

        /// <summary>
        /// Initializes a new instance of the <see cref="SetPropertiesRequest"/> class.
        /// </summary>
        /// <param name="protocol">
        /// The protocol.
        /// </param>
        /// <param name="operationRequest">
        /// Operation request containing the operation parameters.
        /// </param>
        public SetPropertiesRequest(IRpcProtocol protocol, OperationRequest operationRequest)
            : base(protocol, operationRequest)
        {
            if (!this.IsValid)
            {
                return;
            }

            // special handling for game and actor properties send by AS3/Flash (Amf3 protocol) or JSON clients
            if (protocol.ProtocolType == ProtocolType.Amf3V16 || protocol.ProtocolType == ProtocolType.Json)
            {
                if (this.UpdatingGameProperties)
                {
                    Utilities.ConvertAs3WellKnownPropertyKeys(this.Properties, null);
                    Utilities.ConvertAs3WellKnownPropertyKeys(this.ExpectedValues, null);
                }
                else
                {
                    Utilities.ConvertAs3WellKnownPropertyKeys(null, this.Properties);
                    Utilities.ConvertAs3WellKnownPropertyKeys(null, this.ExpectedValues);
                }
            }

            if (this.UpdatingGameProperties)
            {
                this.isValid = GameParameterReader.TryGetProperties(this.Properties, out this.newMaxPlayer,
                    out this.newIsOpen, out this.newIsVisible,
                    out this.newLobbyProperties, out this.MasterClientId,
                    out this.ExpectedUsers, out this.errorMessage);
            }
        }
开发者ID:JerryBian,项目名称:PhotonSample,代码行数:40,代码来源:SetPropertiesRequest.cs

示例2: OutgoingMasterServerPeer

 public OutgoingMasterServerPeer(IRpcProtocol protocol, IPhotonPeer nativePeer, GameApplication application)
     : base(protocol, nativePeer)
 {
     this.application = application;
     log.InfoFormat("connection to master at {0}:{1} established (id={2}), serverId={3}", this.RemoteIP, this.RemotePort, this.ConnectionId, GameApplication.ServerId);
     this.RequestFiber.Enqueue(this.Register);
 }
开发者ID:azanium,项目名称:PopBloop-GameServer,代码行数:7,代码来源:OutgoingMasterServerPeer.cs

示例3: StarCollectorPeer

    public StarCollectorPeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer)
        : base(protocol, unmanagedPeer)
    {
        #region Assigned ID
        lock (allocateIDLock)
        {
            playerID = lastAssignedID;
            lastAssignedID++;
        }

        //notify player of their ID
        EventData evt = new EventData()
        {
            Code = (byte)AckEventType.AssignPlayerID,
            Parameters = new Dictionary<byte, object>()
            {
                { (byte)Parameter.PlayerID, this.playerID }
            }
        };
        evt.Parameters[(byte)Parameter.PlayerID] = playerID;
        this.SendEvent(evt, new SendParameters());
        #endregion

        #region Join to world
        lock (StarCollectorGame.Instance)
        {
            StarCollectorGame.Instance.PeerJoined(this);
        }
        #endregion
    }
开发者ID:anhle128,项目名称:demo_photon_with_unity,代码行数:30,代码来源:StarCollectorPeer.cs

示例4: OutgoingMasterServerPeer

 public OutgoingMasterServerPeer(IRpcProtocol protocol, IPhotonPeer nativePeer, SubServer subServer)
     : base(protocol, nativePeer)
 {
     _application = subServer;
     Log.InfoFormat("connection to master at {0}:{1} established (id={2})", RemoteIP, RemotePort, ConnectionId);
     RequestFiber.Enqueue(Register);
 }
开发者ID:Antaresgames,项目名称:AegisBornPhoton,代码行数:7,代码来源:OutgoingMasterServerPeer.cs

示例5: REPeer

 public REPeer(IRpcProtocol rpcprotocol, IPhotonPeer nativePeer, REServer serverApplication)
     : base(rpcprotocol,nativePeer)
 {
     guid = Guid.NewGuid();
     server = serverApplication;
     server.wandererDictionary.Add(guid, this);
 }
开发者ID:DSobscure,项目名称:Resource-Emperor,代码行数:7,代码来源:REPeer.cs

示例6: ChatPeer

 public ChatPeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer)
     : base(protocol, unmanagedPeer)
 {
     lock (syncRoot)
     {
         BroadcastMessage += this.OnBroadcastMessage;
     }
 }
开发者ID:rkdrnf,项目名称:photonserver,代码行数:8,代码来源:ChatPeer.cs

示例7: LatencyPeer

 public LatencyPeer(IRpcProtocol protocol, IPhotonPeer nativePeer)
     : base(protocol, nativePeer)
 {
     if (log.IsDebugEnabled)
     {
         log.DebugFormat("Latency monitoring client connected, serverId={0}", GameApplication.ServerId);
     }
 }
开发者ID:azanium,项目名称:PopBloop-GameServer,代码行数:8,代码来源:LatencyPeer.cs

示例8: GetPropertiesRequest

 /// <summary>
 ///   Initializes a new instance of the <see cref = "GetPropertiesRequest" /> class.
 /// </summary>
 /// <param name = "protocol">
 ///   The protocol.
 /// </param>
 /// <param name = "operationRequest">
 ///   Operation request containing the operation parameters.
 /// </param>
 public GetPropertiesRequest(IRpcProtocol protocol, OperationRequest operationRequest)
     : base(protocol, operationRequest)
 {
     // special treatment for game and actor properties sent by AS3/Flash or JSON clients
     if (protocol.ProtocolType == ProtocolType.Amf3V16 || protocol.ProtocolType == ProtocolType.Json)
     {
         Utilities.ConvertAs3WellKnownPropertyKeys(this.GamePropertyKeys, this.ActorPropertyKeys);
     }
 }
开发者ID:JerryBian,项目名称:PhotonSample,代码行数:18,代码来源:GetPropertiesRequest.cs

示例9: ServerPeer

        /// <summary>
        /// 类型:方法
        /// 名称:ServerPeer
        /// 作者:taixihuase
        /// 作用:构造 ServerPeer 对象
        /// 编写日期:2015/7/12
        /// </summary>
        /// <param name="protocol"></param>
        /// <param name="unmanagedPeer"></param>
        /// <param name="server"></param>
        public ServerPeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer, ServerApplication server)
            : base(protocol, unmanagedPeer)
        {
            PeerGuid = Guid.NewGuid();
            Server = server;

            // 将当前 peer 加入连线列表
            Server.Users.AddConnectedPeer(PeerGuid, this);
        }
开发者ID:taixihuase,项目名称:SiegeOnline,代码行数:19,代码来源:ServerPeer.cs

示例10: MmoPeer

        public MmoPeer(IRpcProtocol rpcProtocol, IPhotonPeer nativePeer)
            : base(rpcProtocol, nativePeer)
        {
            // this is the operation handler before entering a world
            this.SetCurrentOperationHandler(this);

            #region PopBloop

            string configFile = Path.Combine(DbSettings.BinaryPath, "PopBloopServer.config");
            if (File.Exists(configFile))
            {
                using (StreamReader reader = new StreamReader(configFile))
                {
                    string line = reader.ReadLine();

                    if (line.Length > 1)
                    {
                        string[] config = line.Split('@');
                        string address = config[1];
                        string username = config[0];
                        if (address.Trim().Length > 1 && address.Contains(":"))
                        {
                            DbSettings.DBServerAddress = address;
                            log.Info("DBServerAddress: " + address);
                        }

                        if (username.Trim().Length > 1 && username.Contains(":"))
                        {
                            string[] credentials = username.Split(':');
                            if (credentials.Length == 2)
                            {
                                DbSettings.DBServerUsername = credentials[0];
                                DbSettings.DBServerPassword = credentials[1];
                                log.Info("DBUserName: " + credentials[0] + ", DBPassword: " + credentials[1]);
                            }
                            else
                            {
                                log.Error("No credentials found on PopBloopServer.config");
                            }
                        }
                        else
                        {
                            log.Info("Credentials Invalid: '" + username +"'");
                        }
                    }
                }
            }

            #endregion
        }
开发者ID:azanium,项目名称:PopBloop-Unity,代码行数:50,代码来源:MmoPeer.cs

示例11: JoinGameRequest

        /// <summary>
        /// Initializes a new instance of the <see cref="JoinGameRequest"/> class.
        /// </summary>
        /// <param name="protocol">
        /// The protocol.
        /// </param>
        /// <param name="operationRequest">
        /// Operation request containing the operation parameters.
        /// </param>
        public JoinGameRequest(IRpcProtocol protocol, OperationRequest operationRequest)
            : base(protocol, operationRequest)
        {
            if (!this.IsValid)
            {
                return;
            }

            // special treatment for game and actor properties sent by AS3/Flash or JSON clients
            var protocolId = protocol.ProtocolType;
            if (protocolId == ProtocolType.Amf3V16 || protocolId == ProtocolType.Json)
            {
                Utilities.ConvertAs3WellKnownPropertyKeys(this.GameProperties, this.ActorProperties);
            }

            this.SetupRequest();
        }
开发者ID:JerryBian,项目名称:PhotonSample,代码行数:26,代码来源:JoinGameRequest.cs

示例12: ActorPeer

        public ActorPeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer)
            : base(protocol, unmanagedPeer)
        {
            #region Assigned ID
            lock (allocateIDLock)
            {
                playerID = lastAssignedID;
                lastAssignedID++;
            }
            #endregion

            #region Join to Arena
            lock (ServerArena.Instance)
            {
                ServerArena.Instance.Enter(this);
            }
            #endregion
        }
开发者ID:anhle128,项目名称:demo_photon_with_unity,代码行数:18,代码来源:ActorPeer.cs

示例13: LatencyMonitor

        public LatencyMonitor(
            IRpcProtocol protocol, IPhotonPeer nativePeer, byte operationCode, int maxHistoryLength, int intervalMs, WorkloadController workloadController)
            : base(protocol, nativePeer)
        {
            this.operationCode = operationCode;
            this.intervalMs = intervalMs;
            this.workloadController = workloadController;
            this.latencyHistory = new ValueHistory(maxHistoryLength);
            this.averageLatencyMs = 0;
            this.lastLatencyMs = 0;

            log.InfoFormat("{1} connection for latency monitoring established (id={0}), serverId={2}", this.ConnectionId, this.NetworkProtocol, GameApplication.ServerId);

            if (!Stopwatch.IsHighResolution)
            {
                log.InfoFormat("No hires stopwatch!");
            }
            
            this.pingTimer = this.RequestFiber.ScheduleOnInterval(this.Ping, 0, this.intervalMs);
        }
开发者ID:ommziSolution,项目名称:PhotonServer,代码行数:20,代码来源:LatencyMonitor.cs

示例14: PhotonAckPeer

        public PhotonAckPeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer)
            : base(protocol, unmanagedPeer)
        {
            lock (lockPlayerID)
            {
                this.playerID = lastAssignedPlayerID;
                lastAssignedPlayerID++;
            }
            PhotonAckGame.Instance.PeerConnected(this);

            EventData evn = new EventData((byte)AckEventType.AssignPlayerID)
            {
                Parameters = new Dictionary<byte, object>()
                {
                    { (byte)Parameter.PlayerID, this.playerID }
                }
            };
            Console.WriteLine("PhotonAckPeer PlayerID: " + this.playerID);
            this.SendEvent(evn,new SendParameters());
            Console.WriteLine("PhotonAckPeer SendEvent");
        }
开发者ID:anhle128,项目名称:demo_photon_with_unity,代码行数:21,代码来源:PhotonAckPeer.cs

示例15: RemoveGameEvent

 public RemoveGameEvent(IRpcProtocol protocol, IEventData eventData)
     : base(protocol, eventData.Parameters)
 {
 }
开发者ID:ommziSolution,项目名称:PhotonServer,代码行数:4,代码来源:RemoveGameEvent.cs


注:本文中的IRpcProtocol类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。