internal override void MouseClick(PointF location) { switch (m_ClickNumber) { case 0: { m_FirstClick = location; } break; case 1: { if (OnNewSymbolPart != null) { //GraphicsPath path = new GraphicsPath(); //path.AddLine(m_FirstClick, location); SymbolPart part = new LinePart(m_FirstClick, location); OnNewSymbolPart(this, new NewSymbolPartEventArgs(part)); } } break; default: break; } m_ClickNumber = ++m_ClickNumber % 2; }
private SymbolPartData ConvertSymbolPart(SymbolPart symbolPart) { if (symbolPart is LinePart) { LinePart linePart = (LinePart)symbolPart; PointF p1 = linePart.GetPoint(0); PointF p2 = linePart.GetPoint(1); return(new SymbolLineData(p1.X, p1.Y, p2.X, p2.Y)); } if (symbolPart is RectanglePart) { RectanglePart rectPart = (RectanglePart)symbolPart; return(new SymbolRectData(rectPart.Location.X, rectPart.Location.Y, rectPart.Width, rectPart.Height)); } if (symbolPart is TextPart) { TextPart textPart = (TextPart)symbolPart; return(new SymbolTextData(textPart.Location.X, textPart.Location.Y, textPart.Text)); } if (symbolPart is PortPart) { PortPart portPart = (PortPart)symbolPart; return(new SymbolPortData(portPart.Location.X, portPart.Location.Y, portPart.Angle, portPart.Direction, portPart.Name)); } return(null); }
public void AddToActiveList(LinePart _linePart) { inactiveLineParts.Remove(_linePart); activeLineParts.Add(_linePart); GameManager.Instance.levelPercent = activeLineParts.Count * 100 / 360; }
public void ResetTheCircle() { for (int i = 0; i < activeLineParts.Count; i++) { LinePart linePart = activeLineParts[i]; linePart.Hide(); inactiveLineParts.Add(linePart); } activeLineParts.Clear(); }
public void InstantiateTheCircle() { activeLineParts = new List <LinePart>(); inactiveLineParts = new List <LinePart>(); for (int i = 0; i < 360; i++) { GameObject go = Instantiate(linePartPrefab, lineParent); go.transform.rotation = Quaternion.Euler(Vector3.forward * i); LinePart linePart = go.GetComponent <LinePart>(); linePart.Hide(); inactiveLineParts.Add(linePart); } }
/// <summary> /// Generates the datas. /// </summary> override public void GenerateDatas() { LowPoints.Clear(); HighPoints.Clear(); if (!IsPointsGenerated) { Parts.Clear(); } if (Points != null && SeriesContainer != null) { CalculateMinAndMax(); ChartPoint oldPoint = new ChartPoint { XValue = double.MinValue, YValue = double.MinValue }; IntializePoints(); int index = 0; foreach (ChartPoint point in Points) { if (CheckValuePoint(oldPoint, point)) { Point highPoint = NormalizePoint(new Point(point.XValue, point.YValue)); Point lowPoint = NormalizePoint(new Point(lowPoints[index].XValue, lowPoints[index].YValue)); HighPoints.Add(highPoint); LowPoints.Add(lowPoint); oldPoint = point; } index++; } if (RenderingMode == RenderingMode.Default) { if (!IsPointsGenerated) { for (int i = 0; i < HighPoints.Count; i++) { LinePart linePart = new LinePart(HighPoints[i], LowPoints[i]); SetBindingForStrokeandStrokeThickness(linePart); Parts.Add(linePart); } IsPointsGenerated = true; } else { int i = 0; foreach (LinePart part in Parts) { part.X1 = HighPoints[i].X; part.Y1 = HighPoints[i].Y; part.X2 = LowPoints[i].X; part.Y2 = LowPoints[i].Y; part.Refresh(); i++; } } } } else { Parts.Clear(); } if (this.SeriesContainer != null) { this.SeriesContainer.Invalidate(); } IsRefreshed = false; }
/// <summary> /// Generates the datas. /// </summary> override public void GenerateDatas() { if (Points != null && SeriesContainer != null) { LinePoints = new PointCollection(); if (!IsPointsGenerated) { Parts.Clear(); } CalculateMinAndMax(); ChartPoint oldPoint = new ChartPoint { XValue = double.MinValue, YValue = double.MinValue }; IntializePoints(); foreach (ChartPoint point in Points) { if (CheckValuePoint(oldPoint, point)) { Point linePoint = NormalizePoint(new Point(point.XValue, point.YValue)); LinePoints.Add(linePoint); oldPoint = point; } } if (RenderingMode == RenderingMode.Default) { if (!IsPointsGenerated) { if (!UseSinglePart) { for (int i = 0; i < LinePoints.Count - 1; i++) { if (CheckValue(LinePoints[i].X) && CheckValue(LinePoints[i].Y) && CheckValue(LinePoints[i + 1].X) && CheckValue(LinePoints[i + 1].Y)) { LinePart linePart = new LinePart(LinePoints[i], LinePoints[i + 1]); SetBindingForStrokeandStrokeThickness(linePart); Parts.Add(linePart); } } } else { LineSinglePart singlePart = new LineSinglePart(LinePoints); SetBindingForStrokeandStrokeThickness(singlePart); Parts.Add(singlePart); } IsPointsGenerated = true; } else { int i = 0; if (!UseSinglePart) { foreach (LinePart part in Parts) { if (CheckValue(LinePoints[i].X) && CheckValue(LinePoints[i].Y) && CheckValue(LinePoints[i + 1].X) && CheckValue(LinePoints[i + 1].Y)) { part.X1 = LinePoints[i].X; part.Y1 = LinePoints[i].Y; part.X2 = LinePoints[i + 1].X; part.Y2 = LinePoints[i + 1].Y; part.Refresh(); } i++; } } else { foreach (LineSinglePart part in Parts) { part.LinePoints = LinePoints; part.Refresh(); i++; } } } } } if (this.SeriesContainer != null) { this.SeriesContainer.Invalidate(); } IsRefreshed = false; }