Beispiel #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Initialize the context
            UIContext.Initialize(Window, Graphics, Content);
            UIContext.Load();

            // Create the game frame
            Desktop = new GameDesktop();
            Desktop.Load();
            Desktop.CreatePanels();

            // Initial layout of all views
            Desktop.LayoutSubviews();
            Desktop.NeedsLayout = true;

            ///////////////////////////////////////////////////////////////////
            // For debugging read a TMV file as input

            FileInfo file          = new FileInfo("./Test.tmv");
            Stream   virtualStream = null;

            FileStream fileStream = file.OpenRead();

            if (file.Extension == ".tmv")
            {
                virtualStream = new System.IO.Compression.GZipStream(fileStream, System.IO.Compression.CompressionMode.Decompress);
            }
            else
            {
                virtualStream = fileStream;
            }

            // Add the initial state
            TibiaMovieStream MovieStream = new TibiaMovieStream(virtualStream, file.Name);
            ClientState      State       = new ClientState(MovieStream);

            MovieStream.PlaybackSpeed = 50;
            State.ForwardTo(new TimeSpan(0, 30, 0));

            // If fast-forwarded, client tab immediately,
            // otherwise delay until we receive the login packet.
            if (State.Viewport.Player == null)
            {
                State.Viewport.Login += delegate(ClientViewport Viewport)
                {
                    Desktop.AddClient(State);
                };
            }
            else
            {
                Desktop.AddClient(State);
            }

            State.Update(new GameTime());

            /*
             * while (MS.Elapsed.TotalMinutes < 0 || MS.Elapsed.Seconds < 0)
             *  Protocol.parsePacket(InStream.Read());
             */
        }
Beispiel #2
0
        public void ForwardTo(TimeSpan Span)
        {
            if (!(InStream is TibiaMovieStream))
            {
                throw new NotSupportedException("Can't fast-forward non-movie streams.");
            }

            TibiaMovieStream Movie = (TibiaMovieStream)InStream;

            while (Movie.Elapsed.TotalSeconds < Span.TotalSeconds)
            {
                Protocol.parsePacket(Movie.Read(null));
            }
        }
Beispiel #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Initialize the context
            UIContext.Initialize(Window, Graphics, Content);
            UIContext.Load();

            // Create the game frame
            Desktop = new GameDesktop();
            Desktop.Load();
            Desktop.CreatePanels();

            // Initial layout of all views
            Desktop.LayoutSubviews();
            Desktop.NeedsLayout = true;

            ///////////////////////////////////////////////////////////////////
            // For debugging read a TMV file as input

            FileInfo file = new FileInfo("./Test.tmv");
            Stream virtualStream = null;

            FileStream fileStream = file.OpenRead();
            if (file.Extension == ".tmv")
                virtualStream = new System.IO.Compression.GZipStream(fileStream, System.IO.Compression.CompressionMode.Decompress);
            else
                virtualStream = fileStream;

            // Add the initial state
            TibiaMovieStream MovieStream = new TibiaMovieStream(virtualStream, file.Name);
            ClientState State = new ClientState(MovieStream);

            MovieStream.PlaybackSpeed = 50;
            State.ForwardTo(new TimeSpan(0, 30, 0));

            // If fast-forwarded, client tab immediately,
            // otherwise delay until we receive the login packet.
            if (State.Viewport.Player == null)
            {
                State.Viewport.Login += delegate(ClientViewport Viewport)
                {
                    Desktop.AddClient(State);
                };
            }
            else
            {
                Desktop.AddClient(State);
            }

            State.Update(new GameTime());
            /*
            while (MS.Elapsed.TotalMinutes < 0 || MS.Elapsed.Seconds < 0)
                Protocol.parsePacket(InStream.Read());
             */
        }