Пример #1
0
 public static void ToProtoBuf(UserCmdMessage rc, ReusableList <IUserCmd> list)
 {
     foreach (var item in list.Value)
     {
         UserCmdItem cmd = UserCmdItem.Allocate();
         {
             cmd.RenderTime     = item.RenderTime;
             cmd.FrameInterval  = item.FrameInterval;
             cmd.Buttons        = item.Buttons;
             cmd.MoveHorizontal = item.MoveHorizontal;
             cmd.MoveVertical   = item.MoveVertical;
             cmd.MoveUpDown     = item.MoveUpDown;
             cmd.Seq            = item.Seq;
             cmd.DeltaPitch     = item.DeltaPitch;
             cmd.DeltaYaw       = item.DeltaYaw;
             cmd.SwitchNumber   = item.SwitchNumber;
             cmd.ChangedSeat    = item.ChangedSeat;
             cmd.ChangeChannel  = item.ChangeChannel;
             cmd.SnapshotId     = item.SnapshotId;
             cmd.CurWeapon      = item.CurWeapon;
             cmd.PickUpEquip    = item.PickUpEquip;
             cmd.UseVehicleId   = item.UseEntityId;
             cmd.UseVehicleSeat = item.UseVehicleSeat;
             cmd.UseType        = item.UseType;
             cmd.BagIndex       = item.BagIndex;
         };
         rc.UserCmdList.Add(cmd);
     }
 }
Пример #2
0
        public static ReusableList <IUserCmd> FromProtoBuf(UserCmdMessage message)
        {
            ReusableList <IUserCmd> list = ReusableList <IUserCmd> .Allocate();

            var count = message.UserCmdList.Count;

            for (int i = 0; i < count; i++)
            {
                var     item = message.UserCmdList[i];
                UserCmd cmd  = UserCmd.Allocate();
                cmd.RenderTime     = item.RenderTime;
                cmd.FrameInterval  = item.FrameInterval;
                cmd.MoveHorizontal = item.MoveHorizontal;
                cmd.MoveVertical   = item.MoveVertical;
                cmd.MoveUpDown     = item.MoveUpDown;
                cmd.Seq            = item.Seq;
                cmd.DeltaPitch     = item.DeltaPitch;
                cmd.DeltaYaw       = item.DeltaYaw;
                cmd.Buttons        = item.Buttons;
                cmd.BeState        = item.BeState;
                cmd.SwitchNumber   = item.SwitchNumber;
                cmd.ChangedSeat    = item.ChangedSeat;
                cmd.ChangeChannel  = item.ChangeChannel;
                cmd.SnapshotId     = item.SnapshotId;
                cmd.CurWeapon      = item.CurWeapon;
                cmd.PickUpEquip    = item.PickUpEquip;
                cmd.UseEntityId    = item.UseVehicleId;
                cmd.UseVehicleSeat = item.UseVehicleSeat;
                cmd.UseType        = item.UseType;
                cmd.BagIndex       = item.BagIndex;
                list.Value.Add(cmd);
            }
            return(list);
        }
Пример #3
0
        public object Deserialize(Stream inStream)
        {
            UserCmdMessage msg = (UserCmdMessage)_serialize.Deserialize(inStream);
            object         rc  = UserCmdMessageConverter.FromProtoBuf(msg);

            msg.ReleaseReference();
            return(rc);
        }
Пример #4
0
        public void Serialize(Stream outStream, object message)
        {
            ReusableList <IUserCmd> list = (ReusableList <IUserCmd>)message;
            UserCmdMessage          msg  = UserCmdMessage.Allocate();

            UserCmdMessageConverter.ToProtoBuf(msg, list);
            _serialize.Serialize(outStream, msg);
            msg.ReleaseReference();
        }