Ejemplo n.º 1
0
        /// <summary>
        /// Draw the specified canvas and rect.
        /// </summary>
        /// <param name="canvas">Canvas.</param>
        /// <param name="rect">Rect.</param>
        public override void Draw(NGraphics.ICanvas canvas, NGraphics.Rect rect)
        {
            base.Draw(canvas, rect);

            if (PageCount <= 0)
            {
                return;
            }

            var dotWidth         = rect.Height - 16;
            var spacing          = dotWidth;
            var totalWidthNeeded = (PageCount * (dotWidth + spacing)) - dotWidth;

            // Draw dots
            double midx = rect.Width / 2;
            double midy = rect.Height / 2;

            var x     = midx - (totalWidthNeeded / 2);
            var pen   = new NGraphics.Pen(IndicatorColor.ToNColor(), 0.5);
            var brush = new NGraphics.SolidBrush(IndicatorColor.ToNColor());

            for (int i = 0; i < PageCount; i++)
            {
                canvas.DrawEllipse(new NGraphics.Rect(x, midy - (dotWidth / 2),
                                                      dotWidth, dotWidth), pen, i == Page ? brush : null);

                x += dotWidth + spacing;
            }
        }
Ejemplo n.º 2
0
 private void CardStateUpdate()
 {
     if (currentcolor != indicatorColor)
     {
         SpriteRenderer.sprite = Resources.Load <Sprite>(Slave.GetImagePath(indicatorColor));
         currentcolor          = indicatorColor;
     }
 }
Ejemplo n.º 3
0
 public void setData(int xcord, int ycord, Team cardteam, IndicatorType type, IndicatorColor color)
 {
     x             = xcord;
     y             = ycord;
     team          = cardteam;
     indicatorType = type;
     currentcolor  = color;
 }
Ejemplo n.º 4
0
    //  UTILITIES
    public void SetColor()
    {
        IndicatorColor color = currentTarget.GetComponent <IndicatorColor>();

        if (color == null)
        {
            color = currentTarget.AddComponent <IndicatorColor>();
        }
        color.ChangeColor(Color.red, true, true, true);
    }
Ejemplo n.º 5
0
 private void OutputDataFromArrayToTestModel(ushort[] buff)//wich status will open thyristor module
 {
     try
     {
         LedIndicatorData.TestingStatus = IndicatorColor.GetTestingStatusLEDColor(buff[23]);
         TestThyristorWindowShow(buff);
     }
     catch (Exception ex)
     {
         Logger.Log.Error("Невозможно отобразить тестовые данные." + "Пришёл неверный статус.");
         MessageBox.Show("Невозможно отобразить тестовые данные." + "\n" + "Пришёл неверный статус.", "Ошибка!");
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 6
0
 void FieldStateUpdate()
 {
     if (indicatorState == IndicatorState.blocked &&
         GameObject.Find("Field").GetComponent <GameManager>().currentPlayer == team &&
         currentcolor != IndicatorColor.green)
     {
         SpriteRenderer.sprite = Resources.Load <Sprite>(Slave.GetImagePath(IndicatorColor.green));
         currentcolor          = IndicatorColor.green;
     }
     else if (indicatorState == IndicatorState.blocked &&
              GameObject.Find("Field").GetComponent <GameManager>().currentPlayer != team &&
              currentcolor != IndicatorColor.red)
     {
         SpriteRenderer.sprite = Resources.Load <Sprite>(Slave.GetImagePath(IndicatorColor.red));
         currentcolor          = IndicatorColor.red;
     }
     else if (indicatorState == IndicatorState.anchorfield &&
              GameObject.Find("Field").GetComponent <GameManager>().currentChoosedCard == CardID.Anchorcard &&
              anchorvisible == false)
     {
         SpriteRenderer.sprite = Resources.Load <Sprite>(Slave.GetImagePath(IndicatorColor.green));
         anchorvisible         = true;
     }
     else if (anchorvisible == true &&
              indicatorState == IndicatorState.anchorfield &&
              GameObject.Find("Field").GetComponent <GameManager>().currentChoosedCard != CardID.Anchorcard)
     {
         SpriteRenderer.sprite = Resources.Load <Sprite>(Slave.GetImagePath(IndicatorColor.transparent));
         anchorvisible         = false;
     }
     else if (indicatorState == IndicatorState.reachable &&
              currentcolor != IndicatorColor.green)
     {
         SpriteRenderer.sprite = Resources.Load <Sprite>(Slave.GetImagePath(IndicatorColor.green));
         currentcolor          = IndicatorColor.green;
     }
     else if (indicatorState == IndicatorState.unreachable &&
              currentcolor != IndicatorColor.transparent)
     {
         SpriteRenderer.sprite = Resources.Load <Sprite>(Slave.GetImagePath(IndicatorColor.transparent));
         currentcolor          = IndicatorColor.transparent;
     }
     else if (indicatorState == IndicatorState.anchorfield &&
              currentcolor == IndicatorColor.green)
     {
         SpriteRenderer.sprite = Resources.Load <Sprite>(Slave.GetImagePath(IndicatorColor.transparent));
         currentcolor          = IndicatorColor.transparent;
     }
 }
Ejemplo n.º 7
0
        private void OutputDataFromArrayToDataModel(ushort[] buff)//wich status will open thyristor module
        {
            try
            {
                Data.VoltageA              = buff[4];
                Data.VoltageB              = buff[5];
                Data.VoltageC              = buff[6];
                Data.AmperageA1            = buff[7];
                Data.AmperageB1            = buff[8];
                Data.AmperageC1            = buff[9];
                Data.AmperageA2            = buff[10];
                Data.AmperageB2            = buff[11];
                Data.AmperageC2            = buff[12];
                Data.TemperatureOfTiristor = buff[13];
                Data.WorkingStatus         = GetWorkingStatus(buff[14]);
                if (buff[14] == 128 || buff[14] == 1)
                {
                    LedIndicatorData.StartStatus = IndicatorColor.GetTestingStatusLEDColor(1);
                    LedIndicatorData.StopStatus  = IndicatorColor.GetTestingStatusLEDColor(0);
                }
                else
                {
                    LedIndicatorData.StartStatus = IndicatorColor.GetTestingStatusLEDColor(0);
                    LedIndicatorData.StopStatus  = IndicatorColor.GetTestingStatusLEDColor(1);
                }

                GetStatusFromCurrentVoltage(buff[15]);

                Logger.Log.Info(buff.Skip(4).Take(buff.Length - 2).ToArray());
            }
            catch
            {
                IsCurrentVoltageRequestCyclical = false;
                Logger.Log.Error("Нет данных для вывода, отправка запросов остановлена.");
                MessageBox.Show("Нет данных для вывода, отправка запросов остановлена.", "Ошибка!");
            }
        }
 public static IEnumerable <string> GetColoredIndicators(this KMBombInfo bombInfo, IndicatorColor color)
 {
     return(GetColoredIndicators(bombInfo, color.ToString()));
 }
Ejemplo n.º 9
0
        private void DrawMarker(SKPaintSurfaceEventArgs e)
        {
            SKImageInfo info    = e.Info;
            SKSurface   surface = e.Surface;
            SKCanvas    canvas  = surface.Canvas;
            SKPoint     center  = new SKPoint(info.Width / 2, info.Height / 2);

            // draw live
            FixMaxMin();
            float livePixelsYStart = info.Height + bottomFluidGlassCircleCenterY - bottomFluidGlassHullRadius - startMarkerDistance;
            float livePixelsYEnd   = topFluidGlassCircleCenterY;

            // map real temp to pixels from marker start to end
            float temperatureY = Temperature.Map(MinTemperature, MaxTemperature, livePixelsYStart, livePixelsYEnd);

            int tempRange   = Math.Abs(MinTemperature) + Math.Abs(MaxTemperature);
            int markerCount = tempRange / markerStep;

            float thermometerPixelHeight = livePixelsYStart - livePixelsYEnd;
            float pixelStep = thermometerPixelHeight / markerCount;

            float yMarkerStep = livePixelsYStart;

            SKPaint markerPaint = new SKPaint
            {
                IsAntialias = true,
                Style       = SKPaintStyle.Fill,
                Color       = MarkerColor.ToSKColor(),
                TextSize    = 40,
                TextAlign   = SKTextAlign.Center,
            };

            for (int i = 0; i <= markerCount; i++)
            {
                SKRect marker = new SKRect
                {
                    Left   = center.X + (topFluidGlassWidth / 2) + markerOffsetX,
                    Top    = yMarkerStep + 2,
                    Bottom = yMarkerStep - 2
                };
                marker.Right = marker.Left + 100;

                canvas.DrawRect(marker, markerPaint);
                canvas.DrawText((MinTemperature + (i * markerStep)).ToString(), marker.Right - 30, yMarkerStep - 10, markerPaint);
                yMarkerStep -= pixelStep;
            }

            SKPaint indicatorGeometryPaint = new SKPaint
            {
                IsAntialias = true,
                Style       = SKPaintStyle.StrokeAndFill,
                Color       = IndicatorColor.ToSKColor(),
                StrokeWidth = 6,
            };

            SKPoint indicatorTextPosition = new SKPoint(center.X - indicatorOffset, (livePixelsYStart - (thermometerPixelHeight * indicatorPositionY)));

            SKPoint indicatorUnderlineStart = new SKPoint(indicatorTextPosition.X, indicatorTextPosition.Y);
            SKPoint indicatorUnderlineEnd   = new SKPoint(indicatorTextPosition.X + 120, indicatorTextPosition.Y);

            SKPoint connectionLineStart = new SKPoint(indicatorUnderlineEnd.X, indicatorUnderlineEnd.Y);
            SKPoint connectionLineEnd   = new SKPoint(center.X, temperatureY);

            SKPoint[] points = new SKPoint[]
            {
                indicatorUnderlineStart,
                indicatorUnderlineEnd,
                connectionLineStart,
                connectionLineEnd,
            };

            canvas.DrawPoints(SKPointMode.Lines, points, indicatorGeometryPaint);
            canvas.DrawCircle(center.X, temperatureY, 10, indicatorGeometryPaint);

            SKPaint indicatorTextPaint = new SKPaint
            {
                IsAntialias = true,
                Style       = SKPaintStyle.StrokeAndFill,
                Color       = IndicatorTextColor.ToSKColor(),
                TextSize    = 50,
                TextAlign   = SKTextAlign.Left,
            };

            canvas.DrawText(Temperature.ToString("0.00"), indicatorTextPosition.X, indicatorTextPosition.Y - 10, indicatorTextPaint);
        }
Ejemplo n.º 10
0
 static public string GetImagePath(IndicatorColor color)
 {
     return("emptycards/" + color);
 }
Ejemplo n.º 11
0
 public void setColor(IndicatorColor color)
 {
     indicatorColor = color;
 }