/// <summary> /// /// </summary> /// <param name="msg"></param> void DispatchUserCommand ( GameTime gameTime, SnapshotQueue queue, NetIncomingMessage msg ) { var snapshotID = msg.ReadUInt32(); var commandID = msg.ReadUInt32(); var size = msg.ReadInt32(); var data = msg.ReadBytes( size ); // we got user command and (command count=1) // this means that client receives snapshot: if (msg.SenderConnection.GetCommandCount()==1) { ClientActivated( msg.SenderConnection.GetHailGuid() ); } // do not feed server with empty command. if (data.Length>0) { FeedCommand( msg.SenderConnection.GetHailGuid(), data, commandID, queue.GetLag(snapshotID, gameTime) ); } // set snapshot request when command get. msg.SenderConnection.SetRequestSnapshot( snapshotID, commandID ); }