Esempio n. 1
0
        public void Update()
        {
            if (playback)
            {
                if (Planetarium.GetUniversalTime() > (lastTime))
                {
                    playback = false;
                    ScreenMessages.RemoveMessage(screenMessage);
                    screenMessage = null;
                }
                else
                {
                    int timeLeft = (int)(lastTime - Planetarium.GetUniversalTime());
                    ScreenMessages.RemoveMessage(screenMessage);
                    screenMessage = ScreenMessages.PostScreenMessage("Playback time left: " + timeLeft + " / " + (int)(lastTime - firstTime) + " seconds", float.MaxValue, ScreenMessageStyle.UPPER_CENTER);
                }
            }

            if (active)
            {
                VesselUpdate  vu          = VesselUpdate.CopyFromVessel(vesselWorker, FlightGlobals.fetch.activeVessel);
                ClientMessage updateBytes = networkWorker.GetVesselUpdateMessage(vu);
                byte[]        lengthBytes = BitConverter.GetBytes(updateBytes.data.Length);
                if (BitConverter.IsLittleEndian)
                {
                    Array.Reverse(lengthBytes);
                }
                recordingVector.Write(lengthBytes, 0, lengthBytes.Length);
                recordingVector.Write(updateBytes.data, 0, updateBytes.data.Length);
            }
        }
Esempio n. 2
0
        public void StartRecord()
        {
            active          = true;
            recording       = new MemoryStream();
            recordingVector = new MemoryStream();
            VesselUpdate update = VesselUpdate.CopyFromVessel(vesselWorker, FlightGlobals.fetch.activeVessel);

            networkWorker.SendVesselUpdate(update);
        }
        public void StartRecord()
        {
            active          = true;
            recording       = new MemoryStream();
            recordingVector = new MemoryStream();
            VesselUpdate update = Recycler <VesselUpdate> .GetObject();

            update.SetVesselWorker(vesselWorker);
            update.CopyFromVessel(FlightGlobals.fetch.activeVessel);
            networkWorker.SendVesselUpdate(update);
            Recycler <VesselUpdate> .ReleaseObject(update);
        }