/// <summary> /// Translates to Canvas coordinates and adds a line vector. /// </summary> /// <param name="origin">Staring point for the line vector.</param> /// <param name="canvasOffsetX">Offset X to be added AFTER translation of the origin.</param> /// <param name="canvasOffsetY">Offset Y to be added AFTER translation of the origin.</param> /// <param name="penColor">Hex color to apply to the line vector.</param> public void LoadVector(Point origin, int canvasOffsetX, int canvasOffsetY, DrawColor penColor) { var ptDraw = new Point( (int)(origin.X / CanvasWidthDouble * Size.Width), (int)(origin.Y / CanvasHeightDouble * Size.Height) ); var ptDraw2 = new Point(ptDraw.X + canvasOffsetX, ptDraw.Y + canvasOffsetY); AddLine(ptDraw, ptDraw2, penColor); }
private void CollideWith(string tag, PlayerBase playerBase) { switch (tag) { case "Player": GameObject player = hit.transform.gameObject; DazeState pDaze = player.GetComponent <DazeState>(); //hit.collider.gameObject.transform.Translate(ray.direction * 0.15f); if (playerBase.GodModeKnockback == false) { hit.transform.gameObject.GetComponent <DazeState>().KnockBackEffect(ray.direction, knockBackForce); } else { hit.transform.gameObject.GetComponent <DazeState>().KnockBackEffect(ray.direction, knockBackForce); } break; case "PaintableEnvironment": PaintSizeMultiplier mult = hit.collider.GetComponent <PaintSizeMultiplier>(); //Renderer _wallRenderer = hit.collider.gameObject.GetComponent<Renderer>(); float _smult; if (mult) { _smult = (1f * mult.multiplier) * weaponSplashMultiplier; } else { _smult = 1f * weaponSplashMultiplier; } int _id = Player.skinId; DrawColor.DrawOnSplatmap(hit, _id, Player, _smult); break; default: downRay = new Ray(ray.GetPoint(range), -playerBase.transform.up); Debug.DrawRay(ray.GetPoint(range), -playerBase.transform.up, Color.red); if (Physics.Raycast(downRay, out hit, range)) { //TODO: implement painting of floor if (hit.collider.gameObject.tag == "Floor") { Debug.Log("hit floor"); } } break; } }
/// <summary> /// Translates to Canvas coordinates and adds a collection of points a polygon. /// </summary> /// <param name="polygonPoints">Collection of points to draw on the canvas.</param> /// <param name="penColor">Hex color to apply to the polygon.</param> public void LoadPolygon(IList <Point> polygonPoints, DrawColor penColor) { var ptsPoly = new Point[polygonPoints.Count]; for (var i = 0; i < polygonPoints.Count; i++) { ptsPoly[i].X = (int)(polygonPoints[i].X / CanvasWidthDouble * Size.Width); ptsPoly[i].Y = (int)(polygonPoints[i].Y / CanvasHeightDouble * Size.Height); } AddPolygon(ptsPoly, penColor); }
/// <summary> /// Creates a new instance of <see cref="ScreenCanvas"/>. /// </summary> /// <param name="size">Initial actual size.</param> public ScreenCanvas(Rectangle size) { Size = size; _updatePointsLock = new object(); _updatePolysLock = new object(); _points = new List <Tuple <Point[], DrawColor> >(); _polys = new List <Tuple <Point[], DrawColor> >(); //Set in case a call to add to end is made prior to creating a line _lastPoint = new Point(0, 0); _lastPen = DrawColor.White; }
/// <summary> /// 画笔颜色设置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button4_Click(object sender, EventArgs e) { ColorDialog cd = new ColorDialog(); cd.FullOpen = true; cd.Color = DrawColor; if (cd.ShowDialog() == DialogResult.OK) { DrawColor = cd.Color; Program.SendMessage("{\"method\": \"change_color\"" + ", \"color\": " + DrawColor.ToArgb().ToString() + "}"); } }
public FrmRowListCreator() { InitializeComponent(); DieColor = new DrawColor(); PnlStatus1.BackColor = DieColor.TestedDie; PnlStatus2.BackColor = DieColor.SkippedDie; PnlStatus3.BackColor = DieColor.UntestedDie; PnlStatus4.BackColor = DieColor.FirstDie; PnlStatus5.BackColor = DieColor.ZeroDie; SetActiveDieStatus(DieStatus.TestedDie); DefaultVariables(); // only for fast debugging }
private void changeBrushColorByPalette(string brushKey) { ColorDialog cd = new ColorDialog(); cd.ShowDialog(); DrawColor cdColor = cd.Color; Color newColor = new Color(); newColor.R = cdColor.R; newColor.G = cdColor.G; newColor.B = cdColor.B; newColor.A = cdColor.A; SolidColorBrush brush = new SolidColorBrush(newColor); this.Resources[brushKey] = brush; }
private static Brush GetBrush(DrawColor color) { switch (color) { case DrawColor.Blue: return(RadarCanvas.BlueBrush); case DrawColor.Black: return(RadarCanvas.BlackBrush); case DrawColor.Yellow: return(RadarCanvas.YellowBrush); case DrawColor.Green: return(RadarCanvas.GreenBrush); case DrawColor.White: return(RadarCanvas.WhiteBrush); default: return(RadarCanvas.YellowBrush); } }
public static void DrawElipse(IEnumerable <Vector3> points, int drawTimeMs = 50, DrawColor color = DrawColor.Yellow) { Draw(new DrawOptions { Points = points, Name = string.Empty, Color = color, Type = DrawType.Elipse, Duration = TimeSpan.FromMilliseconds(drawTimeMs) }); }
public static void DrawText(Vector3 position, string text, int drawTimeMs = 50, DrawColor color = DrawColor.White) { Draw(new DrawOptions { Points = new List <Vector3> { position }, Name = text, Color = color, Type = DrawType.Text, Duration = TimeSpan.FromMilliseconds(drawTimeMs) }); }
private void DrawVector(Point origin, int offsetX, int offsetY, DrawColor color) { _canvas.LoadVector(origin, offsetX, offsetY, color); }
private void DrawPolygon(IList <Point> points, DrawColor color = DrawColor.White) { _canvas.LoadPolygon(points, color); }
/// <summary> /// Add a collection of <see cref="Point"/>s that make up a polygon to the interal collection /// without translation. /// </summary> /// <param name="polygonPoints">Collection of points to draw on the canvas.</param> /// <param name="penColor">Hex color to apply to the polygon.</param> public void AddPolygon(Point[] polygonPoints, DrawColor penColor) { lock (_updatePolysLock) _polys.Add(new Tuple <Point[], DrawColor>(polygonPoints, penColor)); }