Ejemplo n.º 1
0
        private void SendUserCmds()
        {
            var last = new UserCmd();

            using (var stream = Bitstream.Create())
            {
                var move = new CCLCMsg_Move();

                move.num_backup_commands = (uint) backup.Count;
                foreach (var cmd in backup)
                {
                    WriteUserCmd(cmd, last, stream);
                    last = cmd;
                }

                move.num_new_commands = (uint) next.Count;
                foreach (var cmd in next)
                {
                    WriteUserCmd(cmd, last, stream);
                    last = cmd;
                }

                backup.Clear();
                backup.AddRange(next);
                next.Clear();

                move.data = stream.ToBytes();

                var tick = new CNETMsg_Tick();
                tick.tick = state.ServerTick;

                connection.SendUnreliably(
                    DotaGameConnection.ConvertProtoToMessage((uint) CLC_Messages.clc_Move, move),
                    DotaGameConnection.ConvertProtoToMessage((uint) NET_Messages.net_Tick, tick));
            }
        }
Ejemplo n.º 2
0
        private Events? Handle(CNETMsg_Tick message)
        {
            if (message.tick > state.ClientTick)
            {
                state.ClientTick = message.tick;
            }

            state.ServerTick = message.tick;

            return null;
        }