Ejemplo n.º 1
0
        /// <inheritdoc />
        public override void WriteJson(JsonWriter writer, Vector3[] value, JsonSerializer serializer)
        {
            Vector3Converter singleConverter = new Vector3Converter();

            writer.WriteStartArray();
            for (int i = 0; i < value.Length; i++)
            {
                ref Vector3 refVector = ref value[i];
                singleConverter.WriteJson(writer, refVector, serializer);
            }
 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);
 }
Ejemplo n.º 3
0
        public static bool HasVector3(this XmlElement xml, string attribute, out Vector3 value)
        {
            value = Vector3.zero;
            if (!xml.HasAttribute(attribute))
            {
                return(false);
            }

            return(Vector3Converter.Convert(xml.Attributes[attribute], ref value));
        }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
        public void AddBulletData(int seq, Vector3 startPoint, Vector3 emitPoint, Vector3 startDir, Vector3 hitPoint, int hitType, INetworkChannel networkChannel)
        {
            _total += 1;
            var msg = FireInfoMessage.Allocate();

            msg.Seq        = seq;
            msg.StartPoint = Vector3Converter.UnityToProtobufVector3(startPoint);
            msg.StartDir   = Vector3Converter.UnityToProtobufVector3(startDir);
            msg.EmitPoint  = Vector3Converter.UnityToProtobufVector3(emitPoint);
            msg.HitPoint   = Vector3Converter.UnityToProtobufVector3(hitPoint);
            msg.HitType    = hitType;
            if (null != _networkChannel)
            {
                _networkChannel.SendReliable((int)EClient2ServerMessage.FireInfo, msg);
            }
            else
            {
                Logger.Error("NetworkChannel is null");
            }
            msg.ReleaseReference();
        }
Ejemplo n.º 6
0
        public static void CollectBulletInfoC(BulletEntity entity, INetworkChannel networkChannel)
        {
            if (networkChannel == null)
            {
                return;
            }
            var cmd     = entity.bulletData.CmdSeq;
            var start   = entity.bulletData.StartPoint;
            var emit    = entity.bulletData.EmitPoint;
            var dir     = entity.bulletData.StartDir;
            var hit     = entity.bulletData.HitPoint;
            var hitType = entity.bulletData.HitType;
            var msg     = FireInfoMessage.Allocate();

            msg.Seq        = cmd;
            msg.StartPoint = Vector3Converter.UnityToProtobufVector3(start);
            msg.EmitPoint  = Vector3Converter.UnityToProtobufVector3(emit);
            msg.StartDir   = Vector3Converter.UnityToProtobufVector3(dir);
            msg.HitPoint   = Vector3Converter.UnityToProtobufVector3(hit);
            msg.HitType    = (int)hitType;
            networkChannel.SendReliable((int)EClient2ServerMessage.FireInfo, msg);
            msg.ReleaseReference();
        }
Ejemplo n.º 7
0
 public void Setup()
 {
     converter = new Vector3Converter();
 }