Example #1
0
        /// <summary>
        /// Activate a highlight over this region, given this cell location.
        /// </summary>
        /// <param name="location">Coordinates of the highlighted region.</param>
        /// <param name="region">The type of region being highlighted.</param>
        public void SetHighlight(Coord location, HighlightRegion region)
        {
            location.y = (short)(numCellsY - location.y - (region == HighlightRegion.Horizontal ? 0 : 1));
            Coord offset = SCALE * location;

            if (region == HighlightRegion.Horizontal)
            {
                offset.x     += 2;
                highlightRect = new Rect(offset, new Vector2(BAR_LENGTH, 1));
            }
            else if (region == HighlightRegion.Vertical)
            {
                offset.y     += 2;
                highlightRect = new Rect(offset, new Vector2(1, BAR_LENGTH));
            }
            else if (region == HighlightRegion.Square)
            {
                offset       += Coord.one;
                highlightRect = new Rect(offset, CELL_SIZE * Vector2.one);
            }
            else
            {
                Debug.LogErrorFormat("Attempted to set highlight at location {0} with region set to None", location);
            }
        }
Example #2
0
            static Highlight CreateActive(Coord location, HighlightRegion region)
            {
                var status = new Highlight();

                status.active   = true;
                status.location = location;
                status.region   = region;
                return(status);
            }
        public Brush GetBrush(HighlightRegion region)
        {
            switch (region.Kind)
            {
            case HighlightKind.Caret:
                return(new SolidColorBrush(Colors.Red));

            case HighlightKind.Hover:
                return(new SolidColorBrush(Colors.Yellow));

            case HighlightKind.VideoCursor:
                return(new SolidColorBrush(Colors.Blue));

            default:
                throw new NotSupportedException();
            }
        }