Exemple #1
0
        public void HighlightArea(Vector2 center, List <Vector2> offsets, HighlightLayer layer, int rotation = 0)
        {
            Dictionary <Cell, bool[]> newHighlightedCells = new Dictionary <Cell, bool[]>();

            DehighlightLayer(layer);

            foreach (Vector2 offset in offsets)
            {
                Cell hc = HexManager.GetCellByCoord(center + offset);
                if (hc)
                {
                    newHighlightedCells.Add(hc, new bool[0]);
                }
            }

            for (int j = 0; j < newHighlightedCells.Count; j++)
            {
                List <bool> b = new List <bool>();
                for (int i = 0; i < 6; i++)
                {
                    Cell n      = HexManager.Neighbour(newHighlightedCells.ElementAt(j).Key.coord, i, newHighlightedCells.Keys.ToList());
                    bool border = (n == null) && LayerType(layer) != HighlightType.Center;
                    b.Add(border);
                }

                bool showCenter = !(LayerType(layer) == HighlightType.Center);

                newHighlightedCells.ElementAt(j).Key.ShowCellBorders(b.ToArray(), LayerColor(layer), showCenter, LayerColor(layer));
                newHighlightedCells[newHighlightedCells.ElementAt(j).Key] = b.ToArray();
            }

            highlightedLayers.Add((int)layer, new HighlightedLayer(newHighlightedCells, LayerColor(layer)));
        }
Exemple #2
0
        public void DehighlightLayer(HighlightLayer hlayer)
        {
            int layerId = (int)hlayer;

            if (highlightedLayers.ContainsKey(layerId))
            {
                foreach (Cell c in highlightedLayers[layerId].cells.Keys)
                {
                    c.ShowCellBorders(new bool[] { false, false, false, false, false, false }, Color.black, false, Color.black);

                    foreach (HighlightedLayer layer in highlightedLayers.OrderBy(kp => kp.Key).Select(kp => kp.Value).ToList())
                    {
                        if (layer.cells.Keys.Contains(c) && layer != highlightedLayers[layerId])
                        {
                            /*
                             * bool showBorder = true;
                             * if (LayerType(highlightedLayers.ElementAt())== HighlightType.Borders)
                             * {
                             *  showBorder = false;
                             * }
                             *
                             * c.ShowCellBorders(layer.cells[c], layer.color, );
                             * break;
                             */
                        }
                    }
                }

                highlightedLayers.Remove(layerId);
            }
        }
Exemple #3
0
        public void HighlightLine(Vector2 center, Vector2 aim, HighlightLayer layer)
        {
            List <Vector2> offsets = new List <Vector2>();

            if (center.x == aim.x)
            {
                if (center.x > aim.x)
                {
                    for (int i = 0; i <= (int)center.x - (int)aim.x; i++)
                    {
                        offsets.Add(new Vector2(-i, 0));
                    }
                }
                else
                {
                    for (int i = 0; i <= (int)aim.x - (int)center.x; i++)
                    {
                        offsets.Add(new Vector2(i, 0));
                    }
                }
            }

            if (center.y == aim.y)
            {
                if (center.x > aim.x)
                {
                    for (int i = 0; i <= (int)center.y - (int)aim.y; i++)
                    {
                        offsets.Add(new Vector2(0, -i));
                    }
                }
                else
                {
                    for (int i = 0; i <= (int)aim.y - (int)center.y; i++)
                    {
                        offsets.Add(new Vector2(0, i));
                    }
                }
            }

            if (aim.x - center.x == aim.y - center.y)
            {
                if (center.x > aim.x)
                {
                    for (int i = 0; i <= (int)center.y - (int)aim.y; i++)
                    {
                        offsets.Add(new Vector2(-i, -i));
                    }
                }
                else
                {
                    for (int i = 0; i <= (int)aim.y - (int)center.y; i++)
                    {
                        offsets.Add(new Vector2(i, i));
                    }
                }
            }

            HighlightArea(center, offsets, layer);
        }
 public HighlightLayer(LayeredHighlight layers, Color color)
 {
     this.layerBelow = this;
     this.layerAbove = this;
     this.Color      = color;
     this.layers     = layers;
     this.disposed   = false;
 }
Exemple #5
0
        public void UnHighlightSelection(int startIndex, int endIndex, HighlightLayer layer)
        {
            int NUM = (int)layer;

            // Remove all uses of our indicator
            this.IndicatorCurrent = NUM;
            this.IndicatorClearRange(startIndex, endIndex - startIndex);
        }
Exemple #6
0
        public void HighlightArea(Cell center, List <Cell> cells, HighlightLayer layer, int rotation = 0)
        {
            List <Vector2> offsets = new List <Vector2>();

            foreach (Cell cell in cells)
            {
                offsets.Add(cell.coord - center.coord);
            }
            HighlightArea(center.coord, offsets, layer, rotation);
        }
        public EditorVisualHost(TextEditorCanvas textEditorCanvas)
        {
            Configurations.InitializeFontSizes();

            children = new VisualCollection(this);
            highlight = new HighlightLayer(textEditorCanvas);
            auxiliary = new AuxiliaryLayer(textEditorCanvas);
            lineHeading = new LineHeadingLayer(textEditorCanvas);
            sourceDisplay = new SourceDisplayLayer(textEditorCanvas);
        }
 public void Dispose()
 {
     if (this.disposed)
     {
         throw new ObjectDisposedException("Highlight layer");
     }
     this.disposed = true;
     this.layerBelow.layerAbove = this.layerAbove;
     this.layerAbove.layerBelow = this.layerBelow;
     this.layers.UpdateRendererColor();
 }
 public HighlightLayer(
     LayeredHighlight layers,
     HighlightLayer layerBelow,
     Color color)
     : this(layers, color)
 {
     this.layerBelow            = layerBelow;
     this.layerAbove            = layerBelow.layerAbove;
     this.layerBelow.layerAbove = this;
     this.layerAbove.layerBelow = this;
     this.layers.UpdateRendererColor();
 }
Exemple #10
0
        public void HighlightSelection(int startIndex, int endIndex, Color color, HighlightLayer layer)
        {
            int NUM = (int)layer;

            // Remove all uses of our indicator
            this.IndicatorCurrent = NUM;

            // Update indicator appearance
            this.Indicators[NUM].Style     = IndicatorStyle.FullBox;
            this.Indicators[NUM].Under     = true;
            this.Indicators[NUM].ForeColor = color;
            this.Indicators[NUM].Alpha     = 200;

            this.IndicatorFillRange(startIndex, endIndex - startIndex);
        }
Exemple #11
0
 private HighlightType LayerType(HighlightLayer layer)
 {
     return(layersHighlightTypes[(int)layer]);
 }
Exemple #12
0
 private Color LayerColor(HighlightLayer layer)
 {
     return(layersColors[(int)layer]);
 }
Exemple #13
0
 void Awake()
 {
     this.baseLayer = new HighlightLayer(this, Color.clear);
     UpdateRendererColor();
 }
Exemple #14
0
 private void UnHighlightSelection(int startIndex, int endIndex, HighlightLayer layer)
 {
     txtFileViewer.UnHighlightSelection(startIndex - 1, endIndex - 1, layer);
 }
Exemple #15
0
 private void HighlightSelection(int startIndex, int endIndex, Color color, HighlightLayer layer)
 {
     txtFileViewer.HighlightSelection(startIndex - 1, endIndex - 1, color, layer);
 }