Exemplo n.º 1
0
        public static void Play()
        {
            if (m_Recording || Playing || m_GZIn == null)
            {
                return;
            }

            if (World.Player == null)
            {
                MessageBox.Show(Engine.MainWindow, "You must be logged in to ANY shard to play a packet video.", "Must Log in", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            btnPlay.Enabled = btnStop.Enabled = btnClose.Enabled = btnRec.Enabled = false;
            btnPlay.Text    = "Pause";

            // save the real player data
            m_TempWriter = new BinaryWriter(new MemoryStream());
            World.Player.SaveState(m_TempWriter);

            //m_InStream = new BinaryReader( new FileStream( fileName, FileMode.Open, FileAccess.Read, FileShare.Read ) );

            m_Playing = true;
            ClientCommunication.SetAllowDisconn(false);

            ClientCommunication.BringToFront(ClientCommunication.FindUOWindow());

            //ClientCommunication.SetDeathMsg( "Playing..." );
            ClientCommunication.ForceSendToClient(new DeathStatus(true));

            RemoveAll();

            m_GZIn.Seek(m_StartPos, SeekOrigin.Begin);

            LoadWorldState();

            m_PlayTimer = Timer.DelayedCallback(FadeDelay, m_BeginPlay);
            m_PlayTimer.Start();
            tbPos.Value = tbPos.Minimum;

            m_Elapsed = TimeSpan.Zero;
            UpdateTimeText();

            ClientCommunication.RequestTitlebarUpdate();
        }
Exemplo n.º 2
0
        private static void EndPlayback()
        {
            m_PlayTimer = null;

            m_Playing = false;
            ClientCommunication.SetAllowDisconn(true);
            //ClientCommunication.SetDeathMsg( "You are dead." );

            PlayerData player;

            using (BinaryReader reader = new BinaryReader(m_TempWriter.BaseStream))
            {
                reader.BaseStream.Seek(0, SeekOrigin.Begin);
                player = World.Player = new PlayerData(reader, PlayerVersion);
            }
            m_TempWriter.Close();

            player.Contains.Clear();
            World.AddMobile(player);

            DoLogin(player);

            tbPos.Enabled = btnClose.Enabled = btnPlay.Enabled = btnStop.Enabled = btnRec.Enabled = true;
            tbPos.Value   = tbPos.Minimum;

            m_Elapsed = TimeSpan.Zero;
            UpdateTimeText();

            ClientCommunication.SendToClient(new MoveReject(World.Player.WalkSequence, World.Player));
            ClientCommunication.SendToServer(new ResyncReq());
            World.Player.Resync();
            ClientCommunication.RequestTitlebarUpdate();

            if (ClientCommunication.AllowBit(FeatureBit.LightFilter) && World.Player != null)
            {
                World.Player.LocalLightLevel = 0;

                ClientCommunication.SendToClient(new GlobalLightLevel(0));
                ClientCommunication.SendToClient(new PersonalLightLevel(World.Player));
            }
        }