Example #1
0
            /// <summary>
            /// Creates instance of Active client state.
            /// </summary>
            /// <param name="gameClient"></param>
            /// <param name="snapshotId"></param>
            /// <param name="initialSnapshot"></param>
            public Active(ClientContext context, uint snapshotId, byte[] initialSnapshot, long svTicks) : base(context.GameClient, ClientState.Active)
            {
                this.context = context;

                queue = new SnapshotQueue(32);
                queue.Push(new Snapshot(snapshotId, initialSnapshot));

                lastServerTicks   = svTicks;
                lastSnapshotID    = snapshotId;
                lastSnapshotFrame = snapshotId;

                Message = "";


                                #if USE_DEJITTER
                jitter = new JitterBuffer(gameClient.Game, svTicks);
                                #endif


                stopwatch = new Stopwatch();
                stopwatch.Start();
                clientTicks = stopwatch.Elapsed.Ticks;


                context.Instance.FeedSnapshot(new GameTime(0, svTicks, 0L), initialSnapshot, 0);
            }
			/// <summary>
			/// Creates instance of Active client state.
			/// </summary>
			/// <param name="gameClient"></param>
			/// <param name="snapshotId"></param>
			/// <param name="initialSnapshot"></param>
			public Active ( GameClient gameClient, uint snapshotId, byte[] initialSnapshot, long svTicks ) : base(gameClient, ClientState.Active)
			{
				queue	=	new SnapshotQueue(32);
				queue.Push( new Snapshot( new TimeSpan(0), snapshotId, initialSnapshot) );

				lastServerTicks		=	svTicks;
				lastSnapshotID		=	snapshotId;
				lastSnapshotFrame	=	snapshotId;

				Message				=	"";


				#if USE_DEJITTER
				jitter		=	new JitterBuffer( gameClient.Game, svTicks );
				#endif


				stopwatch	=	new Stopwatch();
				stopwatch.Start();
				clientTicks	=	stopwatch.Elapsed.Ticks;


				gameClient.FeedSnapshot( new GameTime(0,svTicks,0L), initialSnapshot, 0 );
			}