protected override void EnableProperties() { Segments.IsVisibleWhen(SegmentColors, s => s.CurrentValue); GradientColor.IsVisibleWhen(ColorType, c => c.BaseValue == ColorMappingType.Gradient); MainColor.IsVisibleWhen(ColorType, c => c.BaseValue == ColorMappingType.Simple); SecondaryColor.IsVisibleWhen(ColorType, c => c.BaseValue == ColorMappingType.Simple); }
protected override IEnumerator ProcessPayload(VisualPayload payload) { var filledGraph = VisualizerFactory.InstantiateFilledGraph(); filledGraph.Initialize(this, payload); AssignStates(filledGraph); var mainColor = MainColor.GetFirstValue(payload.Data); foreach (var entry in EntryField.GetEntries(payload.Data)) { filledGraph.AddPoint(ZAxis.GetValue(entry), YAxis.GetValue(entry)); } filledGraph.SetGraphData( mainColor); filledGraph.ApplyPoints(); var iterator = Router.TransmitAll(payload); while (iterator.MoveNext()) { yield return(null); } }
public static ProductColor GetRandomProductColor() { // Returns a mostly random color // Mostly, because it prefers a certain set of colors MainColor randomMainColor = GetRandomMainColor(); return(GetColorFromMainColor(randomMainColor)); }
public override void DrawImage(SKCanvas dc) { var thisRect = GetMainRect(); if (NeedsWhiteBorders == true) { dc.DrawRect(thisRect, _whitePaint); dc.DrawRect(thisRect, _thickBorder); thisRect = SKRect.Create(thisRect.Location.X + 5, thisRect.Location.Y + 5, thisRect.Width - 10, thisRect.Width - 10); } else { thisRect = SKRect.Create(thisRect.Location.X + 2, thisRect.Location.Y + 2, thisRect.Width - 4, thisRect.Height - 4); } if (thisRect.Width != thisRect.Height) { throw new BasicBlankException("Rethink because width and height is not the same so its not a true circle. Values are " + thisRect.Width + ", " + thisRect.Height + ". Actual Was " + ActualWidth + ", " + ActualHeight + ". Needs White Borders Is " + NeedsWhiteBorders); } if (MainColor.Equals(cs.Transparent) == true) { if (NeedsWhiteBorders == false) { throw new Exception("Will cause blank. If we want that, rethink"); } return; } dc.DrawOval(thisRect, MainPaint); dc.DrawOval(thisRect, _borderPaint); }
protected override IEnumerator ProcessPayload(VisualPayload payload) { payload.VisualData.Bound.name = "Line Graph Bound"; var lineGraph = VisualizerFactory.InstantiateLineGraph(); lineGraph.Initialize(this, payload); AssignStates(lineGraph); var entries = EntryField.GetLastKeyValue(payload.Data) as IEnumerable <MutableObject>; if (entries == null) { throw new Exception("Illegal mutable field here! " + EntryField.AbsoluteKey + " is not an enumerable of mutables!"); } if (!entries.Any()) { yield return(null); yield break; } foreach (var entry in entries) { Vector3 entryPosition = new Vector3( XAxis.GetLastKeyValue(entry), YAxis.GetLastKeyValue(entry), ZAxis.GetLastKeyValue(entry) ); Color pointColor = PointColor.GetLastKeyValue(entry); lineGraph.AddPoint(entryPosition, pointColor); yield return(null); } yield return(null); lineGraph.SetLineData(MainColor.GetLastKeyValue(payload.Data), LineWidth.GetLastKeyValue(payload.Data), ZDepthOffset.GetLastKeyValue(payload.Data), EdgeColor.GetLastKeyValue(payload.Data), EdgeWidth.GetLastKeyValue(payload.Data), PointWidth.GetLastKeyValue(payload.Data), PulseLine.GetLastKeyValue(payload.Data), PulseWidth.GetLastKeyValue(payload.Data), Wipe.GetLastKeyValue(payload.Data), StartTime.GetLastKeyValue(payload.Data), WipeDuration.GetLastKeyValue(payload.Data) ); lineGraph.ApplyPoints(); }
public IActionResult UpdateMainColor([FromBody] MainColor mainColor) { if (ModelState.IsValid) { var model = _mainColorAppService.UpdateMainColor(mainColor); return(Ok(model)); } return(NotFound()); }
public XElement ToXml(IToXmlContext ctx) { return(new XElement("JoyrideStepStyle", new XAttribute("Guid", Guid), new XElement("Name", Name), BackgroundColor.IsNullOrEmpty() ? null : new XElement("BackgroundColor", BackgroundColor), MainColor.IsNullOrEmpty() ? null : new XElement("MainColor", MainColor), Color.IsNullOrEmpty() ? null : new XElement("Color", Color), BorderRadius.IsNullOrEmpty() ? null : new XElement("BorderRadius", BorderRadius), TextAlign.IsNullOrEmpty() ? null : new XElement("TextAlign", TextAlign), Width.IsNullOrEmpty() ? null : new XElement("Width", Width))); }
public static ProductColor GetColorFromMainColor(MainColor mainColor) { Color color; switch (mainColor) { case MainColor.red: color = Color.red; break; case MainColor.green: color = new Color(.13f, .545f, .13f); break; case MainColor.darkGreen: color = new Color(0, 0.392f, 0, 1); break; case MainColor.blue: color = Color.blue; break; case MainColor.white: color = Color.white; break; case MainColor.magenta: color = Color.magenta; break; case MainColor.yellow: color = new Color(1, .843f, 0); break; case MainColor.orange: color = new Color(1, .549f, 0, 1); break; case MainColor.gray: color = Color.gray; break; case MainColor.cyan: color = Color.cyan; break; default: // Green is a good default, cause weed is green color = Color.green; break; } return(new ProductColor(color)); }
private void DrawMarble(SKCanvas canvas, SKRect thisRect) // start with the marble piece. { var br_Fill = MiscHelpers.GetCenterGradientPaint(SKColors.White, MainColor.ToSKColor(), new SKPoint(thisRect.Left + (thisRect.Width / 2), thisRect.Top + (thisRect.Height / 2)), thisRect.Height / 2); SKPath gp = new SKPath(); gp.AddOval(thisRect); SKColor firstColor; SKColor secondColor; firstColor = new SKColor(255, 255, 255, 50); // 60 instead of 100 seems to do the trick secondColor = new SKColor(0, 0, 0, 50); var br_Shade = MiscHelpers.GetLinearGradientPaint(firstColor, secondColor, thisRect, MiscHelpers.EnumLinearGradientPercent.Angle45); canvas.DrawPath(gp, br_Fill); canvas.DrawPath(gp, br_Shade); }
public bool UpdateMainColor(MainColor mainColor) { var model = _dbContext .MainColors .FirstOrDefault(x => x.Id == mainColor.Id); if (model != null) { model.Name = mainColor.Name; model.DisplayOrder = mainColor.DisplayOrder; model.UpdatedDate = mainColor.UpdatedDate; model.Published = mainColor.Published; _dbContext.SaveChanges(); return(true); } return(false); }
public override void DrawImage(SKCanvas dc) { if (NeedsToClear == true) { dc.Clear();// needs to always clear. } if (Number == 0) { return; } SKColor thisColor; var tempColor = MainColor.ToSKColor(); thisColor = new SKColor(tempColor.Red, tempColor.Green, tempColor.Blue, 150); // i think var thisPaint = MiscHelpers.GetSolidPaint(thisColor); var thisRect = GetMainRect(); dc.DrawOval(thisRect, thisPaint); dc.DrawOval(thisRect, _borderPaint); var thisText = MiscHelpers.GetTextPaint(SKColors.White, thisRect.Height * 0.7f); dc.DrawCustomText(Number.ToString(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, thisText, thisRect, out _); }
protected override IEnumerator ProcessPayload(VisualPayload payload) { foreach (var entry in Scope.GetEntries(payload.Data)) { var newSystem = ParticleSystemFactory.GenerateParticleSystem(ParticleSystemPrefabName.GetValue(entry)); var mainColor = MainColor.GetValue(entry); newSystem.startColor = mainColor; if (OverrideColorGradient.GetValue(entry)) { var newGradient = new Gradient(); newGradient.colorKeys = new [] { new GradientColorKey(mainColor, 0f), new GradientColorKey(mainColor, 1f), }; newGradient.alphaKeys = new [] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, .15f), new GradientAlphaKey(0f, 1f) }; var col = newSystem.colorOverLifetime; col.enabled = true; col.color = new ParticleSystem.MinMaxGradient( newGradient); } newSystem.startLifetime = LifeTime.GetValue(entry); // this allegedly works, see http://forum.unity3d.com/threads/enabling-emission.364258/#post-2356966 var emission = newSystem.emission; emission.rate = new ParticleSystem.MinMaxCurve(EmitRate.GetValue(entry)); var newBound = newSystem.GetComponent <BoundingBox>(); if (newBound == null) { newBound = newSystem.gameObject.AddComponent <BoundingBox>(); } payload.VisualData.Bound.ChildWithinBound(newBound.transform); var newVisualizer = newSystem.GetComponent <ParticleSystemVisualizer>(); if (newVisualizer == null) { newVisualizer = newSystem.gameObject.AddComponent <ParticleSystemVisualizer>(); } var newPayload = new VisualPayload(entry.Last(), new VisualDescription(newBound)); newVisualizer.Initialize(this, newPayload); var perParticleSystemIterator = PerParticleSystem.Transmit(newPayload); while (perParticleSystemIterator.MoveNext()) { yield return(null); } } var defaultIterator = DefaultState.Transmit(payload); while (defaultIterator.MoveNext()) { yield return(null); } }
public void DrawWeapon(SKCanvas dc, SKRect rect_Piece) { if (Weapon == EnumWeaponList.None) { throw new BasicBlankException("You must specify a weapon to draw"); } #pragma warning disable IDE0068 // Use recommended dispose pattern SKPath gp_Piece = new SKPath(); #pragma warning restore IDE0068 // Use recommended dispose pattern cannot do recommended because it creates some other objects. SKPoint[] pts_Curve; int[] int_Offset; SKMatrix tmp_Matrix; tmp_Matrix = SKMatrix.MakeScale(rect_Piece.Width / 100, rect_Piece.Height / 100); tmp_Matrix.TransX = rect_Piece.Left; tmp_Matrix.TransY = rect_Piece.Top; switch (Weapon) { case EnumWeaponList.Candlestick: { int_Offset = new int[5]; int_Offset[0] = 35; int_Offset[1] = 30; int_Offset[2] = 40; int_Offset[3] = 30; int_Offset[4] = 50; pts_Curve = new SKPoint[10]; // was 4. has to do poly since curves don't work pts_Curve[0] = new SKPoint((float)50 + int_Offset[0], 0); pts_Curve[1] = new SKPoint((float)50 + int_Offset[1], 20); pts_Curve[2] = new SKPoint((float)50 + int_Offset[2], 50); pts_Curve[3] = new SKPoint((float)50 + int_Offset[3], 80); pts_Curve[4] = new SKPoint((float)50 + int_Offset[4], 90); pts_Curve[9] = new SKPoint((float)50 - int_Offset[0], 0); pts_Curve[8] = new SKPoint((float)50 - int_Offset[1], 20); pts_Curve[7] = new SKPoint((float)50 - int_Offset[2], 50); pts_Curve[6] = new SKPoint((float)50 - int_Offset[3], 80); pts_Curve[5] = new SKPoint((float)50 - int_Offset[4], 90); gp_Piece.AddPoly(pts_Curve); gp_Piece.AddRect(SKRect.Create(0, 90, 100, 10)); gp_Piece.Transform(tmp_Matrix); dc.DrawPath(gp_Piece, MainPaint); dc.DrawPath(gp_Piece, _borderPaint); break; } case EnumWeaponList.Knife: { int_Offset = new int[5]; int_Offset[0] = 0; int_Offset[1] = 15; int_Offset[2] = 20; int_Offset[3] = 18; int_Offset[4] = 15; pts_Curve = new SKPoint[12]; pts_Curve[0] = new SKPoint((float)50 + int_Offset[0], 0); pts_Curve[1] = new SKPoint((float)50 + int_Offset[1], 5); pts_Curve[2] = new SKPoint((float)50 + int_Offset[2], 15); pts_Curve[3] = new SKPoint((float)50 + int_Offset[3], 25); pts_Curve[4] = new SKPoint((float)50 + int_Offset[4], 50); pts_Curve[5] = new SKPoint(50, 100); pts_Curve[11] = new SKPoint((float)50 - int_Offset[0], 0); pts_Curve[10] = new SKPoint((float)50 - int_Offset[1], 5); pts_Curve[9] = new SKPoint((float)50 - int_Offset[2], 15); pts_Curve[8] = new SKPoint((float)50 - int_Offset[3], 25); pts_Curve[7] = new SKPoint((float)50 - int_Offset[4], 50); pts_Curve[6] = new SKPoint(50, 100); gp_Piece.AddPoly(pts_Curve); gp_Piece.Transform(tmp_Matrix); dc.DrawPath(gp_Piece, MainPaint); dc.DrawPath(gp_Piece, _borderPaint); gp_Piece = new SKPath(); gp_Piece.AddRect(SKRect.Create(0, 25, 100, 10)); gp_Piece.Transform(tmp_Matrix); dc.DrawPath(gp_Piece, MainPaint); dc.DrawPath(gp_Piece, _borderPaint); break; } case EnumWeaponList.LeadPipe: { gp_Piece = new SKPath(); gp_Piece.AddRect(SKRect.Create(0, 0, 100, 100)); gp_Piece.Transform(tmp_Matrix); if (MainColor.Equals(cs.Aqua) == true) { dc.DrawPath(gp_Piece, _mainHatchPaint); } else { dc.DrawPath(gp_Piece, _cardHatchPaint); } dc.DrawPath(gp_Piece, _borderPaint); gp_Piece = new SKPath(); gp_Piece.AddRect(SKRect.Create(0, 20, 100, 60)); gp_Piece.Transform(tmp_Matrix); dc.DrawPath(gp_Piece, MainPaint); dc.DrawPath(gp_Piece, _borderPaint); break; } case EnumWeaponList.Revolver: { pts_Curve = new SKPoint[3]; pts_Curve[0] = new SKPoint(20, 65); pts_Curve[1] = new SKPoint(55, 60); pts_Curve[2] = new SKPoint(55, 30); gp_Piece.AddPoly(pts_Curve); // try this way gp_Piece.Transform(tmp_Matrix); dc.DrawPath(gp_Piece, MainPaint); dc.DrawPath(gp_Piece, _borderPaint); gp_Piece = new SKPath(); pts_Curve = new SKPoint[8]; pts_Curve[0] = new SKPoint(100, 5); pts_Curve[1] = new SKPoint(30, 5); pts_Curve[2] = new SKPoint(20, 20); pts_Curve[3] = new SKPoint(0, 100); pts_Curve[4] = new SKPoint(30, 100); pts_Curve[5] = new SKPoint(35, 80); pts_Curve[6] = new SKPoint(45, 45); pts_Curve[7] = new SKPoint(100, 40); gp_Piece.AddPoly(pts_Curve); gp_Piece.Transform(tmp_Matrix); dc.DrawPath(gp_Piece, MainPaint); dc.DrawPath(gp_Piece, _borderPaint); break; } case EnumWeaponList.Rope: { int int_Angle = 0; int int_Count; var rect_Rope = SKRect.Create(45, 45, 10, 10); for (int_Count = 1; int_Count <= 8; int_Count++) { gp_Piece.AddArc(rect_Rope, int_Angle, 180); if (int_Angle == 0) { rect_Rope = SKRect.Create(rect_Rope.Left, rect_Rope.Top - 5, rect_Rope.Width + 10, rect_Rope.Height + 10); int_Angle = 180; } else { rect_Rope = SKRect.Create(rect_Rope.Left - 10, rect_Rope.Top - 5, rect_Rope.Width + 10, rect_Rope.Height + 10); int_Angle = 0; } } gp_Piece.AddLine(100, 65, 95, 70); gp_Piece.Transform(tmp_Matrix); dc.DrawPath(gp_Piece, MainPaint); dc.DrawPath(gp_Piece, _borderPaint); break; } case EnumWeaponList.Wrench: { gp_Piece.AddLine(0, 10, 10, 0, true); gp_Piece.AddLine(90, 0, 100, 10); gp_Piece.AddLine(100, 100, 60, 100); gp_Piece.AddLine(60, 40, 10, 40); gp_Piece.AddLine(0, 30, 40, 30); gp_Piece.AddLine(40, 10, 0, 10); gp_Piece.Close(); gp_Piece.Transform(tmp_Matrix); dc.DrawPath(gp_Piece, MainPaint); dc.DrawPath(gp_Piece, _borderPaint); break; } } }
public override void DrawImage(SKCanvas dc) { SKBitmap thisBit; if (MainColor.Equals(cs.Blue) == true) { // blue processes switch (WhichPiece) { case EnumPieceType.BISHOP: { thisBit = _blueBishop; break; } case EnumPieceType.KING: { thisBit = _blueKing; break; } case EnumPieceType.KNIGHT: { thisBit = _blueKnight; break; } case EnumPieceType.PAWN: { thisBit = _bluePawn; break; } case EnumPieceType.QUEEN: { thisBit = _blueQueen; break; } case EnumPieceType.ROOK: { thisBit = _blueRook; break; } default: { throw new BasicBlankException("Not supported"); } } } else if (MainColor.Equals(cs.Red) == true) { // red processes switch (WhichPiece) { case EnumPieceType.BISHOP: { thisBit = _redBishop; break; } case EnumPieceType.KING: { thisBit = _redKing; break; } case EnumPieceType.KNIGHT: { thisBit = _redKnight; break; } case EnumPieceType.PAWN: { thisBit = _redPawn; break; } case EnumPieceType.QUEEN: { thisBit = _redQueen; break; } case EnumPieceType.ROOK: { thisBit = _redRook; break; } default: { throw new BasicBlankException("Not supported"); } } } else { throw new BasicBlankException("Only blue and red are supported for chess pieces"); } if (thisBit == null == true) { throw new BasicBlankException("There is no bitmap to even draw"); } var thisRect = GetMainRect(); dc.DrawBitmap(thisBit, thisRect, _bitPaint); }
public override string ToString() { return($"Palette: MainColor : {MainColor.ToString()}"); }
public static Color GetRandomColor() { MainColor randomMainColor = GetRandomMainColor(); return(GetColorFromMainColor(randomMainColor).GetColor()); }
public bool CreateMainColor(MainColor mainColor) { _dbContext.MainColors.Add(mainColor); _dbContext.SaveChanges(); return(true); }
public override void DrawImage(SKCanvas dc) { if (ActualHeight == 1) { return; } // anything that needs to be drawn for each space will be here. if nothing is done, then will do nothing. if (Number == 0) { return;// because no number associated with it. must have a number } if (Number == 10 || Number == 11) { throw new BasicBlankException("Can't have 10 or 11 for number"); } if (Number < 1 || Number > 12) { throw new BasicBlankException("Number has to be between 2 and 12 but no 10 or 11"); } // can be transparent and previous one (if removing space) if (ActualHeight != ActualWidth) { throw new BasicBlankException("Must be perfect squares for this game"); } if (ActualWidth == 0 || ActualHeight == 0) { throw new BasicBlankException("Can't be 0 for the actual width or height"); } var thisRect = GetMainRect(); var newRect = SKRect.Create(3, 3, thisRect.Width - 6, thisRect.Height - 6); if (Number != 2 && Number != 12) { if (WasPrevious == true) { dc.DrawRect(thisRect, _yellowPaint); } else { dc.DrawRect(thisRect, _whitePaint); } SKPaint otherTextPaint; if (MainColor.Equals(cs.Transparent) == false) { // this means do a circle dc.DrawOval(newRect, _borderPaint); dc.DrawOval(newRect, MainPaint); // i think otherTextPaint = MiscHelpers.GetTextPaint(SKColors.Aqua, newRect.Height * 1.2f); } else { otherTextPaint = MiscHelpers.GetTextPaint(SKColors.Red, newRect.Height * 1.2f); } dc.DrawBorderText(Number.ToString(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, otherTextPaint, _text1Paint, newRect); dc.DrawRect(thisRect, _borderPaint); return; } dc.DrawRect(thisRect, _grayPaint); StandardDiceGraphicsCP firstDice = new StandardDiceGraphicsCP(); { var withBlock = firstDice; withBlock.Location = new SKPoint(newRect.Location.X, newRect.Location.Y); withBlock.NeedsToClear = false; withBlock.ActualWidthHeight = newRect.Height / 2.1f; withBlock.Value = Number / 2; withBlock.UseSmallerBorders(); if (WasPrevious == true) { withBlock.FillColor = cs.Yellow; } } StandardDiceGraphicsCP secondDice = new StandardDiceGraphicsCP(); { var withBlock1 = secondDice; withBlock1.Location = new SKPoint(firstDice.Location.X + 3 + firstDice.ActualWidthHeight, firstDice.Location.Y + 3 + firstDice.ActualWidthHeight); withBlock1.NeedsToClear = false; withBlock1.ActualWidthHeight = newRect.Height / 2.1f; withBlock1.Value = Number / 2; withBlock1.UseSmallerBorders(); if (WasPrevious == true) { withBlock1.FillColor = cs.Yellow; } } firstDice.DrawDice(dc); secondDice.DrawDice(dc); if (MainColor.Equals(cs.Transparent) == false) { // this means do a circle dc.DrawOval(newRect, _borderPaint); dc.DrawOval(newRect, MainPaint); // i think SKPaint otherTextPaint; if (Number == 2) { otherTextPaint = MiscHelpers.GetTextPaint(SKColors.Aqua, newRect.Height * 1.2f); } else { otherTextPaint = MiscHelpers.GetTextPaint(SKColors.Aqua, newRect.Height * 0.7f); } dc.DrawBorderText(Number.ToString(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, otherTextPaint, _text1Paint, newRect); dc.DrawRect(thisRect, _borderPaint); return; } dc.DrawRect(thisRect, _borderPaint); }