Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
PrimitiveUI.PrimitiveCanvas Class Reference
Inheritance diagram for PrimitiveUI.PrimitiveCanvas:

Classes

class  PUIElement
 
class  PUIFillElement
 
class  PUIStrokeElement
 
class  PUIUtils
 

Public Member Functions

void Clear ()
 
void DrawSquare (Vector2 center, float size, Color fillColor)
 
void DrawSquare (Vector2 center, float size, StrokeStyle strokeStyle)
 
void DrawSquare (Vector2 center, float size, Color fillColor, StrokeStyle strokeStyle)
 
void DrawSquare (Vector2 center, float size, float rotation=0f, Color? fillColor=null, StrokeStyle strokeStyle=null)
 
void DrawRectangle (float x, float y, float width, float height, Color fillColor)
 
void DrawRectangle (float x, float y, float width, float height, StrokeStyle strokeStyle)
 
void DrawRectangle (float x, float y, float width, float height, Color fillColor, StrokeStyle strokeStyle)
 
void DrawRectangle (float x, float y, float width, float height, float rotation=0f, Color? fillColor=null, StrokeStyle strokeStyle=null)
 
void DrawRectangle (Rect rect, Color fillColor)
 
void DrawRectangle (Rect rect, StrokeStyle strokeStyle)
 
void DrawRectangle (Rect rect, Color fillColor, StrokeStyle strokeStyle)
 
void DrawRectangle (Rect rect, float rotation=0f, Color? fillColor=null, StrokeStyle strokeStyle=null)
 
void DrawCircle (Vector2 center, float radius, Color fillColor)
 
void DrawCircle (Vector2 center, float radius, StrokeStyle strokeStyle)
 
void DrawCircle (Vector2 center, float radius, Color fillColor, StrokeStyle strokeStyle)
 
void DrawCircle (Vector2 center, float radius, float stepSize=1f, float startAngle=0f, float endAngle=360f, Color? fillColor=null, StrokeStyle strokeStyle=null)
 
void DrawEllipse (Vector2 center, Vector2 radii, Color fillColor)
 
void DrawEllipse (Vector2 center, Vector2 radii, StrokeStyle strokeStyle)
 
void DrawEllipse (Vector2 center, Vector2 radii, Color fillColor, StrokeStyle strokeStyle)
 
void DrawEllipse (Vector2 center, Vector2 radii, float stepSize=1f, float rotation=0f, float startAngle=0f, float endAngle=360f, Color? fillColor=null, StrokeStyle strokeStyle=null)
 
void DrawRegularSolid (Vector2 center, float radius, int sides, Color fillColor)
 
void DrawRegularSolid (Vector2 center, float radius, int sides, StrokeStyle strokeStyle)
 
void DrawRegularSolid (Vector2 center, float radius, int sides, Color fillColor, StrokeStyle strokeStyle)
 
void DrawRegularSolid (Vector2 center, float radius, int sides, float rotation=0f, Color? fillColor=null, StrokeStyle strokeStyle=null)
 
void DrawIrregularSolid (Vector2 center, float[] radii, Color fillColor)
 
void DrawIrregularSolid (Vector2 center, float[] radii, StrokeStyle strokeStyle)
 
void DrawIrregularSolid (Vector2 center, float[] radii, Color fillColor, StrokeStyle strokeStyle)
 
void DrawIrregularSolid (Vector2 center, float[] radii, float rotation, Color? fillColor, StrokeStyle strokeStyle)
 
void DrawPolygon (Vector2[] points, Color fillColor)
 
void DrawPolygon (Vector2[] points, StrokeStyle strokeStyle)
 
void DrawPolygon (Vector2[] points, Color fillColor, StrokeStyle strokeStyle)
 
void DrawRawMesh (Vector2[] points, int[] triangles, Color fillColor)
 
void DrawLine (Vector2 point1, Vector2 point2)
 
void DrawLine (Vector2 point1, Vector2 point2, StrokeStyle strokeStyle)
 
void DrawPath (Vector2[] points)
 
void DrawPath (Vector2[] points, StrokeStyle strokeStyle)
 
void DrawPath (Vector2[] points, StrokeStyle strokeStyle, bool closePath)
 

Public Attributes

bool setDirtyOnDraw = true
 

Protected Member Functions

override void OnPopulateMesh (VertexHelper vh)
 
override void OnRectTransformDimensionsChange ()
 

Properties

float aspectRatio [get]
 

Private Attributes

List< PUIElementelements = new List<PUIElement>()
 

Detailed Description

Definition at line 10 of file PrimitiveCanvas.cs.

Member Function Documentation

◆ Clear()

void PrimitiveUI.PrimitiveCanvas.Clear ( )
inline

◆ DrawCircle() [1/4]

void PrimitiveUI.PrimitiveCanvas.DrawCircle ( Vector2  center,
float  radius,
Color  fillColor 
)
inline

Definition at line 408 of file PrimitiveCanvas.cs.

409 {
410 DrawCircle(center, radius, 1f, 0f, 360f, fillColor);
411 }
void DrawCircle(Vector2 center, float radius, Color fillColor)

References PrimitiveUI.PrimitiveCanvas.DrawCircle().

Referenced by PrimitiveUI.Examples.PUIExampleCharts.Draw(), PrimitiveUI.PrimitiveCanvas.DrawCircle(), and PrimitiveUI.PrimitiveCanvas.DrawRegularSolid().

◆ DrawCircle() [2/4]

void PrimitiveUI.PrimitiveCanvas.DrawCircle ( Vector2  center,
float  radius,
Color  fillColor,
StrokeStyle  strokeStyle 
)
inline

Definition at line 418 of file PrimitiveCanvas.cs.

419 {
420 DrawCircle(center, radius, 1f, 0f, 360f, fillColor, strokeStyle);
421 }

References PrimitiveUI.PrimitiveCanvas.DrawCircle().

◆ DrawCircle() [3/4]

void PrimitiveUI.PrimitiveCanvas.DrawCircle ( Vector2  center,
float  radius,
float  stepSize = 1f,
float  startAngle = 0f,
float  endAngle = 360f,
Color fillColor = null,
StrokeStyle  strokeStyle = null 
)
inline

Definition at line 423 of file PrimitiveCanvas.cs.

424 {
425 if (endAngle - startAngle < 0f)
426 {
427 Debug.LogWarning("DrawCircle() only works in the clockwise-direction; please ensure endAngle > startAngle.");
428 }
429 else
430 {
431 DrawEllipse(center, new Vector2(radius, radius * aspectRatio), stepSize, 0f, startAngle, endAngle, fillColor, strokeStyle);
432 }
433 }
void DrawEllipse(Vector2 center, Vector2 radii, Color fillColor)

References PrimitiveUI.PrimitiveCanvas.aspectRatio, Debug, and PrimitiveUI.PrimitiveCanvas.DrawEllipse().

◆ DrawCircle() [4/4]

void PrimitiveUI.PrimitiveCanvas.DrawCircle ( Vector2  center,
float  radius,
StrokeStyle  strokeStyle 
)
inline

Definition at line 413 of file PrimitiveCanvas.cs.

414 {
415 DrawCircle(center, radius, 1f, 0f, 360f, Color.white, strokeStyle);
416 }

References Color, and PrimitiveUI.PrimitiveCanvas.DrawCircle().

◆ DrawEllipse() [1/4]

void PrimitiveUI.PrimitiveCanvas.DrawEllipse ( Vector2  center,
Vector2  radii,
Color  fillColor 
)
inline

Definition at line 435 of file PrimitiveCanvas.cs.

436 {
437 DrawEllipse(center, radii, 1f, 0f, 0f, 360f, fillColor);
438 }

References PrimitiveUI.PrimitiveCanvas.DrawEllipse().

Referenced by PrimitiveUI.PrimitiveCanvas.DrawCircle(), and PrimitiveUI.PrimitiveCanvas.DrawEllipse().

◆ DrawEllipse() [2/4]

void PrimitiveUI.PrimitiveCanvas.DrawEllipse ( Vector2  center,
Vector2  radii,
Color  fillColor,
StrokeStyle  strokeStyle 
)
inline

Definition at line 445 of file PrimitiveCanvas.cs.

446 {
447 DrawEllipse(center, radii, 1f, 0f, 0f, 360f, fillColor, strokeStyle);
448 }

References PrimitiveUI.PrimitiveCanvas.DrawEllipse().

◆ DrawEllipse() [3/4]

void PrimitiveUI.PrimitiveCanvas.DrawEllipse ( Vector2  center,
Vector2  radii,
float  stepSize = 1f,
float  rotation = 0f,
float  startAngle = 0f,
float  endAngle = 360f,
Color fillColor = null,
StrokeStyle  strokeStyle = null 
)
inline

Definition at line 450 of file PrimitiveCanvas.cs.

451 {
452 if (endAngle - startAngle == 0f)
453 {
454 return;
455 }
456 if (endAngle - startAngle < 0f)
457 {
458 Debug.LogWarning("DrawEllipse() only works in the clockwise-direction; please ensure endAngle > startAngle.");
459 return;
460 }
461 Vector2 vector = center;
462 if (rotation != 0f)
463 {
464 radii.x *= aspectRatio;
465 }
466 float num = MathF.PI / 2f - startAngle * (MathF.PI / 180f);
467 float num2 = MathF.PI * 2f / (360f / stepSize);
468 int num3 = Mathf.CeilToInt((endAngle - startAngle) / stepSize) + 1;
469 List<Vector2> list = new List<Vector2>();
470 list.Add(center);
471 for (int i = 0; i < num3; i++)
472 {
473 list.Add(new Vector2(Mathf.Cos(num - num2 * (float)i) * radii.x + center.x, Mathf.Sin(num - num2 * (float)i) * radii.y + center.y));
474 }
475 if (rotation != 0f)
476 {
477 rotation *= MathF.PI / 180f;
478 float num4 = aspectRatio;
479 float num5 = Mathf.Cos(rotation);
480 float num6 = Mathf.Sin(rotation);
481 for (int j = 0; j < list.Count; j++)
482 {
483 float num7 = list[j].x - center.x;
484 float num8 = list[j].y - center.y;
485 list[j] = new Vector2((num7 * num5 + num8 * num6) / num4 + vector.x, num8 * num5 - num7 * num6 + vector.y);
486 }
487 }
488 if (fillColor.HasValue)
489 {
490 int[] array;
491 if (endAngle - startAngle == 0f)
492 {
493 array = new int[(list.Count - 1) * 3];
494 int num9 = 0;
495 int num10 = 1;
496 while (num9 < array.Length)
497 {
498 array[num9] = 0;
499 array[num9 + 1] = num10;
500 array[num9 + 2] = num10 + 1;
501 num9 += 3;
502 num10++;
503 }
504 array[^1] = 1;
505 }
506 else
507 {
508 array = new int[(list.Count - 2) * 3];
509 int num11 = 0;
510 int num12 = 1;
511 while (num11 < array.Length)
512 {
513 array[num11] = 0;
514 array[num11 + 1] = num12;
515 array[num11 + 2] = num12 + 1;
516 num11 += 3;
517 num12++;
518 }
519 }
520 elements.Add(new PUIFillElement(list.ToArray(), array, fillColor.Value));
521 }
522 if (strokeStyle != null)
523 {
524 DrawPath(list.GetRange(1, list.Count - 2).ToArray(), strokeStyle, closePath: true);
525 }
526 if (setDirtyOnDraw)
527 {
528 SetVerticesDirty();
529 }
530 }
void DrawPath(Vector2[] points)

References PrimitiveUI.PrimitiveCanvas.aspectRatio, Debug, PrimitiveUI.PrimitiveCanvas.DrawPath(), PrimitiveUI.PrimitiveCanvas.elements, and PrimitiveUI.PrimitiveCanvas.setDirtyOnDraw.

◆ DrawEllipse() [4/4]

void PrimitiveUI.PrimitiveCanvas.DrawEllipse ( Vector2  center,
Vector2  radii,
StrokeStyle  strokeStyle 
)
inline

Definition at line 440 of file PrimitiveCanvas.cs.

441 {
442 DrawEllipse(center, radii, 1f, 0f, 0f, 360f, null, strokeStyle);
443 }

References PrimitiveUI.PrimitiveCanvas.DrawEllipse().

◆ DrawIrregularSolid() [1/4]

void PrimitiveUI.PrimitiveCanvas.DrawIrregularSolid ( Vector2  center,
float[]  radii,
Color  fillColor 
)
inline

Definition at line 559 of file PrimitiveCanvas.cs.

560 {
561 DrawIrregularSolid(center, radii, 0f, fillColor, null);
562 }
void DrawIrregularSolid(Vector2 center, float[] radii, Color fillColor)

References PrimitiveUI.PrimitiveCanvas.DrawIrregularSolid().

Referenced by PrimitiveUI.Examples.PUIExampleRPGStats.Draw(), and PrimitiveUI.PrimitiveCanvas.DrawIrregularSolid().

◆ DrawIrregularSolid() [2/4]

void PrimitiveUI.PrimitiveCanvas.DrawIrregularSolid ( Vector2  center,
float[]  radii,
Color  fillColor,
StrokeStyle  strokeStyle 
)
inline

Definition at line 569 of file PrimitiveCanvas.cs.

570 {
571 DrawIrregularSolid(center, radii, 0f, fillColor, strokeStyle);
572 }

References PrimitiveUI.PrimitiveCanvas.DrawIrregularSolid().

◆ DrawIrregularSolid() [3/4]

void PrimitiveUI.PrimitiveCanvas.DrawIrregularSolid ( Vector2  center,
float[]  radii,
float  rotation,
Color fillColor,
StrokeStyle  strokeStyle 
)
inline

Definition at line 574 of file PrimitiveCanvas.cs.

575 {
576 int num = radii.Length;
577 if (num < 3)
578 {
579 Debug.LogError("DrawIrregularSolid() requires at least 3 radii.");
580 return;
581 }
582 float num2 = MathF.PI / 2f - rotation * (MathF.PI / 180f);
583 float num3 = MathF.PI * 2f / (float)num;
584 float num4 = aspectRatio;
585 List<Vector2> list = new List<Vector2>();
586 list.Add(center);
587 for (int i = 0; i < num; i++)
588 {
589 Vector2 vector = new Vector2(radii[i], radii[i] * num4);
590 list.Add(new Vector2(Mathf.Cos(num2 - num3 * (float)i) * vector.x + center.x, Mathf.Sin(num2 - num3 * (float)i) * vector.y + center.y));
591 }
592 if (fillColor.HasValue)
593 {
594 int[] array = new int[(list.Count - 1) * 3];
595 int num5 = 0;
596 int num6 = 1;
597 while (num5 < array.Length)
598 {
599 array[num5] = 0;
600 array[num5 + 1] = num6;
601 array[num5 + 2] = num6 + 1;
602 num5 += 3;
603 num6++;
604 }
605 array[^1] = 1;
606 elements.Add(new PUIFillElement(list.ToArray(), array, fillColor.Value));
607 }
608 if (strokeStyle != null)
609 {
610 DrawPath(list.GetRange(1, list.Count - 2).ToArray(), strokeStyle, closePath: true);
611 }
612 if (setDirtyOnDraw)
613 {
614 SetVerticesDirty();
615 }
616 }

References PrimitiveUI.PrimitiveCanvas.aspectRatio, Debug, PrimitiveUI.PrimitiveCanvas.DrawPath(), PrimitiveUI.PrimitiveCanvas.elements, and PrimitiveUI.PrimitiveCanvas.setDirtyOnDraw.

◆ DrawIrregularSolid() [4/4]

void PrimitiveUI.PrimitiveCanvas.DrawIrregularSolid ( Vector2  center,
float[]  radii,
StrokeStyle  strokeStyle 
)
inline

Definition at line 564 of file PrimitiveCanvas.cs.

565 {
566 DrawIrregularSolid(center, radii, 0f, null, strokeStyle);
567 }

References PrimitiveUI.PrimitiveCanvas.DrawIrregularSolid().

◆ DrawLine() [1/2]

void PrimitiveUI.PrimitiveCanvas.DrawLine ( Vector2  point1,
Vector2  point2 
)
inline

◆ DrawLine() [2/2]

void PrimitiveUI.PrimitiveCanvas.DrawLine ( Vector2  point1,
Vector2  point2,
StrokeStyle  strokeStyle 
)
inline

Definition at line 787 of file PrimitiveCanvas.cs.

788 {
789 float strokeThickness = ((strokeStyle.scaleMode == StrokeScaleMode.Absolute) ? (strokeStyle.thickness / base.rectTransform.rect.width) : strokeStyle.thickness);
790 elements.Add(new PUIStrokeElement(new Vector2[2] { point1, point2 }, PUIUtils.GetLinePoints(point1, point2, strokeThickness, aspectRatio), strokeStyle, isClosedPath: false));
791 if (setDirtyOnDraw)
792 {
793 SetVerticesDirty();
794 }
795 }

References PrimitiveUI.PrimitiveCanvas.aspectRatio, PrimitiveUI.PrimitiveCanvas.elements, PrimitiveUI.PrimitiveCanvas.PUIUtils.GetLinePoints(), PrimitiveUI.PrimitiveCanvas.setDirtyOnDraw, and PrimitiveUI.StrokeStyle.thickness.

◆ DrawPath() [1/3]

◆ DrawPath() [2/3]

void PrimitiveUI.PrimitiveCanvas.DrawPath ( Vector2[]  points,
StrokeStyle  strokeStyle 
)
inline

Definition at line 802 of file PrimitiveCanvas.cs.

803 {
804 DrawPath(points, strokeStyle, closePath: false);
805 }

References PrimitiveUI.PrimitiveCanvas.DrawPath().

◆ DrawPath() [3/3]

void PrimitiveUI.PrimitiveCanvas.DrawPath ( Vector2[]  points,
StrokeStyle  strokeStyle,
bool  closePath 
)
inline

Definition at line 807 of file PrimitiveCanvas.cs.

808 {
809 if (points.Length < 2)
810 {
811 Debug.LogError("DrawPath() needs at least two points to draw");
812 return;
813 }
814 if (points.Length == 2)
815 {
816 DrawLine(points[0], points[1], strokeStyle);
817 if (closePath)
818 {
819 Debug.LogWarning("DrawPath() can't close a path with only two points. 'closePath' parameter ignored.");
820 }
821 return;
822 }
823 float strokeThickness = ((strokeStyle.scaleMode == StrokeScaleMode.Absolute) ? (strokeStyle.thickness / base.rectTransform.rect.width) : strokeStyle.thickness);
824 elements.Add(new PUIStrokeElement(points, PUIUtils.GetPathPoints(points, closePath, strokeThickness, aspectRatio), strokeStyle, closePath));
825 if (setDirtyOnDraw)
826 {
827 SetVerticesDirty();
828 }
829 }

References PrimitiveUI.PrimitiveCanvas.aspectRatio, Debug, PrimitiveUI.PrimitiveCanvas.DrawLine(), PrimitiveUI.PrimitiveCanvas.elements, PrimitiveUI.PrimitiveCanvas.PUIUtils.GetPathPoints(), PrimitiveUI.PrimitiveCanvas.setDirtyOnDraw, and PrimitiveUI.StrokeStyle.thickness.

◆ DrawPolygon() [1/3]

void PrimitiveUI.PrimitiveCanvas.DrawPolygon ( Vector2[]  points,
Color  fillColor 
)
inline

Definition at line 618 of file PrimitiveCanvas.cs.

619 {
620 DrawPolygon(points, fillColor, null);
621 }
void DrawPolygon(Vector2[] points, Color fillColor)

References PrimitiveUI.PrimitiveCanvas.DrawPolygon().

Referenced by PrimitiveUI.PrimitiveCanvas.DrawPolygon().

◆ DrawPolygon() [2/3]

void PrimitiveUI.PrimitiveCanvas.DrawPolygon ( Vector2[]  points,
Color  fillColor,
StrokeStyle  strokeStyle 
)
inline

Definition at line 628 of file PrimitiveCanvas.cs.

629 {
630 if (points.Length < 3)
631 {
632 Debug.LogError("DrawPolygon() requires at least 3 vertices");
633 return;
634 }
635 if (points.Length == 3)
636 {
637 points = new Vector2[3]
638 {
639 points[0],
640 points[1],
641 points[2]
642 };
643 elements.Add(new PUIFillElement(points, new int[3] { 0, 1, 2 }, fillColor));
644 }
645 else if (points.Length == 4)
646 {
647 elements.Add(new PUIFillElement(points, new int[6] { 0, 1, 2, 2, 3, 0 }, fillColor));
648 }
649 else
650 {
651 int[] array = new int[(points.Length - 2) * 3];
652 int num = 0;
653 LinkedList<Vector2> linkedList = new LinkedList<Vector2>(points);
654 List<LinkedListNode<Vector2>> list = new List<LinkedListNode<Vector2>>();
655 List<LinkedListNode<Vector2>> list2 = new List<LinkedListNode<Vector2>>();
656 List<LinkedListNode<Vector2>> list3 = new List<LinkedListNode<Vector2>>();
657 LinkedListNode<Vector2> linkedListNode = linkedList.First;
658 LinkedListNode<Vector2> linkedListNode2 = linkedList.First;
659 while (linkedListNode.Next != null)
660 {
661 linkedListNode = linkedListNode.Next;
662 if (linkedListNode.Value.x < linkedListNode2.Value.x)
663 {
664 linkedListNode2 = linkedListNode;
665 }
666 }
667 LinkedListNode<Vector2> linkedListNode3 = linkedListNode2.Previous ?? linkedListNode2.List.Last;
668 LinkedListNode<Vector2> linkedListNode4 = linkedListNode2.Next ?? linkedListNode2.List.First;
669 Func<Vector2, Vector2, Vector2, bool> func = ((!(linkedListNode4.Value.y > linkedListNode3.Value.y)) ? ((Func<Vector2, Vector2, Vector2, bool>)delegate(Vector2 prev, Vector2 cur, Vector2 next)
670 {
671 Vector2 vector2 = cur - prev;
672 Vector2 rhs2 = next - cur;
673 return Vector2.Dot(new Vector2(0f - vector2.y, vector2.x), rhs2) > 0f;
674 }) : ((Func<Vector2, Vector2, Vector2, bool>)delegate(Vector2 prev, Vector2 cur, Vector2 next)
675 {
676 Vector2 vector = cur - prev;
677 Vector2 rhs = next - cur;
678 return Vector2.Dot(new Vector2(0f - vector.y, vector.x), rhs) < 0f;
679 }));
680 linkedListNode = linkedList.First;
681 for (int i = 0; i < linkedList.Count; i++)
682 {
683 linkedListNode3 = linkedListNode.Previous ?? linkedListNode.List.Last;
684 linkedListNode4 = linkedListNode.Next ?? linkedListNode.List.First;
685 if (func(linkedListNode3.Value, linkedListNode.Value, linkedListNode4.Value))
686 {
687 list2.Add(linkedListNode);
688 float triangleArea = PUIUtils.GetTriangleArea(linkedListNode3.Value, linkedListNode.Value, linkedListNode4.Value);
689 bool flag = true;
690 foreach (LinkedListNode<Vector2> item in list3)
691 {
692 if (PUIUtils.PointInTriangle(item.Value, linkedListNode3.Value, linkedListNode.Value, linkedListNode4.Value, triangleArea))
693 {
694 flag = false;
695 break;
696 }
697 }
698 if (flag)
699 {
700 list.Add(linkedListNode);
701 }
702 }
703 else
704 {
705 list3.Add(linkedListNode);
706 }
707 linkedListNode = linkedListNode.Next;
708 }
709 while (linkedList.Count > 3)
710 {
711 linkedListNode = list[0];
712 linkedListNode3 = linkedListNode.Previous ?? linkedListNode.List.Last;
713 linkedListNode4 = linkedListNode.Next ?? linkedListNode.List.First;
714 array[num] = Array.IndexOf(points, linkedListNode3.Value);
715 array[num + 1] = Array.IndexOf(points, linkedListNode.Value);
716 array[num + 2] = Array.IndexOf(points, linkedListNode4.Value);
717 num += 3;
718 list.Remove(linkedListNode);
719 linkedList.Remove(linkedListNode);
720 LinkedListNode<Vector2>[] array2 = new LinkedListNode<Vector2>[2] { linkedListNode3, linkedListNode4 };
721 foreach (LinkedListNode<Vector2> linkedListNode5 in array2)
722 {
723 LinkedListNode<Vector2> linkedListNode6 = linkedListNode5.Previous ?? linkedListNode5.List.Last;
724 LinkedListNode<Vector2> linkedListNode7 = linkedListNode5.Next ?? linkedListNode5.List.First;
725 if (func(linkedListNode6.Value, linkedListNode5.Value, linkedListNode7.Value))
726 {
727 if (list3.Contains(linkedListNode5))
728 {
729 list3.Remove(linkedListNode5);
730 list2.Add(linkedListNode5);
731 }
732 float triangleArea2 = PUIUtils.GetTriangleArea(linkedListNode6.Value, linkedListNode5.Value, linkedListNode7.Value);
733 bool flag2 = true;
734 foreach (LinkedListNode<Vector2> item2 in list3)
735 {
736 if (PUIUtils.PointInTriangle(item2.Value, linkedListNode6.Value, linkedListNode5.Value, linkedListNode7.Value, triangleArea2))
737 {
738 flag2 = false;
739 break;
740 }
741 }
742 if (flag2 && !list.Contains(linkedListNode5))
743 {
744 list.Add(linkedListNode5);
745 }
746 else if (!flag2 && list.Contains(linkedListNode5))
747 {
748 list.Remove(linkedListNode5);
749 }
750 }
751 else
752 {
753 list2.Remove(linkedListNode5);
754 list3.Add(linkedListNode5);
755 }
756 }
757 }
758 array[num] = Array.IndexOf(points, linkedList.First.Value);
759 array[num + 1] = Array.IndexOf(points, linkedList.First.Next.Value);
760 array[num + 2] = Array.IndexOf(points, linkedList.First.Next.Next.Value);
761 elements.Add(new PUIFillElement(points, array, fillColor));
762 }
763 if (strokeStyle != null)
764 {
765 DrawPath(points, strokeStyle, closePath: true);
766 }
767 if (setDirtyOnDraw)
768 {
769 SetVerticesDirty();
770 }
771 }

References Debug, PrimitiveUI.PrimitiveCanvas.DrawPath(), PrimitiveUI.PrimitiveCanvas.elements, PrimitiveUI.PrimitiveCanvas.PUIUtils.GetTriangleArea(), item, PrimitiveUI.PrimitiveCanvas.PUIUtils.PointInTriangle(), and PrimitiveUI.PrimitiveCanvas.setDirtyOnDraw.

◆ DrawPolygon() [3/3]

void PrimitiveUI.PrimitiveCanvas.DrawPolygon ( Vector2[]  points,
StrokeStyle  strokeStyle 
)
inline

Definition at line 623 of file PrimitiveCanvas.cs.

624 {
625 DrawPath(points, strokeStyle, closePath: true);
626 }

References PrimitiveUI.PrimitiveCanvas.DrawPath().

◆ DrawRawMesh()

void PrimitiveUI.PrimitiveCanvas.DrawRawMesh ( Vector2[]  points,
int[]  triangles,
Color  fillColor 
)
inline

Definition at line 773 of file PrimitiveCanvas.cs.

774 {
775 elements.Add(new PUIFillElement(points, triangles, fillColor));
776 if (setDirtyOnDraw)
777 {
778 SetVerticesDirty();
779 }
780 }

References PrimitiveUI.PrimitiveCanvas.elements, and PrimitiveUI.PrimitiveCanvas.setDirtyOnDraw.

◆ DrawRectangle() [1/8]

void PrimitiveUI.PrimitiveCanvas.DrawRectangle ( float  x,
float  y,
float  width,
float  height,
Color  fillColor 
)
inline

Definition at line 335 of file PrimitiveCanvas.cs.

336 {
337 DrawRectangle(new Rect(x, y, width, height), 0f, fillColor);
338 }
void DrawRectangle(float x, float y, float width, float height, Color fillColor)

References PrimitiveUI.PrimitiveCanvas.DrawRectangle().

Referenced by PrimitiveUI.Examples.PUIExampleCharts.Draw(), PrimitiveUI.PrimitiveCanvas.DrawRectangle(), and PrimitiveUI.PrimitiveCanvas.DrawSquare().

◆ DrawRectangle() [2/8]

void PrimitiveUI.PrimitiveCanvas.DrawRectangle ( float  x,
float  y,
float  width,
float  height,
Color  fillColor,
StrokeStyle  strokeStyle 
)
inline

Definition at line 345 of file PrimitiveCanvas.cs.

346 {
347 DrawRectangle(new Rect(x, y, width, height), fillColor, strokeStyle);
348 }

References PrimitiveUI.PrimitiveCanvas.DrawRectangle().

◆ DrawRectangle() [3/8]

void PrimitiveUI.PrimitiveCanvas.DrawRectangle ( float  x,
float  y,
float  width,
float  height,
float  rotation = 0f,
Color fillColor = null,
StrokeStyle  strokeStyle = null 
)
inline

Definition at line 350 of file PrimitiveCanvas.cs.

351 {
352 DrawRectangle(new Rect(x, y, width, height), rotation, fillColor, strokeStyle);
353 }

References PrimitiveUI.PrimitiveCanvas.DrawRectangle().

◆ DrawRectangle() [4/8]

void PrimitiveUI.PrimitiveCanvas.DrawRectangle ( float  x,
float  y,
float  width,
float  height,
StrokeStyle  strokeStyle 
)
inline

Definition at line 340 of file PrimitiveCanvas.cs.

341 {
342 DrawRectangle(new Rect(x, y, width, height), strokeStyle);
343 }

References PrimitiveUI.PrimitiveCanvas.DrawRectangle().

◆ DrawRectangle() [5/8]

void PrimitiveUI.PrimitiveCanvas.DrawRectangle ( Rect  rect,
Color  fillColor 
)
inline

Definition at line 355 of file PrimitiveCanvas.cs.

356 {
357 DrawRectangle(rect, 0f, fillColor);
358 }

References PrimitiveUI.PrimitiveCanvas.DrawRectangle().

◆ DrawRectangle() [6/8]

void PrimitiveUI.PrimitiveCanvas.DrawRectangle ( Rect  rect,
Color  fillColor,
StrokeStyle  strokeStyle 
)
inline

Definition at line 365 of file PrimitiveCanvas.cs.

366 {
367 DrawRectangle(rect, 0f, fillColor, strokeStyle);
368 }

References PrimitiveUI.PrimitiveCanvas.DrawRectangle().

◆ DrawRectangle() [7/8]

void PrimitiveUI.PrimitiveCanvas.DrawRectangle ( Rect  rect,
float  rotation = 0f,
Color fillColor = null,
StrokeStyle  strokeStyle = null 
)
inline

Definition at line 370 of file PrimitiveCanvas.cs.

371 {
372 Vector2 center = rect.center;
373 Vector2[] array = new Vector2[4];
374 if (rotation != 0f)
375 {
376 rect.width *= aspectRatio;
377 }
378 array[0] = new Vector2(rect.min.x, rect.min.y);
379 array[1] = new Vector2(rect.min.x, rect.max.y);
380 array[2] = new Vector2(rect.max.x, rect.max.y);
381 array[3] = new Vector2(rect.max.x, rect.min.y);
382 if (rotation != 0f)
383 {
384 rotation *= MathF.PI / 180f;
385 float num = Mathf.Cos(rotation);
386 float num2 = Mathf.Sin(rotation);
387 for (int i = 0; i < array.Length; i++)
388 {
389 float num3 = array[i].x - rect.center.x;
390 float num4 = array[i].y - rect.center.y;
391 array[i] = new Vector2((num3 * num + num4 * num2) / aspectRatio + center.x, num4 * num - num3 * num2 + center.y);
392 }
393 }
394 if (fillColor.HasValue)
395 {
396 elements.Add(new PUIFillElement(array, new int[6] { 0, 1, 2, 2, 3, 0 }, fillColor.Value));
397 }
398 if (strokeStyle != null)
399 {
400 DrawPath(array, strokeStyle, closePath: true);
401 }
402 if (setDirtyOnDraw)
403 {
404 SetVerticesDirty();
405 }
406 }

References PrimitiveUI.PrimitiveCanvas.aspectRatio, PrimitiveUI.PrimitiveCanvas.DrawPath(), PrimitiveUI.PrimitiveCanvas.elements, and PrimitiveUI.PrimitiveCanvas.setDirtyOnDraw.

◆ DrawRectangle() [8/8]

void PrimitiveUI.PrimitiveCanvas.DrawRectangle ( Rect  rect,
StrokeStyle  strokeStyle 
)
inline

Definition at line 360 of file PrimitiveCanvas.cs.

361 {
362 DrawRectangle(rect, 0f, null, strokeStyle);
363 }

References PrimitiveUI.PrimitiveCanvas.DrawRectangle().

◆ DrawRegularSolid() [1/4]

void PrimitiveUI.PrimitiveCanvas.DrawRegularSolid ( Vector2  center,
float  radius,
int  sides,
Color  fillColor 
)
inline

Definition at line 532 of file PrimitiveCanvas.cs.

533 {
534 DrawRegularSolid(center, radius, sides, 0f, fillColor);
535 }
void DrawRegularSolid(Vector2 center, float radius, int sides, Color fillColor)

References PrimitiveUI.PrimitiveCanvas.DrawRegularSolid().

Referenced by PrimitiveUI.Examples.PUIExampleRPGStats.Draw(), and PrimitiveUI.PrimitiveCanvas.DrawRegularSolid().

◆ DrawRegularSolid() [2/4]

void PrimitiveUI.PrimitiveCanvas.DrawRegularSolid ( Vector2  center,
float  radius,
int  sides,
Color  fillColor,
StrokeStyle  strokeStyle 
)
inline

Definition at line 542 of file PrimitiveCanvas.cs.

543 {
544 DrawRegularSolid(center, radius, sides, 0f, fillColor, strokeStyle);
545 }

References PrimitiveUI.PrimitiveCanvas.DrawRegularSolid().

◆ DrawRegularSolid() [3/4]

void PrimitiveUI.PrimitiveCanvas.DrawRegularSolid ( Vector2  center,
float  radius,
int  sides,
float  rotation = 0f,
Color fillColor = null,
StrokeStyle  strokeStyle = null 
)
inline

Definition at line 547 of file PrimitiveCanvas.cs.

548 {
549 if (sides < 3)
550 {
551 Debug.LogError("DrawRegularSolid() requires at least 3 sides.");
552 }
553 else
554 {
555 DrawCircle(center, radius, 360f / (float)sides, rotation, 360f + rotation, fillColor, strokeStyle);
556 }
557 }

References Debug, and PrimitiveUI.PrimitiveCanvas.DrawCircle().

◆ DrawRegularSolid() [4/4]

void PrimitiveUI.PrimitiveCanvas.DrawRegularSolid ( Vector2  center,
float  radius,
int  sides,
StrokeStyle  strokeStyle 
)
inline

Definition at line 537 of file PrimitiveCanvas.cs.

538 {
539 DrawRegularSolid(center, radius, sides, 0f, null, strokeStyle);
540 }

References PrimitiveUI.PrimitiveCanvas.DrawRegularSolid().

◆ DrawSquare() [1/4]

void PrimitiveUI.PrimitiveCanvas.DrawSquare ( Vector2  center,
float  size,
Color  fillColor 
)
inline

Definition at line 315 of file PrimitiveCanvas.cs.

316 {
317 DrawSquare(center, size, 0f, fillColor);
318 }
void DrawSquare(Vector2 center, float size, Color fillColor)

References PrimitiveUI.PrimitiveCanvas.DrawSquare().

Referenced by PrimitiveUI.PrimitiveCanvas.DrawSquare().

◆ DrawSquare() [2/4]

void PrimitiveUI.PrimitiveCanvas.DrawSquare ( Vector2  center,
float  size,
Color  fillColor,
StrokeStyle  strokeStyle 
)
inline

Definition at line 325 of file PrimitiveCanvas.cs.

326 {
327 DrawSquare(center, size, 0f, fillColor, strokeStyle);
328 }

References PrimitiveUI.PrimitiveCanvas.DrawSquare().

◆ DrawSquare() [3/4]

void PrimitiveUI.PrimitiveCanvas.DrawSquare ( Vector2  center,
float  size,
float  rotation = 0f,
Color fillColor = null,
StrokeStyle  strokeStyle = null 
)
inline

Definition at line 330 of file PrimitiveCanvas.cs.

331 {
332 DrawRectangle(new Rect(center.x - size * 0.5f, center.y - size * 0.5f * aspectRatio, size, size * aspectRatio), rotation, fillColor, strokeStyle);
333 }

References PrimitiveUI.PrimitiveCanvas.aspectRatio, and PrimitiveUI.PrimitiveCanvas.DrawRectangle().

◆ DrawSquare() [4/4]

void PrimitiveUI.PrimitiveCanvas.DrawSquare ( Vector2  center,
float  size,
StrokeStyle  strokeStyle 
)
inline

Definition at line 320 of file PrimitiveCanvas.cs.

321 {
322 DrawSquare(center, size, 0f, null, strokeStyle);
323 }

References PrimitiveUI.PrimitiveCanvas.DrawSquare().

◆ OnPopulateMesh()

override void PrimitiveUI.PrimitiveCanvas.OnPopulateMesh ( VertexHelper  vh)
inlineprotected

Definition at line 271 of file PrimitiveCanvas.cs.

272 {
273 vh.Clear();
274 Vector2 size = base.rectTransform.rect.size;
275 Vector3 vector = new Vector3(0f - base.rectTransform.pivot.x, 0f - base.rectTransform.pivot.y, 0f);
276 List<List<UIVertex>> list = new List<List<UIVertex>>(elements.Count);
277 for (int i = 0; i < elements.Count; i++)
278 {
279 list.Add(elements[i].GetUIVertexTriangleStream(vector, size, color));
280 }
281 vh.AddUIVertexTriangleStream(list.SelectMany((List<UIVertex> l) => l).ToList());
282 }

References PrimitiveUI.PrimitiveCanvas.elements.

◆ OnRectTransformDimensionsChange()

override void PrimitiveUI.PrimitiveCanvas.OnRectTransformDimensionsChange ( )
inlineprotected

Definition at line 290 of file PrimitiveCanvas.cs.

291 {
292 base.OnRectTransformDimensionsChange();
293 foreach (PUIElement element in elements)
294 {
295 if (!(element.GetType() == typeof(PUIStrokeElement)))
296 {
297 continue;
298 }
299 PUIStrokeElement pUIStrokeElement = (PUIStrokeElement)element;
300 if (pUIStrokeElement.strokeStyle.scaleMode == StrokeScaleMode.Absolute)
301 {
302 float strokeThickness = pUIStrokeElement.strokeStyle.thickness / base.rectTransform.rect.width;
303 if (pUIStrokeElement.rawPoints.Length == 2)
304 {
305 pUIStrokeElement.UpdatePoints(PUIUtils.GetLinePoints(pUIStrokeElement.rawPoints[0], pUIStrokeElement.rawPoints[1], strokeThickness, aspectRatio));
306 }
307 else
308 {
309 pUIStrokeElement.UpdatePoints(PUIUtils.GetPathPoints(pUIStrokeElement.rawPoints, pUIStrokeElement.isClosedPath, strokeThickness, aspectRatio));
310 }
311 }
312 }
313 }

References PrimitiveUI.PrimitiveCanvas.aspectRatio, PrimitiveUI.PrimitiveCanvas.elements, PrimitiveUI.PrimitiveCanvas.PUIUtils.GetLinePoints(), PrimitiveUI.PrimitiveCanvas.PUIUtils.GetPathPoints(), PrimitiveUI.PrimitiveCanvas.PUIStrokeElement.isClosedPath, PrimitiveUI.PrimitiveCanvas.PUIStrokeElement.rawPoints, PrimitiveUI.StrokeStyle.scaleMode, PrimitiveUI.PrimitiveCanvas.PUIStrokeElement.strokeStyle, and PrimitiveUI.PrimitiveCanvas.PUIStrokeElement.UpdatePoints().

Member Data Documentation

◆ elements

◆ setDirtyOnDraw

Property Documentation

◆ aspectRatio


The documentation for this class was generated from the following file: