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, FireInfoMessage messageBody) { BulletStatisticsUtil.HandleClientFireInfoToSrv(messageBody.Seq, Vector3Converter.ProtobufToUnityVector3(messageBody.StartPoint), Vector3Converter.ProtobufToUnityVector3(messageBody.EmitPoint), Vector3Converter.ProtobufToUnityVector3(messageBody.StartDir), Vector3Converter.ProtobufToUnityVector3(messageBody.HitPoint), messageBody.HitType, channel); }
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(); }
public override void DoHandle(INetworkChannel channel, PlayerEntity entity, EClient2ServerMessage eClient2ServerMessage, FireInfoMessage messageBody) { _bulletInfoCollector.AddClientBulletData(messageBody.Seq, Vector3Converter.ProtobufToUnityVector3(messageBody.StartPoint), Vector3Converter.ProtobufToUnityVector3(messageBody.EmitPoint), Vector3Converter.ProtobufToUnityVector3(messageBody.StartDir), Vector3Converter.ProtobufToUnityVector3(messageBody.HitPoint), messageBody.HitType, channel); }
public override void DoHandle(INetworkChannel channel, PlayerEntity entity, EClient2ServerMessage eClient2ServerMessage, ReusableList <UpdateLatestPacakge> messageBody) { var pool = entity.updateMessagePool.UpdateMessagePool; foreach (var updateLatestPacakge in messageBody.Value) { pool.AddMessage(updateLatestPacakge); updateLatestPacakge.ReleaseReference(); _logger.DebugFormat("DoHandle:{0}", updateLatestPacakge.Head.UserCmdSeq); entity.network.NetworkChannel.Serializer.MessageTypeInfo.SetReplicationAckId(updateLatestPacakge.Head.LastSnapshotId); } }
public override void DoHandle(INetworkChannel channel, PlayerEntity entity, EClient2ServerMessage eClient2ServerMessage, ReusableList <IVehicleCmd> messageBody) { //_logger.DebugFormat("Server VehicleCmd seq is {0}", messageBody.Seq); var vehicle = PlayerVehicleUtility.GetControlledVehicle(entity, _contexts.vehicle); var cmdList = messageBody.Value; if (vehicle != null) { vehicle.vehicleCmd.AddLatestList(cmdList); } CheckVehicleCmdList(cmdList); }
public override void DoHandle(INetworkChannel channel, PlayerEntity entity, EClient2ServerMessage eClient2ServerMessage, IVehicleSyncEvent messageBody) { var sourceKey = new EntityKey(messageBody.SourceObjectId, (short)EEntityType.Vehicle); var vehicle = _contexts.vehicle.GetEntityWithEntityKey(sourceKey); if (vehicle != null) { vehicle.vehicleSyncEvent.SyncEvents.Enqueue(messageBody); messageBody.AcquireReference(); } else { _logger.InfoFormat("Can not found vehicle {0} for vehicle sync event {1}", sourceKey.EntityId, messageBody.EType); } }
public override void DoHandle(INetworkChannel channel, PlayerEntity entity, EClient2ServerMessage eClient2ServerMessage, DebugScriptInfo messageBody) { if (_handler != null) { try { _logger.DebugFormat("Receive Debug Script Message {0}", messageBody.Info); _handler(messageBody.Info); } catch (Exception e) { _logger.ErrorFormat("DebugScriptInfo Process Error {0}", e); } } }
public override void DoHandle(INetworkChannel channel, PlayerEntity entity, EClient2ServerMessage eClient2ServerMessage, DebugCommandMessage commandMessageBody) { _logger.InfoFormat("Debug message", commandMessageBody.Command); DebugCommand cmd = new DebugCommand(commandMessageBody.Command, commandMessageBody.Args.ToArray()); try { _handler.OnDebugMessage(room, cmd, entity, _sessionStateMachine); } catch (Exception e) { _logger.ErrorFormat("Error while exe debug command {0} {1} {2}", commandMessageBody, e.ToString(), e.StackTrace); } }
public override void DoHandle(INetworkChannel channel, PlayerEntity entity, EClient2ServerMessage eClient2ServerMessage, TriggerObjectSyncEvent messageBody) { var sourceKey = new EntityKey(messageBody.SourceObjectId, (short)EEntityType.MapObject); var mapObject = _contexts.mapObject.GetEntityWithEntityKey(sourceKey); if (mapObject != null) { mapObject.triggerObjectEvent.SyncEvents.Enqueue(messageBody); messageBody.AcquireReference(); if (!mapObject.isTriggerObjectEventFlag) { //_logger.ErrorFormat("Received Trigger Object Event {0}", messageBody.EType); mapObject.isTriggerObjectEventFlag = true; } } else { _logger.InfoFormat("Can not found SceneObject {0} for trigger object sync event {1}", sourceKey.EntityId, messageBody.EType); } }
public override void DoHandle(INetworkChannel channel, PlayerEntity entity, EClient2ServerMessage eClient2ServerMessage, ReusableList <IUserCmd> messageBody) { var cmdList = messageBody.Value; entity.userCmd.AddLatestList(cmdList); entity.network.NetworkChannel.Serializer.MessageTypeInfo.SetReplicationAckId(entity.userCmd.Latest.SnapshotId); var lastCmd = cmdList[cmdList.Count - 1]; var firstCmd = cmdList[0]; #pragma warning disable RefCounter002 // possible reference counter error var cmd = firstCmd.Seq > lastCmd.Seq ? firstCmd : lastCmd; #pragma warning restore RefCounter002 // possible reference counter error if (_logger.IsDebugEnabled) { _logger.DebugFormat("received usercmd message, seq {0}, ack snapshot {1}", cmd.Seq, cmd.SnapshotId); } CheckVehicleCmdList(cmdList); }
public abstract void DoHandle(INetworkChannel channel, TPlayer entity, EClient2ServerMessage eClient2ServerMessage, TMessage messageBody);
public override void DoHandle(INetworkChannel channel, PlayerEntity entity, EClient2ServerMessage eClient2ServerMessage, GameOverMesssage messageBody) { _logger.InfoFormat("Server Recevie GameOver Message From Player {0}", entity.entityKey.Value); channel.Disconnect(); }
public override void DoHandle(INetworkChannel channel, PlayerEntity entity, EClient2ServerMessage eClient2ServerMessage, SimulationTimeMessage messageBody) { _server.OnSimulationTimeMessage(entity.network.NetworkChannel, messageBody); }
public override void DoHandle(INetworkChannel channel, PlayerEntity entity, EClient2ServerMessage eClient2ServerMessage, SimpleProto messageBody) { FreeMessageHandler.Handle(_room, entity, messageBody); }