示例#1
0
    public void ShowSelf(HighLightType highLightType, bool show = true)
    {
        if (GlobalUImanager.Instance.SingleLandHighLight == null)
        {
            GlobalUImanager.Instance.SingleLandHighLight = gameObject;
        }

        if (highLightType == HighLightType.Single)
        {
            //把上一个先隐藏掉
            GlobalUImanager.Instance.SingleLandHighLight.SetActive(false);
            GlobalUImanager.Instance.SingleLandHighLight = gameObject;
        }
        else
        {
            GlobalUImanager.Instance.SingleLandHighLight = null;
        }
        gameObject.SetActive(show);
        //适应屏幕宽高,使一个图片正好占地图一个单元格大小
        int rectHeight = Screen.height / ((int)Camera.main.orthographicSize * 2);

        rectTransform.sizeDelta = new Vector2(rectHeight, rectHeight);
    }
示例#2
0
    public void setHighlight(HighLightType type)
    {
        highLightType = type;
        if (spriteRenderer != null)
        {
            switch (type)
            {
            case HighLightType.NONE:
                spriteRenderer.color = new Color(0, 1.0f, 1.0f, 0.65f);
                break;

            case HighLightType.SINGLW:
                spriteRenderer.color = new Color(1.0f, 0, 0f, 0.65f);
                break;

            case HighLightType.GROUP:
                spriteRenderer.color = new Color(1.0f, 0, 0f, 0.65f);
                break;

            default:
                break;
            }
        }
    }
示例#3
0
        public static Bitmap DrawArray(int width, int height, int[] arr, HashSet <int> selectedInd = null, HighLightType highLightType = HighLightType.Default)
        {
            Bitmap bit = new Bitmap(width, height);

            Graphics graph = Graphics.FromImage(bit);

            graph.Clear(Color.White);
            StringFormat elemStringForm = new StringFormat()
            {
                Alignment     = StringAlignment.Center,
                LineAlignment = StringAlignment.Center
            };

            for (int i = 0; i < arr.Length; i++)
            {
                HighLightType currentElemHightLight;
                if (selectedInd != null && selectedInd.Contains(i))
                {
                    currentElemHightLight = highLightType;
                }
                else
                {
                    currentElemHightLight = HighLightType.Default;
                }
                Brush     elemColor       = elemColorDict[currentElemHightLight];
                Brush     elemBorderColor = elemBorderColorDict[currentElemHightLight];
                Point     position        = ElementPos(width, height, i);
                Rectangle rectangle       = new Rectangle(position.X - Inner, position.Y - Inner, Inner * 2, Inner * 2);
                graph.FillEllipse(elemBorderColor, rectangle.Left - Border, rectangle.Top - Border, rectangle.Width + 2 * Border, rectangle.Height + 2 * Border);

                graph.FillEllipse(elemColor, rectangle);

                graph.DrawString(arr[i].ToString(), SystemFonts.DefaultFont, Brushes.Black, rectangle, elemStringForm);
            }
            return(bit);
        }
        public void HighLightLine(CodeLocation location, HighLightType HightLightType)
        {
            // Indicators 0-7 could be in use by a lexer

            switch (HightLightType)
            {
                case HighLightType.ERROR:
                    m_scintilla.IndicatorCurrent = 8;
                    m_scintilla.Indicators[8].ForeColor = Color.Red;
                    m_scintilla.Indicators[8].Style = IndicatorStyle.Squiggle;
                    m_scintilla.Indicators[8].Under = true;
                    m_scintilla.Indicators[8].OutlineAlpha = 100;
                    m_scintilla.Indicators[8].Alpha = 100;
                    break;
                case HighLightType.WARNING:
                    m_scintilla.IndicatorCurrent = 9;
                    m_scintilla.Indicators[9].ForeColor = Color.Orange;
                    m_scintilla.Indicators[9].Style = IndicatorStyle.Squiggle;
                    m_scintilla.Indicators[9].Under = true;
                    m_scintilla.Indicators[9].OutlineAlpha = 100;
                    m_scintilla.Indicators[9].Alpha = 100;
                    break;
                case HighLightType.NORMAL_HIGHLIGHT:
                    clearHighLight();
                    m_scintilla.IndicatorCurrent = 10;
                    m_scintilla.Indicators[10].ForeColor = Color.Red;
                    m_scintilla.Indicators[10].Style = IndicatorStyle.DotBox;
                    m_scintilla.Indicators[10].Under = true;
                    m_scintilla.Indicators[10].OutlineAlpha = 100;
                    m_scintilla.Indicators[10].Alpha = 100;
                    break;
                default:
                    break;
            }
            // Update indicator appearance

            m_scintilla.TargetStart = getstartPosFromSourceLocation(location);
            m_scintilla.TargetEnd =   m_scintilla.Lines[location.Line-1].Text.Length;
            m_scintilla.IndicatorFillRange(m_scintilla.TargetStart, m_scintilla.TargetEnd - location.Column);
        }