예제 #1
0
파일: BoxLink.cs 프로젝트: fbizuneh/Igor
        public virtual void DrawLink(Vector2 Offset)
        {
            Color LineColor = Color.blue;

            if (bHighlighted)
            {
                LineColor = Color.red;
            }

            if (EndAnchor != null)
            {
                VisualScriptingDrawing.curveFromTo(EndAnchor.LastRect, StartAnchor.LastRect, LineColor, Color.green, Offset);
            }
            else
            {
                Vector2 MousePosition = InputState.GetLocalMousePosition(StartAnchor.Owner.Owner, Vector2.zero);
                Rect    MouseRect     = new Rect(MousePosition.x, MousePosition.y, 0.0f, 0.0f);

                if (StartAnchor.IsInput())
                {
                    VisualScriptingDrawing.curveFromTo(MouseRect, StartAnchor.LastRect, LineColor, Color.green, Offset);
                }
                else
                {
                    VisualScriptingDrawing.curveFromTo(StartAnchor.LastRect, MouseRect, LineColor, Color.green, Offset);
                }
            }
        }
예제 #2
0
파일: EntityBox.cs 프로젝트: fbizuneh/Igor
        public virtual void DrawSelectedOutline()
        {
            Rect BoxBounds = GetBoxBounds();

            // Top line
            VisualScriptingDrawing.DrawLine(new Vector2(-SelectionOffset - (BoxBounds.width * 0.5f), -SelectionOffset), new Vector2(SelectionOffset + (BoxBounds.width * 0.5f), -SelectionOffset), SelectionColor, SelectionWidth, false);
            // Right line
            VisualScriptingDrawing.DrawLine(new Vector2(SelectionOffset + BoxBounds.width, -SelectionOffset), new Vector2(SelectionOffset + BoxBounds.width, SelectionOffset + BoxBounds.height), SelectionColor, SelectionWidth, false);
            // Bottom line
            VisualScriptingDrawing.DrawLine(new Vector2(-SelectionOffset - (BoxBounds.width * 0.5f), SelectionOffset + BoxBounds.height), new Vector2(SelectionOffset + (BoxBounds.width * 0.5f), SelectionOffset + BoxBounds.height), SelectionColor, SelectionWidth, false);
            // Left line
            VisualScriptingDrawing.DrawLine(new Vector2(-SelectionOffset, -SelectionOffset), new Vector2(-SelectionOffset, SelectionOffset + BoxBounds.height), SelectionColor, SelectionWidth, false);
        }
예제 #3
0
        public static void bezierLine(Vector2 start, Vector2 startTangent, Vector2 end, Vector2 endTangent, Color color, float width, bool antiAlias, int segments)
        {
            Vector2 lastV = cubeBezier(start, startTangent, end, endTangent, 0);

            for (int i = 1; i <= segments; ++i)
            {
                Vector2 v = cubeBezier(start, startTangent, end, endTangent, i / (float)segments);

                VisualScriptingDrawing.DrawLine(
                    lastV,
                    v,
                    color, width, antiAlias);
                lastV = v;
            }
        }
예제 #4
0
        public static void Unused(Rect inwr, Rect inwr2, Color color, Color shadow, Vector2 Offset)
        {
            Rect wr  = new Rect(inwr.x - Offset.x, inwr.y - Offset.y, inwr.width, inwr.height);
            Rect wr2 = new Rect(inwr2.x - Offset.x, inwr2.y - Offset.y, inwr2.width, inwr2.height);

            VisualScriptingDrawing.bezierLine(
                new Vector2(wr.x + wr.width, wr.y + 3 + wr.height / 2),
                new Vector2(wr.x + wr.width + Mathf.Abs(wr2.x - (wr.x + wr.width)) / 2, wr.y + 3 + wr.height / 2),
                new Vector2(wr2.x, wr2.y + 3 + wr2.height / 2),
                new Vector2(wr2.x - Mathf.Abs(wr2.x - (wr.x + wr.width)) / 2, wr2.y + 3 + wr2.height / 2), shadow, 5, true, 20);
            VisualScriptingDrawing.bezierLine(
                new Vector2(wr.x + wr.width, wr.y + wr.height / 2),
                new Vector2(wr.x + wr.width + Mathf.Abs(wr2.x - (wr.x + wr.width)) / 2, wr.y + wr.height / 2),
                new Vector2(wr2.x, wr2.y + wr2.height / 2),
                new Vector2(wr2.x - Mathf.Abs(wr2.x - (wr.x + wr.width)) / 2, wr2.y + wr2.height / 2), color, 2, true, 20);
        }
예제 #5
0
        protected virtual void CheckAndResolveBoxCollision(EntityBox <EntityType> BoxA, EntityBox <EntityType> BoxB)
        {
            Rect BoxABounds       = BoxA.GetBoxBounds();
            Rect BiggerBoxABounds = new Rect(BoxABounds.x - MinimumSafeDistance, BoxABounds.y - MinimumSafeDistance,
                                             BoxABounds.width + (2 * MinimumSafeDistance), BoxABounds.height + (2 * MinimumSafeDistance));
            Rect BoxBBounds       = BoxB.GetBoxBounds();
            Rect BiggerBoxBBounds = new Rect(BoxBBounds.x - MinimumSafeDistance, BoxBBounds.y - MinimumSafeDistance,
                                             BoxBBounds.width + (2 * MinimumSafeDistance), BoxBBounds.height + (2 * MinimumSafeDistance));

            if (VisualScriptingDrawing.RectOverlapsRect(BiggerBoxABounds, BiggerBoxBBounds))
            {
                Rect CurrentRelativeRect = BiggerBoxABounds;
                bool bNewSpotFound       = false;
                Rect NewBoxBBounds       = BiggerBoxBBounds;

                while (!bNewSpotFound)
                {
                    bool bFoundConflict = false;
                    NewBoxBBounds = new Rect(CurrentRelativeRect.x + CurrentRelativeRect.width + 1,
                                             CurrentRelativeRect.y,
                                             BiggerBoxBBounds.width,
                                             BiggerBoxBBounds.height);

                    for (int CurrentBox = 0; CurrentBox < Boxes.Count; ++CurrentBox)
                    {
                        if (Boxes[CurrentBox] != BoxB)
                        {
                            if (VisualScriptingDrawing.RectOverlapsRect(NewBoxBBounds, Boxes[CurrentBox].GetBoxBounds()))
                            {
                                bFoundConflict = true;

                                Rect NewBoxBounds = Boxes[CurrentBox].GetBoxBounds();
                                CurrentRelativeRect = new Rect(NewBoxBounds.x - MinimumSafeDistance, NewBoxBounds.y - MinimumSafeDistance,
                                                               NewBoxBounds.width + (2 * MinimumSafeDistance), NewBoxBounds.height + (2 * MinimumSafeDistance));
                            }
                        }
                    }

                    if (!bFoundConflict)
                    {
                        bNewSpotFound = true;
                    }
                }

                BoxB.MoveBoxTo(new Vector2(NewBoxBBounds.x + MinimumSafeDistance, NewBoxBBounds.y + MinimumSafeDistance));
            }
        }
예제 #6
0
파일: ListItem.cs 프로젝트: fbizuneh/Igor
        public virtual GUIStyle GetBackgroundGUIStyle(bool bEven)
        {
            GUIStyle CustomStyle = new GUIStyle();

            if (bIsSelected && Owner.HasFocus())
            {
                CustomStyle.normal.background = VisualScriptingDrawing.GenerateTexture2DWithColor(new Color(61.0f / 255.0f, 96.0f / 255.0f, 145.0f / 255.0f, 1.0f));
            }
            else
            {
                if (bEven)
                {
                    CustomStyle.normal.background = VisualScriptingDrawing.GenerateTexture2DWithColor(new Color(72.0f / 255.0f, 72.0f / 255.0f, 72.0f / 255.0f, 1.0f));
                }
                else
                {
                    CustomStyle.normal.background = VisualScriptingDrawing.GenerateTexture2DWithColor(new Color(50.0f / 255.0f, 50.0f / 255.0f, 50.0f / 255.0f, 1.0f));
                }
            }

            return(CustomStyle);
        }
예제 #7
0
파일: EntityBox.cs 프로젝트: fbizuneh/Igor
 public virtual bool IsInsideDragArea(Rect DragArea)
 {
     return(VisualScriptingDrawing.RectOverlapsRect(DragArea, new Rect(Position.x, Position.y, Size.x, Size.y)));
 }