Exemplo n.º 1
0
 public void MoveUp <T, TP>(
     FlythroughEvent <T> evt,
     EventSequence <TP> mainSequence,
     EventSequence <T> parallelSequence,
     Action <FlythroughEvent <TP> > parralelChangeEvt,
     Action <FlythroughEvent <T> > changeEvt)
 {
     if (mPlugin.SynchStreams && evt.SequenceStartTime < mainSequence.Length)
     {
         FlythroughEvent <TP> pair = mainSequence[evt.SequenceStartTime];
         if (pair != null && pair.SequenceStartTime == evt.SequenceStartTime)
         {
             mainSequence.MoveUp(pair);
             if (parralelChangeEvt != null)
             {
                 parralelChangeEvt(pair);
             }
         }
     }
     parallelSequence.MoveUp(evt);
     if (PositionOrderChanged != null)
     {
         changeEvt(evt);
     }
 }
Exemplo n.º 2
0
 private void mEvents_LengthChange(EventSequence <Camera> sequence, int length)
 {
     if (LengthChange != null)
     {
         LengthChange(length);
     }
 }
Exemplo n.º 3
0
        private string GetSequenceState <T>(EventSequence <T> sequence, string name)
        {
            string dump = "";

            dump += String.Format("{0}  --{1} Sequence{0}", Environment.NewLine, name);
            if (sequence.CurrentEvent != null)
            {
                try {
                    dump += "  Current Event: " + sequence.CurrentEvent.Name + Environment.NewLine;
                    dump += sequence.CurrentEvent.State;
                } catch (Exception e) {
                    dump += "  Unable to record window of " + sequence.CurrentEvent.Name + "." + Environment.NewLine;
                    dump += e.Message + Environment.NewLine;
                    dump += e.StackTrace;
                }
            }
            else
            {
                dump += "  No current event";
            }
            return(dump);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initialise the flythrough transition an xml file.
        /// </summary>
        /// <param name="file">The file to load as a flythrough.</param>
        public void Load(string file)
        {
            if (!File.Exists(file))
            {
                Logger.Warn("Unable to load " + file + ". Ignoring load request.");
                return;
            }

            if (FlythroughLoading != null)
            {
                FlythroughLoading();
            }

            mEvents = new EventSequence <Camera>();
            mEvents.LengthChange += new Action <EventSequence <Camera>, int>(mEvents_LengthChange);

            XmlDocument doc = new XmlDocument();

            doc.Load(file);
            int     start = 0;
            XmlNode root  = doc.GetElementsByTagName("Events")[0];

            XmlAttribute startPositionAttr = root.Attributes["StartPosition"];
            XmlAttribute startPitchAttr    = root.Attributes["StartPitch"];
            XmlAttribute startYawAttr      = root.Attributes["StartYaw"];
            Vector3      startPos          = mCore.Position;
            double       startPitch        = mCore.Orientation.Pitch;
            double       startYaw          = mCore.Orientation.Yaw;

            if (startPositionAttr != null)
            {
                Vector3.TryParse(startPositionAttr.Value, out startPos);
            }
            if (startPitchAttr != null)
            {
                double.TryParse(startPitchAttr.Value, out startPitch);
            }
            if (startYawAttr != null)
            {
                double.TryParse(startYawAttr.Value, out startYaw);
            }
            Start = new Camera(startPos, new Rotation(startPitch, startYaw));

            foreach (XmlNode node in root.ChildNodes)
            {
                if (node is XmlElement)
                {
                    ComboEvent evt = new ComboEvent(this);
                    evt.Load(node);
                    mEvents.AddEvent(evt);
                    start = evt.SequenceStartTime + evt.Length;
                }
            }

            mCore.Update(Start.Position, Vector3.Zero, Start.Orientation, Rotation.Zero);

            if (FlythroughLoaded != null)
            {
                FlythroughLoaded();
            }
        }
Exemplo n.º 5
0
 internal void SetSequence(EventSequence <T> eventSequence)
 {
     mSequence = eventSequence;
 }
Exemplo n.º 6
0
 private void mOrientationSequence_LengthChange(EventSequence <Rotation> evt, int length)
 {
     Length = Math.Max(mPositionSequence.Length, mOrientationSequence.Length);
 }
Exemplo n.º 7
0
 public void Init(EventSequence <Vector3> positions)
 {
     mPositions = positions;
 }