예제 #1
0
        /// <inheritdoc />
        public bool MatchValue(T value)
        {
            List <T> values = new List <T>(_history.ToList())
            {
                value
            };

            return(_listPredicate(values));
        }
        public void RemoveDuplicatedTimeStamps()
        {
            List <DateTime> lDateTimeStampsLoc      = lDateTimeStamps.ToList();
            List <DateTime> lDateTimeStampsFiltered = new List <DateTime>(lDateTimeStamps.ToList().Distinct <DateTime>());
            List <T>        dataSeriaLoc            = dataSeria.ToList();

            List <T> dataSeriaFiltered = new List <T>();
            int      idx = 0;

            foreach (DateTime dtStamp in lDateTimeStampsFiltered)
            {
                idx = lDateTimeStampsLoc.FindIndex(idx, datetimeValue => datetimeValue == dtStamp);
                dataSeriaFiltered.Add(dataSeriaLoc[idx]);
            }

            lDateTimeStamps = new FixedQueue <DateTime>(lDateTimeStamps.Count);
            lDateTimeStamps.Enqueue(lDateTimeStampsFiltered);
            dataSeria = new FixedQueue <T>(dataSeria.Count);
            dataSeria.Enqueue(dataSeriaFiltered);
        }
예제 #3
0
        /// <summary>
        /// Creates a new ReplayState instance.
        /// </summary>
        public ReplayState(string fieldPath, FixedQueue <List <ContactDescriptor> > contactPoints)
        {
            tStart = Time.time;

            this.fieldPath     = fieldPath;
            this.contactPoints = contactPoints.ToList();
            trackers           = UnityEngine.Object.FindObjectsOfType <Tracker>().ToList();

            playbackMode     = PlaybackMode.Paused;
            firstFrame       = true;
            active           = false;
            contactThreshold = Mathf.Sqrt(30f);

            DynamicCamera.ControlEnabled = true;

            Texture2D thumbTexture = (Texture2D)Resources.Load("Images/ReplayMode/thumb");

            Texture2D rewindTexture        = (Texture2D)Resources.Load("Images/ReplayMode/rewind");
            Texture2D rewindHoverTexture   = (Texture2D)Resources.Load("Images/ReplayMode/rewindHover");
            Texture2D rewindPressedTexture = (Texture2D)Resources.Load("Images/ReplayMode/rewindPressed");

            Texture2D stopTexture        = (Texture2D)Resources.Load("Images/ReplayMode/stop");
            Texture2D stopHoverTexture   = (Texture2D)Resources.Load("Images/ReplayMode/stopHover");
            Texture2D stopPressedTexture = (Texture2D)Resources.Load("Images/ReplayMode/stopPressed");

            Texture2D playTexture        = (Texture2D)Resources.Load("Images/ReplayMode/play");
            Texture2D playHoverTexture   = (Texture2D)Resources.Load("Images/ReplayMode/playHover");
            Texture2D playPressedTexture = (Texture2D)Resources.Load("Images/ReplayMode/playPressed");

            Texture2D collisionTexture        = (Texture2D)Resources.Load("Images/ReplayMode/collision");
            Texture2D collisionHoverTexture   = (Texture2D)Resources.Load("Images/ReplayMode/collisionHover");
            Texture2D collisionPressedTexture = (Texture2D)Resources.Load("Images/ReplayMode/collisionPressed");

            Texture2D consolidateTexture        = (Texture2D)Resources.Load("Images/ReplayMode/consolidate");
            Texture2D consolidateHoverTexture   = (Texture2D)Resources.Load("Images/ReplayMode/consolidateHover");
            Texture2D consolidatePressedTexture = (Texture2D)Resources.Load("Images/ReplayMode/consolidatePressed");

            circleTexture   = (Texture)Resources.Load("Images/ReplayMode/circle");
            keyframeTexture = (Texture)Resources.Load("Images/ReplayMode/keyframe");

            Texture2D sliderBackground = new Texture2D(1, 1);

            sliderBackground.SetPixel(0, 0, new Color(0.1f, 0.15f, 0.15f, 0.75f));
            sliderBackground.Apply();

            windowStyle = new GUIStyle
            {
                alignment = TextAnchor.UpperLeft,
                normal    = new GUIStyleState
                {
                    background = sliderBackground,
                    textColor  = Color.white
                }
            };

            thumbStyle = new GUIStyle
            {
                fixedWidth  = ThumbWidth,
                fixedHeight = ThumbHeight,
                normal      = new GUIStyleState
                {
                    background = thumbTexture
                }
            };

            rewindStyle      = CreateButtonStyle("rewind");
            stopStyle        = CreateButtonStyle("stop");
            playStyle        = CreateButtonStyle("play");
            collisionStyle   = CreateButtonStyle("collision");
            consolidateStyle = CreateButtonStyle("consolidate");
        }