public override void DoHandle(INetworkChannel channel, PlayerEntity entity, EClient2ServerMessage eClient2ServerMessage, PingRequestMessage messageBody) { var serverStatus = _contexts.session.serverSessionObjects.FpsSatatus; var request = messageBody; var resp = Protobuf.PingMessage.Allocate(); resp.Id = request.Id; resp.Type = request.Type; resp.Time = request.Time; resp.AvgDelta = (int)(serverStatus.AvgDelta); resp.MaxDelta = (int)(serverStatus.MaxDelta); resp.CmdLose = 100; resp.CmdTotal = 100; resp.Fps5 = serverStatus.Fps5; resp.Fps30 = serverStatus.Fps30; resp.Fps60 = serverStatus.Fps60; resp.GcCount = System.GC.CollectionCount(0); resp.GcStatus = SingletonManager.Get <gc_manager>().d_gc_disabled; resp.AllocatedMb = (int)SingletonManager.Get <gc_manager>().allocated_mb; resp.AllocationRateMbps = (int)SingletonManager.Get <gc_manager>().average_allocation_rate_mbps; if (request.Type) { channel.SendReliable((int)EServer2ClientMessage.Ping, resp); } else { channel.SendRealTime((int)EServer2ClientMessage.Ping, resp); } resp.ReleaseReference(); }
public override void DoHandle(INetworkChannel channel, PlayerEntity entity, EClient2ServerMessage eClient2ServerMessage, ReusableList <UpdateLatestPacakge> messageBody) { var messageAck = UpdateMessageAck.Allocate(); messageAck.AckSeq = channel.Serializer.MessageTypeInfo.LatestUpdateMessageSeq; _logger.DebugFormat("UserUpdateAckMsgHandler:{0}", messageAck.AckSeq); channel.SendRealTime((int)EServer2ClientMessage.UpdateAck, messageAck); messageAck.ReleaseReference(); }
private void UdpMsg(INetworkChannel channel) { var ping = PingRequestMessage.Allocate(); ping.Id = _seq; ping.Type = false; ping.Time = DateTime.UtcNow.ToMillisecondsSinceEpoch(); channel.SendRealTime((int)EClient2ServerMessage.Ping, ping); ping.ReleaseReference(); }
private void SendUserCmd(PlayerEntity player, INetworkChannel channel) { var list = player.userCmd.CreateLatestList(); if (channel != null) { channel.SendRealTime((int)EClient2ServerMessage.UserCmd, list); } list.ReleaseReference(); }
private void SendUserCmd(PlayerEntity player, INetworkChannel channel) { var list = player.userCmd.CreateLatestList(); if (channel != null) { channel.SendRealTime((int)EClient2ServerMessage.UserCmd, list); } _logger.DebugFormat("SendUserCmd:{0}", list.Value.Last().Seq); list.ReleaseReference(); }
private void SendVehicleCmd(PlayerEntity player, INetworkChannel channel) { var controlledVehicle = PlayerVehicleUtility.GetControlledVehicle(player, _contexts.vehicle); if (controlledVehicle != null) { var list = controlledVehicle.vehicleCmd.CreateLatestList(); if (channel != null && list.Value.Count > 0) { channel.SendRealTime((int)EClient2ServerMessage.VehicleCmd, list); } list.ReleaseReference(); } }
private void SendUpdateMessage(PlayerEntity player, INetworkChannel channel) { if (player.userCmd.Latest == null) { return; } _sessionObjects.UpdateLatestHandler.UserCmd = player.userCmd.Latest.Seq; var pacakge = _updateLatestManager.CreateUpdateSnapshot(player.entityKey.Value); if (channel != null) { channel.SendRealTime((int)EClient2ServerMessage.UpdateMsg, pacakge); } pacakge.ReleaseReference(); }
//只同步自己Entity private void SendUpdateMessage(PlayerEntity player, INetworkChannel channel) { if (player.userCmd.Latest == null) { return; } _sessionObjects.ClientUpdateLatestMgr.LastLocalUserCmd = player.userCmdSeq.LastCmdSeq; var pacakge = _sessionObjects.ClientUpdateLatestMgr.CreateClientUpdateLatestPacakge(player.entityKey.Value); if (channel != null) { channel.SendRealTime((int)EClient2ServerMessage.UpdateMsg, pacakge); } _logger.DebugFormat("SendUserCmd:seq:{0} msg:{1} last;{2}", MyGameTime.seq, pacakge.Head.LastUserCmdSeq, player.userCmd.Latest.Seq); pacakge.ReleaseReference(); }