Ejemplo n.º 1
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Orientation != null)
         {
             hashCode = hashCode * 59 + Orientation.GetHashCode();
         }
         if (BgColor != null)
         {
             hashCode = hashCode * 59 + BgColor.GetHashCode();
         }
         if (Color != null)
         {
             hashCode = hashCode * 59 + Color.GetHashCode();
         }
         if (ActiveColor != null)
         {
             hashCode = hashCode * 59 + ActiveColor.GetHashCode();
         }
         if (UiRevision != null)
         {
             hashCode = hashCode * 59 + UiRevision.GetHashCode();
         }
         return(hashCode);
     }
 }
Ejemplo n.º 2
0
    void ChangeCurrentActiveRight()
    {
        switch (active)
        {
        case Controller.ActiveColor.Red:
            active = ActiveColor.Green;
            cam.backgroundColor  = Color.green;
            btnLeft.image.color  = Color.red;
            btnRight.image.color = Color.blue;
            break;

        case Controller.ActiveColor.Green:
            active = ActiveColor.Blue;
            cam.backgroundColor  = Color.blue;
            btnLeft.image.color  = Color.green;
            btnRight.image.color = Color.red;
            break;

        case Controller.ActiveColor.Blue:
            active = ActiveColor.Red;
            cam.backgroundColor  = Color.red;
            btnLeft.image.color  = Color.blue;
            btnRight.image.color = Color.green;
            break;

        default: break;
        }
    }
Ejemplo n.º 3
0
        public override void Generate(FizzleJson data)
        {
            m_DefaultActivate = data.GetOrDefault("default-activate", m_DefaultActivate);
            string faceAt = data.GetOrDefault("face-at", "forward").ToLower();

            switch (faceAt)
            {
            case "left":
                transform.parent.eulerAngles += 90.0F * Vector3.up;
                break;

            case "back":
                transform.parent.eulerAngles += 180.0F * Vector3.up;
                break;

            case "right":
                transform.parent.eulerAngles += 270.0F * Vector3.up;
                break;

            default:
                faceAt = "forward";
                break;
            }
            ActiveColor   = (FizzleColor)data.GetOrDefault("active-color", ActiveColor.ToString());
            DeactiveColor = (FizzleColor)data.GetOrDefault("deactive-color", DeactiveColor.ToString());
            FizzleDebug.Log($"FizzleButton name = {(object) data["name"] ?? name}, default-activate = {m_DefaultActivate}, face-at = {faceAt}, active-color = {ActiveColor}, deactive-color = {DeactiveColor}");
        }
Ejemplo n.º 4
0
 public override void Generate(FizzleJson data)
 {
     base.Generate(data);
     m_DefaultActivate = data.GetOrDefault("default-activate", m_DefaultActivate);
     ActiveColor       = (FizzleColor)data.GetOrDefault("active-color", ActiveColor.ToString());
     DeactiveColor     = (FizzleColor)data.GetOrDefault("deactive-color", DeactiveColor.ToString());
     FizzleDebug.Log($"FizzleLogicCurtain name = {(object) data["name"] ?? name}, default-activate = {m_DefaultActivate}, active-color = {ActiveColor}, deactive-color = {DeactiveColor}");
 }
Ejemplo n.º 5
0
        public void Process(char c, ref IProcess step)
        {
            if (char.IsDigit(c))
            {
                int count = int.Parse($"{c}");
                this.y += count;
                return;
            }

            switch (char.ToLower(c))
            {
            case 'p':
            case 'n':
            case 'b':
            case 'r':
            case 'q':
            case 'k':
                if ((this.x >= 8) || (this.y >= 8))
                {
                    this.result.Error = true;
                    step = null;
                    return;
                }
                this.result.Board[this.x, this.y] = c;
                ++this.y;
                break;

            case '/':
                if (this.y != 8)
                {
                    this.result.Error = true;
                    step = null;
                }
                this.y = 0;
                ++this.x;
                break;

            case ' ':
                if ((this.x != 7) || (this.y != 8))
                {
                    this.result.Error = true;
                    step = null;
                }
                step = new ActiveColor(this.result);
                break;

            default:
                // Unexpected char.
                this.result.Error = true;
                step = null;
                break;
            }
        }
Ejemplo n.º 6
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Visible != null)
         {
             hashCode = hashCode * 59 + Visible.GetHashCode();
         }
         if (Buttons != null)
         {
             hashCode = hashCode * 59 + Buttons.GetHashCode();
         }
         if (X != null)
         {
             hashCode = hashCode * 59 + X.GetHashCode();
         }
         if (XAnchor != null)
         {
             hashCode = hashCode * 59 + XAnchor.GetHashCode();
         }
         if (Y != null)
         {
             hashCode = hashCode * 59 + Y.GetHashCode();
         }
         if (YAnchor != null)
         {
             hashCode = hashCode * 59 + YAnchor.GetHashCode();
         }
         if (Font != null)
         {
             hashCode = hashCode * 59 + Font.GetHashCode();
         }
         if (BgColor != null)
         {
             hashCode = hashCode * 59 + BgColor.GetHashCode();
         }
         if (ActiveColor != null)
         {
             hashCode = hashCode * 59 + ActiveColor.GetHashCode();
         }
         if (BorderColor != null)
         {
             hashCode = hashCode * 59 + BorderColor.GetHashCode();
         }
         if (BorderWidth != null)
         {
             hashCode = hashCode * 59 + BorderWidth.GetHashCode();
         }
         return(hashCode);
     }
 }
Ejemplo n.º 7
0
        private void StartFading(bool Active)
        {
            Table.Pinball.Alarms.UnregisterAlarm(FadingStep);

            RGBAColor TargetColor = (Active ? ActiveColor : InactiveColor);

            int Duration = (Active ? FadeActiveDurationMs : FadeInactiveDurationMs);
            int Steps    = Duration / FadingRefreshIntervalMs;

            if (Steps > 0)
            {
                IsFading = true;

                RGBAColor CurrentColor;
                switch (FadeMode)
                {
                case FadeModeEnum.CurrentToDefined:
                    CurrentColor = RGBAToy.Layers[Layer].GetRGBAColor();
                    break;

                case FadeModeEnum.DefinedToDefined:
                default:
                    CurrentColor = (!Active ? ActiveColor.GetRGBAColor() : InactiveColor.GetRGBAColor());
                    break;
                }

                Current[0] = CurrentColor.Red;
                Current[1] = CurrentColor.Green;
                Current[2] = CurrentColor.Blue;
                Current[3] = CurrentColor.Alpha;

                Target[0] = TargetColor.Red;
                Target[1] = TargetColor.Green;
                Target[2] = TargetColor.Blue;
                Target[3] = TargetColor.Alpha;

                for (int i = 0; i < 4; i++)
                {
                    Step[i] = (Target[i] - Current[i]) / Steps;
                }

                FadingStep();
            }
            else
            {
                RGBAToy.Layers[Layer].Set(TargetColor);
            }
        }
Ejemplo n.º 8
0
        public void OnCanvasViewPaintSurface(object sender, SKPaintSurfaceEventArgs args)
        {
            SKImageInfo info    = args.Info;
            SKSurface   surface = args.Surface;
            SKCanvas    canvas  = surface.Canvas;

            canvas.Clear();

            using (SKPaint fillPaint = new SKPaint())
            {
                using (SKPaint outlinePaint = new SKPaint())
                {
                    SKPath path   = new SKPath();
                    float  y      = yGap * info.Height;
                    float  width  = info.Height * 1.6f;
                    float  radius = info.Height / 2f;
                    SKRect rect1  = new SKRect(y, y, info.Height - y, info.Height - y);
                    SKRect rect2  = new SKRect(width - info.Height, y, width - y, info.Height - y);
                    path.ArcTo(rect1, 90f, 180f, false);
                    path.LineTo(width - radius, y);
                    path.ArcTo(rect2, 270f, 180f, false);
                    path.Close();

                    outlinePaint.Style       = SKPaintStyle.Stroke;
                    outlinePaint.StrokeWidth = 2;
                    outlinePaint.Color       = BorderColor.ToSKColor();
                    outlinePaint.IsAntialias = true;

                    fillPaint.Style       = SKPaintStyle.Fill;
                    fillPaint.Color       = IsToggled ? ActiveColor.ToSKColor() : InactiveColor.ToSKColor();
                    fillPaint.IsAntialias = true;

                    canvas.DrawPath(path, fillPaint);
                    canvas.DrawPath(path, outlinePaint);

                    fillPaint.Color = BorderColor.ToSKColor();
                    canvas.DrawOval(IsToggled ? rect2 : rect1, fillPaint);
                }
            }
        }
Ejemplo n.º 9
0
        /// <inheritdoc />
        public bool Equals([AllowNull] ModeBar other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Orientation == other.Orientation ||
                     Orientation != null &&
                     Orientation.Equals(other.Orientation)
                     ) &&
                 (
                     BgColor == other.BgColor ||
                     BgColor != null &&
                     BgColor.Equals(other.BgColor)
                 ) &&
                 (
                     Color == other.Color ||
                     Color != null &&
                     Color.Equals(other.Color)
                 ) &&
                 (
                     ActiveColor == other.ActiveColor ||
                     ActiveColor != null &&
                     ActiveColor.Equals(other.ActiveColor)
                 ) &&
                 (
                     UiRevision == other.UiRevision ||
                     UiRevision != null &&
                     UiRevision.Equals(other.UiRevision)
                 ));
        }
Ejemplo n.º 10
0
    private void UpdateColor()
    {
        if (Input.GetButtonDown("SwapColor"))
        {
            switch (activeColor)
            {
            case ActiveColor.green:
                //activeColor = ActiveColor.red;
                //activeColorIndicator.color = paintRed;
                activeColor = ActiveColor.blue;
                activeColorIndicator.color = paintBlue;
                break;

            //case ActiveColor.red:
            //    activeColor = ActiveColor.blue;
            //    activeColorIndicator.color = paintBlue;
            //    break;
            case ActiveColor.blue:
                //activeColor = ActiveColor.black;
                //activeColorIndicator.color = paintBlack;
                activeColor = ActiveColor.green;
                activeColorIndicator.color = paintGreen;
                break;

            //case ActiveColor.black:
            //    activeColor = ActiveColor.yellow;
            //    activeColorIndicator.color = paintYellow;
            //    break;
            //case ActiveColor.yellow:
            //    activeColor = ActiveColor.green;
            //    activeColorIndicator.color = paintGreen;
            //    break;
            default:
                break;
            }
        }
    }
Ejemplo n.º 11
0
        public bool Equals([AllowNull] RangeSelector other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((Visible == other.Visible && Visible != null && other.Visible != null && Visible.Equals(other.Visible)) &&
                   (Equals(Buttons, other.Buttons) || Buttons != null && other.Buttons != null && Buttons.SequenceEqual(other.Buttons)) &&
                   (X == other.X && X != null && other.X != null && X.Equals(other.X)) &&
                   (XAnchor == other.XAnchor && XAnchor != null && other.XAnchor != null && XAnchor.Equals(other.XAnchor)) &&
                   (Y == other.Y && Y != null && other.Y != null && Y.Equals(other.Y)) &&
                   (YAnchor == other.YAnchor && YAnchor != null && other.YAnchor != null && YAnchor.Equals(other.YAnchor)) &&
                   (Font == other.Font && Font != null && other.Font != null && Font.Equals(other.Font)) &&
                   (BgColor == other.BgColor && BgColor != null && other.BgColor != null && BgColor.Equals(other.BgColor)) &&
                   (ActiveColor == other.ActiveColor && ActiveColor != null && other.ActiveColor != null && ActiveColor.Equals(other.ActiveColor)) &&
                   (BorderColor == other.BorderColor && BorderColor != null && other.BorderColor != null && BorderColor.Equals(other.BorderColor)) &&
                   (BorderWidth == other.BorderWidth && BorderWidth != null && other.BorderWidth != null && BorderWidth.Equals(other.BorderWidth)));
        }
Ejemplo n.º 12
0
 public void Generate(FizzleJson data)
 {
     ActiveColor   = (FizzleColor)data.GetOrDefault("active-color", ActiveColor.ToString());
     DeactiveColor = (FizzleColor)data.GetOrDefault("deactive-color", DeactiveColor.ToString());
     FizzleDebug.Log($"PressurePlate name = {(object) data["name"] ?? name}, active-color = {ActiveColor}, deactive-color = {DeactiveColor}");
 }