コード例 #1
0
ファイル: SignonProcessor.cs プロジェクト: hot1989hot/nora
        private Event? Process(CNETMsg_Tick message) {
            log.Debug(String.Format("CNETMsg_Tick: tick {0}", message.tick));

            if (message.tick > client.ClientTick) {
                client.ClientTick = message.tick;
            }

            client.ServerTick = message.tick;

            return null;
        }
コード例 #2
0
ファイル: UserCmdGenerator.cs プロジェクト: hot1989hot/nora
        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 = client.ServerTick;

                connection.SendUnreliably(
                    Connection.ConvertProtoToMessage<CCLCMsg_Move>((uint) CLC_Messages.clc_Move, move),
                    Connection.ConvertProtoToMessage<CNETMsg_Tick>((uint) NET_Messages.net_Tick, tick));
            }
        }